make hid_generic_inout tester have reportLength-sized buffer, since some OSes need that

This commit is contained in:
Tod E. Kurt 2019-05-24 16:32:55 -07:00
parent 981e227774
commit f4dcc08de3
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)
}