Fix eeprom.js
This commit is contained in:
@@ -1,13 +1,21 @@
|
||||
#!/usr/bin/env node
|
||||
const uhk = require('./uhk');
|
||||
const device = uhk.getUhkDevice();
|
||||
|
||||
const eepromTransferType = process.argv[2];
|
||||
const eepromTransfer = uhk.eepromTransfer[eepromTransferType];
|
||||
(async function() {
|
||||
const operationArg = process.argv[2];
|
||||
const operation = uhk.eepromOperations[operationArg];
|
||||
if (operation === undefined) {
|
||||
console.error(`Invalid operation: Gotta provide one of ${Object.keys(uhk.eepromOperations).join(', ')}`);
|
||||
process.exit(1);
|
||||
}
|
||||
|
||||
if (eepromTransfer === undefined) {
|
||||
console.error(`Gotta provide one of ${Object.keys(uhk.eepromTransfer).join(', ')}`);
|
||||
process.exit(1);
|
||||
}
|
||||
|
||||
// const buffer = await uhk.writeDevice(device, [uhk.usbCommands.launchEepromTransfer, eepromTransfer.operation, eepromTransfer.configBuffer]);
|
||||
const bufferIdArg = process.argv[3];
|
||||
const bufferId = uhk.configBufferIds[bufferIdArg]
|
||||
if (bufferId === undefined) {
|
||||
console.error(`Invalid bufferId: Gotta provide one of ${Object.keys(uhk.configBufferIds).join(', ')}`);
|
||||
process.exit(1);
|
||||
}
|
||||
|
||||
const buffer = await uhk.launchEepromTransfer(device, operation, bufferId);
|
||||
})();
|
||||
|
||||
Reference in New Issue
Block a user