> I'm writing an application that works with a USB device. The device
> itself is expected to be plugged and unplugged during the lifetime
> of the application, so I'm looking for a way to follow the state of
> the device. It's a GTK application, I have no problem with using
> timers.
[EMAIL PROTECTED] said:
> If you want to be advised when things change, use the usbview code
> (see http://sourceforge.net/projects/usbview/) that Greg K-H wrote as
> an example. I think it polls on /proc/bus/usb/devices for changes.
I'm leaning toward using a hotplug script to notice the arrival of the
device. This has the additional advantage that I can change the permissions
of the device file so that the main app doesn't need to be set-uid anything.
I'm writing a file into /var/run/gflash.dev that is the path to my
device, and my app just needs to watch for that file. I just realized
that I can also make a symbolic link there. Hmm...
One problem is that the current /etc/hotplug/usb.agent doesn't support
device removal. So I'm thinking that I can validate the contents of the
/var/run/gflash.dev file by noticing if it is newer then the /proc/bus...
file that it points to.
The other problem, of course, is that libusb has no way to create the
descriptors from a usbdevfs path.
And what happens if the device is removed while the application has
the device file opened?
--
Steve Williams "The woods are lovely, dark and deep.
[EMAIL PROTECTED] But I have promises to keep,
[EMAIL PROTECTED] and lines to code before I sleep,
http://www.picturel.com And lines to code before I sleep."
_______________________________________________
[EMAIL PROTECTED]
To unsubscribe, use the last form field at:
http://lists.sourceforge.net/lists/listinfo/linux-usb-devel