Skip to main content

USB/IP server backed by libusb, with persistent bind allowlist and HTTP control plane

Project description

pyusbip

A pure-Python USB/IP server backed by libusb. Shares USB devices from macOS (or any libusb host) into a Linux USB/IP client — e.g. Docker Desktop's VM, a remote Linux box, or a CI runner.

Forked from tumayt/pyusbip.

Install

uv tool install git+https://github.com/jenish-rudani/pyusbip

Run

sudo pyusbip                 # USB/IP on :3240, HTTP control on :3241
sudo pyusbip --vid 0x0483    # only export ST devices
sudo pyusbip --help

sudo is required for libusb to claim devices on macOS.

HTTP control plane

JSON over HTTP on 127.0.0.1:3241. CORS allow-all.

  • GET /health — uptime, device counts, API version.
  • GET /devices — list of libusb-visible devices with bus_id, VID/PID, strings, and bind_state ("shared" or "attached").

Library use

import asyncio, usb1
from pyusbip import USBIPServer, ControlPlane

async def main():
    ctx = usb1.USBContext(); ctx.open()
    loop = asyncio.get_event_loop()
    server = USBIPServer(loop, ctx, vid_filter={0x0483})
    control = ControlPlane(loop, ctx, server)
    await server.start(); await control.start()
    await asyncio.Event().wait()

asyncio.run(main())

Development

uv tool install ruff pre-commit
pre-commit install
ruff format . && ruff check . --fix

Version lives in pyusbip/__init__.py; pyproject.toml reads it dynamically. Bump, tag, push.

Requirements

  • Python 3.8+
  • libusb1
  • Root to claim devices

License

MIT — see LICENSE.

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

pyusbip-2.0.1.tar.gz (29.3 kB view details)

Uploaded Source

Built Distribution

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

pyusbip-2.0.1-py3-none-any.whl (30.3 kB view details)

Uploaded Python 3

File details

Details for the file pyusbip-2.0.1.tar.gz.

File metadata

  • Download URL: pyusbip-2.0.1.tar.gz
  • Upload date:
  • Size: 29.3 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for pyusbip-2.0.1.tar.gz
Algorithm Hash digest
SHA256 ed82ba7e6e11b0c3bea349b11b2f90087cd5e642368c5d6687e3daaa474e29c1
MD5 75f55555295d832689ad87516559eee9
BLAKE2b-256 06eb702efce8db66a85145e6a3febf312faffb02b4838a639f16932fbdd80f92

See more details on using hashes here.

Provenance

The following attestation bundles were made for pyusbip-2.0.1.tar.gz:

Publisher: release.yml on jenish-rudani/pyusbip

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

File details

Details for the file pyusbip-2.0.1-py3-none-any.whl.

File metadata

  • Download URL: pyusbip-2.0.1-py3-none-any.whl
  • Upload date:
  • Size: 30.3 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for pyusbip-2.0.1-py3-none-any.whl
Algorithm Hash digest
SHA256 62a5c65fc69e29a90fefd8466858e026b802cf8bbfb1b849a2290654f07dcb0d
MD5 ca7b8c2ecdb47d2b3b30a5c68aa100f7
BLAKE2b-256 c2ba376dc040fac8ef61b16d07cb0d9b66076445a75e94010c3e00c5c817c7ff

See more details on using hashes here.

Provenance

The following attestation bundles were made for pyusbip-2.0.1-py3-none-any.whl:

Publisher: release.yml on jenish-rudani/pyusbip

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