From 85ec5f6b6a23a8c3cc5d5c4f726566c0d9452a30 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?L=C3=A1szl=C3=B3=20Monda?= Date: Wed, 31 Jan 2018 00:17:27 +0100 Subject: [PATCH] Make update-module-firmware.js use reenumerate() and sendKbootCommandToModule() instead of forking more processes. --- packages/usb/update-module-firmware.js | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/packages/usb/update-module-firmware.js b/packages/usb/update-module-firmware.js index 509e741e..531488cd 100755 --- a/packages/usb/update-module-firmware.js +++ b/packages/usb/update-module-firmware.js @@ -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.'); })();