Query the combined ConfigSizes device property. Remove the deprecated HardwareConfigSize and UserConfigSize device properties.

This commit is contained in:
László Monda
2017-12-14 19:40:03 +01:00
parent cac74c7c5a
commit 3e7a0ed81a
7 changed files with 43 additions and 60 deletions
+7 -8
View File
@@ -1,14 +1,13 @@
#!/usr/bin/env node
const uhk = require('./uhk');
const isHardwareConfig = process.argv[2] === 'h';
const device = uhk.getUhkDevice();
const sendData = new Buffer([uhk.usbCommands.getProperty,
isHardwareConfig ?
uhk.systemPropertyIds.hardwareConfigSize
: uhk.systemPropertyIds.userConfigSize]);
const sendData = new Buffer([uhk.usbCommands.getProperty, uhk.devicePropertyIds.configSizes]);
device.write(uhk.getTransferData(sendData));
const response = Buffer.from(device.readSync());
console.log(response[1] + (response[2]<<8));
const hardwareConfigMaxSize = response[1] + (response[2]<<8);
const userConfigMaxSize = response[3] + (response[4]<<8);
console.log(`hardwareConfigMaxSize: ${hardwareConfigMaxSize}`);
console.log(`userConfigMaxSize: ${userConfigMaxSize}`);