mirror of
https://github.com/hathach/tinyusb.git
synced 2025-03-25 10:43:44 +00:00
make hid_generic_inout tester have reportLength-sized buffer, since some OSes need that
This commit is contained in:
parent
981e227774
commit
f4dcc08de3
@ -4,14 +4,19 @@ var deviceInfo = devices.find( function(d) {
|
|||||||
var isNRF = d.vendorId===0Xcafe && d.productId===0X4004;
|
var isNRF = d.vendorId===0Xcafe && d.productId===0X4004;
|
||||||
return isNRF;
|
return isNRF;
|
||||||
});
|
});
|
||||||
|
var reportLen = 64;
|
||||||
if( deviceInfo ) {
|
if( deviceInfo ) {
|
||||||
console.log(deviceInfo)
|
console.log(deviceInfo)
|
||||||
var device = new HID.HID( deviceInfo.path );
|
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)});
|
device.on("error", function(err) {console.log(err)});
|
||||||
|
|
||||||
setInterval(function () {
|
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)
|
},500)
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user