usb-devices is a Python library providing tools for mapping, describing, and resetting USB devices connected to the system. It offers a cross-platform API to enumerate devices and retrieve detailed information such as product, manufacturer, and serial numbers, and provides functionality to reset individual devices. The library is actively maintained, with version 0.4.5 being the latest, and sees frequent minor releases addressing compatibility and stability.
pip install usb-devicesVerified import paths — ran on the pinned version, not inferred.
This quickstart demonstrates how to discover and list all connected USB devices using `USBDeviceInfo.get_all_usb_devices()`. It prints key details for each device. Note that features like `reset_device()` typically require elevated permissions and are commented out for safe execution.
On Linux, configure udev rules (e.g., `sudo usermod -a -G dialout $USER`, then log out/in) or run the script with `sudo`. On Windows, ensure the script is run as Administrator.
Ensure you are using `usb-devices` version 0.4.2 or newer. If issues persist, verify system drivers and run with administrative privileges.
Upgrade to `usb-devices` version 0.4.1 or newer. Always check for `None` when accessing `usb_device.manufacturer` or `usb_device.product` for robustness.
If device presence changes are critical, re-call `USBDeviceInfo.get_all_usb_devices()` periodically or upon a trigger to refresh the device list.
No dependency data recorded yet.