Rename USB scripts according to the recent USB command renames.
This commit is contained in:
18
packages/usb/get-keyboard-state.js
Executable file
18
packages/usb/get-keyboard-state.js
Executable 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();
|
||||
Reference in New Issue
Block a user