From abca0cd68ec6bbdb5f5e9b20cd05b3e9eaf96f53 Mon Sep 17 00:00:00 2001 From: coah <100182500+coah80@users.noreply.github.com> Date: Fri, 2 Oct 2026 18:27:21 -0500 Subject: [PATCH] match(kbd): reconstruct synchronous LED command reservation --- libs/RVL_SDK/src/kbd/kbd_lib.c | 15 +++++---------- 1 file changed, 5 insertions(+), 10 deletions(-) diff --git a/libs/RVL_SDK/src/kbd/kbd_lib.c b/libs/RVL_SDK/src/kbd/kbd_lib.c index fd542af6..091349b0 100644 --- a/libs/RVL_SDK/src/kbd/kbd_lib.c +++ b/libs/RVL_SDK/src/kbd/kbd_lib.c @@ -624,7 +624,6 @@ USBKBDErr KBDSetLedsAsync(u32 channel, u32 leds, USBKBDCmdLEDCallback callback, USBKBDErr KBDSetLeds(u32 channel, u32 leds) { u32 index; - KBDLEDCommand* command; BOOL interrupts; USBKBDErr result; u8 ledBits; @@ -634,20 +633,16 @@ USBKBDErr KBDSetLeds(u32 channel, u32 leds) { if (channel >= 4) { return 4; } - if ((s32)kbdChannelFlags(channel) == 1 || (s32)kbdChannelFlags(channel) == 4) { + if ((s32)kbdData[(s32)channel].flags == 1 || (s32)kbdData[(s32)channel].flags == 4) { return 5; } ledBits = leds & 0xff; interrupts = OSDisableInterrupts(); - index = 0; - command = kbdCmdBuf; - while (index < 12) { - if (command->device == 0) { - command->device = (u32)kbdData[channel].device; + for (index = 0; index < 12; index++) { + if (kbdCmdBuf[(s32)index].device == 0) { + kbdCmdBuf[(s32)index].device = (u32)kbdData[channel].device; break; } - index++; - command++; } OSRestoreInterrupts(interrupts); if (index == 12) { @@ -655,7 +650,7 @@ USBKBDErr KBDSetLeds(u32 channel, u32 leds) { } result = USBKBDSetLED((u32)kbdData[channel].device, ledBits, (USBKBDCmdLED*)&kbdCmdBuf[index]); - kbdCmdBuf[index].device = 0; + kbdCmdBuf[(s32)index].device = 0; switch (result) { default: return 7; -- 2.49.1