Skip to content

Instantly share code, notes, and snippets.

@todbot
Last active November 2, 2020 02:17
Show Gist options
  • Save todbot/ee76690bc0da93203ffb67a60cf9cafc to your computer and use it in GitHub Desktop.
Save todbot/ee76690bc0da93203ffb67a60cf9cafc to your computer and use it in GitHub Desktop.
Installing node-hid on brand new Raspian on Raspberry Pi
# What is our setup
pi@raspberrypi:~ $ cat /etc/debian_version
9.4
pi@raspberrypi:~ $ lsb_release --all
No LSB modules are available.
Distributor ID: Raspbian
Description: Raspbian GNU/Linux 9.4 (stretch)
Release: 9.4
Codename: stretch
pi@raspberrypi:~ $ uname -a
Linux raspberrypi 4.14.79+ #1159 Sun Nov 4 17:28:08 GMT 2018 armv6l GNU/Linux
# Install pre-requisistes
pi@raspberrypi:~ $ sudo apt update
pi@raspberrypi:~ $ sudo apt install libusb-1.0-0 libusb-1.0-0-dev libudev-dev
# Install NodeJs
pi@raspberrypi:~ $ curl -o- https://raw.githubusercontent.com/creationix/nvm/v0.34.0/install.sh | bash
pi@raspberrypi:~ $ . ~/.bashrc
pi@raspberrypi:~ $ nvm install 11.9
pi@raspberrypi:~ $ cd projects
pi@raspberrypi:~ $ mkdir node-hid-test && cd node-hid-test
# Create a small test project, install node-hid
pi@raspberrypi:~/projects/node-hid-test $ npm init -y
Wrote to /home/pi/projects/node-hid-test/package.json:
{
"name": "node-hid-test",
"version": "1.0.0",
"description": "",
"main": "index.js",
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1"
},
"keywords": [],
"author": "",
"license": "ISC"
}
pi@raspberrypi:~/projects/node-hid-test $ npm install node-hid --save
> node-hid@0.7.6 install /home/pi/projects/node-hid-test/node_modules/node-hid
> prebuild-install || node-gyp rebuild
prebuild-install WARN install No prebuilt binaries found (target=11.9.0 runtime=node arch=arm libc= platform=linux)
make: Entering directory '/home/pi/projects/node-hid-test/node_modules/node-hid/build'
CC(target) Release/obj.target/hidapi/hidapi/linux/hid.o
AR(target) Release/obj.target/hidapi.a
COPY Release/hidapi.a
CXX(target) Release/obj.target/HID/src/HID.o
../src/HID.cc: In static member function ‘static Nan::NAN_METHOD_RETURN_TYPE HID::sendFeatureReport(Nan::NAN_METHOD_ARGS_TYPE)’:
../src/HID.cc:361:72: warning: ‘int32_t v8::Value::Int32Value() const’ is deprecated: Use maybe version [-Wdeprecated-declarations]
message.push_back((unsigned char) messageArray->Get(i)->Int32Value());
^
In file included from /home/pi/.node-gyp/11.9.0/include/node/v8.h:26:0,
from /home/pi/.node-gyp/11.9.0/include/node/node.h:63,
from ../src/HID.cc:30:
/home/pi/.node-gyp/11.9.0/include/node/v8.h:2572:46: note: declared here
V8_DEPRECATED("Use maybe version", int32_t Int32Value() const);
^
/home/pi/.node-gyp/11.9.0/include/node/v8config.h:326:3: note: in definition of macro ‘V8_DEPRECATED’
declarator __attribute__((deprecated(message)))
^~~~~~~~~~
../src/HID.cc: In static member function ‘static Nan::NAN_METHOD_RETURN_TYPE HID::New(Nan::NAN_METHOD_ARGS_TYPE)’:
../src/HID.cc:402:46: warning: ‘int32_t v8::Value::Int32Value() const’ is deprecated: Use maybe version [-Wdeprecated-declarations]
int32_t vendorId = info[0]->Int32Value();
^
In file included from /home/pi/.node-gyp/11.9.0/include/node/v8.h:26:0,
from /home/pi/.node-gyp/11.9.0/include/node/node.h:63,
from ../src/HID.cc:30:
/home/pi/.node-gyp/11.9.0/include/node/v8.h:2572:46: note: declared here
V8_DEPRECATED("Use maybe version", int32_t Int32Value() const);
^
/home/pi/.node-gyp/11.9.0/include/node/v8config.h:326:3: note: in definition of macro ‘V8_DEPRECATED’
declarator __attribute__((deprecated(message)))
^~~~~~~~~~
../src/HID.cc:403:47: warning: ‘int32_t v8::Value::Int32Value() const’ is deprecated: Use maybe version [-Wdeprecated-declarations]
int32_t productId = info[1]->Int32Value();
^
In file included from /home/pi/.node-gyp/11.9.0/include/node/v8.h:26:0,
from /home/pi/.node-gyp/11.9.0/include/node/node.h:63,
from ../src/HID.cc:30:
/home/pi/.node-gyp/11.9.0/include/node/v8.h:2572:46: note: declared here
V8_DEPRECATED("Use maybe version", int32_t Int32Value() const);
^
/home/pi/.node-gyp/11.9.0/include/node/v8config.h:326:3: note: in definition of macro ‘V8_DEPRECATED’
declarator __attribute__((deprecated(message)))
^~~~~~~~~~
../src/HID.cc: In static member function ‘static Nan::NAN_METHOD_RETURN_TYPE HID::setNonBlocking(Nan::NAN_METHOD_ARGS_TYPE)’:
../src/HID.cc:443:37: warning: ‘int32_t v8::Value::Int32Value() const’ is deprecated: Use maybe version [-Wdeprecated-declarations]
blockStatus = info[0]->Int32Value();
^
In file included from /home/pi/.node-gyp/11.9.0/include/node/v8.h:26:0,
from /home/pi/.node-gyp/11.9.0/include/node/node.h:63,
from ../src/HID.cc:30:
/home/pi/.node-gyp/11.9.0/include/node/v8.h:2572:46: note: declared here
V8_DEPRECATED("Use maybe version", int32_t Int32Value() const);
^
/home/pi/.node-gyp/11.9.0/include/node/v8config.h:326:3: note: in definition of macro ‘V8_DEPRECATED’
declarator __attribute__((deprecated(message)))
^~~~~~~~~~
../src/HID.cc: In static member function ‘static Nan::NAN_METHOD_RETURN_TYPE HID::write(Nan::NAN_METHOD_ARGS_TYPE)’:
../src/HID.cc:471:74: warning: ‘int32_t v8::Value::Int32Value() const’ is deprecated: Use maybe version [-Wdeprecated-declarations]
message.push_back((unsigned char) messageArray->Get(i)->Int32Value());
^
In file included from /home/pi/.node-gyp/11.9.0/include/node/v8.h:26:0,
from /home/pi/.node-gyp/11.9.0/include/node/node.h:63,
from ../src/HID.cc:30:
/home/pi/.node-gyp/11.9.0/include/node/v8.h:2572:46: note: declared here
V8_DEPRECATED("Use maybe version", int32_t Int32Value() const);
^
/home/pi/.node-gyp/11.9.0/include/node/v8config.h:326:3: note: in definition of macro ‘V8_DEPRECATED’
declarator __attribute__((deprecated(message)))
^~~~~~~~~~
../src/HID.cc: In static member function ‘static Nan::NAN_METHOD_RETURN_TYPE HID::devices(Nan::NAN_METHOD_ARGS_TYPE)’:
../src/HID.cc:535:38: warning: ‘int32_t v8::Value::Int32Value() const’ is deprecated: Use maybe version [-Wdeprecated-declarations]
vendorId = info[0]->Int32Value();
^
In file included from /home/pi/.node-gyp/11.9.0/include/node/v8.h:26:0,
from /home/pi/.node-gyp/11.9.0/include/node/node.h:63,
from ../src/HID.cc:30:
/home/pi/.node-gyp/11.9.0/include/node/v8.h:2572:46: note: declared here
V8_DEPRECATED("Use maybe version", int32_t Int32Value() const);
^
/home/pi/.node-gyp/11.9.0/include/node/v8config.h:326:3: note: in definition of macro ‘V8_DEPRECATED’
declarator __attribute__((deprecated(message)))
^~~~~~~~~~
../src/HID.cc:536:39: warning: ‘int32_t v8::Value::Int32Value() const’ is deprecated: Use maybe version [-Wdeprecated-declarations]
productId = info[1]->Int32Value();
^
In file included from /home/pi/.node-gyp/11.9.0/include/node/v8.h:26:0,
from /home/pi/.node-gyp/11.9.0/include/node/node.h:63,
from ../src/HID.cc:30:
/home/pi/.node-gyp/11.9.0/include/node/v8.h:2572:46: note: declared here
V8_DEPRECATED("Use maybe version", int32_t Int32Value() const);
^
/home/pi/.node-gyp/11.9.0/include/node/v8config.h:326:3: note: in definition of macro ‘V8_DEPRECATED’
declarator __attribute__((deprecated(message)))
^~~~~~~~~~
SOLINK_MODULE(target) Release/obj.target/HID.node
COPY Release/HID.node
make: Leaving directory '/home/pi/projects/node-hid-test/node_modules/node-hid/build'
npm notice created a lockfile as package-lock.json. You should commit this file.
npm WARN node-hid-test@1.0.0 No description
npm WARN node-hid-test@1.0.0 No repository field.
+ node-hid@0.7.6
added 66 packages from 46 contributors and audited 111 packages in 136.024s
found 0 vulnerabilities
pi@raspberrypi:~/projects/node-hid-test $ node ./node_modules/.bin/hid-showdevices
devices: []
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment