Add get-{left,right}-firmware-version.js
This commit is contained in:
15
packages/usb/get-right-firmware-version.js
Executable file
15
packages/usb/get-right-firmware-version.js
Executable file
@@ -0,0 +1,15 @@
|
||||
#!/usr/bin/env node
|
||||
const uhk = require('./uhk');
|
||||
|
||||
const device = uhk.getUhkDevice();
|
||||
const sendData = new Buffer([uhk.usbCommands.getDeviceProperty, uhk.devicePropertyIds.protocolVersions]);
|
||||
device.write(uhk.getTransferData(sendData));
|
||||
const response = Buffer.from(device.readSync());
|
||||
|
||||
const firmwareMajorVersion = response[1] + (response[2]<<8);
|
||||
const firmwareMinorVersion = response[3] + (response[4]<<8);
|
||||
const firmwarePatchVersion = response[5] + (response[6]<<8);
|
||||
|
||||
console.log(`firmwareMajorVersion: ${firmwareMajorVersion}`);
|
||||
console.log(`firmwareMinorVersion: ${firmwareMinorVersion}`);
|
||||
console.log(`firmwarePatchVersion: ${firmwarePatchVersion}`);
|
||||
Reference in New Issue
Block a user