Merge pull request #77 from todbot/master

make hid_generic_inout tester have reportLength-sized buffer
This commit is contained in:
hathach 2019-05-25 13:05:49 +07:00 committed by GitHub
commit 1d5069e1e9
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 7 additions and 2 deletions

View File

@ -4,14 +4,19 @@ var deviceInfo = devices.find( function(d) {
var isNRF = d.vendorId===0Xcafe && d.productId===0X4004;
return isNRF;
});
var reportLen = 64;
if( deviceInfo ) {
console.log(deviceInfo)
var device = new HID.HID( deviceInfo.path );
device.on("data", function(data) {console.log(data)});
device.on("data", function(data) { console.log(data.toString('hex')); });
device.on("error", function(err) {console.log(err)});
setInterval(function () {
device.write([0x00, 0x01, 0x01, 0x05, 0xff, 0xff]);
var buf = Array(reportLen);
for( var i=0; i<buf.length; i++) {
buf[i] = 0x30 + i; // 0x30 = '0'
}
device.write(buf);
},500)
}