Security News
JSR Working Group Kicks Off with Ambitious Roadmap and Plans for Open Governance
At its inaugural meeting, the JSR Working Group outlined plans for an open governance model and a roadmap to enhance JavaScript package management.
Use npm to execute all installation steps:
npm install
Use node-gyp to compile the extension.
In the src/
directory, various JavaScript programs can be found
that talk to specific devices in some way. The show-devices.js
program can be used to display all HID devices in the system.
var HID = require('HID');
var devices = HID.devices()
devices will contain an array of objects, one for each HID device
available. Of particular interest are the vendorId
and
productId
, as they uniquely identify a device, and the
path
, which is needed to open a particular device.
Here is some sample output:
HID.devices();
[ { vendorId: 1452,
productId: 595,
path: 'USB_05ac_0253_0x100a148e0',
serialNumber: '',
manufacturer: 'Apple Inc.',
product: 'Apple Internal Keyboard / Trackpad',
release: 280,
interface: -1 },
{ vendorId: 1452,
productId: 595,
path: 'USB_05ac_0253_0x100a14e20',
serialNumber: '',
manufacturer: 'Apple Inc.',
product: 'Apple Internal Keyboard / Trackpad',
release: 280,
interface: -1 },
<and more>
Before a device can be read from or written to, it must be opened:
var device = new HID.HID(path);
device
will contain a handle to the device. The path
can
be determined by a prior HID.devices() call. If an error occurs
opening the device, an exception will be thrown.
Reading from a device is performed using the read call on a device handle:
device.read(function(error, data) {});
All reading is asynchronous.
Writing to a device is performed using the write call in a device handle. All writing is synchronous.
device.write([0x00, 0x01, 0x01, 0x05, 0xff, 0xff]);
If you need help, send me an email (hans.huebner@gmail.com)
FAQs
USB HID device access library
The npm package node-hid receives a total of 73,782 weekly downloads. As such, node-hid popularity was classified as popular.
We found that node-hid demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 0 open source maintainers collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
At its inaugural meeting, the JSR Working Group outlined plans for an open governance model and a roadmap to enhance JavaScript package management.
Security News
Research
An advanced npm supply chain attack is leveraging Ethereum smart contracts for decentralized, persistent malware control, evading traditional defenses.
Security News
Research
Attackers are impersonating Sindre Sorhus on npm with a fake 'chalk-node' package containing a malicious backdoor to compromise developers' projects.