From 8b5ae106bd11c619094428a9b30d71f1cd22e1ce Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?L=C3=A1szl=C3=B3=20Monda?= Date: Mon, 2 Apr 2018 23:20:07 +0200 Subject: [PATCH] Display kboot command names instead of numberic ids. --- packages/usb/uhk.js | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/packages/usb/uhk.js b/packages/usb/uhk.js index 14625f6b..3546971b 100644 --- a/packages/usb/uhk.js +++ b/packages/usb/uhk.js @@ -5,6 +5,12 @@ const {getTransferBuffers, ConfigBufferId, UhkHidDevice, UsbCommand} = require(' const Logger = require('./logger'); const debug = process.env.DEBUG; +const kbootCommandIdToName = { + 0: 'idle', + 1: 'ping', + 2: 'reset', +}; + function bufferToString(buffer) { let str = ''; for (let i = 0; i < buffer.length; i++) { @@ -213,7 +219,7 @@ function reenumerate(enumerationMode) { }; 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)]) };