I am new to using Python and PyUSB. I am trying to write a program to communicate with a 3M Quest SoundPro sound meter. Because I'm new, I'm starting simple. The vendor was gracious enough to send me the manual they have on the commands for the unit. Right now all I'm trying to do is request the serial number and read the response. I just need to get communication between a Raspberry Pi and the device working. I have used the software on a Windows 7 machine along with a USB sniffer to verify the commands and endpoint address were correct.
This is the program; import usb.core import usb.util import sys dev = usb.core.find(idVendor=0x130c, idProduct=0x0001) if dev is None: raise ValueError('Device not found') dev.set_configuration() print "Connected to " + str(dev) QS = '0x51,0x53,0x0D' #Call for Serial number dev.write(0x02,QS,0,0) ret = dev.read(0x82,0x0040,0,1000) sret=''.join([chr(x) for x in ret]) print "Return Raw: ",ret print "Return : ", sret (End of program) This is the error I get when I run the program: Python 2.7.3 (default, Mar 18 2014, 05:13:23) [GCC 4.6.3] on linux2 Type "copyright", "credits" or "license()" for more information. >>> ================================ RESTART ================================ >>> Connected to <usb.core.Device object at 0x75176030> Traceback (most recent call last): File "/home/pi/qspSLM.py", line 18, in <module> ret = dev.read(0x82,0x0040,0,1000) File "/usr/local/lib/python2.7/dist-packages/usb/core.py", line 638, in read self.__get_timeout(timeout) File "/usr/local/lib/python2.7/dist-packages/usb/_debug.py", line 52, in do_trace return f(*args, **named_args) File "/usr/local/lib/python2.7/dist-packages/usb/backend/libusb10.py", line 493, in bulk_read timeout) File "/usr/local/lib/python2.7/dist-packages/usb/backend/libusb10.py", line 593, in __read timeout)) File "/usr/local/lib/python2.7/dist-packages/usb/backend/libusb10.py", line 357, in _check raise USBError(_str_error[retval.value]) USBError: Operation timed out >>> The device has responded twice, both times it was the code that the return value requested was invalid. If anyone can help shed light on why this is timing out I would appreciate it.
------------------------------------------------------------------------------
_______________________________________________ pyusb-users mailing list pyusb-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/pyusb-users