Skip to content

Instantly share code, notes, and snippets.

@byronhulcher
Last active May 1, 2017 16:16
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save byronhulcher/7edbfebe5e106d441d5351c9f2c938b5 to your computer and use it in GitHub Desktop.
Save byronhulcher/7edbfebe5e106d441d5351c9f2c938b5 to your computer and use it in GitHub Desktop.
How to compile node-hid for Tessel 2
  • run git clone https://github.com/tessel/t2-compiler.git
  • run cd t2-compiler
  • have docker and docker-machine up and running (sorry I am not sure sure about this)
  • run docker-machine start default
  • run docker-machine env default
  • run the eval command that spits out (likely eval $(docker-machine env default))
  • run docker run -it --entrypoint bash tessel/t2-compiler
  • Now you're inside the t2-compiler VM
  • you should be in ~/ your home directory but just in case, run cd ~
  • if you want, you can copy and run the file compile-node-hid.sh from this gist, or follow the below instructions:
    • run git clone https://github.com/node-hid/node-hid
    • run apt-get install libusb-1.0-0-dev
    • run cd ~/node-hid
    • run git submodule update --init
    • run npm install
    • run ./node_modules/.bin/node-pre-gyp rebuild --target_platform=linux --target_arch=mipsel --target=4.4.3
  • Either way, once you're done validate that ~/node-hid/build/HID/v0.5.1/Release/node-v46-linux-mipsel/HID.node exists!
# clone the node-hid repository
# we can't use `npm pack node-hid@latest` because right now the latest, 0.5.1,
# depends on a version of node-pre-gyp that doesn't support
# compiling to 4.4.3 which tessel 2 runs
git clone https://github.com/node-hid/node-hid && cd node-hid
# we need to have libusb installed to compile node-hid
apt-get install libusb-1.0-0-dev
# we have to make sure the hidapi submodule is installed
git submodule update --init
# we install node-hid's dependencies
npm install
# this will build to ~/node-hid/build/HID/v0.5.1/Release/node-v46-linux-mipsel/HID.node
./node_modules/.bin/node-pre-gyp rebuild --target_platform=linux --target_arch=mipsel --target=4.4.3
@madskunker
Copy link

I move Release folder and used

var HID = require("./Release/HID.node");

'/tmp/remote-script/Release/HID.node' is not an ELF executable for MIPS
module.js:434

What am I missing

TIA

Jeff

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment