Add erase-hca.js

This commit is contained in:
László Monda
2018-05-19 20:05:41 +02:00
parent 653465f0e0
commit 55eef50da7
2 changed files with 15 additions and 0 deletions

8
packages/usb/erase-hca.js Executable file
View File

@@ -0,0 +1,8 @@
#!/usr/bin/env node
const uhk = require('./uhk');
const device = uhk.getUhkDevice();
uhk.eraseHca(device)
.catch((err)=>{
console.error(err);
});

View File

@@ -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,