| title: | Re Detecting unplugged device |
|
On Fri, 19 Nov 2004, Tim Arney wrote:
Hi Brian, Edward, and Sven,
Checking out /proc/bus/usb/devices seems to work, so thanks for your help. I fear it
isnt a complete enough solution, but it will have to do in the meantime. If anyone
else knows a way to possibly trace the connection back through the joystick port it
is registered under, that would be appreciated.
Regarding the large, fast, heavy robots...treaded yes, but still waiting on the
cannon ;)
Cheers,
Tim
A better way to do this is to open the /proc/bus/usb/bbb/ddd file
corresponding to your device and periodically try to read the first few
bytes of the file. When the device disconnects, read() will fail with
errno set to ENODEV.
Maybe even better, you can use the case USBDEVFS_DISCSIGNAL ioctl
available in usbfs. It will cause your process to receive a signal when
then device is disconnected. Unfortunately I dont know how or if that
ioctl is presented in libusb.
Alan Stern
-------------------------------------------------------
SF email is sponsored by - The IT Product Guide
Read honest & candid reviews on hundreds of IT Products from real users.
Discover which products truly live up to the hype. Start reading now.
productguide.itmanagersjournal.com/ productguide.itmanagersjournal.com/
_______________________________________________
Linux-usb-users@xxxxxxxxxxxxxxxxxxxxx
To unsubscribe, use the last form field at:
lists.sourceforge.net/lists/listinfo/linux-usb-users lists.sourceforge.net/lists/listinfo/linux-usb-users
|