{"id":23165221,"url":"https://github.com/snuffish/maschine-2-driver","last_synced_at":"2025-04-04T21:21:36.613Z","repository":{"id":233121803,"uuid":"637040006","full_name":"snuffish/Maschine-2-driver","owner":"snuffish","description":null,"archived":false,"fork":false,"pushed_at":"2023-05-06T10:17:05.000Z","size":31,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-02-10T05:45:16.222Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"bsd-3-clause","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/snuffish.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE-bsd.txt","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null}},"created_at":"2023-05-06T10:16:25.000Z","updated_at":"2023-05-06T10:17:09.000Z","dependencies_parsed_at":"2024-04-14T01:53:56.598Z","dependency_job_id":"9062493d-34a3-49bb-b549-9537bb0f7012","html_url":"https://github.com/snuffish/Maschine-2-driver","commit_stats":null,"previous_names":["snuffish/maschine-2-driver"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/snuffish%2FMaschine-2-driver","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/snuffish%2FMaschine-2-driver/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/snuffish%2FMaschine-2-driver/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/snuffish%2FMaschine-2-driver/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/snuffish","download_url":"https://codeload.github.com/snuffish/Maschine-2-driver/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247249864,"owners_count":20908263,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-12-18T01:15:35.196Z","updated_at":"2025-04-04T21:21:36.593Z","avatar_url":"https://github.com/snuffish.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# node-hid - Access USB HID devices from Node.js #\n\n[![npm](https://img.shields.io/npm/dm/node-hid.svg?maxAge=2592000)](http://npmjs.com/package/node-hid)\n[![build macos](https://github.com/node-hid/node-hid/workflows/macos/badge.svg)](https://github.com/node-hid/node-hid/actions?query=workflow%3Amacos)\n[![build windows](https://github.com/node-hid/node-hid/workflows/windows/badge.svg)](https://github.com/node-hid/node-hid/actions?query=workflow%3Awindows)\n[![build linux](https://github.com/node-hid/node-hid/workflows/linux/badge.svg)](https://github.com/node-hid/node-hid/actions?query=workflow%3Alinux)\n\n\n* [node-hid - Access USB HID devices from Node.js](#node-hid---access-usb-hid-devices-from-nodejs)\n  * [Platform Support](#platform-support)\n     * [Supported Platforms](#supported-platforms)\n     * [Supported Node versions](#supported-node-versions)\n     * [Supported Electron versions](#supported-electron-versions)\n  * [Installation](#installation)\n     * [Installation Special Cases](#installation-special-cases)\n  * [Examples](#examples)\n  * [Usage](#usage)\n     * [List all HID devices connected](#list-all-hid-devices-connected)\n        * [Cost of HID.devices() and \u003ccode\u003enew HID.HID()\u003c/code\u003e for detecting device plug/unplug](#cost-of-hiddevices-and-new-hidhid-for-detecting-device-plugunplug)\n     * [Opening a device](#opening-a-device)\n     * [Picking a device from the device list](#picking-a-device-from-the-device-list)\n     * [Reading from a device](#reading-from-a-device)\n     * [Writing to a device](#writing-to-a-device)\n  * [Complete API](#complete-api)\n     * [devices = HID.devices()](#devices--hiddevices)\n     * [HID.setDriverType(type)](#hidsetdrivertypetype)\n     * [device = new HID.HID(path)](#device--new-hidhidpath)\n     * [device = new HID.HID(vid,pid)](#device--new-hidhidvidpid)\n     * [device.on('data', function(data) {} )](#deviceondata-functiondata--)\n     * [device.on('error, function(error) {} )](#deviceonerror-functionerror--)\n     * [device.write(data)](#devicewritedata)\n     * [device.close()](#deviceclose)\n     * [device.pause()](#devicepause)\n     * [device.resume()](#deviceresume)\n     * [device.read(callback)](#devicereadcallback)\n     * [device.readSync()](#devicereadsync)\n     * [device.readTimeout(time_out)](#devicereadtimeouttime_out)\n     * [device.sendFeatureReport(data)](#devicesendfeaturereportdata)\n     * [device.getFeatureReport(report_id, report_length)](#devicegetfeaturereportreport_id-report_length)\n     * [device.setNonBlocking(no_block)](#devicesetnonblockingno_block)\n  * [General notes:](#general-notes)\n     * [Thread safety, Worker threads, Context-aware modules](#thread-safety-worker-threads-context-aware-modules)\n     * [Devices node-hid cannot read](#devices-node-hid-cannot-read)\n  * [Mac notes](#mac-notes)\n  * [Windows notes](#windows-notes)\n     * [Xbox 360 Controller on Windows 10](#xbox-360-controller-on-windows-10)\n  * [Linux notes](#linux-notes)\n     * [udev device permissions](#udev-device-permissions)\n     * [Selecting driver type](#selecting-driver-type)\n  * [Compiling from source](#compiling-from-source)\n     * [Linux (kernel 2.6 ) : (install examples shown for Debian/Ubuntu)](#linux-kernel-26--install-examples-shown-for-debianubuntu)\n     * [FreeBSD](#freebsd)\n     * [Mac OS X 10.8 ](#mac-os-x-108)\n     * [Windows 7, 8, 10](#windows-7-8-10)\n     * [Building node-hid from source, for your projects](#building-node-hid-from-source-for-your-projects)\n     * [Build node-hid for \u003ccode\u003enode-hid\u003c/code\u003e development](#build-node-hid-for-node-hid-development)\n     * [Building node-hid for cross-compiling](#building-node-hid-for-cross-compiling)\n  * [Electron projects using node-hid](#electron-projects-using-node-hid)\n  * [NW.js projects using node-hid](#nwjs-projects-using-node-hid)\n  * [Support](#support)\n\n## Platform Support\n`node-hid` supports Node.js v6 and upwards. For versions before that,\nyou will need to build from source. The platforms, architectures and node versions `node-hid` supports are the following.\nIn general we try to provide pre-built native library binaries for the most common platforms, Node and Electron versions.\n\nWe strive to make `node-hid` cross-platform so there's a good chance any\ncombination not listed here will compile and work.\n\n### Supported Platforms ###\n- Windows x86 (32-bit) (¹)\n- Windows x64 (64-bit)\n- Mac OSX 10.9+\n- Linux x64 (²)\n- Linux x86 (¹)\n- Linux ARM / Raspberry Pi (¹)\n- Linux MIPSel (¹)\n- Linux PPC64 (¹)\n\n¹ prebuilt-binaries not provided for these platforms  \n² prebuilt binary built on Ubuntu 18.04 x64\n\n### Supported Node versions ###\n\n* Node v8 to\n* Node v16\n\n### Supported Electron versions ###\n\n* Electron v3 to\n* Electron v16\n\nFuture versions of Node or Electron should work, since `node-hid` is now based on NAPI.\n\n## Installation\n\nFor most \"standard\" use cases (macOS, Windows, Linux x86), `node-hid` will install like a standard npm package:\n\n```\nnpm install node-hid\n```\n\nIf 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:\n```\n$ npm install -g node-hid\n$ hid-showdevices libusb\n$ hid-showdevices hidraw\n```\n\n### Installation Special Cases\n\nWe are using [prebuild](https://github.com/mafintosh/prebuild) to compile and post binaries of the library for most common use cases (Linux, MacOS, Windows on standard processor platforms). If a prebuild is not available, `node-hid` will work, but `npm install node-hid` will compile the binary when you install.  For more details on compiler setup, see  [Compling from source](#compiling-from-source) below.\n\n## Examples\n\nIn the `src/` directory, various JavaScript programs can be found\nthat talk to specific devices in some way.  Some interesting ones:\n- [`show-devices.js`](./src/show-devices.js) - display all HID devices in the system\n- [`test-ps3-rumbleled.js`](./src/test-ps3-rumbleled.js) - Read PS3 joystick and control its LED \u0026 rumblers\n- [`test-powermate.js`](./src/test-powermate.js) - Read Griffin PowerMate knob and change its LED\n- [`test-blink1.js`](./src/test-blink1.js) - Fade colors on blink(1) RGB LED\n- [`test-bigredbutton.js`](./src/test-bigredbutton.js) - Read Dreamcheeky Big Red Button\n- [`test-teensyrawhid.js`](./src/test-teensyrawhid.js) - Read/write Teensy running RawHID \"Basic\" Arduino sketch\n\nTo try them out, run them with `node src/showdevices.js` from within the node-hid directory.\n\n----\n\n## Usage\n\n### List all HID devices connected\n\n```js\nvar HID = require('node-hid');\nvar devices = HID.devices();\n```\n\n`devices` will contain an array of objects, one for each HID device\navailable.  Of particular interest are the `vendorId` and\n`productId`, as they uniquely identify a device, and the\n`path`, which is needed to open a particular device.\n\nSample output:\n\n```js\nHID.devices();\n{ vendorId: 10168,\n    productId: 493,\n    path: 'IOService:/AppleACPIPl...HIDDevice@14210000,0',\n    serialNumber: '20002E8C',\n    manufacturer: 'ThingM',\n    product: 'blink(1) mk2',\n    release: 2,\n    interface: -1,\n    usagePage: 65280,\n    usage: 1 },\n  { vendorId: 1452,\n    productId: 610,\n    path: 'IOService:/AppleACPIPl...Keyboard@14400000,0',\n    serialNumber: '',\n    manufacturer: 'Apple Inc.',\n    product: 'Apple Internal Keyboard / Trackpad',\n    release: 549,\n    interface: -1,\n    usagePage: 1,\n    usage: 6 },\n    \u003cand more\u003e\n```\n\n#### Cost of `HID.devices()` and `new HID.HID()` for detecting device plug/unplug\nBoth `HID.devices()` and `new HID.HID()` are relatively costly, each causing a USB (and potentially Bluetooth) enumeration. This takes time and OS resources. Doing either can slow down the read/write that you do in parallel with a device, and cause other USB devices to slow down too. This is how USB works.\n\nIf you are polling `HID.devices()` or doing repeated `new HID.HID(vid,pid)` to detect device plug / unplug, consider instead using [node-usb-detection](https://github.com/MadLittleMods/node-usb-detection). `node-usb-detection` uses OS-specific, non-bus enumeration ways to detect device plug / unplug.\n\n### Opening a device\n\nBefore a device can be read from or written to, it must be opened.\nThe `path` can be determined by a prior HID.devices() call.\nUse either the `path` from the list returned by a prior call to `HID.devices()`:\n\n```js\nvar device = new HID.HID(path);\n```\n\nor open the first device matching a VID/PID pair:\n\n```js\nvar device = new HID.HID(vid,pid);\n```\n\nThe `device` variable will contain a handle to the device.\nIf an error occurs opening the device, an exception will be thrown.\n\nA `node-hid` device is an `EventEmitter`.\nWhile it shares some method names and usage patterns with\n`Readable` and `Writable` streams, it is not a stream and the semantics vary.\nFor example, `device.write` does not take encoding or callback args and\n`device.pause` does not do the same thing as `readable.pause`.\nThere is also no `pipe` method.\n\n### Picking a device from the device list\nIf you need to filter down the `HID.devices()` list, you can use\nstandard Javascript array techniques:\n```js\nvar devices = HID.devices();\nvar deviceInfo = devices.find( function(d) {\n    var isTeensy = d.vendorId===0x16C0 \u0026\u0026 d.productId===0x0486;\n    return isTeensy \u0026\u0026 d.usagePage===0xFFAB \u0026\u0026 d.usage===0x200;\n});\nif( deviceInfo ) {\n  var device = new HID.HID( deviceInfo.path );\n  // ... use device\n}\n```\nYou can also find device of interest by passing VID and PID   \n```js\n//return all the devices that match specified VID and PID\nvar devices = HID.devices(0x16C0,0x0486);\n```\n\n### Reading from a device\n\nTo receive FEATURE reports, use `device.getFeatureReport()`.\n\nTo receive INPUT reports, use `device.on(\"data\",...)`.\nA `node-hid` device is an EventEmitter.\nReading from a device is performed by registering a \"data\" event handler:\n\n```js\ndevice.on(\"data\", function(data) {});\n```\n\nYou can also listen for errors like this:\n\n```js\ndevice.on(\"error\", function(err) {});\n```\nFor FEATURE reports:\n\n```js\nvar buf = device.getFeatureReport(reportId, reportLength)\n```\n\n\nNotes:\n- Reads via `device.on(\"data\")` are asynchronous\n- Reads via `device.getFeatureReport()` are synchronous\n- To remove an event handler, close the device with `device.close()`\n- When there is not yet a data handler or no data handler exists,\n   data is not read at all -- there is no buffer.\n\n### Writing to a device\n\nTo send FEATURE reports, use `device.sendFeatureReport()`.  \n\nTo send OUTPUT reports, use `device.write()`.\n\nAll writing is synchronous.\n\nThe ReportId is the first byte of the array sent to `device.sendFeatureReport()` or `device.write()`, meaning the array should be one byte bigger than your report.\nIf your device does NOT use numbered reports, set the first byte of the 0x00.\n\n\n```js\ndevice.write([0x00, 0x01, 0x01, 0x05, 0xff, 0xff]);\n```\n```js\ndevice.sendFeatureReport( [0x01, 'c', 0, 0xff,0x33,0x00, 70,0, 0] );\n```\nNotes:\n- You must send the exact number of bytes for your chosen OUTPUT or FEATURE report.\n- Both `device.write()` and `device.sendFeatureReport()` return\nnumber of bytes written + 1.\n- For devices using Report Ids, the first byte of the array to `write()` or\n`sendFeatureReport()` must be the Report Id.\n\n\n## Complete API\n\n### `devices = HID.devices()`\n\n- Return array listing all connected HID devices\n\n### `devices = HID.devices(vid,pid)`\n\n- Return array listing all connected HID devices with specific VendorId and ProductId\n\n### `HID.setDriverType(type)`\n  - Linux only\n  - Sets underlying HID driver type\n  - `type` can be `\"hidraw\"` or `\"libusb\"`, defaults to `\"hidraw\"`\n\n### `device = new HID.HID(path)`\n\n- Open a HID device at the specified platform-specific path\n\n### `device = new HID.HID(vid,pid)`\n\n- Open first HID device with specific VendorId and ProductId\n\n### `device.on('data', function(data) {} )`\n\n- `data` - Buffer - the data read from the device\n\n### `device.on('error', function(error) {} )`\n\n- `error` - The error Object emitted\n\n### `device.write(data)`\n\n- `data` - the data to be synchronously written to the device,\nfirst byte is Report Id or 0x00 if not using numbered reports.\n- Returns number of bytes actually written\n\n### `device.close()`\n\n- Closes the device. Subsequent reads will raise an error.\n\n### `device.pause()`\n\n- Pauses reading and the emission of `data` events.  \nThis means the underlying device is _silenced_ until resumption --\nit is not like pausing a stream, where data continues to accumulate.\n\n### `device.resume()`\n\n- This method will cause the HID device to resume emmitting `data` events.\nIf no listeners are registered for the `data` event, data will be lost.\n\n- When a `data` event is registered for this HID device, this method will\nbe automatically called.\n\n### `device.read(callback)`\n\n- Low-level function call to initiate an asynchronous read from the device.\n- `callback` is of the form `callback(err, data)`\n\n### `device.readSync()`\n\n- Return an array of numbers data. If an error occurs, an exception will be thrown.\n\n### `device.readTimeout(time_out)`\n\n- `time_out` - timeout in milliseconds\n- Return an array of numbers data. If an error occurs, an exception will be thrown.\n\n### `device.sendFeatureReport(data)`\n\n- `data` - data of HID feature report, with 0th byte being report_id (`[report_id,...]`)\n- Returns number of bytes actually written\n\n### `device.getFeatureReport(report_id, report_length)`\n\n- `report_id` - HID feature report id to get\n- `report_length` - length of report\n\n### `device.setNonBlocking(no_block)`\n\n- `no_block` - boolean. Set to `true` to enable non-blocking reads\n- exactly mirrors `hid_set_nonblocking()` in [`hidapi`](https://github.com/libusb/hidapi)\n\n-----\n\n## General notes:\n\n### Thread safety, Worker threads, Context-aware modules\nIn general `node-hid` is not thread-safe because the underlying C-library it wraps (`hidapi`) is not thread-safe.\nHowever, `node-hid` is now reporting as minimally Context Aware to allow use in Electron v9+.\nUntil `node-hid` (or `hidapi`) is rewritten to be thread-safe, please constrain all accesses to it via a single thread.\n\n### Devices `node-hid` cannot read\nThe following devices are unavailable to `node-hid` because the OS owns them:\n\n- Keyboards\n- Mice\n- Barcode readers (in USB HID keyboard mode)\n- RFID scanners (in USB HID keyboard mode)\n- Postage Scales (in USB HID keyboard mode)\n\nMost OSes will prevent USB HID keyboards or mice, or devices that appear as a keyboard to the OS.\nThis includes many RFID scanners, barcode readers, USB HID scales, and many other devices.\nThis is a security precaution. Otherwise, it would be trivial to build keyloggers.\n\nSome keyboard-pretending devices like barcode or RFID readers can be configured to be in\n\"HID data\" mode or \"Serial / UART\" mode.  If in \"HID Data\" mode then `node-hid` can access them,\nif in \"Serial / UART\" mode, you should use `node-serialport` instead.\n\n## Mac notes\nSee General notes above Keyboards\n\n## Windows notes\nSee General notes above about Keyboards\n\n### Xbox 360 Controller on Windows 10\nFor reasons similar to mice \u0026 keyboards it appears you can't access this controller on Windows 10.\n\n\n\n## Linux notes\nSee General notes above about Keyboards\n\n### udev device permissions\nMost Linux distros use `udev` to manage access to physical devices,\nand USB HID devices are normally owned by the `root` user.\nTo allow non-root access, you must create a udev rule for the device,\nbased on the devices vendorId and productId.\n\nThis rule is a text file placed in `/etc/udev/rules.d`.  \n\nFor an example HID device (say a blink(1) light with vendorId = 0x27b8 and productId = 0x01ed,\nthe rules file to support both `hidraw` and `libusb` would look like:\n```\nSUBSYSTEM==\"input\", GROUP=\"input\", MODE=\"0666\"\nSUBSYSTEM==\"usb\", ATTRS{idVendor}==\"27b8\", ATTRS{idProduct}==\"01ed\", MODE:=\"666\", GROUP=\"plugdev\"\nKERNEL==\"hidraw*\", ATTRS{idVendor}==\"27b8\", ATTRS{idProduct}==\"01ed\", MODE=\"0666\", GROUP=\"plugdev\"\n```\nNote that the values for idVendor and idProduct must be in hex and lower-case.\n\nSave this file as `/etc/udev/rules.d/51-blink1.rules`, unplug the HID device,\nand reload the rules with:\n```\nsudo udevadm control --reload-rules\n```\n\nFor a complete example, see the\n[blink1 udev rules](https://github.com/todbot/blink1/blob/master/linux/51-blink1.rules).\n\n\n### Selecting driver type\n\nBy 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.\n\nIf you would still like to use the `libusb` driver, then you can do either:\n\nDuring runtime, you can use `HID.setDriverType('libusb')` immediately after require()-ing `node-hid`:\n```js\nvar HID = require('node-hid');\nHID.setDriverType('libusb');\n```\n\nIf you must have the libusb version and cannot use `setDriverType()`,\nyou can install older node-hid or build from source:\n```\nnpm install node-hid@0.5.7\n```\nor:\n```\nnpm install node-hid --build-from-source --driver=libusb\n```\n\n\n## Compiling from source\n\nTo compile \u0026 develop locally or if `prebuild` cannot download a pre-built\nbinary for you, you will need the following compiler tools and libraries:\n\n### Linux (kernel 2.6+) : (install examples shown for Debian/Ubuntu)\n  * Compilation tools: `apt install build-essential git pkg-config`\n  * libudev-dev: `apt install libudev-dev` (Debian/Ubuntu) /\n    `yum install libusbx-devel` (Fedora)\n  * libusb-1.0-0 w/headers:`apt install libusb-1.0-0 libusb-1.0-0-dev`\n\n### FreeBSD\n  * Compilation tools: `pkg install git gcc gmake libiconv node npm`\n\n### Mac OS X 10.8+\n  * [Xcode](https://itunes.apple.com/us/app/xcode/id497799835?mt=12)\n\n### Windows 7, 8, 10\n  The below is slightly stale. The 2021 solution is to use the official NodeJs Windows installer\n  and pick \"install native module tools\"\n  * Visual C++ compiler and Python 2.7\n      * either:\n        * `npm install --global windows-build-tools`\n        * add `%USERPROFILE%\\.windows-build-tools\\python27` to `PATH`,\n         like PowerShell: `$env:Path += \";$env:USERPROFILE\\.windows-build-tools\\python27\"`\n      * or:\n        * [Python 2.7](https://www.python.org/downloads/windows/)\n        * [Visual Studio Express 2013 for Desktop](https://www.visualstudio.com/downloads/download-visual-studio-vs#d-2013-express)\n\n\n### Building `node-hid` from source, for your projects\n\n```\nnpm install node-hid --build-from-source\n```\n\n### Build `node-hid` for `node-hid` development\n\n* check out a copy of this repo\n* change into its directory\n* update the submodules\n* build the node package\n\nFor example:\n\n```\ngit clone https://github.com/node-hid/node-hid.git\ncd node-hid                                        # must change into node-hid directory\nnpm install -g rimraf                              # just so it doesn't get 'clean'ed\nnpm run prepublishOnly                             # get the needed hidapi submodule\nnpm install --build-from-source                    # rebuilds the module with C code\nnpm run showdevices                                # list connected HID devices\nnode ./src/show-devices.js                         # same as above\n```\n\nYou may see some warnings from the C compiler as it compiles\n[hidapi](https://github.com/libusb/hidapi) (the underlying C library `node-hid` uses).  \nThis is expected.\n\nFor ease of development, there are also the scripts:\n```\nnpm run gypclean      # \"node-gyp clean\" clean gyp build directory\nnpm run gypconfigure  # \"node-gyp configure\" configure makefiles\nnpm run gypbuild      # \"node-gyp build\" build native code\n```\n\n### Building `node-hid` for cross-compiling\nWhen cross-compiling you need to override `node-hid`'s normal behavior\nof using Linux `pkg-config` to determine CLFAGS and LDFLAGS for `libusb`.\nTo do this, you can use the `node-gyp` variable `node_hid_no_pkg_config`\nand then invoke a `node-hid` rebuild with either:\n```\n  node-gyp rebuild --node_hid_no_pkg_config=1\n```\nor\n```\n  npm gyprebuild --node_hid_no_pkg_config=1\n```\n\n\n## Electron projects using `node-hid`\nIn your electron project, add `electron-rebuild` to your `devDependencies`.\nThen in your package.json `scripts` add:\n\n```\n  \"postinstall\": \"electron-rebuild\"\n```\nThis will cause `npm` to rebuild `node-hid` for the version of Node that is in Electron.\nIf you get an error similar to `The module \"HID.node\" was compiled against a different version of Node.js`\nthen `electron-rebuild` hasn't been run and Electron is trying to use `node-hid`\ncompiled for Node.js and not for Electron.\n\n\nIf using `node-hid` with `webpack` or similar bundler, you may need to exclude\n`node-hid` and other libraries with native code.  In webpack, you say which\n`externals` you have in your `webpack-config.js`:\n```\n  externals: {\n    \"node-hid\": 'commonjs node-hid'\n  }\n```\n\nExamples of `node-hid` in Electron:\n* [electron-hid-test](https://github.com/todbot/electron-hid-test) - Simple example of using `node-hid`, should track latest Electron release\n* [electron-hid-test-erb](https://github.com/todbot/electron-hid-test-erb) - Simple example of using `node-hid` using [electron-react-boilerplate](https://github.com/electron-react-boilerplate/electron-react-boilerplate/)\n* [electron-hid-toy](https://github.com/todbot/electron-hid-toy) - Simple example of using `node-hid`, showing packaging and signing\n* [Blink1Control2](https://github.com/todbot/Blink1Control2/) - a complete application, using webpack (e.g. see its [webpack-config.js](https://github.com/todbot/Blink1Control2/blob/master/webpack.config.js))\n\n\n## NW.js projects using `node-hid`\n\nWithout knowing much about NW.js, a quick hacky solution that works is:\n\n```\ncd my-nwjs-app\nnpm install node-hid --save\nnpm install -g nw-gyp\ncd node_modules/node-hid\nnw-gyp rebuild --target=0.42.3 --arch=x64  // or whatever NW.js version you have\ncd ../..\nnwjs .\n```\n\n\n## Support\n\nPlease use the [node-hid github issues page](https://github.com/node-hid/node-hid/issues)\nfor support questions and issues.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsnuffish%2Fmaschine-2-driver","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fsnuffish%2Fmaschine-2-driver","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsnuffish%2Fmaschine-2-driver/lists"}