pywinusb
pywinusb copied to clipboard
Data reading!
Could someone help me with a simple example of reading 64 bytes?
On the examples, there is no kind example! Just writing!
Normally, you can't read on demand at the USB transport layer; it would be inefficient to transfer data in this way. At best, you would design your peripheral USB device to accept a written command and then push data back in response using a raw HID report or similar.
Along those lines, the raw_data.py
example is probably the closest to what you want to see. This lets your PC-side app listen for new data coming from the peripheral device, and then the device just pushes whatever data it wants to whenever it's available:
https://github.com/rene-aguirre/pywinusb/blob/master/examples/raw_data.py