Skip to content

Comments

Fix Clevo keyboard LED mapping for per-key RGB control#76

Open
Dronakurl wants to merge 2 commits intoCalcProgrammer1:masterfrom
Dronakurl:clevo2
Open

Fix Clevo keyboard LED mapping for per-key RGB control#76
Dronakurl wants to merge 2 commits intoCalcProgrammer1:masterfrom
Dronakurl:clevo2

Conversation

@Dronakurl
Copy link

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 an unordered_map for hash lookup instead of the previous broken approach.

The mapping covers:

  • Standard keyboard keys (F-row, number row, QWERTY, ASDF, ZXCV rows)
  • Modifier keys (Ctrl, Alt, Win, Shift, Caps Lock)
  • Arrow keys (Up/Left/Down/Right Arrow)
  • Numpad keys (Number Pad 0-9, /, *, -, +, ., Enter)
  • Navigation keys (Insert, Delete, Home, End, Page Up/Down)

Hardware Information

This fix was tested on:

  • System: TUXEDO Stellaris 16 Intel Gen6 (SKU: STELLARIS16I06)
  • Motherboard: TUXEDO GM6IXxB_MB2 (board model NB02)
  • Keyboard Controller: ITE 8291 (USB device 048d:600b)
  • Keyboard Layout: ISO QWERTY

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: Added GetCorrectHWValue() function with full key mapping
  • RGBController_ClevoKeyboard.h: Added function declaration
  • ClevoKeyboardDevices.cpp: Reorganized comments for clarity

Dronakurl and others added 2 commits February 13, 2026 22:56
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 helper script converts OpenRGB .orp profile files to the Linux
kernel LED interface format used by the tuxedo_keyboard driver.

Purpose:
On TUXEDO/Clevo laptops, the Embedded Controller (EC) can turn off the
keyboard backlight after idle periods. When it wakes, it uses firmware
defaults instead of OpenRGB's USB HID settings. The kernel LED interface
may provide better persistence through EC wake cycles.

Features:
- Parses OpenRGB .orp profile binary format
- Uses the same hardware LED mapping as RGBController_ClevoKeyboard
- Applies colors to /sys/class/leds/rgb:kbd_backlight_*/multi_intensity
- Works with any OpenRGB profile (specify profile name as argument)

Usage:
    python3 tuxedo_keyboard_interface_helper.py [profile_name]

Hardware Compatibility:
- TUXEDO laptops with Clevo per-key RGB keyboards (ITE 8291 controller)
- Linux with tuxedo_keyboard kernel driver
- NOT part of OpenRGB itself - external helper utility

Related:
- Addresses EC timeout persistence issue
- Complements Clevo keyboard support (PR CalcProgrammer1#76)
- See: https://gitlab.com/tuxedocomputers/development/packages/tuxedo-keyboard

Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
@Dronakurl
Copy link
Author

Additional Helper for TUXEDO Hardware

I've created a helper script that converts OpenRGB profiles to the kernel LED interface used by the tuxedo_keyboard driver on TUXEDO/Clevo laptops.

Why This Exists

On TUXEDO laptops, the Embedded Controller (EC) can turn off the keyboard backlight after idle periods. When it wakes, it reverts to firmware defaults instead of OpenRGB's USB HID settings.

The kernel LED interface (/sys/class/leds/rgb:kbd_backlight_*/multi_intensity) may provide better persistence through EC wake cycles.

The Helper Script

Location: tuxedo_keyboard_interface_helper.py in this branch

Features:

  • Converts OpenRGB .orp profiles to kernel LED interface format
  • Uses the same hardware LED mapping as RGBController_ClevoKeyboard
  • Works with any OpenRGB profile
  • Fully documented with usage instructions

Usage:

python3 tuxedo_keyboard_interface_helper.py [profile_name]

Hardware Compatibility

  • TUXEDO laptops with Clevo per-key RGB keyboards (ITE 8291 controller)
  • Linux with tuxedo_keyboard kernel driver
  • This is NOT part of OpenRGB - it's an external helper for TUXEDO hardware

Testing

Tested on TUXEDO Stellaris 16 Intel Gen6 with per-key RGB (126 zones).

The script successfully:

  • Parses OpenRGB .orp binary format
  • Maps 102 LEDs using RGBController_ClevoKeyboard's hardware mapping
  • Applies colors via kernel LED interface

Next step: EC timeout persistence test to verify if kernel interface colors survive EC wake.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant