sstallion/go-hid

how to switch to libusb backend?

rajivk-slx opened this issue · 2 comments

It appears like by default the package is using the hidraw backend, how do I switch to libusb ?

Hi @rajiv-obhcare - there is some preliminary support using build tags, however I haven't had much time to test libusb support on Linux yet. You should be able to install with libusb support with the following:

$ go install -tags libusb github.com/sstallion/go-hid

Let me know how things go - if there are any issues and you're willing to help test, I can apply fixes and create a new release for you.

I had a bit of time to take a look at supporting libusb on Linux this evening. A few changes were needed to link against the right set of libraries, but for the most part it seems to "just work". I've also updated CI to ensure that libusb support is verified on each push going forward.

When you get a moment, please try the 0.13.3 release. You'll need to specify the libusb build constraint when building your application in order to enable backend support:

$ go build -tags libusb ./...

Cheers!