Add Troubleshooting FAQ
kevinmehall opened this issue ยท 6 comments
Runtime errors
- LIBUSB_ERROR_BUSY
- Linux: detach_kernel_driver (Example in #174)
- LIBUSB_ERROR_ACCESS
- macOS: Can't open devices that have a kernel driver, no good workaround. (discussion on #30)
- Usually comes up with HID devices -- is there a recommended libhid library?
- Linux: permissions, udev rules
- macOS: Can't open devices that have a kernel driver, no good workaround. (discussion on #30)
- LIBUSB_ERROR_NOT_SUPPORTED
- Windows: Bind WinUSB driver with libwdi / Zadig
- Mention WCID for custom devices
- Windows: Bind WinUSB driver with libwdi / Zadig
- LIBUSB_ERROR_NO_DEVICE
- macOS doesn't configure devices with bDeviceClass=255 "vendor defined" (#61)
- If it's your firmware, use bDeviceClass=0 "defined at interface level" instead
- workaround is
.open(false)
,.setConfiguration(1)
to tell the kernel to configure the device.
- macOS doesn't configure devices with bDeviceClass=255 "vendor defined" (#61)
Install errors
- Install fails with
gyp WARN EACCES user "root" does not have permission to access the dev dir
(#175, #210, #218)- Don't run npm as root. Best way is to install node via nvm, which sets up permissions correctly to run
npm -g
as your normal user. - Or if you really have to,
npm install --unsafe-perm usb
. - Common issue for all NPM packages with native code nodejs/node-gyp#454 (comment)
- Don't run npm as root. Best way is to install node via nvm, which sets up permissions correctly to run
Some mention of how to enable those access rights without requiring sudo
would be nice as well.
After fighting LIBUSB_ERROR_NOT_FOUND
on an OSX Mojave for a while i ended up using node-hid which worked effortlessly.
might serve as a workaround for others with HID devices.
is there a recommended libhid library?
Yes, libusb project recommends HIDAPI for HID device. It supports both USB and Bluetooth HID and even other types of HID devices. There is a active node binding node-hid as well.
hidapi project:
https://github.com/libusb/hidapi
node-hid:
https://github.com/node-hid/node-hid
macOS: Can't open devices that have a kernel driver, no good workaround
Please refer to this discussion, libusb-1.0.26 adds the support to detach kernel driver with correct entitlement (which is diffcult to get from Apple) but at least you can run as root.
Please read libusb FAQ here.
https://github.com/libusb/libusb/wiki/FAQ
Better late than never ๐