Skip to main content

List and monitor USB devices on Raspberry Pi and Linux

Project description

listusb-rpi

List and monitor USB devices on Raspberry Pi and Linux. Provides both a Python API for use in your projects and a CLI tool for the terminal.

Install

pip install listusb-rpi

For full functionality (recommended on Raspberry Pi):

sudo apt install libudev-dev
pip install listusb-rpi[udev]

Python API

from listusb import devices, find_device

# List all USB devices
for dev in devices():
    print(dev.path, dev.vendor, dev.serial)

# Filter devices
serial_devices = devices(subsystem="tty")
ftdi_devices = devices(vendor="FTDI")
specific = devices(vid="0403", pid="6001")

# Find a specific device
arduino = find_device(vendor="Arduino")
if arduino:
    print(f"Arduino found at {arduino.path}")

USBDevice fields

Field Description Example
path Device path /dev/ttyUSB0
name Device model name FT232R_USB_UART
serial Serial identifier FTDI_FT232R_A50285BI
vendor Vendor name Future Technology Devices International
product Product name FT232 Serial (UART) IC
vid Vendor ID 0403
pid Product ID 6001
speed USB speed (Mbps) 12
driver Kernel driver ftdi_sio
subsystem Linux subsystem tty

Watch for hotplug events

from listusb import watch

for event in watch():
    print(f"[{event.action}] {event.device.path} - {event.device.serial}")

Requires pyudev: pip install listusb-rpi[udev]

CLI Usage

# List all USB devices (table format)
listusb-rpi

# Output as JSON
listusb-rpi --json

# Output as CSV
listusb-rpi --csv

# Filter by vendor
listusb-rpi --vendor FTDI

# Filter by type (aliases: serial, storage, camera, audio, network)
listusb-rpi --type serial

# Filter by vendor/product ID
listusb-rpi --vid 0403 --pid 6001

# Watch for USB plug/unplug events
listusb-rpi --watch

# Watch with JSON output
listusb-rpi --watch --json

Optional dependencies

pip install listusb-rpi[udev]      # pyudev for full device info + watch mode
pip install listusb-rpi[mqtt]      # MQTT publishing for IoT
pip install listusb-rpi[webhook]   # Webhook notifications
pip install listusb-rpi[all]       # Everything

Requirements

  • Python >= 3.9
  • Linux (Raspberry Pi OS, Ubuntu, Debian, etc.)
  • libudev-dev for pyudev support: sudo apt install libudev-dev

License

Apache-2.0

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

listusb_rpi-0.1.2.tar.gz (16.1 kB view details)

Uploaded Source

Built Distribution

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

listusb_rpi-0.1.2-py3-none-any.whl (14.7 kB view details)

Uploaded Python 3

File details

Details for the file listusb_rpi-0.1.2.tar.gz.

File metadata

  • Download URL: listusb_rpi-0.1.2.tar.gz
  • Upload date:
  • Size: 16.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.10.5

File hashes

Hashes for listusb_rpi-0.1.2.tar.gz
Algorithm Hash digest
SHA256 2558f0a4248f9281ca6914327c32d2355d5b57d962d7b25f87b7be2856be33f7
MD5 cc87e8addefcb6b21a9ca451e49b7725
BLAKE2b-256 f6c5ed7da6f008635988383505eb92e68013e162cf1a7dc467e521a249699019

See more details on using hashes here.

File details

Details for the file listusb_rpi-0.1.2-py3-none-any.whl.

File metadata

  • Download URL: listusb_rpi-0.1.2-py3-none-any.whl
  • Upload date:
  • Size: 14.7 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.10.5

File hashes

Hashes for listusb_rpi-0.1.2-py3-none-any.whl
Algorithm Hash digest
SHA256 a82338d1f971dd8943d5e9942295d8d046be85e5aeea77e0ca456cac8ae34a5e
MD5 63bcad55249864aa807455f55b9719f5
BLAKE2b-256 55d1e60b5575313f01ff12f292f82d5ff8ac6b38e4f0a2c53bf80684f67f624e

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