Skip to main content

A client-server application for remotely sharing USB devices with usbip

Project description

CI Coverage PyPI License

usb-remote

Client-server software to share USB devices over the network.

Source https://github.com/epics-containers/usb-remote
PyPI pip install usb-remote
Docker docker run ghcr.io/epics-containers/usb-remote:latest
Documentation https://epics-containers.github.io/usb-remote
Releases https://github.com/epics-containers/usb-remote/releases

Multi-Server Configuration

You can configure usb-remote to scan multiple USB device servers automatically. The client discovers configuration files in the following priority order:

  1. Environment variable: USB_REMOTE_CONFIG=/path/to/config.yaml
  2. Project-local config: .usb-remote.config in current directory
  3. User config: ~/.config/usb-remote/usb-remote.config (default)

Create a configuration file with the following format:

servers:
  - localhost
  - raspberrypi
  - 192.168.1.100
  - usb-server-1.local

# Optional: Connection timeout in seconds (default: 5.0)
timeout: 5.0

See usb-remote.config.example for a sample configuration file.

Config File Discovery Examples

# Use default config from ~/.config/usb-remote/usb-remote.config
usb-remote list

# Use project-specific config from current directory
cd /path/to/project
echo "servers: [myserver]" > .usb-remote.config
usb-remote list

# Use environment variable (useful in CI/CD)
export USB_REMOTE_CONFIG=/etc/usb-remote/production.config
usb-remote list

Connection Timeout

The timeout setting controls how long to wait when connecting to each server before giving up. This prevents the client from hanging when a server is unreachable. The default is 5 seconds, but you can adjust it based on your network conditions:

  • Fast local network: Use a shorter timeout (e.g., 2.0 seconds)
  • Slow or remote servers: Use a longer timeout (e.g., 10.0 seconds)

When a server times out, it's logged as a warning and skipped, allowing other servers to be queried.

Behavior

  • list: Without --host, queries all configured servers and displays devices grouped by server
  • attach/detach: Without --host, scans all servers to find a matching device
    • Fails if no match is found across all servers
    • Fails if multiple matches are found across different servers (unless --first is used)
    • Succeeds if exactly one match is found (reports which server it was found on)
    • With --first flag: Attaches the first matching device found, even if multiple servers have matching devices
  • --host flag: When specified, only queries that specific server (ignores config file)

Examples

# List devices on all configured servers
usb-remote list

# List devices on a specific server
usb-remote list --host raspberrypi

# Attach a device (scans all servers, fails if multiple matches)
usb-remote attach --desc "Camera"

# Attach first matching device across servers
usb-remote attach --desc "Camera" --first

# Attach a device from a specific server
usb-remote attach --desc "Camera" --host 192.168.1.100

# Detach with first match (if same device attached from multiple servers)
usb-remote detach --desc "Camera" --first

Installing as a Service

You can install the usb-remote server as a systemd service to run automatically at boot.

System Service (Recommended)

Install as a system service (runs at boot, before login):

# Install as system service (requires sudo)
sudo usb-remote install-service --system

# Enable and start
sudo systemctl enable usb-remote.service
sudo systemctl start usb-remote.service

# Check status
sudo systemctl status usb-remote.service

User Service (Not Recommended)

Install as a user service (runs when you log in) useful for testing if you don't have sudo access:

# Install the service
usb-remote install-service

# Enable it to start on login
systemctl --user enable usb-remote.service

# Start the service now
systemctl --user start usb-remote.service

# Check status
systemctl --user status usb-remote.service

# View logs
journalctl --user -u usb-remote.service -f

Uninstalling

# Uninstall user service
usb-remote uninstall-service

# Uninstall system service (requires sudo)
sudo usb-remote uninstall-service --system

See https://epics-containers.github.io/usb-remote for more detailed documentation.

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

usb_remote-2.1.0b2.tar.gz (131.9 kB view details)

Uploaded Source

Built Distribution

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

usb_remote-2.1.0b2-py3-none-any.whl (27.7 kB view details)

Uploaded Python 3

File details

Details for the file usb_remote-2.1.0b2.tar.gz.

File metadata

  • Download URL: usb_remote-2.1.0b2.tar.gz
  • Upload date:
  • Size: 131.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for usb_remote-2.1.0b2.tar.gz
Algorithm Hash digest
SHA256 146dc1cc873730535abac5237ac2bfc36cc7885e458318ddda41fcb7a39053c3
MD5 6dc8bfc93331dc80fb50c303407ede95
BLAKE2b-256 975e84589c7ba8204f37a7c2e71d0a3b6c13c77bc5b0acde82773f03dbb0b4da

See more details on using hashes here.

File details

Details for the file usb_remote-2.1.0b2-py3-none-any.whl.

File metadata

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

File hashes

Hashes for usb_remote-2.1.0b2-py3-none-any.whl
Algorithm Hash digest
SHA256 f8659fc5f126ec332c678f944a54c8e523ad63274e91f9542dffc589036be67b
MD5 84950712e7cd7283aa596fd0b1c0cfcf
BLAKE2b-256 d3f2fca6ac47864fa48b76d250f2a25c295cb277eed79de04acf3616cf6e1637

See more details on using hashes here.

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