From: Richard B. <ra...@lu...> - 2014-12-02 20:47:11
|
The logs are fairly confusing to me. There are many, many calls to libusb_init and libusb_exit. Is that in your code, or is that part of pyusb? > > From what I see, you do a read of 64 bytes at line 433, and you must have > specified a 16ms timeout. That timer expires on line 438 and gets returned > to you on 449. You then submit another read of 64 bytes on line 451, > apparently with a 0ms timeout. So why does the error message on line 469 > say the timeout was in an attempt to write? I don't see the first write > until line 473. > > It looks like you're opening three different devices. Is that true? Are > you sure it's going to respond in 16ms? > I'm not sure about those calls to libusb_init and libusb_exit. That is pyusb, but from looking at its source I would expect the init call to occur only once at the beginning. One aspect of the program that clutters up the logs is that I perform a periodic check of all connected usb devices to see if a new device of a certain type has been connected or disconnected. Pyusb does not have any asynchronous support, so I'm forced to continually enumerate all devices to detect this. Also cluttering the logs, the program was interacting with two devices when these logs were recorded -- so the reads/writes for each are interlaces throughout. I typically perform short timeout usb reads and handle the timeout appropriately. The problematic timeouts are unusual in that they either occur during a write() call (for which I specify a 1s timeout) or during enumeration (in which pyusb calls libusb_get_device_list()). I'll see if I can recreate this issue with only a single device connected. And also if I can figure out why libusb_init() is being called so often. Richard |