diff --git a/packages/usb/erase-hca.js b/packages/usb/erase-hca.js new file mode 100755 index 00000000..a9e4feb3 --- /dev/null +++ b/packages/usb/erase-hca.js @@ -0,0 +1,8 @@ +#!/usr/bin/env node +const uhk = require('./uhk'); + +const device = uhk.getUhkDevice(); +uhk.eraseHca(device) + .catch((err)=>{ + console.error(err); + }); diff --git a/packages/usb/uhk.js b/packages/usb/uhk.js index 39455c03..01e51800 100644 --- a/packages/usb/uhk.js +++ b/packages/usb/uhk.js @@ -393,6 +393,12 @@ async function writeHca(device, isIso) { await uhk.launchEepromTransfer(device, uhk.eepromOperations.write, configBufferIds.hardwareConfig); } +async function eraseHca(device) { + const buffer = new Buffer(Array(64).fill(0xff)); + await uhk.writeConfig(device, buffer, true); + await uhk.launchEepromTransfer(device, uhk.eepromOperations.write, configBufferIds.hardwareConfig); +} + async function getModuleProperty(device, slotId, moduleProperty) { await writeDevice(device, [uhk.usbCommands.getModuleProperty, slotId, moduleProperty]); } @@ -423,6 +429,7 @@ uhk = exports = module.exports = moduleExports = { launchEepromTransfer, writeUca, writeHca, + eraseHca, getModuleProperty, usbCommands: { getDeviceProperty : 0x00,