Bob McElrath writes:
> Alan Cox <[EMAIL PROTECTED]> wrote:
> > > And I can get devfsd to run it for me when I press the hotsync button
> > > by
> > > adding this line to /etc/devfsd.conf:
> > >     REGISTER        usb/tty/1       EXECUTE sudo -u mcelrath 
>~mcelrath/bin/visor-sync
> > > 
> > > With these two things I can now hotsync simply by pressing the hotsync
> > > button.  
> > 
> > Very nice indeed. So is devfsd enough to avoid writing another daemon
> > and sending it change messages. At least if we expand the info passed
> > a little ?
> 
> Not sure what you mean by "info passed".  But since there is no info
> about what /dev/usb/tty/1 actually *is*, then yes it would be useful to
> get more info.  I believe these numbers (/dev/usb/tty/*) are allocated
> sequentially, so there's no guarantee that /dev/usb/tty/1 is my visor
> (it could be another serial device, if I had one).
> 
> Adding hooks to devfsd to identify a device by vendor/product id would
> be very useful.  Alternatively, one could parse /proc/bus/usb/devices to
> determine if the newly registered device is the one I care about.  After
> looking over /proc/bus/usb/devices (and
> Documentation/usb/proc_usb_info.txt), it doesn't seem possible to derive
> the name of the /dev entry allocated to a particular device reported in
> /proc/bus/usb/devices.  How about something adding something like the
> following for devfsd:
>     DEVICE [name] [driver] [vendor id] [product id]
>     REGISTER [name] ACTION [args...]
> where name is an arbitrary name for your device, so a real entry would
> look like:
>     DEVICE Visor usb-serial 082d 0100
>     REGISTER Visor EXECUTE sudo -u mcelrath ~mcelrath/bin/visor-sync $devname
> where $devname is the name of the /dev entry allocated for the device
> (/dev/usb/tty/1).

To do that would require bending^Wextending the devfsd protocol to add
USB-specific data. I don't think that's the right approach. Go read
the devfs mailing list archives for the thread between Johannes and
myself. Briefly: use <devfs_register> to notify devfsd that a new
device has been plugged in, but then do an ioctl(2) on that device to
figure out exactly what it is.

I've already added the necessary hooks to devfsd so that you can call
your own C functions in shared objects. Johannes has written an
extension to devfsd that can make use of this.

> I don't know how hard this info (vendor/product) is to get, nor how
> to identify devices in general (USB uses vendor/product, but what
> about PCI? SCSI?).  But one might envision using this for all kinds
> of hot-swappable devices.  (auto-mount USB/SCSI hot-swappable
> storage devices, fill my Diamond rio with new songs when I connect
> it to USB, etc...)

Just define an ioctl(2) on the device. Talk to Johannes.

                                Regards,

                                        Richard....
Permanent: [EMAIL PROTECTED]
Current:   [EMAIL PROTECTED]

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to