Socket
Socket
Sign inDemoInstall

node-hid

Package Overview
Dependencies
Maintainers
5
Versions
43
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

node-hid - npm Package Compare versions

Comparing version 0.7.8 to 0.7.9

.DS_Store

27

nodehid.js

@@ -16,19 +16,14 @@

if( !binding ) {
binding = require('bindings')('HID.node');
if( os.platform() === 'linux' ) {
// Linux defaults to hidraw
if( !driverType || driverType === 'hidraw' ) {
binding = require('bindings')('HID-hidraw.node');
} else {
binding = require('bindings')('HID.node');
}
}
else {
binding = require('bindings')('HID.node');
}
}
// disabled until prebuild gets multi-target support, see node-hid#242
// if( !binding ) {
// if( os.platform() === 'linux' ) {
// // Linux defaults to hidraw
// if( !driverType || driverType === 'hidraw' ) {
// binding = require('bindings')('HID-hidraw.node');
// } else {
// binding = require('bindings')('HID.node');
// }
// }
// else {
// binding = require('bindings')('HID.node');
// }
// }
}

@@ -35,0 +30,0 @@

{
"name": "node-hid",
"description": "USB HID device access library",
"version": "0.7.8",
"version": "0.7.9",
"author": "Hans Hübner <hans.huebner@gmail.com> (https://github.com/hanshuebner)",

@@ -21,4 +21,4 @@ "bugs": "https://github.com/node-hid/node-hid/issues",

"install": "prebuild-install || node-gyp rebuild",
"prebuild": "prebuild --all --verbose",
"prebuild-upload": "prebuild --all --strip --verbose --upload",
"prebuild": "prebuild --all --verbose --include-regex \"HID.*node$\"",
"prebuild-upload": "prebuild --upload-all",
"prebuild-ci": "prebuild-ci",

@@ -46,2 +46,3 @@ "gypclean": "node-gyp clean",

"devDependencies": {
"node-abi": "^2.8.0",
"prebuild": "^8.2.1",

@@ -48,0 +49,0 @@ "prebuild-ci": "^2.3.0",

@@ -54,47 +54,36 @@ # node-hid - Access USB HID devices from Node.js #

## Platform Support
`node-hid` supports Node.js v6 and upwards. For versions 0.10 and 0.12 and v4,
`node-hid` supports Node.js v6 and upwards. For versions before that,
you will need to build from source. The platforms, architectures and node versions `node-hid` supports are the following.
Those with checks we provide pre-built binaries, for the others you will need to compile.
In general we try to provide pre-built native library binaries for the most common platforms, Node and Electron versions.
* ☑ = full-support with pre-built binaries
* ☐ = source-support only
We strive to make `node-hid` cross-platform so there's a good chance any
combination not listed here will compile and work.
### Supported Platofrms ###
- Windows x86 (32-bit) (¹)
- Windows x64 (64-bit)
- Mac OSX 10.9+
- Linux x64 (²)
- Linux x86 (¹)
- Linux ARM / Raspberry Pi (¹)
- Linux MIPSel (¹)
- Linux PPC64 (¹)
¹ prebuilt-binaries not provided for these platforms
² prebuilt binary built on Ubuntu 16.04 x64
### Supported Node versions ###
| Platform / Arch | Node v6.x | Node v7.x | Node v8.x | Node v9.x | Node v10.x
| --- | --- | --- | --- | --- | --- |
| Windows / x86 | ☑ | ☑ | ☑ | ☑ | ☑ |
| Windows / x64 | ☑ | ☑ | ☑ | ☑ | ☑ |
| Mac OSX / x64 | ☑ | ☑ | ☑ | ☑ | ☑ |
| Linux / x64 | ☑ | ☑ | ☑ | ☑ | ☑ |
| Linux / ia32¹ | ☐ | ☐ | ☐ | ☐ | ☐ |
| Linux / ARM v6¹ | ☐ | ☐ | ☐ | ☐ | ☐ |
| Linux / ARM v7¹ | ☐ | ☐ | ☐ | ☐ | ☐ |
| Linux / ARM v8¹ | ☐ | ☐ | ☐ | ☐ | ☐ |
| Linux / MIPSel¹ | ☐ | ☐ | ☐ | ☐ | ☐ |
| Linux / PPC64¹ | ☐ | ☐ | ☐ | ☐ | ☐ |
* Node v6 to
* Node v12
¹ ia32, ARM, MIPSel and PPC64 platforms are known to work but are not currently part of our test or build matrix. ARM v4 and v5 was dropped from Node.js after Node v0.10.
### Supported Electron versions ###
| Platform / Arch |v1.0 |v1.2 |v1.3 |v1.4 |v1.5 |v1.6 |v1.7 |v1.8² |
| --- | --- | --- | --- | --- | --- | --- | --- | --- |
| Windows / x86 | ☑ | ☑ | ☑ | ☑ | ☑ | ☑ | ☑ | ☑ |
| Windows / x64 | ☑ | ☑ | ☑ | ☑ | ☑ | ☑ | ☑ | ☑ |
| Mac OSX / x64 | ☑ | ☑ | ☑ | ☑ | ☑ | ☑ | ☑ | ☑ |
| Linux / x64 | ☑ | ☑ | ☑ | ☑ | ☑ | ☑ | ☑ | ☑ |
| Linux / ia32¹ | ☐ | ☐ | ☐ | ☐ | ☐ | ☐ | ☐ | ☐ |
| Linux / ARM v6¹ | ☐ | ☐ | ☐ | ☐ | ☐ | ☐ | ☐ | ☐ |
| Linux / ARM v7¹ | ☐ | ☐ | ☐ | ☐ | ☐ | ☐ | ☐ | ☐ |
| Linux / ARM v8¹ | ☐ | ☐ | ☐ | ☐ | ☐ | ☐ | ☐ | ☐ |
| Linux / MIPSel¹ | ☐ | ☐ | ☐ | ☐ | ☐ | ☐ | ☐ | ☐ |
| Linux / PPC64¹ | ☐ | ☐ | ☐ | ☐ | ☐ | ☐ | ☐ | ☐ |
* Electron v1 to (³)
* Electron v5
² Electron v1.8 currently has issues but prebuilt binaries are provided.
³ Electron v1.8 currently has issues, but prebuilt binaries are provided.
## Installation

@@ -108,2 +97,9 @@

If you install globally, the test program `src/show-devices.js` is installed as `hid-showdevices`. On Linux you can use it to try the difference between `hidraw` and `libusb` driverTypes:
```
$ npm install -g node-hid
$ hid-showdevices libusb
$ hid-showdevices hidraw
```
### Installation Special Cases

@@ -224,2 +220,3 @@

To receive FEATURE reports, use `device.getFeatureReport()`.
To receive INPUT reports, use `device.on("data",...)`.

@@ -255,2 +252,3 @@ A `node-hid` device is an EventEmitter.

To send FEATURE reports, use `device.sendFeatureReport()`.
To send OUTPUT reports, use `device.write()`.

@@ -282,3 +280,2 @@ All writing is synchronous.

- `type` can be `"hidraw"` or `"libusb"`, defaults to `"hidraw"`
- NOTE: this function is currently disabled in `node-hid@^0.7.1` due to incompatibilities with `prebuild`.

@@ -373,3 +370,2 @@ ### `device = new HID.HID(path)`

### Selecting driver type
(NOTE: The multi-driver feature of `HID.setDriverType()` is currently disabled. See issue #242 )

@@ -387,3 +383,11 @@ By default as of `node-hid@0.7.0`, the [hidraw](https://www.kernel.org/doc/Documentation/hid/hidraw.txt) driver is used to talk to HID devices. Before `node-hid@0.7.0`, the more older but less capable [libusb](http://libusb.info/) driver was used. With `hidraw` Linux apps can now see `usage` and `usagePage` attributes of devices.

Or during runtime, you can use `HID.setDriverType('libusb')` immediately after require()-ing `node-hid`:
```js
var HID = require('node-hid');
HID.setDriverType('libusb');
```
### udev device permissions

@@ -390,0 +394,0 @@ Most Linux distros use `udev` to manage access to physical devices,

@@ -5,14 +5,10 @@ #!/usr/bin/env node

// choose driverType
// default is 'libusb' for Mac OSX & Windows
// default is 'hidraw', for Linux
var type = null;
// Linux: choose driverType
// default is 'hidraw', can also be 'libusb'
if( process.argv[2] ) {
type = process.argv[2];
var type = process.argv[2];
console.log("driverType:",type);
HID.setDriverType( type );
}
// disabled until prebuild gets multi-target, see issue node-hid#242
// console.log('driverType:', (type) ? type : 'default');
// HID.setDriverType( type );
console.log('devices:', HID.devices());

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc