Merge branch 'finalize-usb-protocol'
This commit is contained in:
@@ -82,12 +82,8 @@ export class UhkHidDevice {
|
||||
});
|
||||
}
|
||||
|
||||
public async writeUserConfigToEeprom(): Promise<void> {
|
||||
await this.write(new Buffer([
|
||||
UsbCommand.LaunchEepromTransfer,
|
||||
EepromOperation.write,
|
||||
ConfigBufferId.validatedUserConfig
|
||||
]));
|
||||
public async writeConfigToEeprom(configBufferId: ConfigBufferId): Promise<void> {
|
||||
await this.write(new Buffer([UsbCommand.LaunchEepromTransfer, EepromOperation.write, configBufferId]));
|
||||
await this.waitUntilKeyboardBusy();
|
||||
}
|
||||
|
||||
|
||||
@@ -153,7 +153,7 @@ export class UhkOperations {
|
||||
this.logService.debug('[DeviceOperation] USB[T]: Write user configuration to keyboard');
|
||||
await this.sendUserConfigToKeyboard(json);
|
||||
this.logService.debug('[DeviceOperation] USB[T]: Write user configuration to EEPROM');
|
||||
await this.device.writeUserConfigToEeprom();
|
||||
await this.device.writeConfigToEeprom(ConfigBufferId.validatedUserConfig);
|
||||
}
|
||||
catch (error) {
|
||||
this.logService.error('[DeviceOperation] Transferring error', error);
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
#!/usr/bin/env node
|
||||
const {HardwareConfiguration, UhkBuffer} = require('uhk-common');
|
||||
const {EepromTransfer, getTransferBuffers, UhkHidDevice, UsbCommand} = require('uhk-usb');
|
||||
const {EepromTransfer, getTransferBuffers, ConfigBufferId, UhkHidDevice, UsbCommand} = require('uhk-usb');
|
||||
const Logger = require('./logger');
|
||||
|
||||
if (process.argv.length < 2) {
|
||||
@@ -40,7 +40,7 @@ async function writeHca() {
|
||||
}
|
||||
|
||||
logger.debug('USB[T]: Write hardware configuration to EEPROM');
|
||||
await device.writeConfigToEeprom(EepromTransfer.WriteHardwareConfig);
|
||||
await device.writeConfigToEeprom(ConfigBufferId.hardwareConfig);
|
||||
}
|
||||
|
||||
writeHca()
|
||||
|
||||
Reference in New Issue
Block a user