Hi.
I'm wondering if this is the right place to the question I'm about to ask, but I think I'll give it a try...
I'm programming a custom USB device that will communicate with a Linux host via one of the standard drivers and the libusb software. My test machine uses usb-uhci. The setup works most of the time, but sometimes the message transfer fails horribly, and also puts the setup in such a state that I have to reload the USB driver. I think this is likely to be a problem with my device software rather than an usb-uchi issue, but knowing a bit more about the driver behaviour might make it easier to track it down.
Actually, I think I'll just quote a message of my own to the libusb mailing list in order to provide more details:
OK. Let's return to the disconnect problem that I mentioned in my other post earlier today. This may well be a general USB issue rather than a libusb one, but I hope you forgive me for being slightly off-topic...
In any case, I'm using usb_bulk_write() and usb_bulk_read() to communicate with a custom USB device. Write is always followed by read, as the device is supposed to send an acknowledgement after receiving data. Now, when I connect the device and start talking to it, everything works fine initially, but after running for a while, sending a lot of data, the connection is lost somehow. In one case I got the following
fbscud: 72 of 72 bytes written fbscud: error reading from bulk endpoint 0x82: Invalid or incomplete multibyte or wide character fbscud: 0 of 108 ack. bytes read
when printing usb_strerror() (on read or write failure) and the number of bytes read or written (with a prefix) after usb_bulk_write() and usb_bulk_read(). The software would then try reopening the device - by locating the correct one using usb_find_busses()/usb_find_devices(), then calling usb_open() - which it always does when the connection appears to be lost. This operation appeared to be successful, but on the next read/write I got:
fbscud: error writing to bulk endpoint 1: Connection timed out fbscud: -1 of 72 bytes written fbscud: error reading from bulk endpoint 0x82: Invalid or incomplete multibyte or wide character fbscud: 0 of 108 ack. bytes read
On a 2nd re-open attempt, the device was nowhere to be found - via a scan using usb_find_busses()/usb_find_devices(), that is. Some of the system log messages that appeared while this was going on were:
Sep 1 11:12:34 indonesia kernel: usb-uhci.c: interrupt, status 2, frame# 615 Sep 1 11:12:34 indonesia kernel: usbdevfs: USBDEVFS_BULK failed dev 2 ep 0x82 len 108 ret -84 Sep 1 11:12:34 indonesia kernel: usbdevfs: process 17467 (fbscud) did not claim interface 0 before use Sep 1 11:12:34 indonesia kernel: usbdevfs: USBDEVFS_BULK failed dev 2 ep 0x1 len 72 ret -110 Sep 1 11:12:34 indonesia kernel: usbdevfs: USBDEVFS_BULK failed dev 2 ep 0x82 len 108 ret -84 Sep 1 11:12:34 indonesia kernel: hub.c: already running port 2 disabled by hub (EMI?), re-enabling... Sep 1 11:12:34 indonesia kernel: usb.c: USB disconnect on device 00:07.2-2 address 2 Sep 1 11:12:34 indonesia devlabel: devlabel service started/restarted Sep 1 11:12:34 indonesia kernel: hub.c: new USB device 00:07.2-2, assigned address 3 Sep 1 11:12:34 indonesia kernel: usb.c: USB device 3 (vend/prod 0x534/0x9328) is not claimed by any active driver. Sep 1 11:12:37 indonesia /etc/hotplug/usb.agent: ... no modules for USB product 534/9328/100
When ending up in such a state, I can usually get back into business by reloading the USB driver (usb-uhci); there is no need to touch the device, or at least, in some of the cases there isn't.
Does anyone have any idea about what may be wrong? Like I said, this problem may lie elsewhere than in libusb, but I'd really appreciate it if someone could tell me where to start looking.
I'm using libusb-0.1.6-3 on Red Hat Linux 9.
- Toralf
------------------------------------------------------- This SF.Net email is sponsored by BEA Weblogic Workshop FREE Java Enterprise J2EE developer tools! Get your free copy of BEA WebLogic Workshop 8.1 today. http://ads.osdn.com/?ad_id=5047&alloc_id=10808&op=click _______________________________________________ [EMAIL PROTECTED] To unsubscribe, use the last form field at: https://lists.sourceforge.net/lists/listinfo/linux-usb-users
