NetBSD-Users archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

Re: using devpubd for device event notifications and actions?



reed%reedmedia.net@localhost ("Jeremy C. Reed") writes:

>Have a look at /libexec/devpubd-hooks/01-makedev as the single example.

In -current there is also /libexec/devpubd-hooks/02-wedgenames. This
creates named symlinks to the wedge devices (/dev/dk*).


>Any suggestions on how to best identify the disk and its file system for 
>mounting?

mount(8) should do.

I made an automounter configuration that allows to mount wedges
as e.g., /a/wedges/wedgename/ using a program mount which first
does a fsck and on success a mount.


>2) Plug in in a sdcard (also used with a camera).

>devpubd did nothing.

devpubd has a few shortcomings because it only sees attach/detach.
It does not see when a device goes online/offline (as with a
card reader, because the card reader won't tell by itself) and
it doesn't see devices that are relabeled, mainly because that
doesn't trigger autodetection of wedges.


>Any ideas on how I can get inserting or ejecting this sdcard to have a 
>drvctl event?

Currently you can't. And since there is nothing generated by the
hardware, the only choice is to poll.


>3) Plug in a Canon EOS camera via USB:

>ugen0 at uhub3 port 2
>ugen0: Canon Inc. Canon Digital Camera, rev 2.00/0.02, addr 4

>The devpubd event is:

> device-attach ugen0

>How can I script something to look at ugen0 to identify it is my camera?

You can use usbdevs to get vendor/product, maybe even serial number.
For more you need to code a driver.


>6) Inserted a disk into my CD drawer and ejected it 30 seconds later. 
>Its lights flashed.

>The kernel didn't log anything and devpubd didn't notice it.

>How to see a inserted CD or DVD?


Just with the sdcard, the kernel doesn't get any information about
the media change. You need a program that constantly polls the
drive.





Home | Main Index | Thread Index | Old Index