packetry icon indicating copy to clipboard operation
packetry copied to clipboard

Port capture backend from `rusb` to `nusb`

Open martinling opened this issue 1 year ago • 1 comments

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:

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.

martinling avatar Feb 08 '24 00:02 martinling

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 avatar Feb 26 '24 13:02 miek

@miek I think I've fixed the issues with this now.

martinling avatar May 13 '24 19:05 martinling