I have a device connected via usb and I use pyUSB to interact with the data.
This is what my code looks like:
import usb.core
import usb.util
def main():
device = usb.core.find(idVendor=0x072F, idProduct=0x2200)
device.set_configuration()
endpoint = device[0][(0,0)][0]
data = None
while True:
try:
data = device.read(endpoint.bEndpointAddress,
endpoint.wMaxPacketSize)
print data
except usb.core.USBError as e:
data = None
if e.args == ('Operation timed out',):
continue
if __name__ == '__main__':
main()
It is based on a mouse reader, but the data that I get does not make sense to me:
array('B', [80, 3])
array('B', [80, 2])
array('B', [80, 3])
array('B', [80, 2])
I assume that he reads only part of what is actually provided? I tried to install maxpacketsize more, but nothing.
source
share