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.
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.
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 ./...
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.
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
Pull requests are welcome! See CONTRIBUTING.md for details.
Source code in this repository is licensed under a Simplified BSD License. See LICENSE for details.