hello guys,
i am really new to usb programming so plz help
i am trying to access kingsun dazzle irda via pyusb
import usb
from struct import *
vendor_id= 0x07d0
product_id= 0x4100
supported_speeds =
[2400,9600,19200,38400,57600,115200,576000,1152000,4000000,0]
bRequestType= 0x21
bRequest = 0x09
wValue = 0x0200
wIndex = 0x0001
wLength = 0x0008
hello=[]
buffer = pack('lhh',115200,0x03,0)
def find_dazzle():
buses = usb.busses()
for bus in buses :
for device in bus.devices :
if device.idVendor == vendor_id :
if device.idProduct == product_id :
print "found ksdazzle"
return device
if __name__=="__main__":
device=find_dazzle()
for alt in device.configurations[0].interfaces[0]:
for ep in alt.endpoints:
print "endpoint:",hex(ep.address)
handle=device.open()
handle.reset()
handle.setConfiguration(1)
handle.claimInterface(0)
r=handle.controlMsg(bRequestType,bRequest,buffer,wValue,wIndex,10000)
#while 1:
# r=handle.interruptRead(1,2048,10000)
# print r
handle.releaseInterface()
while running the above program ie while sending that contol message i
receive the following error
found ksdazzle
endpoint: 0x81
endpoint: 0x2
Traceback (most recent call last):
File "a.py", line 33, in ?
r=handle.controlMsg(bRequestType,bRequest,buffer,wValue,wIndex,10000)
usb.USBError: error sending control message: No such file or directory
my demsg shows this
usb 1-1: reset low speed USB device using ohci_hcd and address 2
usb 1-1: usbfs: process 16850 (python) did not claim interface 1 before use
plz helppppppppp
--
"it's not who i am underneath but what i do that defines me"
|