Skip to content

Commit

Permalink
Updated hidapi. Updated README. Added Windows module.
Browse files Browse the repository at this point in the history
  • Loading branch information
jameshartig committed May 9, 2012
1 parent 41410a3 commit 1e6e1f9
Show file tree
Hide file tree
Showing 4 changed files with 40 additions and 11 deletions.
47 changes: 38 additions & 9 deletions README.md
@@ -1,27 +1,49 @@
# node-hid - Access USB HID devices from node.js #

Prerequisites:
Installation
------------

Mac OS (I use 10.6.8) or Linux (I use Ubuntu 11.10 with Linux 3.0 on x86_64)
node.js v0.6, built from source.
### Prerequisites:

* Mac OS (I use 10.6.8) or Linux (kernel 2.6+ that support libusb-1.0) or Windows XP+
* node.js v0.6
* libusb-1.0 (Linux-only)

### Windows-only

Copy the HID.node file from build/win into your node_modules folder.

### Compile from Source

Pull the required submodule:

git submodule init
git submodule update
```
$ git submodule init
$ git submodule update
```
Build the extension using node-gyp:

```
$ node-gyp rebuild
```

Build the extension:
Or build the extension using node-waf:

```
$ cd src/
$ node-waf configure build
```

Try it:

How to Use
----------

List devices:
(see show-devices.js)

```
$ node show-devices.js
devices: [ { vendorId: 1452,
HID.devices();
[ { vendorId: 1452,
productId: 595,
path: 'USB_05ac_0253_0x100a148e0',
serialNumber: '',
Expand All @@ -40,4 +62,11 @@ devices: [ { vendorId: 1452,
<and more>
```

Use device:
```
var device = new HID.HID(path);
device.read(function(error, data){}); //async read
device.write([0x00, 0x01, 0x01, 0x05, 0xff, 0xff]);
```

If you need help, send me an email (hans.huebner@gmail.com)
2 changes: 1 addition & 1 deletion binding.gyp
Expand Up @@ -16,7 +16,7 @@
[ 'OS=="linux"', {
'conditions': [
[ 'driver=="libusb"', {
'sources': [ 'hidapi/linux/hid-libusb.c' ],
'sources': [ 'hidapi/libusb/hid.c' ],
'include_dirs+': [
'/usr/include/libusb-1.0/'
]
Expand Down
Binary file added build/win/HID.node
Binary file not shown.

0 comments on commit 1e6e1f9

Please sign in to comment.