Skip to main content

A cross-platform tool to monitor and inspect USB devices connected to the host system.

Project description

USB Inspector

Coverage

Overview

A simple package that leverages pyusb and allows you to lookup USB vendor and device IDs and get back a human readable vendor and device name. It includes ability to manually update the USB DB without installing a new version of usb-inspector.

Installation

uv add usb-inspector
# via pip
python3 -m pip install usb-inspector

IMPORTANT: On Windows ensure you have libusb-1.0.dll (64bit) in C:\Windows\System32 or you will get a NoBackendError. You can get it from here.

Example Usage

Command Line:

usb-inspector lookup --vendor-id 1A40
usb-inspector lookup --vendor-id 1A40 --device-id 0801

# To manually update the USB DB
usb-inspector delete-data
usb-inspector update-db
import asyncio

from usb_inspector.monitor import USBDeviceMonitor

async def main():
    usb_monitor = USBDeviceMonitor(poll_interval=1.0)
    monitor_task = asyncio.create_task(usb_monitor.run())  # or usb_monitor.start()
    await asyncio.sleep(10)
    await usb_monitor.stop()
    await monitor_task

asyncio.run(main())

Issues

If you experience any issues, please create an issue on Bitbucket.

Development

To get a list of all commands with descriptions simply run just.

just env
just pip-install-editable

Testing

just pytest
just coverage
just open-coverage

History

All notable changes to this project will be documented in this file. This project adheres to Semantic Versioning.

0.3.1 (2026-04-21)

  • CHANGED updated build backend and release tooling configuration.
  • CHANGED refreshed Justfile workflows for environment, testing, and release checks.
  • CHANGED updated packaging/verification helper scripts and dependency lock maintenance.
  • CHANGED updated pre-commit toolchain versions.

0.3.0 (2026-03-13)

  • CHANGED refactored package internals to a layered DDD structure under usb_inspector.usb (domain/application/infrastructure/interface).
  • CHANGED internal legacy modules db.py, update.py, and cli.py were removed; CLI entry point now resolves to usb_inspector.usb.interface.router:cli.
  • CHANGED usb_inspector.monitor remains available as a compatibility shim for USBDeviceMonitor.
  • FIXED circular import issues in package initialization/import flow.
  • ADDED layered test coverage for application and infrastructure modules plus import regression coverage.

0.2.2 (2025-12-04)

  • ADDED tox and more test coverage

0.2.1 (2025-11-21)

  • ADDED port to the device info
  • CHANGED cleaned up logging on connect/disconnect descriptions

0.2.0 (2025-11-21)

  • FIXED Connecting/Disconnecting the same physical device to the same port now correctly identifies the device as the same device on Windows/Linux.

0.1.9 (2025-11-21)

  • FIXED Cached sql db lookup so it occurs only once.

0.1.8 (2025-11-20)

  • FIXED turned default packaged logging to ERROR. Was INFO...Sorry!

0.1.7 (2025-11-13)

  • FIXED is_connected bug introduced in last patch.
  • ADDED improved tracking of devices allowing multiple of the same vendor/device ID to be connected.

0.1.6 (2025-11-13)

  • FIXED last_seen timestamp for each device, only updates when connected/disonnected.

0.1.5 (2025-11-05)

  • Locked pandas to version 2.3.3 for Raspberry Pi compatability (it pulls the pre-built wheel from piwheels.org)

0.1.4 (2025-11-05)

  • Added last_seen timestamp for each device.

0.1.4 (2025-10-31)

  • update-db cli command only adds new Vendors and Devices to the existing DB rather than requiring deletion and recreation of the DB.
  • Track which devices are connected/disconnected.

0.1.2 (2025-10-30)

  • Fix lookup error

0.1.1 (2025-10-30)

  • Added start as an alias for monitor.

0.1.0 (2025-10-30)

  • First release

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_inspector-0.3.1.tar.gz (354.0 kB view details)

Uploaded Source

Built Distribution

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

usb_inspector-0.3.1-py3-none-any.whl (273.8 kB view details)

Uploaded Python 3

File details

Details for the file usb_inspector-0.3.1.tar.gz.

File metadata

  • Download URL: usb_inspector-0.3.1.tar.gz
  • Upload date:
  • Size: 354.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.13.1

File hashes

Hashes for usb_inspector-0.3.1.tar.gz
Algorithm Hash digest
SHA256 3d03ef1bc3cac962a6f23fe9e6ccb6633ff093bbaaf2ff201be936fdda54ffdf
MD5 e87c93ccfba4c5de45009a259461828e
BLAKE2b-256 eba8467bcc7d9ff4c90ea917c2d40e4a2b74e56aa02d0a7f89c25b9408505e9c

See more details on using hashes here.

File details

Details for the file usb_inspector-0.3.1-py3-none-any.whl.

File metadata

  • Download URL: usb_inspector-0.3.1-py3-none-any.whl
  • Upload date:
  • Size: 273.8 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.13.1

File hashes

Hashes for usb_inspector-0.3.1-py3-none-any.whl
Algorithm Hash digest
SHA256 79c241e3affbff685e8ca7803b6edb74e0bdec16c463d4347ef78550b84b09e9
MD5 633cf2c9864410bd00268f2ea378cab1
BLAKE2b-256 bed4a9048131547de0ad22adffa1532f31446cb6d397f8cf2f8b79a3ab1b2173

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