# Raspberry pi - USB HID node error

**URL:** <https://discourse.nodered.org/t/raspberry-pi-usb-hid-node-error/19410>\
**Category:** General\
**Created:** [20 December 2019 21:28 UTC](https://discourse.nodered.org/t/raspberry-pi-usb-hid-node-error/19410 "2019-12-20T21:28:09Z")\
**Posts on this page:** 14\
**Page:** 1

<div class="post-metadata">

**Author:** ![sense](https://avatars.discourse-cdn.com/v4/letter/s/edb3f5/32.png) [@sense](https://discourse.nodered.org/u/sense)\
**Post date:** [20 December 2019 21:28 UTC](https://discourse.nodered.org/t/raspberry-pi-usb-hid-node-error/19410/1 "2019-12-20T21:28:09Z")

</div>

Hello,  
been trying to install node/node-red-contrib-usbhid by following all the steps with no success.

Through the Palette-Management i get the errors below (truncated)

```auto
/home/pi/.cache/node-gyp/12.14.0/include/node/v8.h: In instantiation of ‘void v8::PersistentBase<T>::SetWeak(P*, typename v8::WeakCallbackInfo<P>::Callback, v8::WeakCallbackType) [with P = Nan::ObjectWrap; T = v8::Object; typename v8::WeakCallbackInfo<P>::Callback = void (*)(const v8::WeakCallbackInfo<Nan::ObjectWrap>&)]’:
../../../../nan/nan_object_wrap.h:65:61: required from here
/home/pi/.cache/node-gyp/12.14.0/include/node/v8.h:10004:16: warning: cast between incompatible function types from ‘v8::WeakCallbackInfo<Nan::ObjectWrap>::Callback’ {aka ‘void (*)(const v8::WeakCallbackInfo<Nan::ObjectWrap>&)’} to ‘Callback’ {aka ‘void (*)(const v8::WeakCallbackInfo<void>&)’} [-Wcast-function-type]
make: *** [HID.target.mk:118: Release/obj.target/HID/src/HID.o] Error 1
gyp ERR! build error
gyp ERR! stack Error: `make` failed with exit code: 2
gyp ERR! stack at ChildProcess.onExit (/usr/lib/node_modules/npm/node_modules/node-gyp/lib/build.js:194:23)
gyp ERR! stack at ChildProcess.emit (events.js:210:5)
gyp ERR! stack at Process.ChildProcess._handle.onexit (internal/child_process.js:272:12)
gyp ERR! System Linux 4.19.75-v7l+
gyp ERR! command "/usr/bin/node" "/usr/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js" "rebuild"
gyp ERR! cwd /home/pi/.node-red/node_modules/node-red-contrib-usbhid/node_modules/node-hid
gyp ERR! node -v v12.14.0
gyp ERR! node-gyp -v v5.0.5
gyp ERR! not ok
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! node-hid@0.5.7 install: `prebuild-install || node-gyp rebuild`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the node-hid@0.5.7 install script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.

npm ERR! A complete log of this run can be found in:
npm ERR! /home/pi/.npm/_logs/2019-12-20T21_12_14_469Z-debug.log

20 Dec 21:12:14 - [warn] ------------------------------------------

```

Through the shell by running the command npm install node-hid --build-from-source --unsafe-perm  
I get the results below:

```auto
make: Leaving directory '/home/pi/node_modules/node-hid/build'
npm WARN saveError ENOENT: no such file or directory, open '/home/pi/package.json'
npm notice created a lockfile as package-lock.json. You should commit this file.
npm WARN enoent ENOENT: no such file or directory, open '/home/pi/package.json'
npm WARN pi No description
npm WARN pi No repository field.
npm WARN pi No README data
npm WARN pi No license field.

+ node-hid@1.1.0
added 61 packages from 43 contributors and audited 97 packages in 27.056s
found 0 vulnerabilities

```

but still, no nodes are added, and the package shows as uninstalled in the palette management.

my target is to use a usb scanner that reads using a python script successfully and is an HID device.

Thank you.

---

<div class="post-metadata">

**Author:** ![Colin](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/colin/32/17040_2.png) [@Colin](https://discourse.nodered.org/u/Colin)\
**Post date:** [20 December 2019 22:14 UTC](https://discourse.nodered.org/t/raspberry-pi-usb-hid-node-error/19410/2 "2019-12-20T22:14:35Z")

</div>

> [@sense](#):
>
> but still, no nodes are added,

That's because you installed it in the pi home directory rather than in the .node-red directory.

---

<div class="post-metadata">

**Author:** ![sense](https://avatars.discourse-cdn.com/v4/letter/s/edb3f5/32.png) [@sense](https://discourse.nodered.org/u/sense)\
**Post date:** [21 December 2019 08:12 UTC](https://discourse.nodered.org/t/raspberry-pi-usb-hid-node-error/19410/3 "2019-12-21T08:12:53Z")

</div>

Hello Colin,

This time i tried to install it with the error below.

```auto
pi@raspberrypi:~/.node-red $ sudo npm install node-red-contrib-usbhid --build-from-source --unsafe-perm
npm WARN checkPermissions Missing write access to /home/pi/.node-red/node_modules/node-hid
npm ERR! code ELOOP
npm ERR! syscall access
npm ERR! path /home/pi/.node-red/node_modules/node-hid
npm ERR! errno -40
npm ERR! ELOOP: too many symbolic links encountered, access '/home/pi/.node-red/node_modules/node-hid'

```

as with the ls -alt i get the below

```auto
pi@raspberrypi:~/.node-red/node_modules $ ls -alt
total 312
drwxr-xr-x 78 pi pi 4096 Dec 21 08:05 .
lrwxrwxrwx 1 pi pi 8 Dec 21 08:05 node-hid -> node-hid

```

so, is the node-hid the same as node-red-contrib-usbhid?  
if not, how can i solve the linking issue above please?

Thank u.

---

<div class="post-metadata">

**Author:** ![Colin](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/colin/32/17040_2.png) [@Colin](https://discourse.nodered.org/u/Colin)\
**Post date:** [21 December 2019 08:52 UTC](https://discourse.nodered.org/t/raspberry-pi-usb-hid-node-error/19410/4 "2019-12-21T08:52:15Z")

</div>

You should not use sudo for installing local nodes. Now you may have files owned by root in your home directory which is likely to cause problems later. Probably best to delete that node and try again. Try

```auto
cd ~/.node-red/node_modules
sudo rm -rf node-hid
cd ~/.node-red

```

and try the install again. Take care with the sudo rm command as you can use that to delete your operating system if you get it wrong.  
I don't know why you are using build-from-source or unsafe-perm, but I assume you have a reason for that.

---

<div class="post-metadata">

**Author:** ![sense](https://avatars.discourse-cdn.com/v4/letter/s/edb3f5/32.png) [@sense](https://discourse.nodered.org/u/sense)\
**Post date:** [21 December 2019 10:28 UTC](https://discourse.nodered.org/t/raspberry-pi-usb-hid-node-error/19410/5 "2019-12-21T10:28:10Z")

</div>

Hello Colin,

i'm if i don't use unsafe-perm and build-from-source it ends with the error below

```auto
/home/pi/.cache/node-gyp/12.14.0/include/node/v8.h: In instantiation of ‘void v8::PersistentBase<T>::SetWeak(P*, typename v8::WeakCallbackInfo<P>::Callback, v8::WeakCallbackType) [with P = Nan::ObjectWrap; T = v8::Object; typename v8::WeakCallbackInfo<P>::Callback = void (*)(const v8::WeakCallbackInfo<Nan::ObjectWrap>&)]’:
../../../../nan/nan_object_wrap.h:65:61: required from here
/home/pi/.cache/node-gyp/12.14.0/include/node/v8.h:10004:16: warning: cast between incompatible function types from ‘v8::WeakCallbackInfo<Nan::ObjectWrap>::Callback’ {aka ‘void (*)(const v8::WeakCallbackInfo<Nan::ObjectWrap>&)’} to ‘Callback’ {aka ‘void (*)(const v8::WeakCallbackInfo<void>&)’} [-Wcast-function-type]
make: *** [HID.target.mk:118: Release/obj.target/HID/src/HID.o] Error 1
make: Leaving directory '/home/pi/.node-red/node_modules/node-red-contrib-usbhid/node_modules/node-hid/build'
gyp ERR! build error
gyp ERR! stack Error: `make` failed with exit code: 2
gyp ERR! stack at ChildProcess.onExit (/usr/lib/node_modules/npm/node_modules/node-gyp/lib/build.js:194:23)
gyp ERR! stack at ChildProcess.emit (events.js:210:5)
gyp ERR! stack at Process.ChildProcess._handle.onexit (internal/child_process.js:272:12)
gyp ERR! System Linux 4.19.75-v7l+
gyp ERR! command "/usr/bin/node" "/usr/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js" "rebuild"
gyp ERR! cwd /home/pi/.node-red/node_modules/node-red-contrib-usbhid/node_modules/node-hid
gyp ERR! node -v v12.14.0
gyp ERR! node-gyp -v v5.0.5
gyp ERR! not ok
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! node-hid@0.5.7 install: `prebuild-install || node-gyp rebuild`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the node-hid@0.5.7 install script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.

npm ERR! A complete log of this run can be found in:
npm ERR! /home/pi/.npm/_logs/2019-12-21T09_11_46_646Z-debug.log

```

When installing from the palette manager i get the error below

```auto
/home/pi/.cache/node-gyp/12.14.0/include/node/v8.h: In instantiation of ‘void v8::PersistentBase<T>::SetWeak(P*, typename v8::WeakCallbackInfo<P>::Callback, v8::WeakCallbackType) [with P = Nan::ObjectWrap; T = v8::Object; typename v8::WeakCallbackInfo<P>::Callback = void (*)(const v8::WeakCallbackInfo<Nan::ObjectWrap>&)]’:
../../../../nan/nan_object_wrap.h:65:61: required from here
/home/pi/.cache/node-gyp/12.14.0/include/node/v8.h:10004:16: warning: cast between incompatible function types from ‘v8::WeakCallbackInfo<Nan::ObjectWrap>::Callback’ {aka ‘void (*)(const v8::WeakCallbackInfo<Nan::ObjectWrap>&)’} to ‘Callback’ {aka ‘void (*)(const v8::WeakCallbackInfo<void>&)’} [-Wcast-function-type]
make: *** [HID.target.mk:118: Release/obj.target/HID/src/HID.o] Error 1
gyp ERR! build error
gyp ERR! stack Error: `make` failed with exit code: 2
gyp ERR! stack at ChildProcess.onExit (/usr/lib/node_modules/npm/node_modules/node-gyp/lib/build.js:194:23)
gyp ERR! stack at ChildProcess.emit (events.js:210:5)
gyp ERR! stack at Process.ChildProcess._handle.onexit (internal/child_process.js:272:12)
gyp ERR! System Linux 4.19.75-v7l+
gyp ERR! command "/usr/bin/node" "/usr/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js" "rebuild"
gyp ERR! cwd /home/pi/.node-red/node_modules/node-red-contrib-usbhid/node_modules/node-hid
gyp ERR! node -v v12.14.0
gyp ERR! node-gyp -v v5.0.5
gyp ERR! not ok
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! node-hid@0.5.7 install: `prebuild-install || node-gyp rebuild`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the node-hid@0.5.7 install script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.

npm ERR! A complete log of this run can be found in:
npm ERR! /home/pi/.npm/_logs/2019-12-21T10_27_11_458Z-debug.log

21 Dec 10:27:11 - [warn] ------------------------------------------

```

---

<div class="post-metadata">

**Author:** ![zenofmud](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/zenofmud/32/316_2.png) [@zenofmud](https://discourse.nodered.org/u/zenofmud)\
**Post date:** [21 December 2019 11:19 UTC](https://discourse.nodered.org/t/raspberry-pi-usb-hid-node-error/19410/6 "2019-12-21T11:19:01Z")

</div>

If you look at GitHub, it would seem the author has lost interest and several people have had install issues ([https://github.com/somebuddy87/node-red-contrib-usbhid/issues/1](https://github.com/somebuddy87/node-red-contrib-usbhid/issues/1)) but some have had some success ([https://github.com/somebuddy87/node-red-contrib-usbhid/issues/3](https://github.com/somebuddy87/node-red-contrib-usbhid/issues/3)) with a 'bit' of extra work.

---

<div class="post-metadata">

**Author:** ![sense](https://avatars.discourse-cdn.com/v4/letter/s/edb3f5/32.png) [@sense](https://discourse.nodered.org/u/sense)\
**Post date:** [21 December 2019 11:21 UTC](https://discourse.nodered.org/t/raspberry-pi-usb-hid-node-error/19410/7 "2019-12-21T11:21:56Z")

</div>

@zenofmud  
Yes i can see that, the point is i cannot find any other way to read input from an HID Zebra (Symbol) QR Code scanner to nodered.  
do you think there is another way to do this?

---

<div class="post-metadata">

**Author:** ![zenofmud](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/zenofmud/32/316_2.png) [@zenofmud](https://discourse.nodered.org/u/zenofmud)\
**Post date:** [21 December 2019 11:27 UTC](https://discourse.nodered.org/t/raspberry-pi-usb-hid-node-error/19410/8 "2019-12-21T11:27:06Z")

</div>

> [@sense](#):
>
> i cannot find any other way to read input from an HID Zebra (Symbol) QR Code scanner to nodered.

If you read the second thread I pointed to, it looks like some people have abeen successful installing the node - with some extra work.

I know of no way to use that scanner, but I don't have one, never used one so there has been no need for me to look for a solution. Maybe someone else has and will give you an answer, but till then, if I needed to use it, I'd look at those threads...

---

<div class="post-metadata">

**Author:** ![dceejay](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/dceejay/32/38_2.png) [@dceejay](https://discourse.nodered.org/u/dceejay)\
**Post date:** [21 December 2019 11:49 UTC](https://discourse.nodered.org/t/raspberry-pi-usb-hid-node-error/19410/9 "2019-12-21T11:49:33Z")

</div>

Some HID devices do just look like keyboards etc - so may just send strings into an input field in the dashboard, or use the keyboard node on Pi... but then again - many do not...

---

<div class="post-metadata">

**Author:** ![sense](https://avatars.discourse-cdn.com/v4/letter/s/edb3f5/32.png) [@sense](https://discourse.nodered.org/u/sense)\
**Post date:** [21 December 2019 11:52 UTC](https://discourse.nodered.org/t/raspberry-pi-usb-hid-node-error/19410/10 "2019-12-21T11:52:37Z")

</div>

Hello,  
Just found a configuration utitlity for the scanner.  
i may change the behavior of the scanner to one of the below, do u recommend any that works with Node-red!

![image](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/2X/6/6b2f6199a1ccd209784334f8cede87b385b79978.png)

---

<div class="post-metadata">

**Author:** ![Colin](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/colin/32/17040_2.png) [@Colin](https://discourse.nodered.org/u/Colin)\
**Post date:** [21 December 2019 14:47 UTC](https://discourse.nodered.org/t/raspberry-pi-usb-hid-node-error/19410/11 "2019-12-21T14:47:16Z")

</div>

In terminal run  
`tail -f /var/log/syslog`  
Then hit return a couple of times so you get a gap in the output.  
Now plug the device in and copy/paste the resulting syslog output here. Copy/paste if possible please rather than a screenshot.

---

<div class="post-metadata">

**Author:** ![sense](https://avatars.discourse-cdn.com/v4/letter/s/edb3f5/32.png) [@sense](https://discourse.nodered.org/u/sense)\
**Post date:** [21 December 2019 15:12 UTC](https://discourse.nodered.org/t/raspberry-pi-usb-hid-node-error/19410/12 "2019-12-21T15:12:55Z")

</div>

Here's the output

```auto
Dec 21 15:13:23 raspberrypi kernel: [413.641597] usb 1-1.1: USB disconnect, device number 3
Dec 21 15:13:26 raspberrypi kernel: [416.759939] usb 1-1.3: new full-speed USB device number 4 using xhci_hcd
Dec 21 15:13:26 raspberrypi kernel: [416.899465] usb 1-1.3: New USB device found, idVendor=05e0, idProduct=1200, bcdDevice= 0.01
Dec 21 15:13:26 raspberrypi kernel: [416.899481] usb 1-1.3: New USB device strings: Mfr=1, Product=2, SerialNumber=3
Dec 21 15:13:26 raspberrypi kernel: [416.899494] usb 1-1.3: Product: Symbol Bar Code Scanner::EA
Dec 21 15:13:26 raspberrypi kernel: [416.899506] usb 1-1.3: Manufacturer: Symbol Technologies, Inc, 2008
Dec 21 15:13:26 raspberrypi kernel: [416.899517] usb 1-1.3: SerialNumber: 19099520100079
Dec 21 15:13:26 raspberrypi kernel: [416.910399] input: Symbol Technologies, Inc, 2008 Symbol Bar Code Scanner::EA as /devices/platform/scb/fd500000.pcie/pci0000:00/0000:00:00.0/0000:01:00.0/usb1/1-1/1-1.3/1-1.3:1.0/0003:05E0:1200.0002/input/input1
Dec 21 15:13:26 raspberrypi kernel: [416.980897] hid-generic 0003:05E0:1200.0002: input,hidraw0: USB HID v1.10 Keyboard [Symbol Technologies, Inc, 2008 Symbol Bar Code Scanner::EA] on usb-0000:01:00.0-1.3/input0
Dec 21 15:13:26 raspberrypi mtp-probe: checking bus 1, device 4: "/sys/devices/platform/scb/fd500000.pcie/pci0000:00/0000:00:00.0/0000:01:00.0/usb1/1-1/1-1.3"
Dec 21 15:13:26 raspberrypi mtp-probe: bus: 1, device: 4 was not an MTP device
Dec 21 15:13:27 raspberrypi systemd-udevd[740]: Process '/usr/sbin/th-cmd --socket /var/run/thd.socket --passfd --udev' failed with exit code 1.
Dec 21 15:13:27 raspberrypi mtp-probe: checking bus 1, device 4: "/sys/devices/platform/scb/fd500000.pcie/pci0000:00/0000:00:00.0/0000:01:00.0/usb1/1-1/1-1.3"
Dec 21 15:13:27 raspberrypi mtp-probe: bus: 1, device: 4 was not an MTP device

```

i believe i can make some changes to the default settings as per the screenshot in the reply before this one.  
Thank u.

---

<div class="post-metadata">

**Author:** ![Colin](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/colin/32/17040_2.png) [@Colin](https://discourse.nodered.org/u/Colin)\
**Post date:** [21 December 2019 21:12 UTC](https://discourse.nodered.org/t/raspberry-pi-usb-hid-node-error/19410/13 "2019-12-21T21:12:45Z")

</div>

That suggests it might just appear to be a keyboard. If you open a terminal and scan something does anything appear?

---

<div class="post-metadata">

**Author:** ![nksky](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/nksky/32/9173_2.png) [@nksky](https://discourse.nodered.org/u/nksky)\
**Post date:** [19 August 2020 15:28 UTC](https://discourse.nodered.org/t/raspberry-pi-usb-hid-node-error/19410/14 "2020-08-19T15:28:21Z")

</div>

Hi, Did you ever get this working? I am having the same problem on a Pi4 running Dietpi
