I am using the following code to read from a usb barcode scanner in Windows. However, it returns this error :
raise USBError(_strerror(ret), ret, _libusb_errno[ret]) usb.core.USBError: [Errno 5] Input/Output Error
How can I correct this code to read sent data from barcode scanner?
import usb.core
dev = usb.core.find(idVendor=0x05f9,idProduct=0x4005)
data = []
endpoint = dev[0][(0,0)][0]
while 1:
data += dev.read(endpoint.bEndpointAddress, endpoint.wMaxPacketSize)
print(data)