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.0.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.0-py3-none-any.whl (14.6 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: listusb_rpi-0.1.0.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.0.tar.gz
Algorithm Hash digest
SHA256 e2aedfaa302019c87f06091b92250552b42ce457bcb5aed639936394655ed408
MD5 b2f62bc1c253b3e0326731d0adcf42c6
BLAKE2b-256 6622b2be69e281a9fd3505fe6e7b0e537aa3eff6318f29f98a624f69b9afddb8

See more details on using hashes here.

File details

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

File metadata

  • Download URL: listusb_rpi-0.1.0-py3-none-any.whl
  • Upload date:
  • Size: 14.6 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.0-py3-none-any.whl
Algorithm Hash digest
SHA256 7c1e067c944bbd9f79d617847bdf1ca470da502b36519c4f97fb2ca164b00f67
MD5 d87866d194472b0e63c2556f28bdb5a1
BLAKE2b-256 79515d0c2a820a00c7f7256dda8d1dda2b8013f9e368082f9e3957e045c5bd13

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