Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.python > #100034 > unrolled thread

Python 3.4 + pyUSB 1.0 + libusb-win32 1.2.6.0, what happens?

Started byjfong@ms4.hinet.net
First post2015-12-05 03:26 -0800
Last post2015-12-05 03:26 -0800
Articles 1 — 1 participant

Back to article view | Back to comp.lang.python


Contents

  Python 3.4 + pyUSB 1.0 + libusb-win32 1.2.6.0, what happens? jfong@ms4.hinet.net - 2015-12-05 03:26 -0800

#100034 — Python 3.4 + pyUSB 1.0 + libusb-win32 1.2.6.0, what happens?

Fromjfong@ms4.hinet.net
Date2015-12-05 03:26 -0800
SubjectPython 3.4 + pyUSB 1.0 + libusb-win32 1.2.6.0, what happens?
Message-ID<ea58e15e-d651-4142-8ffc-b9a4ea311c74@googlegroups.com>
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

[toc] | [standalone]


Back to top | Article view | comp.lang.python


csiph-web