Move updateDeviceFirmware() from update-device-firmware.js to uhk.js

This commit is contained in:
László Monda
2018-01-30 21:48:42 +01:00
parent ca9bf60a1b
commit cac6fdc190
2 changed files with 20 additions and 20 deletions

View File

@@ -11,22 +11,4 @@ program
.parse(process.argv)
const firmwareImage = program.args[0];
async function updateDeviceFirmware(firmwareImage, extension) {
const usbDir = `${__dirname}`;
const blhost = uhk.getBlhostCmd(uhk.enumerationNameToProductId.bootloader);
uhk.checkFirmwareImage(firmwareImage, extension);
config.verbose = true;
await uhk.reenumerate('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.');
};
updateDeviceFirmware(firmwareImage, extension);
uhk.updateDeviceFirmware(firmwareImage, extension);