Hi all,

I've solved this, in what seems to be a more efficient way. I now use the linux input drivers to read the device (as mapped onto /dev/input/event#), and under this kernel module (evdev, which is standard in kernels >= 2.4) read() returns in blocking mode when the device disconnects and errno is set to ENODEV.

Thanks to everyone who has offered their help.

Cheers,
Tim

----- Original Message ----- From: "Alan Stern" <[EMAIL PROTECTED]>
To: "Tim Arney" <[EMAIL PROTECTED]>
Cc: "Brian T. Brunner" <[EMAIL PROTECTED]>; "Edward" <[EMAIL PROTECTED]>; <[EMAIL PROTECTED]>; <[EMAIL PROTECTED]>
Sent: Tuesday, November 23, 2004 5:53 AM
Subject: Re: [Linux-usb-users] 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
isn't 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 don't know how or if that
ioctl is presented in libusb.

Alan Stern




--
UTS CRICOS Provider Code: 00099F
DISCLAIMER: This email message and any accompanying attachments may contain
confidential information. If you are not the intended recipient, do not
read, use, disseminate, distribute or copy this message or attachments. If
you have received this message in error, please notify the sender immediately and delete this message. Any views expressed in this message are those of the individual sender, except where the sender expressly, and with authority, states them to be the views the University of Technology, Sydney. Before opening any attachments, please check them for viruses and defects.



-------------------------------------------------------
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. http://productguide.itmanagersjournal.com/
_______________________________________________
[EMAIL PROTECTED]
To unsubscribe, use the last form field at:
https://lists.sourceforge.net/lists/listinfo/linux-usb-users

Reply via email to