Make update-module-firmware.js use reenumerate() and sendKbootCommandToModule() instead of forking more processes.

This commit is contained in:
László Monda
2018-01-31 00:17:27 +01:00
parent 739b830f47
commit 85ec5f6b6a

View File

@@ -23,6 +23,8 @@ const blhostBuspal = `${blhostUsb} --buspal i2c,${i2cAddress}`;
(async function() {
config.verbose = true;
exec(`${usbDir}/send-kboot-command-to-module.js ping ${moduleSlot}`);
// const device = uhk.getUhkDevice();
// await uhk.sendKbootCommandToModule(device, uhk.kbootCommands.ping, i2cAddress);
exec(`${usbDir}/jump-to-module-bootloader.js ${moduleSlot}`);
exec(`${usbDir}/wait-for-kboot-idle.js`);
await uhk.reenumerate('buspal');
@@ -30,9 +32,10 @@ const blhostBuspal = `${blhostUsb} --buspal i2c,${i2cAddress}`;
exec(`${blhostBuspal} flash-erase-all-unsecure`);
exec(`${blhostBuspal} write-memory 0x0 ${firmwareImage}`);
exec(`${blhostUsb} reset`);
exec(`${usbDir}/reenumerate.js normalKeyboard`);
uhk.execRetry(`${usbDir}/send-kboot-command-to-module.js reset ${moduleSlot}`);
exec(`${usbDir}/send-kboot-command-to-module.js idle`);
await uhk.reenumerate('normalKeyboard');
const device = uhk.getUhkDevice();
await uhk.sendKbootCommandToModule(device, uhk.kbootCommands.reset, i2cAddress);
await uhk.sendKbootCommandToModule(device, uhk.kbootCommands.idle, i2cAddress);
config.verbose = false;
echo('Firmware updated successfully.');
})();