Fix write-hca.js and write-user.js, and remove write-config.js. Fixes #627.

This commit is contained in:
László Monda
2018-05-19 20:59:11 +02:00
parent 55eef50da7
commit 5d23ad1c9e
3 changed files with 4 additions and 28 deletions

View File

@@ -1,26 +0,0 @@
#!/usr/bin/env node
const program = require('commander');
const fs = require('fs');
const uhk = require('./uhk');
(async function() {
const device = uhk.getUhkDevice();
require('shelljs/global');
program
.usage(`config.bin`)
.option('-h, --hardware-config', 'Write the hardware config instead of the user config')
.parse(process.argv);
if (program.args.length == 0) {
console.error('No binary config file specified.');
exit(1);
}
const configBin = program.args[0];
const isHardwareConfig = program.hardwareConfig;
const configTypeString = isHardwareConfig ? 'hardware' : 'user';
const configBuffer = fs.readFileSync(configBin);
await uhk.writeUserConfig(device, configBuffer, isHardwareConfig);
})();

View File

@@ -12,7 +12,8 @@ if (layout !== 'iso' && layout !== 'ansi') {
process.exit(1);
}
uhk.writeHca(layout === 'iso')
const device = uhk.getUhkDevice();
uhk.writeHca(device, layout === 'iso')
.catch((err)=>{
console.error(err);
});

View File

@@ -17,5 +17,6 @@ const uhk = require('./uhk');
const device = uhk.getUhkDevice();
const configBuffer = fs.readFileSync(configPath);
await uhk.writeConfig(device, configBuffer, false);
await uhk.launchEepromTransfer(device, uhk.eepromOperations.write, uhk.configBufferIds.stagingUserConfig);
await uhk.applyConfig(device);
await uhk.launchEepromTransfer(device, uhk.eepromOperations.write, uhk.configBufferIds.validatedUserConfig);
})();