I am new to python. I had a USB HID device which behavior is that the host send
a 64 bytes commands to it, after complete the execution of this commands it
send back a 64 bytes status to the host, so the host can check the status and
decide the next step.
When I run it under Win7 with SwiftForth 3.5.9 (a Forth system) and
libusb-win32 1.2.6.0, it performs well. But when I test it under the same PC
with python 3.4, pyUSB 1.0 and libusb-win32 1.2.6.0, it performs a little
strange. The status read back always fail at the first time (return zero
length) and success at the second time.
>>> dev.write(0x02, cmdBuf)
64
>>> dev.read(0x81, 64, 5000)
array('B') # no data returned
>>> dev.read(0x81, 64, 5000)
array('B', [165, 0, ....]) # this one is correct, totally 64 bytes
another "strange" thing is that I had a 5000 timeout in the read but I see no
delay at the first read. It returns immediately. I suppose it should wait for 5
seconds long before it returns. Right?
Any hint?
Best Regards,
Jach Fong
--
https://mail.python.org/mailman/listinfo/python-list