From 81c9fc27b07b61f614b9bb540000b60751e9721d Mon Sep 17 00:00:00 2001 From: voidvore Date: Tue, 15 Sep 2026 20:43:05 +0300 Subject: [PATCH 1/2] fix(rog-aura): honour shutdown state for TUF keyboard power states The TUF `kbd_rgb_state` interface takes five values: cmd, boot, awake, sleep and the shutdown state occupying the fifth slot. That fifth byte was hardcoded to 1 and the configured value was dropped, so every write re-enabled the shutdown LED state on the EC - and because the write carries the save bit, the user's configuration was overridden in non-volatile EC state on every boot. Measured on a TUF Gaming A15 FA507NV (BIOS 318): writing `1 0 1 0 0` vs `1 0 1 0 1` differs only in bit 7 of the state flags (arg0 0x000804BD vs 0x008804BD for DEVS(0x00100057)). With the bit set, the EC lights the keyboard with its power-on default colour (white) while the S5 power-off sequence runs; with it clear the LED stays dark. The same bit position is named `shutdown` by `new_to_byte()` for the 2021+ keyboards, and rog-control-center already exposes the matching toggle for TUF laptops, so pass the configured value through instead of forcing it on. Machines that never touched the setting are unaffected: `AuraPowerState::default()` keeps `shutdown` enabled. --- rog-aura/src/keyboard/power.rs | 47 ++++++++++++++++++++++++++++++++-- 1 file changed, 45 insertions(+), 2 deletions(-) diff --git a/rog-aura/src/keyboard/power.rs b/rog-aura/src/keyboard/power.rs index 0b2bd70d3..7bb4c778d 100644 --- a/rog-aura/src/keyboard/power.rs +++ b/rog-aura/src/keyboard/power.rs @@ -51,9 +51,9 @@ impl AuraPowerState { } fn tuf_to_bytes(&self) -> Vec { - // &cmd, &boot, &awake, &sleep, &keyboard + // &cmd, &boot, &awake, &sleep, &shutdown vec![ - 1, self.boot as u8, self.awake as u8, self.sleep as u8, 1, + 1, self.boot as u8, self.awake as u8, self.sleep as u8, self.shutdown as u8, ] } @@ -690,4 +690,47 @@ mod test { }); assert_eq!(byte1, "11111111, 00011110, 00001111, 00001111"); } + + #[test] + fn check_tuf_control_bytes() { + // TUF keyboard interface: cmd, boot, awake, sleep, shutdown. + // The last byte (bit 7 of the state flags) gates the keyboard LED + // during the S5/power-off phase and must follow the configured + // `shutdown` state instead of being hardcoded to on. + let power = LaptopAuraPower { + states: vec![ + AuraPowerState { + zone: PowerZones::Keyboard, + boot: false, + awake: true, + sleep: false, + shutdown: false, + }, + ], + }; + assert_eq!( + power.to_bytes(AuraDeviceType::LaptopKeyboardTuf), + [ + 1, 0, 1, 0, 0 + ] + ); + + let power = LaptopAuraPower { + states: vec![ + AuraPowerState { + zone: PowerZones::Keyboard, + boot: false, + awake: true, + sleep: false, + shutdown: true, + }, + ], + }; + assert_eq!( + power.to_bytes(AuraDeviceType::LaptopKeyboardTuf), + [ + 1, 0, 1, 0, 1 + ] + ); + } } From deaf8531f9bcf4aaf03072d43da10ccc855443a0 Mon Sep 17 00:00:00 2001 From: voidvore Date: Tue, 15 Sep 2026 20:43:37 +0300 Subject: [PATCH 2/2] docs(rog-aura): TUF power states include shutdown `AuraPowerState.shutdown` is honoured by the TUF interface now, and the TUF state set consists of four states, not three. --- rog-aura/src/keyboard/power.rs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/rog-aura/src/keyboard/power.rs b/rog-aura/src/keyboard/power.rs index 7bb4c778d..b70b8c952 100644 --- a/rog-aura/src/keyboard/power.rs +++ b/rog-aura/src/keyboard/power.rs @@ -14,7 +14,7 @@ use crate::{AuraDeviceType, PowerZones}; /// Meaning of this struct depends on the laptop generation. /// - 2021+, the struct is a single zone with 4 states /// - pre-2021, the struct is 1 or 2 zones and 3 states -/// - Tuf, the struct is 1 zone and 3 states +/// - Tuf, the struct is 1 zone and 4 states #[cfg_attr(feature = "dbus", derive(Type, Value, OwnedValue))] #[derive(Clone, Copy, Debug, PartialEq, Eq, Serialize, Deserialize)] pub struct AuraPowerState { @@ -22,7 +22,7 @@ pub struct AuraPowerState { pub boot: bool, pub awake: bool, pub sleep: bool, - /// Ignored for pre-2021 and Tuf + /// Ignored for pre-2021 pub shutdown: bool, }