By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
443,908 Members | 1,945 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 443,908 IT Pros & Developers. It's quick & easy.

problems with pyusb

angelie
P: 2
im trying to communicate with an humain interface device using python's pyusb. i need to acquire data using the interrupt transfer type.

i have two endpoints,
EP1 = interrupt, out
EP2 = interrupt, in

1 configuration (configuration 1)
1 interface (interface 0)

idVendor = 0xFFFF
idProduct = 0xFFF1

OS: ubuntu

Expand|Select|Wrap|Line Numbers
  1.  
  2. import usb
  3. def OpenDevice(idVendor, idProduct):
  4.     devices = []
  5.  
  6.     for b in usb.busses():
  7.         for d in b.devices():
  8.             if d.idVendor = idVendor and d.idProduct = id.Product:
  9.                 devices.append(d)
  10.  
  11.     if len(devices) == 1:
  12.         device = devices[0]
  13.         return device
  14.  
  15.     elif not devices:
  16.         print "Device not found"
  17.  
  18.     else
  19.         print "More than one device found"
  20.  
  21. IRCVENDOR = 0xFFFF
  22. POXPRODUCT = 0xFFF1
  23.  
  24. if __name__ == "__main__":
  25.     device = OpenDevice(IRCVENDOR,POXPRODUCT)
  26.     packet_len = 8
  27.  
  28.     dh = device.open()
  29.     dh.setConfiguration(1)
  30.     dh.claimInterface(0)
  31.  
  32.     ADCdata = dh.interruptRead(2,2,100)
  33.     print ADCdata
  34.  
  35.  
do you see any problem with this code?
i get these errors:

usb.USBError: could not set config 1: Operation not permitted

what does this error mean? i tried surfing the net for answers but couldnt find any...i also tried ommiting the dh.setConfiguration line since i only have one configuration but i also got errors (guess that really wasnt the way to solve it :P )

also, what does "error submitting urb" mean?

please help! thanks
Dec 5 '07 #1
Share this question for a faster answer!
Share on Google+

Post your reply

Sign in to post your reply or Sign up for a free account.