libusb/hidapi
FreeA Simple cross-platform library for communicating with HID devices
About libusb/hidapi
HIDAPI is a multi-platform library that allows applications to interface with USB and Bluetooth Human Interface Device (HID)-class devices on Windows, Linux, FreeBSD, and macOS. Originally developed by Alan Ott, it was moved to the libusb organization in 2019 for continued maintenance and bug fixes. The library offers four back-ends: Windows using hid.dll, Linux/hidraw using the kernel's hidraw driver, libusb via libusb-1.0, and macOS using IOHidManager. HIDAPI can be built as a shared library (.so, .dll, .dylib) or embedded directly into an application by adding a single source file and header per platform. It supports both USB and Bluetooth HID devices on the Linux/hidraw back-end, while the libusb back-end supports USB only. The library is widely used for building cross-platform tools and applications that interact with HID peripherals such as game controllers, sensors, and custom USB devices.
Key Features
Pros & Cons
- Truly cross-platform with consistent API across Windows, Linux, FreeBSD, and macOS
- Supports both USB and Bluetooth HID devices (depending on backend)
- Can be used as a shared library or compiled directly into an application
- Open source (BSD/GPL3 licensed) and free to use
- Active development with regular updates and bug fixes
- Well-documented API with test applications included
- Bluetooth HID support is limited to specific back-ends (e.g., not available with libusb backend)
- Some devices like keyboards and mice are blacklisted from hidraw nodes on Linux
- Requires udev rules on Linux for unprivileged users to access HID devices
- Linux/hidraw backend requires kernel 2.6.39 or later
- No native support for Android or iOS (though community ports exist)