HIDAPI Bindings for Go


Package hid provides an idiomatic interface to HIDAPI, a simple library for
communicating with USB and Bluetooth HID devices on FreeBSD, Linux, macOS, and
Windows.
See https://github.com/libusb/hidapi for details.
Installation
To add package hid as a dependency or upgrade to its latest version, issue:
$ go get github.com/sstallion/go-hid@latest
[!NOTE]
Prerequisites for building HIDAPI from source must be installed prior to
issuing go get. See Prerequisites for details.
[!IMPORTANT]
This package requires cgo. GCC must be installed and available on the system
PATH before compilation. See the cgo documentation for details.
libusb Backend Support
On Linux, the hidraw backend is enabled by default. If the libusb backend is
desired, the libusb build constraint must be specified:
$ go build -tags libusb ./...
lshid
A command named lshid is provided, which lists HID devices attached to the
system. lshid may be installed by issuing:
$ go install github.com/sstallion/go-hid/cmd/lshid@latest
Once installed, issue lshid -h to show usage.
Documentation
Up-to-date documentation can be found on pkg.go.dev or by issuing the go doc command after installation:
$ go doc -all github.com/sstallion/go-hid
Contributing
Pull requests are welcome! See CONTRIBUTING.md for details.
License
Source code in this repository is licensed under a Simplified BSD License. See
LICENSE for details.