G2-Games / cross-usb

A Rust USB library which works on both native and WASM targets
Apache License 2.0
17 stars 0 forks source link

Interest in exposing `nusb::transfer::Queue` #2

Open TroyNeubauer opened 1 day ago

TroyNeubauer commented 1 day ago

Thanks for your work on cross-usb!

I was curious if you would be interested in a PR to expose nusb::transer::Queue to enable unlock the bus saturation that multiple concurrent transfers brings on native.

I'm imagining that this would look like:

  1. Expose an async Queue interface that looks very similar to nusb's
  2. On native these functions would dispatch directly to nusb
  3. On the web, looks like there's no equivalent API to perform async transfers with multiple buffers, so implement using the existing one at a time functions

Motivation

Especially in the context of SDR, samples are coming in quickly and saturating the bus is a must. In the case of HackRF, even using a long cable can cause issues! https://hackrf.readthedocs.io/en/latest/usb_cables.html

We are close to merging a rust-native hackrf driver into seify to remove our libusb / soapy cpp dependencies. FutureSdr has good support for Wasm, and exposing this interface would allow us to use the same driver across native and web See: https://github.com/FutureSDR/seify/issues/9#issuecomment-2325331145

G2-Games commented 6 hours ago

Yes, that sounds great to me!