Fix Clevo keyboard LED mapping for per-key RGB control#76
Open
Dronakurl wants to merge 1 commit intoCalcProgrammer1:masterfrom
Open
Fix Clevo keyboard LED mapping for per-key RGB control#76Dronakurl wants to merge 1 commit intoCalcProgrammer1:masterfrom
Dronakurl wants to merge 1 commit intoCalcProgrammer1:masterfrom
Conversation
The KeyboardLayoutManager returns LED names with "Key: " prefix (e.g., "Key: W") but the hardware value lookup was checking for just "W", causing all keys to map to hardware LED 0 (Left Ctrl). Added GetCorrectHWValue() function that properly maps all 126 keys including: - Standard keyboard keys (F-row, number row, QWERTY, etc.) - Arrow keys (Up/Left/Down/Right Arrow) - Numpad keys (Number Pad 0-9, /, *, -, +, ., Enter) This fixes per-key RGB control on Clevo ITE 8291 keyboards. Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com> refactor: remove redundant GetCorrectHWValue function The Clevo keyboard controller had duplicate hardware LED value mappings in both clevo_tkl_values array and GetCorrectHWValue(). This removes the ~100 if-statement function and uses KeyboardLayoutManager.GetKeyValueAt() directly, aligning with the pattern used by other keyboard controllers. Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com> Revert "refactor: remove redundant GetCorrectHWValue function" This reverts commit afe1141. refactor: replace GetCorrectHWValue if-statements with unordered_map Replace ~100 if-statements in GetCorrectHWValue() with a static unordered_map for O(1) hash lookup instead of O(n) string comparisons. This improves: - Performance: O(1) vs O(n) lookup - Maintainability: single map definition vs scattered if-statements - Readability: compact data structure vs verbose code The mapping is still required because Clevo hardware LED positions don't match standard keyboard matrix order. Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This PR fixes the broken per-key RGB control on Clevo ITE 8291 keyboards found in TUXEDO/Clevo laptops.
Problem
The KeyboardLayoutManager returns LED names with a "Key: " prefix (e.g., "Key: W", "Key: F1") but the hardware value lookup in the Clevo controller was using
KeyboardLayoutManager.GetKeyValueAt()which expects bare key names. This mismatch caused incorrect key-to-LED mapping, making per-key RGB lighting non-functional.When attempting to set colors on individual keys, the wrong key would light up. For example, selecting the W key in OpenRGB would actually light up the I key on the keyboard. The mapping was completely broken.
Solution
Added a
GetCorrectHWValue()function that properly maps all 126 keyboard LEDs from their full key names to the correct hardware LED values. The function uses anunordered_mapfor hash lookup instead of the previous broken approach.The mapping covers:
Hardware Information
This fix was tested on:
Testing
After applying this fix, per-key RGB control works correctly. Each key now maps to its proper hardware LED position, allowing individual key color customization through the OpenRGB UI.
Changes
RGBController_ClevoKeyboard.cpp: AddedGetCorrectHWValue()function with full key mappingRGBController_ClevoKeyboard.h: Added function declarationClevoKeyboardDevices.cpp: Reorganized comments for clarity