Port the blhost-unix.sh firmware update script of the right keyboard half to ShellJS resulting in update-master-firmware.js

This commit is contained in:
László Monda
2017-10-29 18:20:13 +01:00
parent 4e2d867424
commit 72b279841c
4 changed files with 29 additions and 37 deletions

View File

@@ -0,0 +1,27 @@
#!/usr/bin/env node
const program = require('commander');
require('shelljs/global');
require('./shared')
const extension = '.srec';
config.fatal = true;
program
.usage(`update-master-firmware <firmware-image${extension}>`)
.parse(process.argv)
const firmwareImage = program.args[0];
const usbDir = '../../../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');