Call uhk.sendKbootCommandToModule() instead of forking send-kboot-command-to-module.js

This commit is contained in:
László Monda
2018-01-31 00:57:53 +01:00
parent 85ec5f6b6a
commit 4f8a0247d3

View File

@@ -22,18 +22,20 @@ const blhostBuspal = `${blhostUsb} --buspal i2c,${i2cAddress}`;
(async function() { (async function() {
config.verbose = true; config.verbose = true;
exec(`${usbDir}/send-kboot-command-to-module.js ping ${moduleSlot}`); let device = uhk.getUhkDevice();
// const device = uhk.getUhkDevice(); await uhk.sendKbootCommandToModule(device, uhk.kbootCommands.ping, i2cAddress);
// await uhk.sendKbootCommandToModule(device, uhk.kbootCommands.ping, i2cAddress); device.close();
exec(`${usbDir}/jump-to-module-bootloader.js ${moduleSlot}`); exec(`${usbDir}/jump-to-module-bootloader.js ${moduleSlot}`);
exec(`${usbDir}/wait-for-kboot-idle.js`); exec(`${usbDir}/wait-for-kboot-idle.js`);
await uhk.reenumerate('buspal'); await uhk.reenumerate('buspal');
uhk.execRetry(`${blhostBuspal} get-property 1`); uhk.execRetry(`${blhostBuspal} get-property 1`);
exec(`${blhostBuspal} flash-erase-all-unsecure`); exec(`${blhostBuspal} flash-erase-all-unsecure`);
exec(`${blhostBuspal} write-memory 0x0 ${firmwareImage}`); exec(`${blhostBuspal} write-memory 0x0 ${firmwareImage}`);
exec(`${blhostUsb} reset`); exec(`${blhostUsb} reset`);
await uhk.reenumerate('normalKeyboard'); await uhk.reenumerate('normalKeyboard');
const device = uhk.getUhkDevice(); device = uhk.getUhkDevice();
await uhk.sendKbootCommandToModule(device, uhk.kbootCommands.reset, i2cAddress); await uhk.sendKbootCommandToModule(device, uhk.kbootCommands.reset, i2cAddress);
await uhk.sendKbootCommandToModule(device, uhk.kbootCommands.idle, i2cAddress); await uhk.sendKbootCommandToModule(device, uhk.kbootCommands.idle, i2cAddress);
config.verbose = false; config.verbose = false;