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:
27
scripts/update-master-firmware.js
Executable file
27
scripts/update-master-firmware.js
Executable 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');
|
||||
Reference in New Issue
Block a user