kevinmehall / nusb

A new pure-Rust library for cross-platform low-level access to USB devices.
Apache License 2.0
191 stars 26 forks source link

Support for isochronous transfers #47

Open alufers opened 7 months ago

alufers commented 7 months ago

Hi!

I am in progress of creating a Rust application to display a feed from thermal cameras. They are UVC devices (with some nasty non standard features, which require an userspace driver), which use isochronous transfers to send the video.

It would be very nice to have a native Rust API for receiving isochronous data, since rusb doesn't wrap libusb for that and playing around with unsafe code, callbacks, and such is required.

PS: If you think this is out of scope to this project, feel free to close this issue. Many thanks for your library!

kevinmehall commented 7 months ago

This is definitely in scope, but not something I'm going to be able to prioritize in the near future.

If you (or someone else reading this) is interested in working on this, the first step is to figure out what the API should be. I think it probably makes most sense to build on Queue as isochronous is generally used for streaming and requires multiple submitted transfers to not lose packets. MacOS and Linux have per-packet metadata that must be dealt with when allocating and submitting transfers. Windows has this for IN transfers only, but requires that OUT transfers are contiguous in the buffer. Windows also requires a mechanism for pre-registering buffers (maybe like #11?).

andreysaf commented 2 months ago

Would love to have support for isochronous transfer. I am interested in web route and seeing it added it to cross-usb later.

Great library indeed! Thank you.