packetry
packetry copied to clipboard
Port capture backend from `rusb` to `nusb`
This PR rewrites the capture backend to use nusb instead of rusb.
Using nusb
has the following advantages for us over rusb
:
- Eliminates a layer of indirection and a dependency on the
libusb
C library:nusb
uses OS APIs directly. - Has an API that supports queuing multiple bulk transfers on one endpoint, maximising capture throughput.
- Seems more likely to gain hotplug and RAW_IO support on Windows, both of which are long-stalled in
libusb
.
This PR includes the first usage of async
in Packetry. I have tried to bring in a minimum of baggage with this:
-
futures-lite for the
block_on
function. -
futures-channel for the
oneshot
channel, to signal the capture task to stop. -
futures-util for the
select_biased
macro andFutureExt::fuse
method.
The latter two crates are already in our dependency tree as they are used by the gio
and glib
crates.
Tested on Linux with Cynthion r1.4.
I just tried this out and I find it gets out of sync on capture start quite often, and gets stuck displaying malformed packets.
@miek I think I've fixed the issues with this now.