Use updateDeviceFirmware(), reenumerate(), and updateModuleFirmware() in update-all-firmwares.js instead of forking processes.
This commit is contained in:
@@ -255,6 +255,7 @@ async function updateModuleFirmware(i2cAddress, moduleSlotId, firmwareImage) {
|
|||||||
device = uhk.getUhkDevice();
|
device = uhk.getUhkDevice();
|
||||||
await uhk.sendKbootCommandToModule(device, uhk.kbootCommands.reset, i2cAddress);
|
await uhk.sendKbootCommandToModule(device, uhk.kbootCommands.reset, i2cAddress);
|
||||||
await uhk.sendKbootCommandToModule(device, uhk.kbootCommands.idle, i2cAddress);
|
await uhk.sendKbootCommandToModule(device, uhk.kbootCommands.idle, i2cAddress);
|
||||||
|
device.close();
|
||||||
config.verbose = false;
|
config.verbose = false;
|
||||||
echo('Firmware updated successfully.');
|
echo('Firmware updated successfully.');
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -3,6 +3,7 @@ const program = require('commander');
|
|||||||
const tmp = require('tmp');
|
const tmp = require('tmp');
|
||||||
const decompress = require('decompress');
|
const decompress = require('decompress');
|
||||||
const decompressTarbz = require('decompress-tarbz2');
|
const decompressTarbz = require('decompress-tarbz2');
|
||||||
|
const uhk = require('./uhk')
|
||||||
require('shelljs/global');
|
require('shelljs/global');
|
||||||
|
|
||||||
(async function() {
|
(async function() {
|
||||||
@@ -28,9 +29,11 @@ require('shelljs/global');
|
|||||||
firmwarePath = tmpObj.name;
|
firmwarePath = tmpObj.name;
|
||||||
}
|
}
|
||||||
config.verbose = true;
|
config.verbose = true;
|
||||||
exec(`${__dirname}/update-device-firmware.js ${firmwarePath}/devices/uhk60-right/firmware.hex`);
|
console.log('Updating right firmware');
|
||||||
exec(`${__dirname}/reenumerate.js normalKeyboard`);
|
await uhk.updateDeviceFirmware(`${firmwarePath}/devices/uhk60-right/firmware.hex`, 'hex');
|
||||||
exec(`${__dirname}/update-module-firmware.js leftHalf ${firmwarePath}/modules/uhk60-left.bin`);
|
await uhk.reenumerate('normalKeyboard');
|
||||||
|
console.log('Updating left firmware');
|
||||||
|
await uhk.updateModuleFirmware(uhk.moduleSlotToI2cAddress.leftHalf, uhk.moduleSlotToId.leftHalf, `${firmwarePath}/modules/uhk60-left.bin`);
|
||||||
|
|
||||||
if (program.overwriteUserConfig) {
|
if (program.overwriteUserConfig) {
|
||||||
exec(`${__dirname}/write-config.js ${firmwarePath}/devices/uhk60-right/config.bin`);
|
exec(`${__dirname}/write-config.js ${firmwarePath}/devices/uhk60-right/config.bin`);
|
||||||
@@ -39,7 +42,7 @@ require('shelljs/global');
|
|||||||
}
|
}
|
||||||
|
|
||||||
config.verbose = false;
|
config.verbose = false;
|
||||||
} catch(exception) {
|
} catch (exception) {
|
||||||
console.error(exception.message);
|
console.error(exception.message);
|
||||||
exit(1);
|
exit(1);
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user