Skip to content

feat(aura): support Dynamic Lighting sysfs interface with hidraw fallback - #369

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

scardracs wants to merge 5 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

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 2 times, most recently from 1e4b78d to 82721b6 Compare September 23, 2026 13:33
Replace the manual element-wise loop with slice::fill to address
the clippy::manual_slice_fill lint when mutating matrix rows.
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.

Keep ASUS aura_mode separate from 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, from_dynamic_effect_str}
- Speed::{to_dynamic_speed, from_dynamic_speed}
- Direction::{to_dynamic_direction_str, from_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

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.

Clean up dead hidraw/comment leftovers in anime and device handles,
stream exact led_count*3 RGB payloads through direct_buffer, and
honour ASUS aura_mode topology: skip -EBUSY on inactive unified/split
nodes, map legacy Key1–4 / bar zones onto keyboard/lightbar nodes,
and scale Fn-key brightness across writable DL nodes.

Document the userspace DL vs hidraw policy.

Signed-off-by: Marco Scardovi <scardracs@disroot.org>
@scardracs
scardracs force-pushed the leds/dynamic-lighting branch from 82721b6 to 57fe394 Compare September 24, 2026 17:38
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>
@scardracs
scardracs force-pushed the leds/dynamic-lighting branch 2 times, most recently from 3797678 to 1a4599c Compare September 24, 2026 17:46

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