node-hid: Cannot open device with path
I’m trying to read input from a Acan barcode scanner that emulates a keyboard.
However var device = new HID.HID('USB_05fe_1010_14200000'); returns cannot open device with path USB_05fe_1010_14200000.
Currently, when scanning the scanner “types” the read characters followed by a return key. Do I need to set a particular config setting for this to be read as a HID directly?
Full output
[ { vendorId: 1534,
productId: 4112,
path: 'USB_05fe_1010_14200000',
serialNumber: '',
manufacturer: 'OKE Electron Company',
product: 'OKE PS2-USB V1.61',
release: 1,
interface: -1 },
{ vendorId: 1452,
productId: 611,
path: 'USB_05ac_0263_1d182000',
serialNumber: '',
manufacturer: 'Apple Inc.',
product: 'Apple Internal Keyboard / Trackpad',
release: 546,
interface: -1 },
{ vendorId: 1452,
productId: 611,
path: 'USB_05ac_0263_1d182000',
serialNumber: '',
manufacturer: 'Apple Inc.',
product: 'Apple Internal Keyboard / Trackpad',
release: 546,
interface: -1 },
{ vendorId: 1452,
productId: 611,
path: 'USB_05ac_0263_1d182000',
serialNumber: '',
manufacturer: 'Apple Inc.',
product: 'Apple Internal Keyboard / Trackpad',
release: 546,
interface: -1 },
{ vendorId: 0,
productId: 0,
path: '',
serialNumber: '',
manufacturer: '',
product: 'Apple Mikey HID Driver',
release: 0,
interface: -1 },
{ vendorId: 1452,
productId: 611,
path: 'USB_05ac_0263_1d182000',
serialNumber: '',
manufacturer: 'Apple Inc.',
product: 'Apple Internal Keyboard / Trackpad',
release: 546,
interface: -1 } ]
About this issue
- Original URL
- State: closed
- Created 10 years ago
- Reactions: 1
- Comments: 17 (5 by maintainers)
Try with
sudo, i.e.sudo node yourapp.js. Worked for me on Mac and Linux.I have this issue as well using a barcode scanner. Has anyone figured out why this happens?
Hi @toxaq, it’s my understanding that if the HID device identifies as a keyboard or mouse, node-hid (and hidapi) can’t access it on Mac or Windows because the OS drivers grab it. (this is for security reasons) If you’re talking about a non-keyboard/non-mouse device, then we should open a different issue.
Generally with devices that emulate keyboards and mice, the OS’s native driver will grab the device and intercept any data from it. On Linux you can subvert this. Some devices allow you to set their mode to be “not a keyboard”, and then you could use
node-hid.Hi @mdemaredeb, The setting isn’t in Windows but on the device. Some devices have a little switch on them that lets you set their mode. Some barcode scanners I’ve seen have special barcodes you can scan to set them to be HID devices, Serial Port (SPP) devices, or turn on/off Bluetooth. E.g. something like this: https://www.socketmobile.com/docs/default-source/series-7/command-barcode-sheet-2d.pdf