I'm having a bit of difficulty reading from my device.. It seems that I have to make the Device.read() call multiple times in order to get the response. I wrote a short test code that inserts a variable delay between reads. Regardless of the delay value it seems to always take 3 or 4 read() calls before I get my response. Please see below. d is an instance of usb.core.Device.
any ideas why this is happening??? Python 3.4.0 (default, Apr 11 2014, 13:05:11) Type "copyright", "credits" or "license" for more information. IPython 1.2.1 -- An enhanced Interactive Python. ? -> Introduction and overview of IPython's features. %quickref -> Quick reference. help -> Python's own help system. object? -> Details about 'object', use 'object??' for extra details. could not detach kernel driver index 1 could not detach kernel driver index 2 In [1]: speedtest?? Type: function String Form:<function speedtest at 0x7ffba6f6e048> File: /home/walker/software/stopsen/testing/py_usb.py Definition: speedtest(d, delay=0.1) Source: def speedtest( d, delay = 0.1 ): d.write(2, 'a') for i in range(5): time.sleep(delay) print("{0}: {1}".format(i + 1, "".join(chr(a) for a in d.read(0x81, 20)))) In [2]: speedtest( d, .2 ) 1: 2: 3: 4: 1403-OS4X-0303-0008 5: In [3]: speedtest( d, .1 ) 1: 2: 3: 4: 1403-OS4X-0303-0008 5: In [4]: speedtest( d, 1 ) 1: 2: 3: 4: 1403-OS4X-0303-0008 5: In [5]: speedtest( d, 2 ) 1: 2: 3: 4: 1403-OS4X-0303-0008 5: In [6]: ------------------------------------------------------------------------------ "Accelerate Dev Cycles with Automated Cross-Browser Testing - For FREE Instantly run your Selenium tests across 300+ browser/OS combos. Get unparalleled scalability from the best Selenium testing platform available. Simple to use. Nothing to install. Get started now for free." http://p.sf.net/sfu/SauceLabs _______________________________________________ pyusb-users mailing list pyusb-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/pyusb-users