I’ve written a NodeJS script that listens to a HID device and triggers some other actions.
The very first line I interact with the HID is the following line:
let device = await HID.HIDAsync.open(vendorId, productId);
This works fine if the script is called with sudo/root privileges by using sudo node /home/pi/main.js
. This script should automatically start if the computer (Raspberry Pi with Raspberry OS x64, aarch64-linux-gnu) is started. I used the /home/pi/.config/autostart/hid.desktop method with xterm (to leave the terminal opened) with the command Exec=xterm -hold -e 'sudo node /home/pi/main.js'
. The next reboot unfortunately this fails with the following error message:
node[1755]: napi_status napi_call_threadsafe_function(napi_threadsafe_function, void*, napi_threadsafe_function_call_mode) at ../src/noed_api.cc:1389
Assertion failed: (func) != nullptr
—— Native stack trace ——
1: 0xc9cd44 node::Assert(node::AssertionInfo const&) [node]
…
Unfortunately I have no clue about this message. The script works perfectly fine if I start it manually.