Skip to content

feat(aura): Dynamic Lighting via asus::* sysfs with hidraw fallback - #369

Draft
scardracs wants to merge 8 commits into
OpenGamingCollective:mainfrom
scardracs:leds/dynamic-lighting
Draft

scardracs wants to merge 8 commits into
OpenGamingCollective:mainfrom
scardracs:leds/dynamic-lighting

Conversation

@scardracs

@scardracs scardracs commented Sep 8, 2026 •

Copy link
Copy Markdown
Contributor

Description

Userspace support for the Linux Dynamic Lighting LED class, aligned with linux-unstable PR #17. Prefer standardized sysfs when present; keep legacy hidraw only when no valid DL node exists. Draft / paired with the kernel series — not for daily use on stock kernels.

All chassis LED nodes use the asus:: vendor prefix (same pattern as asus::kbd_backlight):

Node Role
asus::keyboard Aura keyboard DL
asus::lightbar Chassis lightbar DL when present
asus::slash Slash LED classdev
asus::anime AniMe Matrix DL (kernel)
asus::kbd_backlight TUF WMI DL when asus-wmi exposes the ABI

Commits

  1. fix(asusctl): use slice::fill in anime-diag example — clippy cleanup
  2. feat(rog-platform): add dynamic lighting led sysfs abstraction — DynamicLed helper
  3. feat(rog-aura): add dynamic lighting mode and palette conversions — effect/palette mapping
  4. feat(asusd): prefer dynamic lighting with hidraw fallback — probe asus::keyboard / asus::lightbar, one owner vs hidraw
  5. feat(asusd): discover tuf dynamic lighting on asus::kbd_backlight — TUF fallback when keyboard DL is on WMI backlight
  6. feat(rog-control-center): list every Aura mode and show supported ones
  7. feat(asusd): control slash lighting via sysfs led classdev — asus::slash
  8. fix(asusd): restore Aura lighting after s2idle resume

Behaviour notes

  • A node is DL only with effect, effect_index, zone_type, and led_count.
  • Under DL, supported_basic_zones is empty; legacy Key1–4 / Bar* are aliases onto keyboard/lightbar.
  • LampArray stays a kernel-only direct-RGB backend; not a second userspace ABI.
  • Slash uses asus::slash sysfs; AniMe Matrix is registered by the kernel as asus::anime (asusd anime path may still use its existing stack until wired to DL).

Tested

  • Laptop: ROG Strix G16 (G614PR)
  • Distro: Arch / OpenGamingCollective
  • Kernel: linux-unstable with Dynamic Lighting series (asus::* LED names)

Verification

  • Self-review
  • Docs updated (docs/usage/dynamic-lighting.md)
  • cargo fmt / clippy / check as applicable on this branch
  • Unit tests for touched crates

@coderabbitai

coderabbitai Bot commented Sep 8, 2026 •

Copy link
Copy Markdown

Important

Draft PR not reviewed

Draft PRs are not automatically reviewed by default.

  • Trigger a manual review

To automatically review draft PRs, update your CodeRabbit configuration:

reviews:
  auto_review:
    drafts: true
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@scardracs
scardracs force-pushed the leds/dynamic-lighting branch 6 times, most recently from 446d581 to cbbe60a Compare September 13, 2026 10:23
@scardracs
scardracs force-pushed the leds/dynamic-lighting branch 11 times, most recently from 2abf73c to 26d1aec Compare September 25, 2026 13:11
@scardracs
scardracs force-pushed the leds/dynamic-lighting branch 3 times, most recently from 395f72c to e37afc6 Compare October 16, 2026 09:27
Replace the manual element-wise loop with slice::fill to address
the clippy::manual_slice_fill lint when mutating matrix rows.

Signed-off-by: Marco Scardovi <scardracs@disroot.org>
Introduce a validated wrapper for Linux Dynamic Lighting LED nodes.
Require generic mandatory attributes, probe optional capabilities, and
validate ranges, palette capacity, exact buffers, and sysfs errors.
Map missing sysfs attributes on numeric writes to AttrNotFound.

Expose optional enabled/enabled_index as true/false lighting-engine
controls. Keep vendor-specific topology out of generic node validation.
The unused optional frame sink remains deliberately unexposed.

Signed-off-by: Marco Scardovi <scardracs@disroot.org>
Add mapping functions between ROG Aura structures and Dynamic Lighting class values:
- AuraModeNum::to_dynamic_effect_str
- Speed::to_dynamic_speed
- Direction::to_dynamic_direction_str
- AuraEffect::to_dynamic_palette for extracting RGB palette tuples
- LedBrightness::{to_scaled, from_scaled} for mapping Off/Low/Med/High onto
  Dynamic Lighting 0..=max_brightness sysfs ranges

Effect names follow the hid-asus effect_index vocabulary: static, breathe,
rainbow_cycle, rainbow_wave, star, rain, highlight, laser, ripple, pulse,
comet, flash, and direct. direct is AuraModeNum::Direct.

Signed-off-by: Marco Scardovi <scardracs@disroot.org>
@scardracs scardracs changed the title feat(aura): support Dynamic Lighting sysfs interface with hidraw fallback feat(aura): Dynamic Lighting via asus::* sysfs with hidraw fallback Oct 19, 2026
@scardracs
scardracs force-pushed the leds/dynamic-lighting branch from e37afc6 to fb792e7 Compare October 19, 2026 08:51
Prioritize valid Dynamic Lighting sysfs nodes for laptop Aura control
and keep hidraw only as a capability-based fallback when no DL node
exists. The two paths stay mutually exclusive for one device.

Drive independent aura:keyboard and aura:lightbar nodes, map lighting
off through enabled=false, stream exact led_count*3 RGB payloads through
direct_buffer, map legacy Key1–4 / bar zones onto keyboard/lightbar, and
scale Fn-key brightness across writable DL nodes.

Under Dynamic Lighting, supported_basic_modes is the full Aura catalog
intersected with the kernel effect_index.

Document the userspace DL vs hidraw policy.

Signed-off-by: Marco Scardovi <scardracs@disroot.org>
Prefer aura:keyboard, then fall back to a Dynamic Lighting-capable
asus::kbd_backlight from asus-wmi on TUF laptops. Keep brightness-only
kbd_backlight as the legacy KeyboardBacklight path, and drop that handle
when DL already owns the same LED node so the two paths never fight.

Signed-off-by: Marco Scardovi <scardracs@disroot.org>
Name the full Aura catalog in the mode menu, including Rainbow cycle,
Rainbow wave, and Direct. Show only the mode numbers asusd reports
for the current device.

Signed-off-by: Marco Scardovi <scardracs@disroot.org>
Drive Slash lighting through the kernel LED classdev sysfs path when
asus::slash exists. Do not gate on DMI board lists. Kernel Slash LED has
no power_states, so boot/sleep/shutdown/battery/lid D-Bus setters return
NotSupported instead of persisting a hardware no-op.

Signed-off-by: Marco Scardovi <scardracs@disroot.org>
AuraZbus::start_tasks never registered CtrlTask sleep handlers, so
keyboard/lightbar effects were not reapplied after suspend. Wire
create_tasks and re-apply power states, brightness, and the current
mode after resume with a short settle/retry for Dynamic Lighting.

Signed-off-by: Marco Scardovi <scardracs@disroot.org>
@scardracs
scardracs force-pushed the leds/dynamic-lighting branch from fb792e7 to aa656da Compare October 19, 2026 09:02

This branch has not been deployed

No deployments
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