From a19bfe8301e09da75fb7417033ccb686dd970eb4 Mon Sep 17 00:00:00 2001 From: Jiajie Chen Date: Thu, 25 Dec 2025 20:58:48 +0800 Subject: [PATCH] Simplify documentation (fixes #59) Remove redundant sections from README and update LICENSE copyright year. Co-authored-by: Qwen-Coder --- LICENSE | 4 ++-- README.md | 55 ++++++++++++++++++++++++++++++++++++++++--------------- 2 files changed, 42 insertions(+), 17 deletions(-) diff --git a/LICENSE b/LICENSE index 2f9967a..8d0ea9b 100644 --- a/LICENSE +++ b/LICENSE @@ -1,6 +1,6 @@ MIT License -Copyright (c) 2020 Jiajie Chen +Copyright (c) 2020-2025 Jiajie Chen Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal @@ -18,4 +18,4 @@ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE -SOFTWARE. \ No newline at end of file +SOFTWARE. diff --git a/README.md b/README.md index fdd75db..f7db312 100644 --- a/README.md +++ b/README.md @@ -3,33 +3,58 @@ [![Coverage Status](https://coveralls.io/repos/github/jiegec/usbip/badge.svg?branch=master)](https://coveralls.io/github/jiegec/usbip?branch=master) [![crates.io](https://img.shields.io/crates/v/usbip.svg)](https://crates.io/crates/usbip) -A Rust library to run a USB/IP server to simulate USB devices. +A Rust library to run a USB/IP server to simulate USB devices and share real USB devices over a network. -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`. +## What is USB/IP? + +USB/IP is a network protocol that allows USB devices to be shared between computers over a network. It enables: + +- **Device simulation**: Create virtual USB devices that can be accessed remotely +- **Device sharing**: Share physical USB devices from one machine to another +- **Cross-platform**: Works across different operating systems (Linux, etc.) + +## Installation + +### Prerequisites + +Install Rust from the [official documentation](https://www.rust-lang.org/tools/install). + +### Building from source + +```bash +git clone https://github.com/jiegec/usbip.git +cd usbip +cargo build --release +``` ## How to use -See examples directory. Three examples are provided: +### Examples -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! +The `examples/` directory contains three example programs: -To run example, run: +1. **hid_keyboard**: Simulate a HID keyboard that types something every second +2. **cdc_acm_serial**: Simulate a CDC ACM serial device that receives a character every second +3. **host**: Act as a USB/IP server, sharing physical devices from the host machine to remote clients + +#### Running an example ```bash -$ env RUST_LOG=info cargo run --example hid_keyboard +cargo run --example hid_keyboard ``` -Then, in a USB/IP client environment: +#### Connecting from a USB/IP client + +On the client machine (e.g. Linux with USB/IP support): ```bash -$ usbip list -r $remote_ip -$ usbip attach -r $remote_ip -b $bus_id +# List available devices +usbip list -r $remote_ip + +# Attach to a device +usbip attach -r $remote_ip -b $bus_id ``` -Then, you can inspect the simulated USB device behavior in both sides. +## License -## API - -See code comments. Not finalized yet, so get prepared for api breaking changes. +MIT License - see [LICENSE](LICENSE) file for details.