Skip to main content

List all USB devices in a developer-friendly tree view (Windows/macOS/Linux)

Project description

python-usb

List all USB devices in a developer-friendly tree view. Zero dependencies — works on macOS, Linux, and Windows.

Dev

python3 -m venv .venv
source .venv/bin/activate
python -m pip install -e .
python-usb

Install

pip install python-usb

Usage

python-usb

Example output (macOS):

└── USB 3.1 Bus
    ├── USB Keyboard [05ac:024f]
    │   Vendor:    Apple Inc.
    │   Serial:    ABCD1234
    │   Speed:     Full Speed
    │   Power:     50 mA
    ├── USB Mouse [046d:c077]
    │   Vendor:    Logitech
    │   Speed:     Low Speed
    └── USB Hub [2109:2817]
        Vendor:    VIA Labs, Inc.
        Speed:     Super Speed
        └── External SSD [0781:5583]
            Vendor:    SanDisk
            Serial:    12345678
            Speed:     Super Speed
            Power:     896 mA

JSON output

python-usb --json

What it shows

Field Description
Name Product / device name
ID vendor_id:product_id (hex)
Vendor Manufacturer name
Serial Serial number
Speed Low / Full / High / Super Speed
Class USB device class
Driver Kernel driver in use
Location Bus and device number
Power Max power draw
USB Ver USB specification version

How it works

Platform Method
macOS system_profiler SPUSBDataType -json
Linux /sys/bus/usb/devices sysfs (or lsusb)
Windows PowerShell + WMI Win32_PnPEntity

No compiled extensions, no libusb dependency.

Publish to PyPI

  1. Update the version in pyproject.toml.
  2. Create a PyPI API token at https://pypi.org/manage/account/token/.
  3. Install the publishing tools:
python -m pip install --upgrade build twine
  1. Build the distribution files:
python -m build
python -m twine check dist/*
  1. Upload to PyPI:
python -m twine upload dist/*

Use __token__ as the username and your PyPI API token as the password when prompted.

License

MIT

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

python_usb-0.1.0.tar.gz (10.7 kB view details)

Uploaded Source

Built Distribution

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

python_usb-0.1.0-py3-none-any.whl (10.9 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: python_usb-0.1.0.tar.gz
  • Upload date:
  • Size: 10.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.13.5

File hashes

Hashes for python_usb-0.1.0.tar.gz
Algorithm Hash digest
SHA256 7823525d236db875a6dbfbf38092e792ac787273de5f765529226d929ad27eb9
MD5 53ed776a08e138bce5e0d700f57a28bc
BLAKE2b-256 1a6bec80c3cde6e81dc8fcb296ccc6fbc8a200559def543a8e2b350aeffa86f2

See more details on using hashes here.

File details

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

File metadata

  • Download URL: python_usb-0.1.0-py3-none-any.whl
  • Upload date:
  • Size: 10.9 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.13.5

File hashes

Hashes for python_usb-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 683b798d39e71c56f51d4434c9fff8e5537808278e9c41a522cefa287f699374
MD5 94eca245ff39021c6240416fb5cb8ce4
BLAKE2b-256 74f06627d4bc9d13da3c004c45a22d7ea16f7fa32af401b802d71778c23914a4

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