Hi Wanda, I have a simple pyUSB code to send and read a message with the scan interface of a multi-functional printer. But I encountered an error when reading back from the scan with the following codes. Although the message I tried to send was a meaningless one, I thought it should return something and not time-out. Please help. I am using pyUSB 1.0 in WinVista.
Thanks, Charlie The error message is: USBError: libusb0-dll:err [_usb_reap_async] timeout error The codes are: #!/usr/bin/env python import usb.core import usb.util import sys, time dev=usb.core.find() print "Found a scaner; idVendor is 0x%x, idProduct is 0x%x\n" % (dev.idVendor, dev.idProduct) dev.set_configuration() cfg = dev[0] intf = cfg[(0,0)] ep_write = intf[0].bEndpointAddress ep_read = intf[1].bEndpointAddress ep_read2 = intf[2].bEndpointAddress print "ep_write = %xh" % int(ep_write) print "ep_read = %xh" % int(ep_read) print "ep_read2 = %xh" % int(ep_read2) msg ='test' s1 = dev.write(ep_write, msg, intf) print "send msg: %s" % msg print "return from write: %s" % s1 time.sleep(0.5) raw_input('hit enter:') retRead = dev.read(ep_read, 100, intf, 1000) sret = ''.join([chr(x) for x in retRead]) print "return message: %s" % sret The following are the outputs and the error log: Found a scaner; idVendor is 0x3f0, idProduct is 0x9911 ep_write = 1h ep_read = 82h ep_read2 = 83h send msg: test return from write: 4 Traceback (most recent call last): File "C:\Users\ChuCh\Desktop\scaniq\pyusb\scanTest\standalone.py", line 33, in <module> retRead = dev.read(ep_read, 100, intf, 1000) File "C:\Python26\lib\site-packages\usb\core.py", line 624, in read self.__get_timeout(timeout) File "C:\Python26\lib\site-packages\usb\_debug.py", line 53, in do_trace return f(*args, **named_args) File "C:\Python26\lib\site-packages\usb\backend\libusb01.py", line 448, in bulk_read timeout) File "C:\Python26\lib\site-packages\usb\backend\libusb01.py", line 531, in __read timeout File "C:\Python26\lib\site-packages\usb\backend\libusb01.py", line 364, in _check raise USBError(errmsg) USBError: libusb0-dll:err [_usb_reap_async] timeout error ------------------------------------------------------------------------------ Beautiful is writing same markup. Internet Explorer 9 supports standards for HTML5, CSS3, SVG 1.1, ECMAScript5, and DOM L2 & L3. Spend less time writing and rewriting code and more time creating great experiences on the web. Be a part of the beta today http://p.sf.net/sfu/msIE9-sfdev2dev _______________________________________________ pyusb-users mailing list pyusb-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/pyusb-users