libusb/hidapi

Public

A Simple cross-platform library for communicating with HID devices

  • Stars2.3k+1 tuần này
  • Forks480
  • Watchers47
  • Issues59
  • Ngày tạo05/06/2019
  • Cập nhật gần nhất10/10/2026
  • Ngôn ngữC
  • Giấy phép—
README.md16.2 KBRaw

HIDAPI library for Windows, Linux, FreeBSD and macOS

CI instance Status
Linux/macOS/Windows (master) GitHub Builds
Windows (master) Build status
BSD, last build (branch/PR) builds.sr.ht status
Coverity Scan (last) Coverity Scan

HIDAPI is a multi-platform library which allows an application to interface with USB and Bluetooth HID-Class devices on Windows, Linux, FreeBSD, and macOS. HIDAPI can be either built as a shared library (.so, .dll or .dylib) or can be embedded directly into a target application by adding a single source file (per platform) and a single header.
See remarks on embedding directly into your build system.

HIDAPI library was originally developed by Alan Ott (signal11).

It was moved to libusb/hidapi on June 4th, 2019, in order to merge important bugfixes and continue development of the library.

Table of Contents

About

HIDAPI has four back-ends:

  • Windows (using hid.dll)
  • Linux/hidraw (using the Kernel's hidraw driver)
  • libusb (using libusb-1.0 - Linux/BSD/other UNIX-like systems)
  • macOS (using IOHidManager)

On Linux, either the hidraw or the libusb back-end can be used. There are tradeoffs, and the functionality supported is slightly different. Both are built by default. It is up to the application linking to hidapi to choose the backend at link time by linking to either libhidapi-libusb or libhidapi-hidraw.

Note that you will need to install an udev rule file with your application for unprivileged users to be able to access HID devices with hidapi. Refer to the 69-hid.rules file in the udev directory for an example.

Linux/hidraw (linux/hid.c):

This back-end uses the hidraw interface in the Linux kernel, and supports both USB and Bluetooth HID devices. It requires kernel version at least 2.6.39 to build. In addition, it will only communicate with devices which have hidraw nodes associated with them. Keyboards, mice, and some other devices which are blacklisted from having hidraw nodes will not work. Fortunately, for nearly all the uses of hidraw, this is not a problem.

Nội dung README thuộc về libusb và cộng đồng đóng góp, giấy phép Không có giấy phép. Nguồn: github.com/libusb/hidapi