10 releases (6 breaking)
0.7.1 | Jan 14, 2024 |
---|---|
0.7.0 | Dec 30, 2023 |
0.6.0 | Feb 22, 2023 |
0.5.0 | Apr 11, 2022 |
0.2.1 | Jun 15, 2020 |
#339 in Hardware support
105KB
2.5K
SLoC
usbip
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:
- hid_keyboard: Simulate a hid keyboard that types something every second.
- cdc_acm_serial: Simulate a serial that gets a character every second.
- 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.
Dependencies
~5–13MB
~165K SLoC