PyUSB 1.0 claims to now support isochronous transfers if the underlying backend supports it. I've figured out how to select the libusb1.0 backend which supports isochronous transfer, but I'm not sure how to actually implement reads and writes. I've searched the Internets and cannot find an example using PyUSB. Help?
Asked
Active
Viewed 1,172 times
1 Answers
4
Ok, so I'm answering my own question because I found the solution. It turns out PyUSB will automatically choose the correct read/write method depending on the type of endpoint being operated on. From core.py in the definition for 'write' see:
fn_map = {
util.ENDPOINT_TYPE_BULK:backend.bulk_write,
util.ENDPOINT_TYPE_INTR:backend.intr_write,
util.ENDPOINT_TYPE_ISO:backend.iso_write
}
And similarly in the definition for 'read' see:
fn_map = {
util.ENDPOINT_TYPE_BULK:backend.bulk_read,
util.ENDPOINT_TYPE_INTR:backend.intr_read,
util.ENDPOINT_TYPE_ISO:backend.iso_read
}
So really, all that needs to be done is call {device}.read() or {device}.write() and the code will handle assigning the appropriate operation.
I was going to delete my question rather than answer it, but since isochronous transfer is relatively new to PyUSB I'm hoping this will help other folks not waste a full day to discover what I just did :)

baltimore_cg
- 87
- 5
-
2I appreciate both the question and the answer. Thanks! – Dan H Oct 30 '15 at 00:59