Skip to content

fix(lighting): keyboard backlight, power button, fixed-size preview (focus #28) - #23

Merged
I4cTime merged 5 commits into
mainfrom
fix/keyboard-lighting
Oct 23, 2026
Merged

I4cTime merged 5 commits into
mainfrom
fix/keyboard-lighting

Conversation

@I4cTime

@I4cTime I4cTime commented Oct 23, 2026

Copy link
Copy Markdown
Owner

Repairs keyboard lighting on the m18 R2, the two halves of focus #28.

Why only the lid changed. On the m16/m18 R1/R2 family the AW-ELC controller (187c:0551) does not drive the keyboard at all. Probed on the m18 R2 on 2026-10-22: ids 0 and 1 are the rear exhaust rings, 2 the lid logo and 4 the power button. Id 3 is a phantom and id 5 is poison (a zone list containing it makes the firmware drop the whole animation). Cryo sent the AWCC keyboard default 0-3, so rings and lid changed and the power button never did.

Changes

  • hw/effects.py: chassis zones are now 0, 1, 2, 4. Each effect first blanks the controller's six power-state animation slots for the button (opcode 0x22, slots 0x5b-0x60), because those blend on top of the user animation where a zone is shared. This replaces the stock "blue on AC" colour; the setting persists in the controller (AWCC reprograms it on Windows).
  • hw/keyboard.py (new): the keyboard is a separate Darfon HID device (0d62:aab1 here, bab0/bab1 on siblings) speaking alienfx-tools' "API V5" over hidraw: 64-byte feature reports with ID 0xCC (length read from the HID descriptor), reset/status, colour blocks (wire id = index + 1, 15 per packet, exactly report length), loop, update, global brightness. It mirrors the chassis effect as a solid colour (quantum = brand cyan).
  • Engine drives both devices independently, capabilities gain lighting_elc / lighting_keyboard, reapply reopens the hidraw node after resume, doctor prints the keyboard node and report size and the verdict distinguishes "no lighting at all" from "chassis lighting missing".
  • GUI: the keyboard preview keeps one fixed size (372 px, centered) instead of stretching with the window; verified offscreen at 440, 480 and 720 px windows.
  • README and docs/COMPATIBILITY.md describe the chassis + keyboard split and the out-of-scope keyboard animations.

Verified on hardware (m18 R2, kernel 7.2.8): static amber on rings, lid, power button and all keys; brightness 100; quantum morph on the chassis with cyan keys. 103 tests pass; new packet-level tests for the ELC sequence and the keyboard driver over fake transports.

Closes the two acceptance criteria of focus #28.

🤖 Generated with Claude Code

https://claude.ai/code/session_0137cahar5LBoYMf2fiDkt4v

I4cTime and others added 5 commits October 22, 2026 21:28
The lighting preview stretched with the window. It is a picture of a
keyboard, not a layout, so it now has a fixed 372 px width (the panel's
inner width at the window minimum) and sits centered. Verified offscreen
at 440, 480 and 720 px windows: 372 px every time.

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_0137cahar5LBoYMf2fiDkt4v
On the m18 R2 the AW-ELC (187c:0551) never touches the keyboard: it
drives the lid logo, exhaust lights and power button. The keyboard is a
separate Darfon HID device (0d62:aab1) speaking alienfx-tools' "API V5":
64-byte feature reports with ID 0xCC over hidraw. New cryo.hw.keyboard
implements reset/status, colour blocks (wire id = index + 1, 15 per
packet, exactly report length), loop/update and global brightness, and
mirrors the chassis effect as a solid colour (quantum = brand cyan).

Engine drives both devices independently (one failing never blocks the
other), capabilities gain lighting_elc / lighting_keyboard, reapply
reopens the hidraw node after resume, and doctor reports the keyboard
node and report size. 14 unit tests over fake transports and sysfs.

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_0137cahar5LBoYMf2fiDkt4v
Zones 0-3 were the AWCC keyboard default; on the 0551 laptops the ELC
drives the rear exhaust rings (0, 1), the lid logo (2) and the power
button (4, 5), and id 3 is nothing. Verified on the m18 R2: with 0-3 the
rings and lid changed and the power button stayed firmware blue.

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_0137cahar5LBoYMf2fiDkt4v
Probed on the m18 R2 (2026-10-22): zone 4 drives the power button from
the normal user animation; zone 3 is a phantom and zone 5 makes the
firmware drop the entire animation, which is why the previous 0,1,2,4,5
list changed nothing. Chassis zones are now 0,1,2,4.

The controller also layers six power-state animation slots (AC/battery
states, opcode 0x22) over the user animation and blends them where a
zone is shared, so every effect first programs those slots black for
the button. Effects takes an elc_factory for tests; three packet-level
tests cover the sequence.

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_0137cahar5LBoYMf2fiDkt4v
@I4cTime
I4cTime merged commit 77a8210 into main Oct 23, 2026
1 check passed
@I4cTime
I4cTime deleted the fix/keyboard-lighting branch October 23, 2026 03:04
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