Rewrite writeHca() using the JavaScript USB API instead of TypeScript because the latter couldn't reopen the USB device.
This commit is contained in:
@@ -5,33 +5,29 @@ const uhk = require('./uhk')
|
||||
require('shelljs/global');
|
||||
|
||||
(async function() {
|
||||
try {
|
||||
config.fatal = true;
|
||||
config.fatal = true;
|
||||
|
||||
program
|
||||
.usage(`firmwarePath`)
|
||||
.parse(process.argv);
|
||||
program
|
||||
.usage(`firmwarePath`)
|
||||
.parse(process.argv);
|
||||
|
||||
if (program.args.length == 0) {
|
||||
console.error('No firmware path specified.');
|
||||
exit(1);
|
||||
}
|
||||
|
||||
config.verbose = true;
|
||||
const firmwarePath = program.args[0];
|
||||
await uhk.updateFirmwares(firmwarePath);
|
||||
const device = uhk.getUhkDevice();
|
||||
const configBuffer = fs.readFileSync(`${firmwarePath}/devices/uhk60-right/config.bin`);
|
||||
console.log('write config');
|
||||
await uhk.writeConfig(device, configBuffer, false);
|
||||
console.log('apply config');
|
||||
await uhk.applyConfig(device);
|
||||
console.log('lanuch eeprom transfer');
|
||||
await uhk.launchEepromTransfer(device, uhk.eepromOperations.write, uhk.eepromTransfer.writeUserConfig);
|
||||
config.verbose = false;
|
||||
|
||||
} catch (exception) {
|
||||
console.error(exception.message);
|
||||
if (program.args.length == 0) {
|
||||
console.error('No firmware path specified.');
|
||||
exit(1);
|
||||
}
|
||||
|
||||
config.verbose = true;
|
||||
const firmwarePath = program.args[0];
|
||||
await uhk.updateFirmwares(firmwarePath);
|
||||
const device = uhk.getUhkDevice();
|
||||
const configBuffer = fs.readFileSync(`${firmwarePath}/devices/uhk60-right/config.bin`);
|
||||
console.log('write config');
|
||||
await uhk.writeConfig(device, configBuffer, false);
|
||||
console.log('apply config');
|
||||
await uhk.applyConfig(device);
|
||||
console.log('lanuch eeprom transfer');
|
||||
await uhk.launchEepromTransfer(device, uhk.eepromOperations.write, uhk.eepromTransfer.writeUserConfig);
|
||||
|
||||
await uhk.writeHca(device, false);
|
||||
config.verbose = false;
|
||||
})();
|
||||
|
||||
Reference in New Issue
Block a user