Replace UsbCommandId_ReadHardwareConfig and UsbCommandId_ReadUserConfig with UsbCommandId_ReadConfig.
This commit is contained in:
@@ -23,10 +23,10 @@ device.write(uhk.getTransferData(payload));
|
||||
let buffer = Buffer.from(device.readSync());
|
||||
configSize = buffer[1] + (buffer[2]<<8);
|
||||
console.log(`${configTypeString}configSize:`, configSize);
|
||||
while(offset < configSize) {
|
||||
const usbCommand = isHardwareConfig ? uhk.usbCommands.readHardwareConfig : uhk.usbCommands.readUserConfig;
|
||||
while (offset < configSize) {
|
||||
const configBufferId = isHardwareConfig ? uhk.configBufferIds.hardwareConfig : uhk.configBufferIds.validatedUserConfig;
|
||||
chunkSizeToRead = Math.min(chunkSize, configSize - offset);
|
||||
buffer = Buffer.from([usbCommand, chunkSizeToRead, offset & 0xff, offset >> 8]);
|
||||
buffer = Buffer.from([uhk.usbCommands.readConfig, configBufferId, chunkSizeToRead, offset & 0xff, offset >> 8]);
|
||||
console.log('write to keyboard', uhk.bufferToString(buffer));
|
||||
device.write(uhk.getTransferData(buffer));
|
||||
buffer = Buffer.from(device.readSync());
|
||||
|
||||
@@ -51,21 +51,20 @@ exports = module.exports = moduleExports = {
|
||||
getTransferData,
|
||||
checkModuleSlot,
|
||||
usbCommands: {
|
||||
getProperty: 0,
|
||||
reenumerate: 1,
|
||||
getProperty : 0x00,
|
||||
reenumerate : 0x01,
|
||||
jumpToModuleBootloader : 0x02,
|
||||
sendKbootCommandToModule: 0x03,
|
||||
readConfig : 0x04,
|
||||
setTestLed: 0x14,
|
||||
writeUserConfig: 8,
|
||||
applyConfig: 9,
|
||||
setLedPwmBrightness: 10,
|
||||
getAdcValue: 11,
|
||||
launchEepromTransferLegacy: 12,
|
||||
readHardwareConfig: 13,
|
||||
writeHardwareConfig: 14,
|
||||
readUserConfig: 15,
|
||||
getKeyboardState: 16,
|
||||
getDebugInfo: 17,
|
||||
jumpToModuleBootloader: 0x02,
|
||||
sendKbootCommandToModule: 0x03,
|
||||
},
|
||||
enumerationModes: {
|
||||
bootloader: 0,
|
||||
@@ -94,6 +93,11 @@ exports = module.exports = moduleExports = {
|
||||
hardwareConfigSize: 4,
|
||||
userConfigSize: 5,
|
||||
},
|
||||
configBufferIds: {
|
||||
hardwareConfig: 0,
|
||||
stagingUserConfig: 1,
|
||||
validatedUserConfig: 2,
|
||||
},
|
||||
eepromTransfer: {
|
||||
readHardwareConfig: 0,
|
||||
writeHardwareConfig: 1,
|
||||
|
||||
Reference in New Issue
Block a user