Skip to content

feat(aura): support Dynamic Lighting sysfs interface 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

This draft introduces support for the Linux kernel Dynamic Lighting LED class interface (/sys/class/leds/aura:*) across asusctl, prioritizing the standardized sysfs interface while maintaining seamless fallback to legacy USB hidraw for backward compatibility with older kernels. It is based on that draft and as such NOT suitable for daily usage.

NOTE: due to heavy work on both here and linux the text on that OP can or cannot be accurate

Key Changes:

  1. rog-platform (DynamicLed):
    • Implemented DynamicLed sysfs abstraction for interacting with /sys/class/leds/<device>/.
    • Added support for reading/writing effect, effect_index, speed, speed_range, direction, direction_index, effects_palette (#RRGGBB format), direct_buffer, brightness, and power_states.
    • Added unit tests validating palette string formatting and parsing.
  2. rog-aura:
    • Implemented bidirectional conversions between ROG Aura enums (AuraModeNum, Speed, Direction, AuraEffect) and Dynamic Lighting sysfs strings/palettes.
    • Added unit tests covering all effect, speed, direction, and RGB palette conversions.
  3. asusd (3-Device Multi-Zone Dynamic Lighting & Fallback):
    • Probes for aura:global, aura:keyboard, and aura:lightbar during Aura laptop initialization.
    • Independent Zone Routing:
      • Global requests (AuraZone::None) route to aura:global (firmware AURA_ZONE_ALL) for atomic aggregate updates across all zones.
      • Keyboard requests (AuraZone::Key1..4) route to aura:keyboard without interrupting lightbar animations.
      • Lightbar requests (AuraZone::BarLeft / BarRight) route to aura:lightbar without disturbing keyboard lighting.
    • Fallback: Preserves the legacy hidraw handle and transparently falls back to direct HID reports if Dynamic Lighting is unsupported on older kernels.
    • Cleanup: Removed legacy commented-out AniMe HIDRAW probe code in maybe_anime_hid.
  4. asusctl:
    • Fixed clippy::manual_slice_fill in examples/anime-diag.rs.

Tested Hardware & Environment

  • ASUS Laptop Model: ROG Strix G16 (G614PR)
  • Linux Distribution: Arch Linux / OpenGamingCollective
  • Kernel Version: 7.3.0-rc1+ (with Dynamic Lighting patch series)

Verification and testing:

  • I have performed a self-review of my code
  • I have commented my code, particularly in hard-to-understand areas
  • I have made corresponding changes to the documentation
  • My code follows the style guidelines of this project (cargo fmt --all -- --check)
  • My changes generate no new warnings (cargo clippy --all -- -D warnings/cargo check --all-targets)
  • New and existing unit tests pass locally with my changes (cargo test --all)
  • Cranky with 0 warning (cargo cranky)

@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 from 26d1aec to 55fdc1a Compare October 12, 2026 07:35
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>
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>
@scardracs
scardracs force-pushed the leds/dynamic-lighting branch from 55fdc1a to 395f72c Compare October 16, 2026 09:25
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 395f72c to e37afc6 Compare October 16, 2026 09:27

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