Skip to main content

A Python USB/IP server for sharing USB devices over the network

Project description

usbipd-python

Downloads REUSE Compliant Lint

A USB/IP server written in Python 3 for sharing USB devices over the network. This implementation uses the pyusb library and the libusb backend to support cross-platform USB device access on macOS and Linux.

Note: This is an early-stage implementation, primarily created for learning purposes. Simple USB devices generally work well, but more complex or HID-based devices may experience issues. HID devices are managed by OS kernel drivers on macOS and Windows, making them difficult to detach without OS-native code or custom drivers. Contributions are welcome!

Installation

Users

Install from PyPI:

pip install usbipd-python
usbipd --help

Developers

  1. Clone the repository:

    git clone https://github.com/abrinkman/usbipd-python.git
    cd usbipd-python
    
  2. Create and activate a virtual environment:

    python3 -m venv .venv
    source .venv/bin/activate
    
  3. Install in development mode with dev dependencies:

    pip install -e ".[dev]"
    

System Requirements

  • Python: 3.9 or higher
  • libusb: Install using your system package manager
    • macOS: brew install libusb
    • Linux (Debian/Ubuntu): sudo apt-get install libusb-1.0-0-dev
    • Linux (Fedora/RHEL): sudo dnf install libusbx-devel

Usage

List USB Devices

Display all available USB devices:

usbipd-python list

Bind a Device

Bind a USB device by its bus ID to make it available for sharing:

usbipd-python bind --bus-id <bus-id>

Bindings are stored persistently using the device's VID:PID:serial for future recognition, even if the bus ID changes. Devices without a serial number are matched by VID:PID only.

Start the Server

Start the USB/IP server (requires root/sudo on macOS):

sudo usbipd-python start

Add -v or --verbose for debug output:

sudo usbipd-python -v start

Connect to the Server

Use a USB/IP client on another machine to connect and access shared devices.

Development

Code Quality

Run linting and formatting checks using ruff:

ruff check .          # Check for linting issues
ruff format --check . # Check code formatting
ruff format .         # Auto-format code

Run type checking:

mypy --ignore-missing-imports .

Project Structure

  • usbipd.py - Main CLI entry point using argparse
  • usb_device.py - USBDevice wrapper class for pyusb device access
  • usbip_server.py - USBIPServer class implementing the USB/IP protocol
  • binding_configuration.py - BindingConfiguration class for XML-based device binding storage
  • libusb_backend.py - Cross-platform libusb backend loader for pyusb

License

Licensed under GPL-3.0. See LICENSE for details.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

usbipd-0.0.5.tar.gz (47.5 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

usbipd-0.0.5-py3-none-any.whl (31.4 kB view details)

Uploaded Python 3

File details

Details for the file usbipd-0.0.5.tar.gz.

File metadata

  • Download URL: usbipd-0.0.5.tar.gz
  • Upload date:
  • Size: 47.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for usbipd-0.0.5.tar.gz
Algorithm Hash digest
SHA256 a79df7866392f1cb6aa3d49a8d3d75db8b5c53626c55c5cb748dc02cb98b1eab
MD5 03bf4e5c2fe79d933cf29a2f3d18989e
BLAKE2b-256 e40078764a9fce3846d28d5877c1384a49df2ac7d156d7196b8c0e39223eaca5

See more details on using hashes here.

Provenance

The following attestation bundles were made for usbipd-0.0.5.tar.gz:

Publisher: publish.yml on abrinkman/usbipd-python

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file usbipd-0.0.5-py3-none-any.whl.

File metadata

  • Download URL: usbipd-0.0.5-py3-none-any.whl
  • Upload date:
  • Size: 31.4 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for usbipd-0.0.5-py3-none-any.whl
Algorithm Hash digest
SHA256 39cbec63bcc6cc8e7bd9381b43b947fffc4f5636f11b07cb61e79e017c7a501b
MD5 3f933c072fa1974bc396e75489cb0ee1
BLAKE2b-256 d319cb7c9144ab0cfe295a5300826096eb0a3dc727de34b7e9f70465c9c0272e

See more details on using hashes here.

Provenance

The following attestation bundles were made for usbipd-0.0.5-py3-none-any.whl:

Publisher: publish.yml on abrinkman/usbipd-python

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page