Use reenumerate() in update-device-firmware.js instead of forking reenumerate.js

This commit is contained in:
László Monda
2018-01-30 20:39:48 +01:00
parent 0d4e1acf76
commit 8e620caac5
2 changed files with 11 additions and 10 deletions

View File

@@ -86,7 +86,7 @@ function reenumerate(enumerationMode) {
const enumerationModeId = exports.enumerationModes[enumerationMode];
if (enumerationModeId === undefined) {
const enumerationModes = Object.keys(uhk.enumerationModes).join(', ');
const enumerationModes = Object.keys(exports.enumerationModes).join(', ');
console.log(`Invalid enumeration mode '${enumerationMode}' is not one of: ${enumerationModes}`);
reject();
return;

View File

@@ -17,12 +17,13 @@ const blhost = getBlhostCmd(uhk.enumerationNameToProductId.bootloader);
checkFirmwareImage(firmwareImage, extension);
(async function() {
config.verbose = true;
exec(`${usbDir}/reenumerate.js bootloader`);
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.');
})();