Change UsbCommandId_WriteHardwareConfig and UsbCommandId_WriteUserConfig to 0x05 and 0x06.
This commit is contained in:
@@ -13,10 +13,10 @@ export enum UsbCommand {
|
|||||||
JumpToModuleBootloader = 0x02,
|
JumpToModuleBootloader = 0x02,
|
||||||
SendKbootCommandToModule = 0x03,
|
SendKbootCommandToModule = 0x03,
|
||||||
ReadConfig = 0x04,
|
ReadConfig = 0x04,
|
||||||
UploadUserConfig = 8,
|
WriteHardwareConfig = 0x05,
|
||||||
|
WriteStagingUserConfig = 0x06,
|
||||||
ApplyConfig = 9,
|
ApplyConfig = 9,
|
||||||
LaunchEepromTransfer = 12,
|
LaunchEepromTransfer = 12,
|
||||||
WriteHardwareConfig = 14,
|
|
||||||
GetKeyboardState = 16
|
GetKeyboardState = 16
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -171,7 +171,7 @@ export class UhkOperations {
|
|||||||
*/
|
*/
|
||||||
private async sendUserConfigToKeyboard(json: string): Promise<void> {
|
private async sendUserConfigToKeyboard(json: string): Promise<void> {
|
||||||
const buffer: Buffer = new Buffer(JSON.parse(json).data);
|
const buffer: Buffer = new Buffer(JSON.parse(json).data);
|
||||||
const fragments = getTransferBuffers(UsbCommand.UploadUserConfig, buffer);
|
const fragments = getTransferBuffers(UsbCommand.WriteStagingUserConfig, buffer);
|
||||||
for (const fragment of fragments) {
|
for (const fragment of fragments) {
|
||||||
await this.device.write(fragment);
|
await this.device.write(fragment);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -56,13 +56,13 @@ exports = module.exports = moduleExports = {
|
|||||||
jumpToModuleBootloader : 0x02,
|
jumpToModuleBootloader : 0x02,
|
||||||
sendKbootCommandToModule: 0x03,
|
sendKbootCommandToModule: 0x03,
|
||||||
readConfig : 0x04,
|
readConfig : 0x04,
|
||||||
|
writeHardwareConfig : 0x05,
|
||||||
|
writeStagingUserConfig : 0x06,
|
||||||
setTestLed: 0x14,
|
setTestLed: 0x14,
|
||||||
writeUserConfig: 8,
|
|
||||||
applyConfig: 9,
|
applyConfig: 9,
|
||||||
setLedPwmBrightness: 10,
|
setLedPwmBrightness: 10,
|
||||||
getAdcValue: 11,
|
getAdcValue: 11,
|
||||||
launchEepromTransferLegacy: 12,
|
launchEepromTransferLegacy: 12,
|
||||||
writeHardwareConfig: 14,
|
|
||||||
getKeyboardState: 16,
|
getKeyboardState: 16,
|
||||||
getDebugInfo: 17,
|
getDebugInfo: 17,
|
||||||
},
|
},
|
||||||
|
|||||||
@@ -24,7 +24,7 @@ let buffer = Buffer.from(device.readSync());
|
|||||||
configSize = buffer[1] + (buffer[2]<<8);
|
configSize = buffer[1] + (buffer[2]<<8);
|
||||||
console.log(`${configTypeString}configSize:`, configSize);
|
console.log(`${configTypeString}configSize:`, configSize);
|
||||||
|
|
||||||
while (offset < configSize){
|
while (offset < configSize) {
|
||||||
const usbCommand = isHardwareConfig ? uhk.usbCommands.writeHardwareConfig : uhk.usbCommands.writeUserConfig;
|
const usbCommand = isHardwareConfig ? uhk.usbCommands.writeHardwareConfig : uhk.usbCommands.writeUserConfig;
|
||||||
chunkSizeToRead = Math.min(chunkSize, configSize - offset);
|
chunkSizeToRead = Math.min(chunkSize, configSize - offset);
|
||||||
buffer = Buffer.concat([
|
buffer = Buffer.concat([
|
||||||
|
|||||||
Reference in New Issue
Block a user