I am trying to read data from USB using pyusb in python.I am able to get all the configuration of devices but when i am trying to read data .I am getting the below error:
USBError: [Errno None] libusb0-dll:err [claim_interface] could not claim interface 1, win error: The requested resource is in use.
PF the code also what i had written :
import usb.core
test = usb.core.find(idVendor=0x0ghe, idProduct=0x0241)
print test
test.set_configuration()
for i in range(0, 20):
while True:
try:
test = test.read(0x81, 8, timeout=50)
break
except usb.core.USBError, e:
if str(e).find("timeout") >= 0:
pass
else:
raise IOError("USB Error: %s"%str(e))
print test
Below are my questions:
- How to read data from USB in host machine every second whenever we are doing any operation in usb connected device ?
- Why this error is coming while reading data from endpoints ?
- What's the efficient way to read inputs from USB using pyusb for any button press whatever we are doing in device ?