Hello,
I have a strange problem, which might be caused by some hardware limitation, or
by my ignorance in USB protocol (I have no advanced knowledge in USB).
I need to read keys from a USB device (some kind of keyboard). When doing it
under Windows 2000/XP, everything is fine. When doing it under GNU/Linux though,
I always get a timeout, even though by ignoring the timeout I get the data
right (but it doesn't always work, it varies according to the kernels and
architectures used). After trying everything I could think of, I finally
decided to dive into intimate USB protocol by snooping over raw USB
communications. For that, I used the snoop feature in usbcore [1].
I wrote a simple program that initializes the USB device, read keys for 10
seconds, and terminates. I first ran the program on a Windows virtual machine,
and as expected the keys were right. I then compiled and ran the same program
on GNU/Linux, and as expected, I got nothing else than timeouts. Then I went to
compare the logs: the working one, and the non-working one. Codes don't seem to
be tampered with in any way; the only real difference seems to lie in a subtle
difference at the beginning (interrupt urb instead of urb complete).
From this point I'm stuck: I have no idea whether they are correct regarding to
the standard. I have no way to force some kind of trick to simulate the working
one from GNU/Linux, as it would probably mean tampering with the kernel (even
for testing purpose, I am not exactly confident). Therefore I have no choice
but to try my luck at finding someone who would be willing to dive into the
gory details below and hint me about what's hapenning :-P
Configuration on Windows (virtual machine):
- Windows XP (no service pack)
- AMD Athlon(tm) 64 X2 Dual (only 1 core used, virtual machine) 2.51 GHz
- 256 Mb of RAM
Configuration on GNU/Linux (real machine):
- OpenSuse 10.2, kernel 2.6.24.2 (last version, not patched, downloaded from kernel.org)
- AMD Athlon(tm) 64 X2 Dual (2 cores used) 2.51 GHz
- 1 Gb of RAM
- USB chipset: USB Controller: nVidia Corporation MCP51 USB Controller (rev a3)
The above configurations are the ones I used for testing, but the timeouts
problem occurs on other machines and other flavours of GNU/Linux (including a
2.4 kernel on an arm processor). Windows seems to always work though (2000 and
XP tested).
Log obtained from Windows:
http://wotan.homelinux.com/vbremaud/usb_win32.logLog obtained from GNU/Linux (truncated in the middle):
http://wotan.homelinux.com/vbremaud/usb_linux.log[1]
http://www.linuxjournal.com/node/7582