1

I am trying to compile hidapi on ubuntu 14.04 for use with node-hid. Node-hid cannot see any devices for some reason when hidapi uses hidraw as this issue describes. The fourth post also offers a solution:

So, with my limited gcc/waf knowledge I managed to get it to build (I changed wscript to use ../hidapi/libusb/hid.c vs using /hidapi/linux/hid.c. I also changed its linkflags to use -lusb1.0 instead of -ludev and I added /usr/include/libusb-1.0 (a hardcoded path as the makefile wants to use pkgconfig to find that path.. I don't know an equivalent).

I have managed to change /hidapi/linux/hid.c to ../hidapi/libusb/hid.c in the wscript file and I also found the linkflags and changed them; but, I am not sure how to implement the last part about hardcoding the path. Where would I write this path? Or perhaps, is there a better way to get node-hid working?

Jabbath
  • 334
  • 1
  • 3
  • 11

1 Answers1

1

node-hid doesn't use the wscript anymore, it has a binding.gyp now and so node-gyp is used instead. Also by default the binding.gyp uses libusb instead of hidraw, so this shouldn't be a problem.

mscdex
  • 104,356
  • 15
  • 192
  • 153
  • You are completely right! Turns out node-hid just doesn't work with the specific device I was testing with. – Jabbath Sep 19 '14 at 21:41
  • Just an update that node-hid^0.7.0 now only uses hidraw. To use libusb, you must downgrade to node-hid@0.6.0. libusb is more stable than hidraw. Weirdly, hidraw only works with high power (red) USB 3.0 ports on my system. libusb works on all. – Dominic Cerisano Mar 18 '18 at 13:12