diff options
| author | hathach <[email protected]> | 2019-05-24 12:33:56 +0700 |
|---|---|---|
| committer | hathach <[email protected]> | 2019-05-24 12:33:56 +0700 |
| commit | 5f34c63660348f422d1b3934fd03cee62cbf3092 (patch) | |
| tree | 351c687bcf917b1adfd720b7400997ee18320ee7 /examples/device | |
| parent | 231773cae92991c9e16675bfb3772fb19d214f84 (diff) | |
should fix and work with #58
- add hid_test_js
Diffstat (limited to 'examples/device')
| -rw-r--r-- | examples/device/hid_generic_inout/hid_test.js | 17 | ||||
| -rw-r--r-- | examples/device/hid_generic_inout/src/usb_descriptors.c | 2 |
2 files changed, 18 insertions, 1 deletions
diff --git a/examples/device/hid_generic_inout/hid_test.js b/examples/device/hid_generic_inout/hid_test.js new file mode 100644 index 000000000..d4fc800c7 --- /dev/null +++ b/examples/device/hid_generic_inout/hid_test.js @@ -0,0 +1,17 @@ +var HID = require('node-hid'); +var devices = HID.devices(); +var deviceInfo = devices.find( function(d) { + var isNRF = d.vendorId===0Xcafe && d.productId===0X4004; + return isNRF; +}); +if( deviceInfo ) { + console.log(deviceInfo) + var device = new HID.HID( deviceInfo.path ); + device.on("data", function(data) {console.log(data)}); + + device.on("error", function(err) {console.log(err)}); + + setInterval(function () { + device.write([0x00, 0x01, 0x01, 0x05, 0xff, 0xff]); + },500) +} diff --git a/examples/device/hid_generic_inout/src/usb_descriptors.c b/examples/device/hid_generic_inout/src/usb_descriptors.c index 28a487549..3cf0f711b 100644 --- a/examples/device/hid_generic_inout/src/usb_descriptors.c +++ b/examples/device/hid_generic_inout/src/usb_descriptors.c @@ -85,7 +85,7 @@ uint8_t const desc_configuration[] = TUD_CONFIG_DESCRIPTOR(ITF_NUM_TOTAL, 0, CONFIG_TOTAL_LEN, TUSB_DESC_CONFIG_ATT_REMOTE_WAKEUP, 100), // Interface number, string index, protocol, report descriptor len, EP In & Out address, size & polling interval - TUD_HID_INOUT_DESCRIPTOR(ITF_NUM_HID, 0, HID_PROTOCOL_NONE, sizeof(desc_hid_report), 0x80 | EPNUM_HID, EPNUM_HID, 16, 10) + TUD_HID_INOUT_DESCRIPTOR(ITF_NUM_HID, 0, HID_PROTOCOL_NONE, sizeof(desc_hid_report), 0x80 | EPNUM_HID, EPNUM_HID, CFG_TUD_HID_BUFSIZE, 10) }; |
