On Mon, Apr 19, 2010 at 5:25 PM, Xiaofan Chen <[email protected]> wrote:
>> As a test, I delete pyusb 1.0 and then install pyusb-0.4.2. It does
>> seem to work.
>
I then delete pyusb-0.4.2 and reinstall the svn version of pyusb. The
following program works fine.
#!/usr/bin/env python
import usb.core
import usb.backend.libusb01
b = usb.backend.libusb01.get_backend()
assert b is not None
#import usb.legacy
def opendevice(idVendor, idProduct):
devices=[]
for b in usb.busses():
for d in b.devices:
if d.idVendor==idVendor and d.idProduct==idProduct:
devices.append(d)
if len(devices)==1:
device=devices[0]
return device
elif not devices:
raise "Device not found"
else:
raise "More than one device found"
if __name__=="__main__":
device=opendevice(0x04d8, 0x0033)
packet_len=64
dh=device.open()
dh.setConfiguration(1)
print "set Configuration 1"
dh.claimInterface(0)
print "claim Interface 0"
#dh.setAltInterface(0)
# To get firmware version number
print "Sending version command by USB interrupt write"
dh.interruptWrite(0x01,"v",1000)
print "Getting version command by USB interrupt write"
r=dh.interruptRead(0x81,3,1000)
print r
[mc...@myfreebsd ~/Desktop/build/pyusb/tests]$ python testpk2_1.py
set Configuration 1
claim Interface 0
Sending version command by USB interrupt write
Getting version command by USB interrupt write
array('B', [2, 32, 0])
But unfortunately it is still using libusb10 backend.
[mc...@myfreebsd ~/Desktop/build/pyusb/tests]$ export PYUSB_DEBUG_LEVEL=debug
[mc...@myfreebsd ~/Desktop/build/pyusb/tests]$ python testpk2_1.py
2010-04-19 17:33:04,791 INFO:usb.core:find(): using backend
"usb.backend.libusb10"
2010-04-19 17:33:04,791 DEBUG:usb.backend.libusb10:_LibUSB.enumerate_devices()
2010-04-19 17:33:04,791
DEBUG:usb.backend.libusb10:_LibUSB.get_device_descriptor(<usb.backend.libusb10._Device
object at 0x285933ac>)
2010-04-19 17:33:04,791
DEBUG:usb.backend.libusb10:_LibUSB.get_device_descriptor(<usb.backend.libusb10._Device
object at 0x2859344c>)
2010-04-19 17:33:04,792
DEBUG:usb.backend.libusb10:_LibUSB.get_device_descriptor(<usb.backend.libusb10._Device
object at 0x285934ac>)
2010-04-19 17:33:04,792
DEBUG:usb.backend.libusb10:_LibUSB.get_device_descriptor(<usb.backend.libusb10._Device
object at 0x2859350c>)
2010-04-19 17:33:04,792
DEBUG:usb.backend.libusb10:_LibUSB.get_device_descriptor(<usb.backend.libusb10._Device
object at 0x2859356c>)
2010-04-19 17:33:04,792
DEBUG:usb.backend.libusb10:_LibUSB.get_configuration_descriptor(<usb.backend.libusb10._Device
object at 0x285933ac>, 0)
2010-04-19 17:33:04,792
DEBUG:usb.backend.libusb10:_LibUSB.get_interface_descriptor(<usb.backend.libusb10._Device
object at 0x285933ac>, 0, 0, 0)
2010-04-19 17:33:04,792
DEBUG:usb.backend.libusb10:_LibUSB.get_configuration_descriptor(<usb.backend.libusb10._Device
object at 0x285933ac>, 0)
2010-04-19 17:33:04,793
DEBUG:usb.backend.libusb10:_LibUSB.get_interface_descriptor(<usb.backend.libusb10._Device
object at 0x285933ac>, 0, 0, 0)
2010-04-19 17:33:04,793
DEBUG:usb.backend.libusb10:_LibUSB.get_configuration_descriptor(<usb.backend.libusb10._Device
object at 0x285933ac>, 0)
2010-04-19 17:33:04,793
DEBUG:usb.backend.libusb10:_LibUSB.get_endpoint_descriptor(<usb.backend.libusb10._Device
object at 0x285933ac>, 0, 0, 0, 0)
2010-04-19 17:33:04,793
DEBUG:usb.backend.libusb10:_LibUSB.get_interface_descriptor(<usb.backend.libusb10._Device
object at 0x285933ac>, 0, 0, 0)
2010-04-19 17:33:04,793
DEBUG:usb.backend.libusb10:_LibUSB.get_configuration_descriptor(<usb.backend.libusb10._Device
object at 0x285933ac>, 0)
2010-04-19 17:33:04,793
DEBUG:usb.backend.libusb10:_LibUSB.get_interface_descriptor(<usb.backend.libusb10._Device
object at 0x285933ac>, 0, 1, 0)
2010-04-19 17:33:04,794
DEBUG:usb.backend.libusb10:_LibUSB.get_configuration_descriptor(<usb.backend.libusb10._Device
object at 0x285933ac>, 0)
2010-04-19 17:33:04,794
DEBUG:usb.backend.libusb10:_LibUSB.get_configuration_descriptor(<usb.backend.libusb10._Device
object at 0x2859344c>, 0)
2010-04-19 17:33:04,794
DEBUG:usb.backend.libusb10:_LibUSB.get_interface_descriptor(<usb.backend.libusb10._Device
object at 0x2859344c>, 0, 0, 0)
2010-04-19 17:33:04,794
DEBUG:usb.backend.libusb10:_LibUSB.get_configuration_descriptor(<usb.backend.libusb10._Device
object at 0x2859344c>, 0)
2010-04-19 17:33:04,794
DEBUG:usb.backend.libusb10:_LibUSB.get_interface_descriptor(<usb.backend.libusb10._Device
object at 0x2859344c>, 0, 0, 0)
2010-04-19 17:33:04,794
DEBUG:usb.backend.libusb10:_LibUSB.get_configuration_descriptor(<usb.backend.libusb10._Device
object at 0x2859344c>, 0)
2010-04-19 17:33:04,795
DEBUG:usb.backend.libusb10:_LibUSB.get_endpoint_descriptor(<usb.backend.libusb10._Device
object at 0x2859344c>, 0, 0, 0, 0)
2010-04-19 17:33:04,795
DEBUG:usb.backend.libusb10:_LibUSB.get_interface_descriptor(<usb.backend.libusb10._Device
object at 0x2859344c>, 0, 0, 0)
2010-04-19 17:33:04,795
DEBUG:usb.backend.libusb10:_LibUSB.get_configuration_descriptor(<usb.backend.libusb10._Device
object at 0x2859344c>, 0)
2010-04-19 17:33:04,795
DEBUG:usb.backend.libusb10:_LibUSB.get_interface_descriptor(<usb.backend.libusb10._Device
object at 0x2859344c>, 0, 1, 0)
2010-04-19 17:33:04,795
DEBUG:usb.backend.libusb10:_LibUSB.get_configuration_descriptor(<usb.backend.libusb10._Device
object at 0x2859344c>, 0)
2010-04-19 17:33:04,795
DEBUG:usb.backend.libusb10:_LibUSB.get_configuration_descriptor(<usb.backend.libusb10._Device
object at 0x285934ac>, 0)
2010-04-19 17:33:04,796
DEBUG:usb.backend.libusb10:_LibUSB.get_interface_descriptor(<usb.backend.libusb10._Device
object at 0x285934ac>, 0, 0, 0)
2010-04-19 17:33:04,796
DEBUG:usb.backend.libusb10:_LibUSB.get_configuration_descriptor(<usb.backend.libusb10._Device
object at 0x285934ac>, 0)
2010-04-19 17:33:04,796
DEBUG:usb.backend.libusb10:_LibUSB.get_interface_descriptor(<usb.backend.libusb10._Device
object at 0x285934ac>, 0, 0, 0)
2010-04-19 17:33:04,796
DEBUG:usb.backend.libusb10:_LibUSB.get_configuration_descriptor(<usb.backend.libusb10._Device
object at 0x285934ac>, 0)
2010-04-19 17:33:04,796
DEBUG:usb.backend.libusb10:_LibUSB.get_endpoint_descriptor(<usb.backend.libusb10._Device
object at 0x285934ac>, 0, 0, 0, 0)
2010-04-19 17:33:04,796
DEBUG:usb.backend.libusb10:_LibUSB.get_interface_descriptor(<usb.backend.libusb10._Device
object at 0x285934ac>, 0, 0, 0)
2010-04-19 17:33:04,796
DEBUG:usb.backend.libusb10:_LibUSB.get_configuration_descriptor(<usb.backend.libusb10._Device
object at 0x285934ac>, 0)
2010-04-19 17:33:04,797
DEBUG:usb.backend.libusb10:_LibUSB.get_interface_descriptor(<usb.backend.libusb10._Device
object at 0x285934ac>, 0, 0, 0)
2010-04-19 17:33:04,797
DEBUG:usb.backend.libusb10:_LibUSB.get_configuration_descriptor(<usb.backend.libusb10._Device
object at 0x285934ac>, 0)
2010-04-19 17:33:04,797
DEBUG:usb.backend.libusb10:_LibUSB.get_endpoint_descriptor(<usb.backend.libusb10._Device
object at 0x285934ac>, 1, 0, 0, 0)
2010-04-19 17:33:04,797
DEBUG:usb.backend.libusb10:_LibUSB.get_interface_descriptor(<usb.backend.libusb10._Device
object at 0x285934ac>, 0, 0, 0)
2010-04-19 17:33:04,797
DEBUG:usb.backend.libusb10:_LibUSB.get_configuration_descriptor(<usb.backend.libusb10._Device
object at 0x285934ac>, 0)
2010-04-19 17:33:04,797
DEBUG:usb.backend.libusb10:_LibUSB.get_interface_descriptor(<usb.backend.libusb10._Device
object at 0x285934ac>, 0, 1, 0)
2010-04-19 17:33:04,798
DEBUG:usb.backend.libusb10:_LibUSB.get_configuration_descriptor(<usb.backend.libusb10._Device
object at 0x285934ac>, 0)
2010-04-19 17:33:04,798
DEBUG:usb.backend.libusb10:_LibUSB.get_configuration_descriptor(<usb.backend.libusb10._Device
object at 0x2859350c>, 0)
2010-04-19 17:33:04,798
DEBUG:usb.backend.libusb10:_LibUSB.get_interface_descriptor(<usb.backend.libusb10._Device
object at 0x2859350c>, 0, 0, 0)
2010-04-19 17:33:04,802
DEBUG:usb.backend.libusb10:_LibUSB.get_configuration_descriptor(<usb.backend.libusb10._Device
object at 0x2859350c>, 0)
2010-04-19 17:33:04,803
DEBUG:usb.backend.libusb10:_LibUSB.get_interface_descriptor(<usb.backend.libusb10._Device
object at 0x2859350c>, 0, 0, 0)
2010-04-19 17:33:04,803
DEBUG:usb.backend.libusb10:_LibUSB.get_configuration_descriptor(<usb.backend.libusb10._Device
object at 0x2859350c>, 0)
2010-04-19 17:33:04,803
DEBUG:usb.backend.libusb10:_LibUSB.get_endpoint_descriptor(<usb.backend.libusb10._Device
object at 0x2859350c>, 0, 0, 0, 0)
2010-04-19 17:33:04,803
DEBUG:usb.backend.libusb10:_LibUSB.get_interface_descriptor(<usb.backend.libusb10._Device
object at 0x2859350c>, 0, 0, 0)
2010-04-19 17:33:04,803
DEBUG:usb.backend.libusb10:_LibUSB.get_configuration_descriptor(<usb.backend.libusb10._Device
object at 0x2859350c>, 0)
2010-04-19 17:33:04,803
DEBUG:usb.backend.libusb10:_LibUSB.get_interface_descriptor(<usb.backend.libusb10._Device
object at 0x2859350c>, 0, 1, 0)
2010-04-19 17:33:04,803
DEBUG:usb.backend.libusb10:_LibUSB.get_configuration_descriptor(<usb.backend.libusb10._Device
object at 0x2859350c>, 0)
2010-04-19 17:33:04,804
DEBUG:usb.backend.libusb10:_LibUSB.get_configuration_descriptor(<usb.backend.libusb10._Device
object at 0x2859356c>, 0)
2010-04-19 17:33:04,804
DEBUG:usb.backend.libusb10:_LibUSB.get_interface_descriptor(<usb.backend.libusb10._Device
object at 0x2859356c>, 0, 0, 0)
2010-04-19 17:33:04,804
DEBUG:usb.backend.libusb10:_LibUSB.get_configuration_descriptor(<usb.backend.libusb10._Device
object at 0x2859356c>, 0)
2010-04-19 17:33:04,804
DEBUG:usb.backend.libusb10:_LibUSB.get_interface_descriptor(<usb.backend.libusb10._Device
object at 0x2859356c>, 0, 0, 0)
2010-04-19 17:33:04,804
DEBUG:usb.backend.libusb10:_LibUSB.get_configuration_descriptor(<usb.backend.libusb10._Device
object at 0x2859356c>, 0)
2010-04-19 17:33:04,805
DEBUG:usb.backend.libusb10:_LibUSB.get_endpoint_descriptor(<usb.backend.libusb10._Device
object at 0x2859356c>, 0, 0, 0, 0)
2010-04-19 17:33:04,805
DEBUG:usb.backend.libusb10:_LibUSB.get_interface_descriptor(<usb.backend.libusb10._Device
object at 0x2859356c>, 0, 0, 0)
2010-04-19 17:33:04,805
DEBUG:usb.backend.libusb10:_LibUSB.get_configuration_descriptor(<usb.backend.libusb10._Device
object at 0x2859356c>, 0)
2010-04-19 17:33:04,805
DEBUG:usb.backend.libusb10:_LibUSB.get_interface_descriptor(<usb.backend.libusb10._Device
object at 0x2859356c>, 0, 0, 0)
2010-04-19 17:33:04,805
DEBUG:usb.backend.libusb10:_LibUSB.get_configuration_descriptor(<usb.backend.libusb10._Device
object at 0x2859356c>, 0)
2010-04-19 17:33:04,806
DEBUG:usb.backend.libusb10:_LibUSB.get_endpoint_descriptor(<usb.backend.libusb10._Device
object at 0x2859356c>, 1, 0, 0, 0)
2010-04-19 17:33:04,806
DEBUG:usb.backend.libusb10:_LibUSB.get_interface_descriptor(<usb.backend.libusb10._Device
object at 0x2859356c>, 0, 0, 0)
2010-04-19 17:33:04,806
DEBUG:usb.backend.libusb10:_LibUSB.get_configuration_descriptor(<usb.backend.libusb10._Device
object at 0x2859356c>, 0)
2010-04-19 17:33:04,806
DEBUG:usb.backend.libusb10:_LibUSB.get_interface_descriptor(<usb.backend.libusb10._Device
object at 0x2859356c>, 0, 1, 0)
2010-04-19 17:33:04,806
DEBUG:usb.backend.libusb10:_LibUSB.get_configuration_descriptor(<usb.backend.libusb10._Device
object at 0x2859356c>, 0)
2010-04-19 17:33:04,807
DEBUG:usb.backend.libusb10:_LibUSB.get_configuration_descriptor(<usb.backend.libusb10._Device
object at 0x2859356c>, 1)
2010-04-19 17:33:04,815
DEBUG:usb.backend.libusb10:_LibUSB.get_interface_descriptor(<usb.backend.libusb10._Device
object at 0x2859356c>, 0, 0, 1)
2010-04-19 17:33:04,815
DEBUG:usb.backend.libusb10:_LibUSB.get_configuration_descriptor(<usb.backend.libusb10._Device
object at 0x2859356c>, 1)
2010-04-19 17:33:04,823
DEBUG:usb.backend.libusb10:_LibUSB.get_interface_descriptor(<usb.backend.libusb10._Device
object at 0x2859356c>, 0, 0, 1)
2010-04-19 17:33:04,823
DEBUG:usb.backend.libusb10:_LibUSB.get_configuration_descriptor(<usb.backend.libusb10._Device
object at 0x2859356c>, 1)
2010-04-19 17:33:04,832
DEBUG:usb.backend.libusb10:_LibUSB.get_endpoint_descriptor(<usb.backend.libusb10._Device
object at 0x2859356c>, 0, 0, 0, 1)
2010-04-19 17:33:04,832
DEBUG:usb.backend.libusb10:_LibUSB.get_interface_descriptor(<usb.backend.libusb10._Device
object at 0x2859356c>, 0, 0, 1)
2010-04-19 17:33:04,832
DEBUG:usb.backend.libusb10:_LibUSB.get_configuration_descriptor(<usb.backend.libusb10._Device
object at 0x2859356c>, 1)
2010-04-19 17:33:04,841
DEBUG:usb.backend.libusb10:_LibUSB.get_interface_descriptor(<usb.backend.libusb10._Device
object at 0x2859356c>, 0, 0, 1)
2010-04-19 17:33:04,841
DEBUG:usb.backend.libusb10:_LibUSB.get_configuration_descriptor(<usb.backend.libusb10._Device
object at 0x2859356c>, 1)
2010-04-19 17:33:04,848
DEBUG:usb.backend.libusb10:_LibUSB.get_endpoint_descriptor(<usb.backend.libusb10._Device
object at 0x2859356c>, 1, 0, 0, 1)
2010-04-19 17:33:04,849
DEBUG:usb.backend.libusb10:_LibUSB.get_interface_descriptor(<usb.backend.libusb10._Device
object at 0x2859356c>, 0, 0, 1)
2010-04-19 17:33:04,849
DEBUG:usb.backend.libusb10:_LibUSB.get_configuration_descriptor(<usb.backend.libusb10._Device
object at 0x2859356c>, 1)
2010-04-19 17:33:04,857
DEBUG:usb.backend.libusb10:_LibUSB.get_interface_descriptor(<usb.backend.libusb10._Device
object at 0x2859356c>, 0, 1, 1)
2010-04-19 17:33:04,857
DEBUG:usb.backend.libusb10:_LibUSB.get_configuration_descriptor(<usb.backend.libusb10._Device
object at 0x2859356c>, 1)
2010-04-19 17:33:04,865
DEBUG:usb.backend.libusb10:_LibUSB.get_configuration_descriptor(<usb.backend.libusb10._Device
object at 0x2859356c>, 0)
2010-04-19 17:33:04,866
DEBUG:usb.backend.libusb10:_LibUSB.open_device(<usb.backend.libusb10._Device
object at 0x2859356c>)
2010-04-19 17:33:04,867
DEBUG:usb.backend.libusb10:_LibUSB.set_configuration(c_void_p(674858560),
1)
set Configuration 1
2010-04-19 17:33:04,867
DEBUG:usb.backend.libusb10:_LibUSB.claim_interface(c_void_p(674858560),
0)
claim Interface 0
Sending version command by USB interrupt write
2010-04-19 17:33:04,867
DEBUG:usb.backend.libusb10:_LibUSB.get_configuration_descriptor(<usb.backend.libusb10._Device
object at 0x2859356c>, 0)
2010-04-19 17:33:04,867
DEBUG:usb.backend.libusb10:_LibUSB.get_interface_descriptor(<usb.backend.libusb10._Device
object at 0x2859356c>, 0, 0, 0)
2010-04-19 17:33:04,867
DEBUG:usb.backend.libusb10:_LibUSB.get_configuration_descriptor(<usb.backend.libusb10._Device
object at 0x2859356c>, 0)
2010-04-19 17:33:04,868
DEBUG:usb.backend.libusb10:_LibUSB.get_interface_descriptor(<usb.backend.libusb10._Device
object at 0x2859356c>, 0, 0, 0)
2010-04-19 17:33:04,868
DEBUG:usb.backend.libusb10:_LibUSB.get_configuration_descriptor(<usb.backend.libusb10._Device
object at 0x2859356c>, 0)
2010-04-19 17:33:04,868
DEBUG:usb.backend.libusb10:_LibUSB.get_endpoint_descriptor(<usb.backend.libusb10._Device
object at 0x2859356c>, 0, 0, 0, 0)
2010-04-19 17:33:04,868
DEBUG:usb.backend.libusb10:_LibUSB.get_interface_descriptor(<usb.backend.libusb10._Device
object at 0x2859356c>, 0, 0, 0)
2010-04-19 17:33:04,868
DEBUG:usb.backend.libusb10:_LibUSB.get_configuration_descriptor(<usb.backend.libusb10._Device
object at 0x2859356c>, 0)
2010-04-19 17:33:04,868
DEBUG:usb.backend.libusb10:_LibUSB.get_interface_descriptor(<usb.backend.libusb10._Device
object at 0x2859356c>, 0, 0, 0)
2010-04-19 17:33:04,869
DEBUG:usb.backend.libusb10:_LibUSB.get_configuration_descriptor(<usb.backend.libusb10._Device
object at 0x2859356c>, 0)
2010-04-19 17:33:04,871
DEBUG:usb.backend.libusb10:_LibUSB.get_endpoint_descriptor(<usb.backend.libusb10._Device
object at 0x2859356c>, 1, 0, 0, 0)
2010-04-19 17:33:04,871
DEBUG:usb.backend.libusb10:_LibUSB.get_interface_descriptor(<usb.backend.libusb10._Device
object at 0x2859356c>, 0, 0, 0)
2010-04-19 17:33:04,871
DEBUG:usb.backend.libusb10:_LibUSB.get_configuration_descriptor(<usb.backend.libusb10._Device
object at 0x2859356c>, 0)
2010-04-19 17:33:04,871
DEBUG:usb.backend.libusb10:_LibUSB.intr_write(c_void_p(674858560), 1,
0, array('B', [118]), 1000)
Getting version command by USB interrupt write
2010-04-19 17:33:04,875
DEBUG:usb.backend.libusb10:_LibUSB.get_configuration_descriptor(<usb.backend.libusb10._Device
object at 0x2859356c>, 0)
2010-04-19 17:33:04,875
DEBUG:usb.backend.libusb10:_LibUSB.get_interface_descriptor(<usb.backend.libusb10._Device
object at 0x2859356c>, 0, 0, 0)
2010-04-19 17:33:04,875
DEBUG:usb.backend.libusb10:_LibUSB.get_configuration_descriptor(<usb.backend.libusb10._Device
object at 0x2859356c>, 0)
2010-04-19 17:33:04,875
DEBUG:usb.backend.libusb10:_LibUSB.get_interface_descriptor(<usb.backend.libusb10._Device
object at 0x2859356c>, 0, 0, 0)
2010-04-19 17:33:04,875
DEBUG:usb.backend.libusb10:_LibUSB.get_configuration_descriptor(<usb.backend.libusb10._Device
object at 0x2859356c>, 0)
2010-04-19 17:33:04,875
DEBUG:usb.backend.libusb10:_LibUSB.get_endpoint_descriptor(<usb.backend.libusb10._Device
object at 0x2859356c>, 0, 0, 0, 0)
2010-04-19 17:33:04,875
DEBUG:usb.backend.libusb10:_LibUSB.get_interface_descriptor(<usb.backend.libusb10._Device
object at 0x2859356c>, 0, 0, 0)
2010-04-19 17:33:04,876
DEBUG:usb.backend.libusb10:_LibUSB.get_configuration_descriptor(<usb.backend.libusb10._Device
object at 0x2859356c>, 0)
2010-04-19 17:33:04,876
DEBUG:usb.backend.libusb10:_LibUSB.intr_read(c_void_p(674858560), 129,
0, 3, 1000)
array('B', [2, 32, 0])
2010-04-19 17:33:04,881
DEBUG:usb.backend.libusb10:_LibUSB.release_interface(c_void_p(674858560),
0)
2010-04-19 17:33:04,881
DEBUG:usb.backend.libusb10:_LibUSB.close_device(c_void_p(674858560))
--
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
[email protected]
https://lists.sourceforge.net/lists/listinfo/pyusb-users