Change the value of UsbCommandId_{GetDeviceState,SetTestLed,GetDebugBuffer,GetAdcValue,SetLedPwmBrightness}.

This commit is contained in:
László Monda
2017-12-12 18:49:40 +01:00
parent 6b60241180
commit 2eb31603f1
5 changed files with 13 additions and 9 deletions

View File

@@ -17,7 +17,11 @@ export enum UsbCommand {
WriteStagingUserConfig = 0x06, WriteStagingUserConfig = 0x06,
ApplyConfig = 0x07, ApplyConfig = 0x07,
LaunchEepromTransfer = 0x08, LaunchEepromTransfer = 0x08,
GetKeyboardState = 16 GetDeviceState = 0x09,
SetTestLed = 0x0a,
GetDebugBuffer = 0x0b,
GetAdcValue = 0x0c,
SetLedPwmBrightness = 0x0d
} }
export enum EepromOperation { export enum EepromOperation {

View File

@@ -106,7 +106,7 @@ export class UhkHidDevice {
public async waitUntilKeyboardBusy(): Promise<void> { public async waitUntilKeyboardBusy(): Promise<void> {
while (true) { while (true) {
const buffer = await this.write(new Buffer([UsbCommand.GetKeyboardState])); const buffer = await this.write(new Buffer([UsbCommand.GetDeviceState]));
if (buffer[1] === 0) { if (buffer[1] === 0) {
break; break;
} }

View File

@@ -20,7 +20,7 @@ if (responseCode !== 0) {
function waitUntilKeyboardBusy() { function waitUntilKeyboardBusy() {
device.write(uhk.getTransferData(new Buffer([uhk.usbCommands.getKeyboardState]))); device.write(uhk.getTransferData(new Buffer([uhk.usbCommands.getDeviceState])));
const keyboardStateBuffer = Buffer.from(device.readSync()); const keyboardStateBuffer = Buffer.from(device.readSync());
if (keyboardStateBuffer[1] === 1) { if (keyboardStateBuffer[1] === 1) {

View File

@@ -3,7 +3,7 @@ const uhk = require('./uhk');
const device = uhk.getUhkDevice(); const device = uhk.getUhkDevice();
function readKeyboardState() { function readKeyboardState() {
const payload = new Buffer([uhk.usbCommands.getKeyboardState]); const payload = new Buffer([uhk.usbCommands.getDeviceState]);
console.log('Sending ', uhk.bufferToString(payload)); console.log('Sending ', uhk.bufferToString(payload));
device.write(uhk.getTransferData(payload)); device.write(uhk.getTransferData(payload));
const receivedBuffer = device.readSync(); const receivedBuffer = device.readSync();

View File

@@ -71,11 +71,11 @@ exports = module.exports = moduleExports = {
writeStagingUserConfig : 0x06, writeStagingUserConfig : 0x06,
applyConfig : 0x07, applyConfig : 0x07,
launchEepromTransfer : 0x08, launchEepromTransfer : 0x08,
setTestLed: 0x14, getDeviceState : 0x09,
setLedPwmBrightness: 10, setTestLed : 0x0a,
getAdcValue: 11, getDebugBuffer : 0x0b,
getKeyboardState: 16, getAdcValue : 0x0c,
getDebugInfo: 17, setLedPwmBrightness : 0x0d,
}, },
enumerationModes: { enumerationModes: {
bootloader: 0, bootloader: 0,