Display kboot command names instead of numberic ids.

This commit is contained in:
László Monda
2018-04-02 23:20:07 +02:00
parent 44639bbf53
commit 8b5ae106bd

View File

@@ -5,6 +5,12 @@ const {getTransferBuffers, ConfigBufferId, UhkHidDevice, UsbCommand} = require('
const Logger = require('./logger'); const Logger = require('./logger');
const debug = process.env.DEBUG; const debug = process.env.DEBUG;
const kbootCommandIdToName = {
0: 'idle',
1: 'ping',
2: 'reset',
};
function bufferToString(buffer) { function bufferToString(buffer) {
let str = ''; let str = '';
for (let i = 0; i < buffer.length; i++) { for (let i = 0; i < buffer.length; i++) {
@@ -213,7 +219,7 @@ function reenumerate(enumerationMode) {
}; };
async function sendKbootCommandToModule(device, kbootCommandId, i2cAddress) { async function sendKbootCommandToModule(device, kbootCommandId, i2cAddress) {
writeLog(`T: sendKbootCommandToModule kbootCommandId:${kbootCommandId} i2cAddress:${i2cAddress}`); writeLog(`T: sendKbootCommandToModule kbootCommandId:${kbootCommandIdToName[kbootCommandId]} i2cAddress:${i2cAddress}`);
return await uhk.writeDevice(device, [uhk.usbCommands.sendKbootCommandToModule, kbootCommandId, parseInt(i2cAddress)]) return await uhk.writeDevice(device, [uhk.usbCommands.sendKbootCommandToModule, kbootCommandId, parseInt(i2cAddress)])
}; };