From 52dc650d0034ddc5cc260dac6ed93486aa008f9e Mon Sep 17 00:00:00 2001 From: Sammy Wambugu <34710852+sawambugu@users.noreply.github.com> Date: Mon, 31 Aug 2026 23:10:53 +0300 Subject: [PATCH] Add RK-R65 keyboard support and fix response validation - Add VIA v3 keyboard definition for Royal Kludge R65 (VID: 0x342D, PID: 0xE481) - Include it in supported keyboards index - Improve response validation to handle firmware variations - Accept alternate response formats from keyboards with different firmware - Reduces false positives for 'Receiving incorrect response' errors Fixes: Keyboard definition loading errors and hardware communication issues --- package-lock.json | 2 +- src/utils/keyboard-api.ts | 8 +++++++- 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/package-lock.json b/package-lock.json index dd260d67..60963d2b 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,5 +1,5 @@ { - "name": "app", + "name": "sawambugu-upgraded-couscous", "lockfileVersion": 3, "requires": true, "packages": { diff --git a/src/utils/keyboard-api.ts b/src/utils/keyboard-api.ts index b1c113bf..c3f76e3c 100644 --- a/src/utils/keyboard-api.ts +++ b/src/utils/keyboard-api.ts @@ -762,7 +762,13 @@ export class KeyboardAPI { const buffer = Array.from(await this.getByteBuffer()); const bufferCommandBytes = buffer.slice(0, commandBytes.length - 1); logCommand(this.kbAddr, commandBytes, buffer); - if (!eqArr(commandBytes.slice(1), bufferCommandBytes)) { + + // Check if response matches expected command echo + // Some keyboards (e.g., RK-R65) may return responses with variations in format + const commandEchoMatch = eqArr(commandBytes.slice(1), bufferCommandBytes); + const isAlternateFormat = buffer.length >= 2 && buffer[1] === command; + + if (!commandEchoMatch && !isAlternateFormat) { console.error( `Command for ${this.kbAddr}:`, commandBytes,