I'm trying to make an open source libusb driver for a piece of hardware. Unfortunately, a time and data accurate packet replay on Linux causes a certain bulk read to repeatably time out and not return the bulk data (LIBUSB_ERROR_TIMEOUT, URB status: -ENOENT). According to Wireshark, the Windows application is predictable and always returns this data when executed on VMWare Workstation through the same Linux laptop.
I used Wireshark to generate packet captures from both the Windows app and my app and, as far as I can tell, they are identical up to the error. I went a step further and borrowed a USB protocol analyzer (Total Phase Beagle 12) and captured data on the wire. My previous testing was at high speed but I was able to make an equivalent test case at full speed so that I can use the analyzer. It shows that the device is in fact correctly replying to the control request but somehow is not making it to userspace (or a URB for that matter).
A few packets before the error, there is a very similar packet (same bulk in request and same data returned). The python libusb code does not throw an error but the URB status is -EREMOTEIO. As far as I can tell, this may be normal and may simply be a difference between how VMWare and libusb set Linux kernel USB parameters. But this is still probably a hint: some different setting is making a big difference.
I tried this on a Linux 3.5 x64 and a Linux 3.18 x64 system under Ubuntu 12.04. If this looks like it could be a kernel bug I can setup a more recent kernel. Both systems have Intel 82801H USB controllers.
The device does some weird startup magic where it repeatably resets the device and clears some bulk endpoints. Regardless of whether I do this dance the error occurs later on.
I'm hoping someone has seen this before and can give me some pointers. Otherwise I imagine my next step would be to try to find workarounds (I might have a workaround but it creates other problems) or instrument Linux USB subsystem some more.
Data:
-Full Wireshark and Total Phase logs can be found here: http://ift.tt/1EPC2LT
-Full speed test code: bp1410_rst_12.py
-Total phase screenshot showing the request made it: failed_reply.png (from 12_04_mein_startup_cold.tdc)
-Wireshark screenshot (Windows reference): ws_ref.png
-Wireshark screenshot (my Linux libusb): ws_mine.png
Aucun commentaire:
Enregistrer un commentaire