feat(aura): support Dynamic Lighting sysfs interface with hidraw fallback - #369
Draft
scardracs wants to merge 12 commits into
Draft
feat(aura): support Dynamic Lighting sysfs interface with hidraw fallback#369scardracs wants to merge 12 commits into
scardracs wants to merge 12 commits into
Conversation
|
Important Draft PR not reviewedDraft PRs are not automatically reviewed by default.
To automatically review draft PRs, update your CodeRabbit configuration: reviews:
auto_review:
drafts: trueThanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
scardracs
force-pushed
the
leds/dynamic-lighting
branch
from
September 8, 2026 22:01
75ed83b to
f70b66d
Compare
Replace the manual element-wise loop with slice::fill to address the clippy::manual_slice_fill lint when mutating matrix rows.
Introduce DynamicLed for communicating with the Linux kernel Dynamic Lighting class interface under /sys/class/leds/<name>/. This wrapper provides methods to inspect and control: - effect and dynamically queried supported effects via effect_index - direction and direction_index - speed and speed_range - effects_palette using space-separated #RRGGBB values - write_direct for streaming raw binary frame data - brightness, max_brightness, and power_states attributes
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
Probe for /sys/class/leds/aura:global, aura:keyboard, and aura:lightbar Dynamic Lighting LED devices during Aura laptop initialization. When present: - Query available hardware effect modes dynamically from the kernel via sysfs effect_index instead of hardcoding assumptions. - Route global laptop requests (AuraZone::None) directly to aura:global for aggregate hardware execution on AURA_ZONE_ALL. - Route individual zone requests to aura:keyboard or aura:lightbar for independent zone control. - Prioritize the sysfs Dynamic Lighting interface for effect application, brightness control, and power states. - Retain the legacy USB hidraw device handle and fallback to legacy packets if an effect is unsupported by Dynamic Lighting or on older kernels.
Remove legacy commented-out HIDRAW AniMe Matrix probe code in DeviceHandle::maybe_anime_hid. AniMe Matrix over HIDRAW is currently unsupported and immediately returns an explicit NotFound error, making the commented lines dead code.
…om aura laptop With the introduction of the Dynamic Lighting sysfs interface (/sys/class/leds/aura:*), direct USB HID report 0x5d writes via hidraw are no longer necessary for Aura laptop keyboard, lightbar, or unified chassis control. - Remove the `hid` (HidRaw) handle from the `Aura` struct. - Remove raw 64-byte padded packet writes (AURA_LAPTOP_LED_SET/APPLY) and fallback paths from `write_effect_and_apply`, `set_power_states`, `write_effect_block`, and `fix_ally_power`. - Update `DeviceHandle::maybe_laptop_aura` to not require a HidRaw handle. - In `aura_manager`, bypass opening `/dev/hidrawX` for Aura laptop keyboards to avoid unnecessary open file descriptors and kernel hidraw minor leaks.
…handles Remove unused `hid` (HidRaw) handle from `AniMe` struct and methods, as AniMe Matrix devices are driven exclusively via USB raw packets. - Remove `hid` field from `AniMe` and `AniMe::new`. - Remove dead `DeviceHandle::maybe_anime_hid` stub and its invocation in `init_hid_devices`. - Remove dead enum variants `Ally`, `OldAura`, and `TufLedClass` from `DeviceHandle`.
…t_buffer Migrate per-key and zoned direct RGB addressing in write_effect_block from raw USB HID writes to the Dynamic Lighting direct_buffer sysfs interface exposed by the kernel driver (hid-asus). When Dynamic Lighting is available on the keyboard or global chassis node, convert the per-key chunked packets or 4-zone payloads into a flat RGB stream sized to match the hardware led_count, and write it directly to direct_buffer. The kernel driver handles packet chunking (opcode 0xbc), concurrency locking, and direct frame streaming without requiring userspace to open or manage /dev/hidraw.
Update DynamicLed device discovery to support non-aura-prefixed LED class nodes that expose the Dynamic Lighting sysfs ABI (effect_index), such as asus::kbd_backlight registered by asus-wmi on TUF laptops. In DeviceHandle::maybe_laptop_aura, fall back to asus::kbd_backlight if aura:keyboard is absent. This allows TUF RGB laptop keyboards to be driven via the unified Dynamic Lighting sysfs path (effect, speed, palette) with graceful fallback to legacy platform sysfs when Dynamic Lighting is not supported by the kernel.
…idraw Add SlashLed wrapper in rog-platform targeting /sys/class/leds/asus::slash created by the kernel hid-asus driver. Update asusd's Slash implementation to drive brightness, animation mode, and interval via SlashLed sysfs attributes, retaining raw USB as a fallback for older kernels. Remove remaining HidRaw handles and device probing from aura_manager, completing the full removal of hidraw dependencies from the asusd daemon.
scardracs
force-pushed
the
leds/dynamic-lighting
branch
from
September 8, 2026 22:35
3e07fa2 to
e90e9ed
Compare
Add generic ScsiLed abstraction in rog-platform leveraging the kernel's Dynamic Lighting interface (led_classdev_dynamic) exposed by the leds-asus-aura-scsi driver. Update ScsiAura in asusd to drive lighting exclusively through native kernel Dynamic Lighting (ScsiLed), and remove legacy userspace SG_IO ioctl mechanisms (sg.rs, scsi.rs, and libc dependency across the workspace). In aura_manager, discover native ScsiLed sysfs nodes directly, eliminating raw SCSI ioctls, retry loops, and the need for CAP_SYS_RAWIO.
Drive Slash lighting exclusively through the sysfs SlashLed interface provided by the hid-asus kernel driver. Remove the USBRaw fallback handle and write_bytes wrapper from the Slash controller, and remove new_slash_usb from DeviceHandle. With hid-asus handling Slash Lighting in the kernel, userspace raw USB transfers are no longer required, simplifying the daemon architecture and eliminating unneeded device descriptor handles.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
This draft introduces support for the Linux kernel Dynamic Lighting LED class interface (
/sys/class/leds/aura:*) acrossasusctl, prioritizing the standardized sysfs interface while maintaining seamless fallback to legacy USBhidrawfor 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:
rog-platform(DynamicLed):DynamicLedsysfs abstraction for interacting with/sys/class/leds/<device>/.effect,effect_index,speed,speed_range,direction,direction_index,effects_palette(#RRGGBBformat),direct_buffer,brightness, andpower_states.rog-aura:AuraModeNum,Speed,Direction,AuraEffect) and Dynamic Lighting sysfs strings/palettes.asusd(3-Device Multi-Zone Dynamic Lighting & Fallback):aura:global,aura:keyboard, andaura:lightbarduring Aura laptop initialization.AuraZone::None) route toaura:global(firmwareAURA_ZONE_ALL) for atomic aggregate updates across all zones.AuraZone::Key1..4) route toaura:keyboardwithout interrupting lightbar animations.AuraZone::BarLeft/BarRight) route toaura:lightbarwithout disturbing keyboard lighting.hidrawhandle and transparently falls back to direct HID reports if Dynamic Lighting is unsupported on older kernels.maybe_anime_hid.asusctl:clippy::manual_slice_fillinexamples/anime-diag.rs.Tested Hardware & Environment
Verification and testing:
cargo fmt --all -- --check)cargo clippy --all -- -D warnings/cargo check --all-targets)cargo test --all)cargo cranky)