Rust usbip protocol library and tooling
Find a file
Jiajie Chen c8cd214e1d Fix clippy warning: cloned_ref_to_slice_refs
Replace &[device.clone()] with std::slice::from_ref(&device) in
test to address clippy::cloned_ref_to_slice_refs warning.

Co-authored-by: Qwen-Coder <qwen-coder@alibabacloud.com>
2025-12-25 20:52:45 +08:00
.github/workflows Add stale bot 2025-06-13 17:17:59 +08:00
examples Add unset string fuctions 2024-10-26 09:35:32 +08:00
src Fix clippy warning: cloned_ref_to_slice_refs 2025-12-25 20:52:45 +08:00
.gitignore Initial usbip server based on tokio 2020-05-15 21:18:28 +08:00
Cargo.toml Migrate to nusb 0.2.1 2025-12-24 23:17:02 +08:00
LICENSE Add LICENSE and README 2020-05-16 11:19:04 +08:00
NOTES.md Add notes 2022-12-05 17:39:37 +08:00
README.md Add crates.io badge 2020-11-08 11:00:40 +08:00

usbip

Coverage Status crates.io

A Rust library to run a USB/IP server to simulate USB devices.

It also enables sharing devices from an OS supporting libusb(libusb claims that it supports Linux, macOS, Windows, OpenBSD/NetBSD, Haiku and Solaris) to another OS supporting USB/IP(Linux, Windows). Sharing an CCID SmartCard from macOS to Linux is tested by running gpg --card-status.

How to use

See examples directory. Three examples are provided:

  1. hid_keyboard: Simulate a hid keyboard that types something every second.
  2. cdc_acm_serial: Simulate a serial that gets a character every second.
  3. host: Act like original usb/ip sharing server, sharing one device from one machine to another. Also supports sharing from macOS to Linux!

To run example, run:

$ env RUST_LOG=info cargo run --example hid_keyboard

Then, in a USB/IP client environment:

$ usbip list -r $remote_ip
$ usbip attach -r $remote_ip -b $bus_id

Then, you can inspect the simulated USB device behavior in both sides.

API

See code comments. Not finalized yet, so get prepared for api breaking changes.