pywinusb icon indicating copy to clipboard operation
pywinusb copied to clipboard

Data reading!

Open fabio-ric-silva opened this issue 1 year ago • 1 comments

Could someone help me with a simple example of reading 64 bytes?

On the examples, there is no kind example! Just writing!

fabio-ric-silva avatar Sep 12 '23 14:09 fabio-ric-silva

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

jrowberg avatar Sep 12 '23 14:09 jrowberg