hid

raw JSON →
1.0.9 verified Fri May 01 auth: no python

A Python wrapper for hidapi using ctypes bindings. It provides low-level access to HID (Human Interface Device) devices on Linux, macOS, and Windows. Current version: 1.0.9. Release cadence: infrequent.

pip install hid
error ImportError: No module named hid
cause hid module not installed or not in Python path.
fix
Run 'pip install hid' and ensure the Python environment is active.
error OSError: [Error 126] The specified module could not be found
cause Windows missing hidapi DLL.
fix
Install hidapi DLL (e.g., from http://libusb.info or vcpkg) and place in system PATH or script folder.
error AttributeError: module 'hid' has no attribute 'enumerate'
cause The hid module is not imported correctly; possibly a naming conflict with another hid module.
fix
Uninstall conflicting packages: 'pip uninstall hid' and reinstall 'pip install hid'.
gotcha hid.enumerate(0, 0) returns all devices; passing (vendor_id, product_id) filters. Many users call it incorrectly.
fix Use hid.enumerate(vendor_id=0, product_id=0) for all devices.
deprecated The library is not actively maintained; last release 2020. May lack support for newer hidapi features.
fix Consider using cython-hidapi or hidapi package if issues arise.
gotcha On Windows, hidapi DLL must be in PATH or alongside the script. Missing DLL causes ImportError.
fix Install hidapi via vcpkg or download prebuilt DLL and place in working directory.

Lists all HID devices on the system.

import hid

for device in hid.enumerate(0, 0):
    print(f"0x{device['vendor_id']:04x}:0x{device['product_id']:04x} {device['product_string']}")