On Thu, Apr 8, 2010 at 8:08 AM, Wander Lairson <wander.lair...@gmail.com> wrote: > I tried to manually interact with device using python command prompt, > and it worked fine: > > C:\Projetos\pyusb\trunk>python > ActivePython 2.6.1.1 (ActiveState Software Inc.) based on > Python 2.6.1 (r261:67515, Dec 5 2008, 13:58:38) [MSC v.1500 32 bit (Intel)] > on > win32 > Type "help", "copyright", "credits" or "license" for more information. >>>> import usb.core >>>> d = usb.core.find(idVendor=0xfffe) >>>> d.write(1, "teste") > 5 >>>> d.read(5) > Traceback (most recent call last): > File "<stdin>", line 1, in <module> > TypeError: read() takes at least 3 arguments (2 given) >>>> d.read(0x81, 5) > array('B', [116, 101, 115, 116, 101]) >>>> exit() >
I rebuild the DLL with MSVC2008 and it is now working fine when using interactive Python. c:\cygwin\home\mcuee\mcu\pyusb\pyusb\tests>python Python 2.6.5 (r265:79096, Mar 19 2010, 21:48:26) [MSC v.1500 32 bit (Intel)] on win32 Type "help", "copyright", "credits" or "license" for more information. >>> import usb.core >>> d=usb.core.find(idVendor=0xfffe) >>> d.write(1,"Hello") 5 >>> d.read(0x81,5) array('B', [72, 101, 108, 108, 111]) >>> exit() But there are a few errors for the tests. c:\cygwin\home\mcuee\mcu\pyusb\pyusb\tests>set PYUSB_DEBUG_LEVEL=5 c:\cygwin\home\mcuee\mcu\pyusb\pyusb\tests>python testall.py 2010-04-08 22:16:46,720 INFO:usb.test:Adding BackendTest(usb.backend.libusb10) t o test suite... 2010-04-08 22:16:46,726 INFO:usb.test:Adding BackendTest(usb.backend.libusb01) t o test suite... 2010-04-08 22:16:46,733 WARNING:usb.test:BackendTest(usb.backend.openusb) is not available 2010-04-08 22:16:46,861 INFO:usb.test:Adding DeviceTest(usb.backend.libusb10) to test suite... 2010-04-08 22:16:46,862 INFO:usb.test:Adding ConfigurationTest(usb.backend.libus b10) to test suite... 2010-04-08 22:16:46,865 INFO:usb.test:Adding InterfaceTest(usb.backend.libusb10) to test suite... 2010-04-08 22:16:46,867 INFO:usb.test:Adding EndpointTest(usb.backend.libusb10) to test suite... 2010-04-08 22:16:46,871 WARNING:usb.test:Test hardware not found for backend usb .backend.libusb01 EF.E..E...... ====================================================================== ERROR: runTest (test_backend.BackendTest) ---------------------------------------------------------------------- Traceback (most recent call last): File "c:\cygwin\home\mcuee\mcu\pyusb\pyusb\tests\test_backend.py", line 49, in runTest self.test_open_device() File "c:\cygwin\home\mcuee\mcu\pyusb\pyusb\tests\test_backend.py", line 119, i n test_open_device self.handle = self.backend.open_device(self.dev) File "c:\cygwin\home\mcuee\mcu\pyusb\pyusb\usb\backend\libusb10.py", line 427, in open_device _check(_lib.libusb_open(dev.devid, byref(handle))) File "c:\cygwin\home\mcuee\mcu\pyusb\pyusb\usb\backend\libusb10.py", line 344, in _check raise USBError(_str_error[retval.value]) USBError: Access denied (insufficient permissions) ====================================================================== ERROR: runTest (test_integration.DeviceTest) ---------------------------------------------------------------------- Traceback (most recent call last): File "c:\cygwin\home\mcuee\mcu\pyusb\pyusb\tests\test_integration.py", line 59 , in runTest self.test_write_read() File "c:\cygwin\home\mcuee\mcu\pyusb\pyusb\tests\test_integration.py", line 12 0, in test_write_read ret = utils.to_array(self.dev.read(ep[1], len(data))) File "c:\cygwin\home\mcuee\mcu\pyusb\pyusb\usb\core.py", line 632, in read self.__get_timeout(timeout) File "c:\cygwin\home\mcuee\mcu\pyusb\pyusb\usb\backend\libusb10.py", line 461, in bulk_read timeout) File "c:\cygwin\home\mcuee\mcu\pyusb\pyusb\usb\backend\libusb10.py", line 549, in __read timeout)) File "c:\cygwin\home\mcuee\mcu\pyusb\pyusb\usb\backend\libusb10.py", line 344, in _check raise USBError(_str_error[retval.value]) USBError: Operation timed out ====================================================================== ERROR: runTest (test_integration.EndpointTest) ---------------------------------------------------------------------- Traceback (most recent call last): File "c:\cygwin\home\mcuee\mcu\pyusb\pyusb\tests\test_integration.py", line 20 6, in runTest self.test_write_read() File "c:\cygwin\home\mcuee\mcu\pyusb\pyusb\tests\test_integration.py", line 22 1, in test_write_read ret = utils.to_array(self.ep_in.read(len(data))) File "c:\cygwin\home\mcuee\mcu\pyusb\pyusb\usb\core.py", line 281, in read return self.device.read(self.bEndpointAddress, size, self.interface, timeout ) File "c:\cygwin\home\mcuee\mcu\pyusb\pyusb\usb\core.py", line 632, in read self.__get_timeout(timeout) File "c:\cygwin\home\mcuee\mcu\pyusb\pyusb\usb\backend\libusb10.py", line 461, in bulk_read timeout) File "c:\cygwin\home\mcuee\mcu\pyusb\pyusb\usb\backend\libusb10.py", line 549, in __read timeout)) File "c:\cygwin\home\mcuee\mcu\pyusb\pyusb\usb\backend\libusb10.py", line 344, in _check raise USBError(_str_error[retval.value]) USBError: Operation timed out ====================================================================== FAIL: runTest (test_backend.BackendTest) ---------------------------------------------------------------------- Traceback (most recent call last): File "c:\cygwin\home\mcuee\mcu\pyusb\pyusb\tests\test_backend.py", line 44, in runTest self.test_enumerate_devices() File "c:\cygwin\home\mcuee\mcu\pyusb\pyusb\tests\test_backend.py", line 67, in test_enumerate_devices self.fail('PyUSB test device not found') AssertionError: PyUSB test device not found ---------------------------------------------------------------------- Ran 13 tests in 2.143s FAILED (failures=1, errors=3) -- Xiaofan http://mcuee.blogspot.com ------------------------------------------------------------------------------ Download Intel® Parallel Studio Eval Try the new software tools for yourself. Speed compiling, find bugs proactively, and fine-tune applications for parallel performance. See why Intel Parallel Studio got high marks during beta. http://p.sf.net/sfu/intel-sw-dev _______________________________________________ pyusb-users mailing list pyusb-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/pyusb-users