Add get-{left,right}-firmware-version.js
This commit is contained in:
16
packages/usb/get-left-firmware-version.js
Executable file
16
packages/usb/get-left-firmware-version.js
Executable file
@@ -0,0 +1,16 @@
|
|||||||
|
#!/usr/bin/env node
|
||||||
|
const uhk = require('./uhk');
|
||||||
|
|
||||||
|
const device = uhk.getUhkDevice();
|
||||||
|
const sendData = new Buffer([uhk.usbCommands.getModuleProperty, uhk.modulePropertyIds.protocolVersions]);
|
||||||
|
console.log(sendData)
|
||||||
|
device.write(uhk.getTransferData(sendData));
|
||||||
|
const response = Buffer.from(device.readSync());
|
||||||
|
console.log(response)
|
||||||
|
const firmwareMajorVersion = response[7] + (response[8]<<8);
|
||||||
|
const firmwareMinorVersion = response[9] + (response[10]<<8);
|
||||||
|
const firmwarePatchVersion = response[11] + (response[12]<<8);
|
||||||
|
|
||||||
|
console.log(`firmwareMajorVersion: ${firmwareMajorVersion}`);
|
||||||
|
console.log(`firmwareMinorVersion: ${firmwareMinorVersion}`);
|
||||||
|
console.log(`firmwarePatchVersion: ${firmwarePatchVersion}`);
|
||||||
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}`);
|
||||||
@@ -102,6 +102,9 @@ exports = module.exports = moduleExports = {
|
|||||||
protocolVersions: 1,
|
protocolVersions: 1,
|
||||||
configSizes: 2,
|
configSizes: 2,
|
||||||
},
|
},
|
||||||
|
modulePropertyIds: {
|
||||||
|
protocolVersions: 0,
|
||||||
|
},
|
||||||
configBufferIds,
|
configBufferIds,
|
||||||
eepromOperations,
|
eepromOperations,
|
||||||
eepromTransfer: {
|
eepromTransfer: {
|
||||||
|
|||||||
Reference in New Issue
Block a user