npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

@gdziuba/node-red-usbhid

v1.0.3

Published

A node-hid (USB HID device access library) wrapper for Node-RED

Downloads

112

Readme

node-red-contrib-usbhid

A node-hid (USB HID device access library) wrapper for nodered

Credit goes to node-hid.

You can look up either git to find information on setup, Prerequisites and Platforms to get the node working: https://github.com/node-hid/node-hid

Prerequisites:

  • Node.js v0.8 - v4.x+
  • Mac OS X 10.8, Linux (kernel 2.6+), and Windows XP+
  • libudev-dev, libusb-1.0-0-dev (if Linux, see Compile below)
  • git

node-hid uses node-pre-gyp to store pre-built binary bundles, so usually no compiler is needed to install.

Platforms we pre-build binaries for:

  • Mac OS X x64: v0.10, v0.12, v4.2.x
  • Windows x64 & x86: v0.10, v0.12, v4.2.x
  • Linux Debian/Ubuntu x64: v4.2.x
  • Raspberry Pi arm: v4.2.x

How to Install on Windows

This package works natively with Windows.

Manual installation is the current way to get the node. It will be added to the pallette manager in the future.

Install from source

From github: Navigate to the your home directory on linux and windows it is typically ~/.node-red/node-modules

git clone https://github.com/gdziuba/node-red-contrib-usbhid.git
cd node-red-contrib-usbhid
npm install

How to Install on Linux

HID ( USB ) read/write access for non root users ( in my case for user pi on an raspberry pi 2 running nodered )

Install libraries for Linux

sudo apt install libusb-1.0-0 libusb-1.0-0-dev libudev-dev

The Pd-extended [hid] object allows you to access Human Interface Devices such as mice, keyboards, and joysticks. However, in most Linux distributions, these devices are setup to where they cannot be read/written directly by Pd unless you run it as root.

Running a non-system process as root is considered a security risk, so an alternative is to change the permissions of the input devices so that pd can read/write them.

sudo mkdir -p /etc/udev/rules.d
sudo nano /etc/udev/rules.d/85-pure-data.rules

Now add the following rules to /etc/udev/rules.d/85-pure-data.rules making sure to updated KERNEL to your hidraw* device:

SUBSYSTEM=="input", GROUP="input", MODE="0777"
SUBSYSTEM=="usb", MODE:="777", GROUP="input"
KERNEL=="hidraw0", MODE="0777", GROUP="input"

Make sure no existing rules compete. I found existing file on Raspberry pi that needed updating. I added above code instead of creating a new file

Then create an "input" group and add yourself to it:

sudo groupadd -f input
sudo gpasswd -a $USER input

Reloads rules:

udevadm control --reload-rules

Reboot your machine for the rules to take effect. Your nodejs / nodered has now FULL ACCESS !! to you usb devides. Feel free to adjust the permissions to fit your needs.

How to Use

Leverage this Flow to get started.