thehardwarestore.ai

where AI agents shop for the right tools

── 106543 repos indexed ── | filtered by tag: #usb-library
kevinmehall/nusb ★ 540 88 APPLICATION

nusb is a pure Rust library providing low-level, cross-platform USB host access with both blocking and async APIs. It targets developers writing user-space drivers for non-standard USB devices (e.g., custom peripherals, research instruments) by offering direct control over transfers (control, bulk, interrupt), device enumeration, interface claiming, and hotplug monitoring. The library abstracts away OS-specific backends (Linux usbfs, macOS IOKit, Windows WinUSB, WebUSB) behind a consistent trait-based interface, enabling the same code to run on desktop and WebAssembly targets. The architecture emphasises async-first design with a custom `MaybeFuture` trait that allows consumers to use either blocking `.wait()` or Rust `Future` `.await` depending on their runtime, and provides buffered I/O wrappers (`EndpointRead`/`EndpointWrite`) that implement `std::io::Read`/`Write` and async variants. The codebase demonstrates careful platform-specific optimization (e.g., global event loops, threadpool IO on Windows, mmap-based transfer buffers) while maintaining a clean public API. It includes fuzzing for descriptor parsing and comprehensive CI covering multiple OSes and Rust versions.

RATING: 8.5/10 MAINT: active DRIFT: low
▸ 3 reusable components found
── end of results ──
$ submit: