Extract uhk.updateFirmwares()
This commit is contained in:
@@ -268,6 +268,14 @@ async function updateModuleFirmware(i2cAddress, moduleSlotId, firmwareImage) {
|
|||||||
echo('Firmware updated successfully.');
|
echo('Firmware updated successfully.');
|
||||||
};
|
};
|
||||||
|
|
||||||
|
async function updateFirmwares(firmwarePath) {
|
||||||
|
console.log('Updating right firmware');
|
||||||
|
await uhk.updateDeviceFirmware(`${firmwarePath}/devices/uhk60-right/firmware.hex`, 'hex');
|
||||||
|
await uhk.reenumerate('normalKeyboard');
|
||||||
|
console.log('Updating left firmware');
|
||||||
|
await uhk.updateModuleFirmware(uhk.moduleSlotToI2cAddress.leftHalf, uhk.moduleSlotToId.leftHalf, `${firmwarePath}/modules/uhk60-left.bin`);
|
||||||
|
}
|
||||||
|
|
||||||
uhk = exports = module.exports = moduleExports = {
|
uhk = exports = module.exports = moduleExports = {
|
||||||
bufferToString,
|
bufferToString,
|
||||||
getUint16,
|
getUint16,
|
||||||
@@ -288,6 +296,7 @@ uhk = exports = module.exports = moduleExports = {
|
|||||||
switchKeymap,
|
switchKeymap,
|
||||||
waitForKbootIdle,
|
waitForKbootIdle,
|
||||||
updateModuleFirmware,
|
updateModuleFirmware,
|
||||||
|
updateFirmwares,
|
||||||
usbCommands: {
|
usbCommands: {
|
||||||
getDeviceProperty : 0x00,
|
getDeviceProperty : 0x00,
|
||||||
reenumerate : 0x01,
|
reenumerate : 0x01,
|
||||||
|
|||||||
@@ -29,11 +29,7 @@ require('shelljs/global');
|
|||||||
firmwarePath = tmpObj.name;
|
firmwarePath = tmpObj.name;
|
||||||
}
|
}
|
||||||
config.verbose = true;
|
config.verbose = true;
|
||||||
console.log('Updating right firmware');
|
await uhk.updateFirmwares(firmwarePath);
|
||||||
await uhk.updateDeviceFirmware(`${firmwarePath}/devices/uhk60-right/firmware.hex`, 'hex');
|
|
||||||
await uhk.reenumerate('normalKeyboard');
|
|
||||||
console.log('Updating left firmware');
|
|
||||||
await uhk.updateModuleFirmware(uhk.moduleSlotToI2cAddress.leftHalf, uhk.moduleSlotToId.leftHalf, `${firmwarePath}/modules/uhk60-left.bin`);
|
|
||||||
|
|
||||||
if (program.overwriteUserConfig) {
|
if (program.overwriteUserConfig) {
|
||||||
exec(`${__dirname}/write-config.js ${firmwarePath}/devices/uhk60-right/config.bin`);
|
exec(`${__dirname}/write-config.js ${firmwarePath}/devices/uhk60-right/config.bin`);
|
||||||
|
|||||||
Reference in New Issue
Block a user