Rename USB scripts according to the recent USB command renames.

This commit is contained in:
László Monda
2017-11-08 23:19:21 +01:00
parent 4e8061eb63
commit 3f26aa68fb
5 changed files with 0 additions and 0 deletions

View File

@@ -0,0 +1,18 @@
#!/usr/bin/env node
const uhk = require('./uhk');
const device = uhk.getUhkDevice();
function readKeyboardState() {
const payload = new Buffer([uhk.usbCommands.getKeyboardState]);
console.log('Sending ', uhk.bufferToString(payload));
device.write(uhk.getTransferData(payload));
const receivedBuffer = device.readSync();
console.log('Received', uhk.bufferToString(receivedBuffer));
const isEepromBusy = receivedBuffer[1] !== 0 ? 'yes' : 'no ';
const areHalvesMerged = receivedBuffer[2] !== 0 ? 'yes' : 'no ';
const isLeftHalfConnected = receivedBuffer[3] !== 0 ? 'yes' : 'no ';
console.log(`isEepromBusy: ${isEepromBusy} | areHalvesMerged: ${areHalvesMerged} | isLeftHalfConnected:${isLeftHalfConnected}`);
setTimeout(readKeyboardState, 500)
}
readKeyboardState();