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.0.tar.gz (24.4 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.0-py3-none-any.whl (24.9 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: pyusbip-2.0.0.tar.gz
  • Upload date:
  • Size: 24.4 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.0.tar.gz
Algorithm Hash digest
SHA256 0d50b6c3b466eaea8578f16bed7a67e08b7f9593fcf63ee96b8728aa99b6d75c
MD5 960d25d9857696f6ea442370518396cb
BLAKE2b-256 da6cbf20fb9d77c17fb8f8a89cd64f4f96b16c3d63f10a95827b81de0906bf83

See more details on using hashes here.

Provenance

The following attestation bundles were made for pyusbip-2.0.0.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.0-py3-none-any.whl.

File metadata

  • Download URL: pyusbip-2.0.0-py3-none-any.whl
  • Upload date:
  • Size: 24.9 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.0-py3-none-any.whl
Algorithm Hash digest
SHA256 8e8849cb27e62235f95d3ccbbaa83f925f314504303c2a8bbd1a79be16a032e7
MD5 e5a9f2d4a9bab5dec7bcb6fc4c2657a7
BLAKE2b-256 06f2b495a3f7803815a0b5d1ca72403c9763420fd7b499c5cd78ee38aeff818a

See more details on using hashes here.

Provenance

The following attestation bundles were made for pyusbip-2.0.0-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