diff --git a/lib/agent b/lib/agent index b3a38a5..ac5d6ba 160000 --- a/lib/agent +++ b/lib/agent @@ -1 +1 @@ -Subproject commit b3a38a5d6c64ab163861fd4e30b6e1d18e48b635 +Subproject commit ac5d6ba32ab06151eb4de85f64364bf1df922955 diff --git a/right/build/uhk60-right_debug_kboot.launch b/right/build/uhk60-right_debug_kboot.launch index 980193d..45405f4 100644 --- a/right/build/uhk60-right_debug_kboot.launch +++ b/right/build/uhk60-right_debug_kboot.launch @@ -19,7 +19,7 @@ - + diff --git a/right/build/uhk60-right_release_kboot.launch b/right/build/uhk60-right_release_kboot.launch index 9728e16..6e6be2f 100644 --- a/right/build/uhk60-right_release_kboot.launch +++ b/right/build/uhk60-right_release_kboot.launch @@ -19,7 +19,7 @@ - + diff --git a/scripts/shared.js b/scripts/shared.js deleted file mode 100644 index 2004cbd..0000000 --- a/scripts/shared.js +++ /dev/null @@ -1,64 +0,0 @@ -require('shelljs/global'); - -function checkFirmwareImage(imagePath, extension) { - if (!imagePath) { - echo('No firmware image specified'); - exit(1); - } - - if (!imagePath.endsWith(extension)) { - echo(`Firmware image extension is not ${extension}`); - exit(1); - } - - if (!test('-f', imagePath)) { - echo('Firmware image does not exist'); - exit(1); - } -} - -function getBlhostCmd(pid) { - let blhostPath; - switch (process.platform) { - case 'linux': - blhostPath = 'linux/amd64/blhost'; - break; - case 'darwin': - blhostPath = 'mac/blhost'; - break; - case 'win32': - blhostPath = 'win/blhost.exe'; - break; - default: - echo('Your operating system is not supported'); - exit(1); - break; - } - - return `${__dirname}/../lib/bootloader/bin/Tools/blhost/${blhostPath} --usb 0x1d50,${pid}`; -} - -function execRetry(command) { - let firstRun = true; - let remainingRetries = 3; - let code; - do { - if (!firstRun) { - console.log(`Retrying ${command}`) - } - config.fatal = !remainingRetries; - code = exec(command).code; - config.fatal = true; - firstRun = false; - } while(code && --remainingRetries); -} - -const exp = { - checkFirmwareImage, - getBlhostCmd, - execRetry, -} - -Object.keys(exp).forEach(function (cmd) { - global[cmd] = exp[cmd]; -}); diff --git a/scripts/update-master-firmware.js b/scripts/update-master-firmware.js deleted file mode 100755 index 2425190..0000000 --- a/scripts/update-master-firmware.js +++ /dev/null @@ -1,27 +0,0 @@ -#!/usr/bin/env node -const program = require('commander'); -require('shelljs/global'); -require('./shared') - -const extension = '.hex'; -config.fatal = true; - -program - .usage(`update-master-firmware `) - .parse(process.argv) - -const firmwareImage = program.args[0]; -const usbDir = `${__dirname}/../lib/agent/packages/usb`; -const blhost = getBlhostCmd(0x6120); - -checkFirmwareImage(firmwareImage, extension); - -config.verbose = true; -exec(`${usbDir}/reenumerate.js bootloader`); -exec(`${blhost} flash-security-disable 0403020108070605`); -exec(`${blhost} flash-erase-region 0xc000 475136`); -exec(`${blhost} flash-image ${firmwareImage}`); -exec(`${blhost} reset`); -config.verbose = false; - -echo('Firmware updated successfully'); diff --git a/scripts/update-slave-firmware.js b/scripts/update-slave-firmware.js deleted file mode 100755 index aab4161..0000000 --- a/scripts/update-slave-firmware.js +++ /dev/null @@ -1,32 +0,0 @@ -#!/usr/bin/env node -const program = require('commander'); -require('shelljs/global'); -require('./shared') - -const extension = '.bin'; -config.fatal = true; - -program - .usage(`update-slave-firmware `) - .parse(process.argv) - -const firmwareImage = program.args[0]; -const usbDir = `${__dirname}/../lib/agent/packages/usb`; -const blhostUsb = getBlhostCmd(0x6121); -const blhostBuspal = `${blhostUsb} --buspal i2c,0x10,100k`; - -checkFirmwareImage(firmwareImage, extension); - -config.verbose = true; -exec(`${usbDir}/send-kboot-command-to-slave.js ping 0x10`); -exec(`${usbDir}/jump-to-slave-bootloader.js`); -exec(`${usbDir}/reenumerate.js buspal`); -execRetry(`${blhostBuspal} get-property 1`); -exec(`${blhostBuspal} flash-erase-all-unsecure`); -exec(`${blhostBuspal} write-memory 0x0 ${firmwareImage}`); -exec(`${blhostUsb} reset`); -exec(`${usbDir}/reenumerate.js normalKeyboard`); -execRetry(`${usbDir}/send-kboot-command-to-slave.js reset 0x10`); -config.verbose = false; - -echo('Firmware updated successfully');