Compare commits

...

10 Commits

Author SHA1 Message Date
rforced
0d9d42fb19 Merge branch 'fix-z13-2025-1' into 'devel'
Fixes for Asus z13 2025

See merge request asus-linux/asusctl!245
2026-01-27 20:26:13 -05:00
Denis Benato
99ec1e8bcf feat: improve the UI 2026-01-27 01:42:19 +01:00
Denis Benato
c2a3310891 fix: move keyboard power 2026-01-27 01:09:02 +01:00
Denis Benato
024d41727f feat: support TUF lighting power 2026-01-26 22:38:07 +01:00
Denis Benato
7d55a2675b feat: reorder CLI parameters 2026-01-26 20:49:41 +01:00
Josh Dariano
f471f340d4 Fix fan controls on z13 2026-01-16 16:37:15 -05:00
Josh Dariano
8095ac34ed Fix formatting 2026-01-16 15:48:02 -05:00
Josh Dariano
9d629b62ca Fix aura backlight for z13 2026-01-16 15:33:30 -05:00
Josh Dariano
5282c56f59 Merge remote-tracking branch 'rforced/fix-z13-2025' 2026-01-16 14:13:45 -05:00
Josh Dariano
0d2cd4eb10 Fix keyboard light 2026-01-16 13:57:35 -05:00
18 changed files with 260 additions and 168 deletions

View File

@@ -8,7 +8,7 @@ use rog_aura::{AuraEffect, AuraModeNum, AuraZone, Colour, Direction, Speed};
#[derive(FromArgs, Debug, Clone)]
#[argh(
subcommand,
name = "aura-power-old",
name = "power-tuf",
description = "aura power (old ROGs and TUF laptops)"
)]
pub struct LedPowerCommand1 {
@@ -38,7 +38,7 @@ pub struct LedPowerCommand1 {
}
#[derive(FromArgs, Debug, Clone)]
#[argh(subcommand, name = "aura-power", description = "aura power")]
#[argh(subcommand, name = "power", description = "aura power")]
pub struct LedPowerCommand2 {
#[argh(subcommand)]
pub command: Option<SetAuraZoneEnabled>,

View File

@@ -18,9 +18,7 @@ pub struct CliStart {
#[derive(FromArgs, Debug)]
#[argh(subcommand)]
pub enum CliCommand {
Aura(LedModeCommand),
AuraPowerOld(LedPowerCommand1),
AuraPower(LedPowerCommand2),
Aura(AuraCommand),
Brightness(BrightnessCommand),
Profile(ProfileCommand),
FanCurve(FanCurveCommand),
@@ -99,7 +97,7 @@ pub struct ProfileSetCommand {
}
#[derive(FromArgs, Debug, Default)]
#[argh(subcommand, name = "aura", description = "led mode commands")]
#[argh(subcommand, name = "effect", description = "led mode commands")]
pub struct LedModeCommand {
#[argh(switch, description = "switch to next aura mode")]
pub next_mode: bool,
@@ -111,6 +109,21 @@ pub struct LedModeCommand {
pub command: Option<SetAuraBuiltin>,
}
#[derive(FromArgs, Debug)]
#[argh(subcommand, name = "aura", description = "aura device commands")]
pub struct AuraCommand {
#[argh(subcommand)]
pub command: AuraSubCommand,
}
#[derive(FromArgs, Debug)]
#[argh(subcommand)]
pub enum AuraSubCommand {
Power(LedPowerCommand2),
PowerTuf(LedPowerCommand1),
Effect(LedModeCommand),
}
#[derive(FromArgs, Debug, Default)]
#[argh(
subcommand,

View File

@@ -186,9 +186,11 @@ fn do_parsed(
conn: Connection,
) -> Result<(), Box<dyn std::error::Error>> {
match &parsed.command {
CliCommand::Aura(mode) => handle_led_mode(mode)?,
CliCommand::AuraPowerOld(pow) => handle_led_power1(pow)?,
CliCommand::AuraPower(pow) => handle_led_power2(pow)?,
CliCommand::Aura(a) => match &a.command {
crate::cli_opts::AuraSubCommand::Effect(mode) => handle_led_mode(mode)?,
crate::cli_opts::AuraSubCommand::PowerTuf(pow) => handle_led_power1(pow)?,
crate::cli_opts::AuraSubCommand::Power(pow) => handle_led_power2(pow)?,
},
CliCommand::Brightness(cmd) => handle_brightness(cmd)?,
CliCommand::Profile(cmd) => handle_throttle_profile(&conn, supported_properties, cmd)?,
CliCommand::FanCurve(cmd) => handle_fan_curve(&conn, cmd)?,
@@ -720,7 +722,7 @@ fn handle_led_power1(power: &LedPowerCommand1) -> Result<(), Box<dyn std::error:
&& !power.keyboard
&& !power.lightbar
{
println!("Missing arg or command; run 'asusctl aura-power-old --help' for usage");
println!("Missing arg or command; run 'asusctl aura power-tuf --help' for usage");
return Ok(());
}
@@ -773,7 +775,7 @@ fn handle_led_power2(power: &LedPowerCommand2) -> Result<(), Box<dyn std::error:
}
if power.command.is_none() {
println!("Missing arg or command; run 'asusctl aura-power --help' for usage");
println!("Missing arg or command; run 'asusctl aura power --help' for usage");
println!("Commands available");
return Ok(());
}

View File

@@ -25,6 +25,30 @@ pub struct Aura {
impl Aura {
/// Initialise the device if required.
pub async fn do_initialization(&self) -> Result<(), RogError> {
if let Some(hid) = &self.hid {
let hid = hid.lock().await;
let init_1: [u8; 2] = [
0x5d, 0xb9,
];
let init_2 = b"]ASUS Tech.Inc.";
let init_3: [u8; 6] = [
0x5d, 0x05, 0x20, 0x31, 0, 0x1a,
];
hid.write_bytes(&init_1)?;
hid.write_bytes(init_2)?;
hid.write_bytes(&init_3)?;
let config = self.config.lock().await;
if config.support_data.device_name.contains("GZ30")
|| config.support_data.device_name.contains("Z13")
{
let z13_init: [u8; 4] = [
0x5d, 0xc0, 0x03, 0x01,
];
hid.write_bytes(&z13_init)?;
}
}
Ok(())
}
@@ -152,9 +176,54 @@ impl Aura {
}
}
let bytes = config.enabled.to_bytes(config.led_type);
let mut enabled = config.enabled.clone();
if config.support_data.device_name.contains("GZ30")
|| config.support_data.device_name.contains("Z13")
{
let logo_state = enabled
.states
.iter()
.find(|s| s.zone == PowerZones::Logo)
.cloned();
if let Some(logo) = logo_state {
let mut lid_found = false;
let mut bar_found = false;
for s in enabled.states.iter_mut() {
if s.zone == PowerZones::Lid {
s.boot = logo.boot;
s.awake = logo.awake;
s.sleep = logo.sleep;
s.shutdown = logo.shutdown;
lid_found = true;
}
if s.zone == PowerZones::Lightbar {
s.boot = logo.boot;
s.awake = logo.awake;
s.sleep = logo.sleep;
s.shutdown = logo.shutdown;
bar_found = true;
}
}
if !lid_found {
let mut new_state = logo;
new_state.zone = PowerZones::Lid;
enabled.states.push(new_state.clone());
new_state.zone = PowerZones::Lightbar;
enabled.states.push(new_state);
} else if !bar_found {
// Lid found but not bar?
let mut new_state = logo;
new_state.zone = PowerZones::Lightbar;
enabled.states.push(new_state);
}
}
}
let bytes = enabled.to_bytes(config.led_type);
let msg = [
0x5d, 0xbd, 0x01, bytes[0], bytes[1], bytes[2], bytes[3],
0x5d, 0xbd, 0x01, bytes[0], bytes[1], bytes[2], bytes[3], 0xff,
];
hid_raw.write_bytes(&msg)?;
}

View File

@@ -980,6 +980,24 @@
advanced_type: r#None,
power_zones: [Keyboard],
),
(
device_name: "GZ302",
product_id: "18c6",
layout_name: "",
basic_modes: [Static, Breathe, Pulse],
basic_zones: [],
advanced_type: r#None,
power_zones: [Logo],
),
(
device_name: "GZ302",
product_id: "1a30",
layout_name: "ga401q",
basic_modes: [Static, Breathe, Pulse],
basic_zones: [],
advanced_type: r#None,
power_zones: [Keyboard],
),
(
device_name: "RC71L",
product_id: "",

View File

@@ -123,7 +123,8 @@ impl AuraPowerState {
| ((self.shutdown as u32) << 7)
}
PowerZones::Lightbar => {
((self.boot as u32) << (7 + 2))
((self.awake as u32) << (7 + 1))
| ((self.boot as u32) << (7 + 2))
| ((self.awake as u32) << (7 + 3))
| ((self.sleep as u32) << (7 + 4))
| ((self.shutdown as u32) << (7 + 5))
@@ -133,12 +134,20 @@ impl AuraPowerState {
| ((self.awake as u32) << (15 + 2))
| ((self.sleep as u32) << (15 + 3))
| ((self.shutdown as u32) << (15 + 4))
| ((self.boot as u32) << (15 + 5))
| ((self.awake as u32) << (15 + 6))
| ((self.sleep as u32) << (15 + 7))
| ((self.shutdown as u32) << (15 + 8))
}
PowerZones::RearGlow => {
((self.boot as u32) << (23 + 1))
| ((self.awake as u32) << (23 + 2))
| ((self.sleep as u32) << (23 + 3))
| ((self.shutdown as u32) << (23 + 4))
| ((self.boot as u32) << (23 + 5))
| ((self.awake as u32) << (23 + 6))
| ((self.sleep as u32) << (23 + 7))
| ((self.shutdown as u32) << (23 + 8))
}
PowerZones::None | PowerZones::KeyboardAndLightbar => 0,
}
@@ -618,19 +627,19 @@ mod test {
assert_eq!(shut_keyb_, "10000000, 00000000, 00000000, 00000000");
//
assert_eq!(boot_bar__, "00000000, 00000010, 00000000, 00000000");
assert_eq!(awake_bar_, "00000000, 00000100, 00000000, 00000000");
assert_eq!(awake_bar_, "00000000, 00000101, 00000000, 00000000");
assert_eq!(sleep_bar_, "00000000, 00001000, 00000000, 00000000");
assert_eq!(shut_bar__, "00000000, 00010000, 00000000, 00000000");
//
assert_eq!(boot_lid__, "00000000, 00000000, 00000001, 00000000");
assert_eq!(awake_lid_, "00000000, 00000000, 00000010, 00000000");
assert_eq!(sleep_lid_, "00000000, 00000000, 00000100, 00000000");
assert_eq!(shut_lid__, "00000000, 00000000, 00001000, 00000000");
assert_eq!(boot_lid__, "00000000, 00000000, 00010001, 00000000");
assert_eq!(awake_lid_, "00000000, 00000000, 00100010, 00000000");
assert_eq!(sleep_lid_, "00000000, 00000000, 01000100, 00000000");
assert_eq!(shut_lid__, "00000000, 00000000, 10001000, 00000000");
//
assert_eq!(boot_rear_, "00000000, 00000000, 00000000, 00000001");
assert_eq!(awake_rear, "00000000, 00000000, 00000000, 00000010");
assert_eq!(sleep_rear, "00000000, 00000000, 00000000, 00000100");
assert_eq!(shut_rear_, "00000000, 00000000, 00000000, 00001000");
assert_eq!(boot_rear_, "00000000, 00000000, 00000000, 00010001");
assert_eq!(awake_rear, "00000000, 00000000, 00000000, 00100010");
assert_eq!(sleep_rear, "00000000, 00000000, 00000000, 01000100");
assert_eq!(shut_rear_, "00000000, 00000000, 00000000, 10001000");
// All on
let byte1 = to_binary_string_post2021(&LaptopAuraPower {
@@ -657,6 +666,6 @@ mod test {
},
],
});
assert_eq!(byte1, "11111111, 00011110, 00001111, 00001111");
assert_eq!(byte1, "11111111, 00011111, 11111111, 11111111");
}
}

View File

@@ -106,10 +106,10 @@ impl From<&str> for AuraDeviceType {
match s.to_lowercase().trim_start_matches("0x") {
"tuf" => AuraDeviceType::LaptopKeyboardTuf,
"1932" => AuraDeviceType::ScsiExtDisk,
"1866" | "18c6" | "1869" | "1854" => Self::LaptopKeyboardPre2021,
"1866" | "1869" | "1854" => Self::LaptopKeyboardPre2021,
"1abe" | "1b4c" => Self::Ally,
"19b3" | "193b" => Self::AnimeOrSlash,
"19b6" => Self::LaptopKeyboard2021,
"19b6" | "1a30" | "18c6" => Self::LaptopKeyboard2021,
_ => Self::Unknown,
}
}

View File

@@ -148,6 +148,12 @@ async fn main() -> Result<()> {
}
};
let is_tuf = {
let b = board_name.to_lowercase();
let p = prod_family.to_lowercase();
b.contains("tuf") || p.contains("tuf")
};
#[cfg(feature = "rog_ally")]
if is_rog_ally {
config.notifications.enabled = false;
@@ -198,7 +204,7 @@ async fn main() -> Result<()> {
loop {
if is_rog_ally {
let config_copy_2 = config.clone();
let newui = setup_window(config.clone(), prefetched_supported.clone());
let newui = setup_window(config.clone(), prefetched_supported.clone(), is_tuf);
newui.window().on_close_requested(move || {
exit(0);
});
@@ -256,7 +262,7 @@ async fn main() -> Result<()> {
});
} else {
let config_copy_2 = config_copy.clone();
let newui = setup_window(config_copy, pref_for_invoke.clone());
let newui = setup_window(config_copy, pref_for_invoke.clone(), is_tuf);
newui.window().on_close_requested(move || {
if let Ok(mut app_state) = app_state_copy.lock() {
*app_state = AppState::MainWindowClosed;

View File

@@ -120,6 +120,7 @@ pub fn show_toast(
pub fn setup_window(
config: Arc<Mutex<Config>>,
prefetched_supported: std::sync::Arc<Option<Vec<i32>>>,
is_tuf: bool,
) -> MainWindow {
slint::set_xdg_app_id("rog-control-center")
.map_err(|e| warn!("Couldn't set application ID: {e:?}"))
@@ -127,6 +128,8 @@ pub fn setup_window(
let ui = MainWindow::new()
.map_err(|e| warn!("Couldn't create main window: {e:?}"))
.unwrap();
// propagate TUF flag to the UI so the sidebar can swap logo branding
ui.set_is_tuf(is_tuf);
ui.window()
.show()
.map_err(|e| warn!("Couldn't show main window: {e:?}"))

View File

@@ -40,10 +40,6 @@ pub fn setup_system_page(ui: &MainWindow, _config: Arc<Mutex<Config>>) {
ui.global::<SystemPageData>().set_platform_profile(-1);
ui.global::<SystemPageData>().set_panel_overdrive(-1);
ui.global::<SystemPageData>().set_boot_sound(-1);
ui.global::<SystemPageData>().set_kbd_leds_awake(-1);
ui.global::<SystemPageData>().set_kbd_leds_sleep(-1);
ui.global::<SystemPageData>().set_kbd_leds_boot(-1);
ui.global::<SystemPageData>().set_kbd_leds_shutdown(-1);
ui.global::<SystemPageData>().set_screen_auto_brightness(-1);
ui.global::<SystemPageData>().set_mcu_powersave(-1);
ui.global::<SystemPageData>().set_mini_led_mode(-1);
@@ -673,26 +669,6 @@ pub fn setup_system_page_callbacks(ui: &MainWindow, _states: Arc<Mutex<Config>>)
setup_callback!(boot_sound, handle, attr, i32);
setup_external!(boot_sound, i32, handle, attr, value)
}
FirmwareAttribute::KbdLedsAwake => {
init_property!(kbd_leds_awake, handle, value, i32);
setup_callback!(kbd_leds_awake, handle, attr, i32);
setup_external!(kbd_leds_awake, i32, handle, attr, value)
}
FirmwareAttribute::KbdLedsSleep => {
init_property!(kbd_leds_sleep, handle, value, i32);
setup_callback!(kbd_leds_sleep, handle, attr, i32);
setup_external!(kbd_leds_sleep, i32, handle, attr, value)
}
FirmwareAttribute::KbdLedsBoot => {
init_property!(kbd_leds_boot, handle, value, i32);
setup_callback!(kbd_leds_boot, handle, attr, i32);
setup_external!(kbd_leds_boot, i32, handle, attr, value)
}
FirmwareAttribute::KbdLedsShutdown => {
init_property!(kbd_leds_shutdown, handle, value, i32);
setup_callback!(kbd_leds_shutdown, handle, attr, i32);
setup_external!(kbd_leds_shutdown, i32, handle, attr, value)
}
FirmwareAttribute::ScreenAutoBrightness => {
init_property!(screen_auto_brightness, handle, value, i32);
setup_callback!(screen_auto_brightness, handle, attr, i32);

View File

@@ -35,6 +35,8 @@ export component MainWindow inherits Window {
true, // About
];
private property <bool> show_notif;
// TODO: change if TUF on the logo in the menu on the main page
in property <bool> is_tuf: false;
private property <bool> fade_cover;
private property <bool> toast: false;
private property <string> toast_text: "I show when something is waiting";
@@ -80,6 +82,7 @@ export component MainWindow inherits Window {
@tr("Menu7" => "About"),
];
available: root.sidebar_items_avilable;
is_tuf: root.is_tuf;
}
Button {
@@ -101,31 +104,37 @@ export component MainWindow inherits Window {
/*if(side-bar.current-item == 1):*/ aura := PageAura {
width: root.width - side-bar.width;
height: root.height + 12px;
visible: side-bar.current-item == 1;
}
if(side-bar.current-item == 2): PageAnime {
width: root.width - side-bar.width;
height: root.height + 12px;
visible: side-bar.current-item == 2;
}
if(side-bar.current-item == 3): fans := PageFans {
width: root.width - side-bar.width;
height: root.height + 12px;
visible: side-bar.current-item == 3;
}
if(side-bar.current-item == 4): PageGPU {
width: root.width - side-bar.width;
height: root.height + 12px;
visible: side-bar.current-item == 4;
}
if(side-bar.current-item == 5): PageAppSettings {
width: root.width - side-bar.width;
height: root.height + 12px;
visible: side-bar.current-item == 5;
}
if(side-bar.current-item == 6): PageAbout {
width: root.width - side-bar.width;
height: root.height + 12px;
visible: side-bar.current-item == 6;
}

View File

@@ -238,15 +238,47 @@ export component PageAura inherits Rectangle {
}
}
}
}
}
Button {
x: root.width - self.width - 6px;
y: 6px;
text: "✕";
height: 36px;
clicked => {
root.show_aura_power = false;
root.show_fade_cover = false;
// TUF devices: show the same configurable power groups as `New`, since
// `setup_aura` fills `AuraPageData.supported_power_zones` and `led_power`
// appropriately for TUF devices. This ensures the Power Settings panel
// reflects what the firmware reports for TUF models.
if root.show_aura_power && AuraPageData.device_type == AuraDevType.Tuf: Rectangle {
background: Palette.background;
width: 100%;
height: 100%;
opacity: 1;
ScrollView {
VerticalLayout {
padding: 30px;
padding-top: 10px;
spacing: 10px;
alignment: LayoutAlignment.start;
for state[idx] in AuraPageData.led_power.states: tuf_zone := AuraPowerGroup {
group-title: AuraPageData.power_zone_names[state.zone_name_idx];
boot_checked: state.boot;
boot_toggled => {
AuraPageData.led_power.states[idx].boot = tuf_zone.boot_checked;
AuraPageData.cb_led_power(AuraPageData.led_power);
}
awake_checked: state.awake;
awake_toggled => {
AuraPageData.led_power.states[idx].awake = tuf_zone.awake_checked;
AuraPageData.cb_led_power(AuraPageData.led_power);
}
sleep_checked: state.sleep;
sleep_toggled => {
AuraPageData.led_power.states[idx].sleep = tuf_zone.sleep_checked;
AuraPageData.cb_led_power(AuraPageData.led_power);
}
shutdown_checked: state.shutdown;
shutdown_toggled => {
AuraPageData.led_power.states[idx].shutdown = tuf_zone.shutdown_checked;
AuraPageData.cb_led_power(AuraPageData.led_power);
}
}
}
}
@@ -292,17 +324,17 @@ export component PageAura inherits Rectangle {
}
}
}
}
}
Button {
x: root.width - self.width - 6px;
y: 6px;
text: "✕";
height: 36px;
clicked => {
root.show_aura_power = false;
root.show_fade_cover = false;
}
}
if root.show_aura_power: Button {
x: root.width - self.width - 6px;
y: 6px;
text: "✕";
height: 36px;
clicked => {
root.show_aura_power = false;
root.show_fade_cover = false;
}
}
}

View File

@@ -18,8 +18,22 @@ export component PageGPU inherits Rectangle {
ScrollView {
VerticalLayout {
padding: 10px;
spacing: 10px;
padding: 12px;
spacing: 8px;
Rectangle {
background: Palette.alternate-background;
border-color: Palette.border;
border-width: 1px;
border-radius: 2px;
height: 36px;
Text {
font-size: 16px;
color: Palette.control-foreground;
horizontal-alignment: TextHorizontalAlignment.center;
text: @tr("Internal/Discrete GPU");
}
}
HorizontalLayout {
padding-right: 10px;

View File

@@ -51,14 +51,6 @@ export global SystemPageData {
callback cb_panel_overdrive(int);
in-out property <int> boot_sound;
callback cb_boot_sound(int);
in-out property <int> kbd_leds_awake;
callback cb_kbd_leds_awake(int);
in-out property <int> kbd_leds_sleep;
callback cb_kbd_leds_sleep(int);
in-out property <int> kbd_leds_boot;
callback cb_kbd_leds_boot(int);
in-out property <int> kbd_leds_shutdown;
callback cb_kbd_leds_shutdown(int);
in-out property <int> screen_auto_brightness;
callback cb_screen_auto_brightness(int);
in-out property <int> mcu_powersave;
@@ -252,66 +244,6 @@ export component PageSystem inherits Rectangle {
}
}
if SystemPageData.kbd_leds_awake != -1 ||
SystemPageData.kbd_leds_sleep != -1 ||
SystemPageData.kbd_leds_boot != -1 ||
SystemPageData.kbd_leds_shutdown != -1: VerticalLayout {
padding: 0px;
spacing: 0px;
alignment: LayoutAlignment.start;
Rectangle {
background: Palette.alternate-background;
border-color: Palette.border;
border-width: 1px;
border-radius: 2px;
height: 40px;
Text {
font-size: 16px;
color: Palette.control-foreground;
horizontal-alignment: TextHorizontalAlignment.center;
text: @tr("Keyboard Power Management");
}
}
GroupBox {
HorizontalLayout {
spacing: 10px;
if SystemPageData.kbd_leds_awake != -1: SystemToggleInt {
text: @tr("Keyboard Awake Effect");
checked_int <=> SystemPageData.kbd_leds_awake;
toggled => {
SystemPageData.cb_kbd_leds_awake(SystemPageData.kbd_leds_awake)
}
}
if SystemPageData.kbd_leds_sleep != -1: SystemToggleInt {
text: @tr("Keyboard Sleep Effect");
checked_int <=> SystemPageData.kbd_leds_sleep;
toggled => {
SystemPageData.cb_kbd_leds_sleep(SystemPageData.kbd_leds_sleep)
}
}
if SystemPageData.kbd_leds_boot != -1: SystemToggleInt {
text: @tr("Keyboard Boot Effect");
checked_int <=> SystemPageData.kbd_leds_boot;
toggled => {
SystemPageData.cb_kbd_leds_boot(SystemPageData.kbd_leds_boot)
}
}
if SystemPageData.kbd_leds_shutdown != -1: SystemToggleInt {
text: @tr("Keyboard Shutdown Effect");
checked_int <=> SystemPageData.kbd_leds_shutdown;
toggled => {
SystemPageData.cb_kbd_leds_shutdown(SystemPageData.kbd_leds_shutdown)
}
}
}
}
}
Rectangle {
background: Palette.alternate-background;
border-color: Palette.border;

View File

@@ -52,6 +52,7 @@ component SideBarItem inherits Rectangle {
export component SideBar inherits Rectangle {
in property <[string]> model: [];
in property <[bool]> available: [];
in property <bool> is_tuf: false;
out property <int> current-item: 0;
out property <int> current-focused: fs.has-focus ? fs.focused-tab : -1;
@@ -99,6 +100,9 @@ export component SideBar inherits Rectangle {
Image {
height: 100px;
// TODO: change if TUF on the logo in the menu on the main page
// If running on a TUF model, replace the ROG red with TUF orange
// (add data/tuf-control-center.png and switch here when available)
source: @image-url("../../data/rog-control-center.png");
horizontal-alignment: center;
image-fit: contain;

View File

@@ -257,7 +257,6 @@ impl FirmwareAttributes {
pub enum FirmwareAttributeType {
#[default]
Immediate,
TUFKeyboard,
Ppt,
Gpu,
Bios,
@@ -346,11 +345,6 @@ define_attribute_getters!(
panel_hd_mode: Immediate,
panel_od: Immediate,
kbd_leds_awake: TUFKeyboard,
kbd_leds_sleep: TUFKeyboard,
kbd_leds_boot: TUFKeyboard,
kbd_leds_shutdown: TUFKeyboard,
charge_mode: Immediate,
}
);
@@ -400,10 +394,6 @@ pub enum FirmwareAttribute {
PptEnabled = 24,
None = 25,
ScreenAutoBrightness = 26,
KbdLedsAwake = 27,
KbdLedsSleep = 28,
KbdLedsBoot = 29,
KbdLedsShutdown = 30,
}
impl From<&str> for FirmwareAttribute {
@@ -425,10 +415,6 @@ impl From<&str> for FirmwareAttribute {
"nv_tgp" => Self::DgpuTgp,
"charge_mode" => Self::ChargeMode,
"boot_sound" => Self::BootSound,
"kbd_leds_awake" => Self::KbdLedsAwake,
"kbd_leds_sleep" => Self::KbdLedsSleep,
"kbd_leds_boot" => Self::KbdLedsBoot,
"kbd_leds_shutdown" => Self::KbdLedsShutdown,
"mcu_powersave" => Self::McuPowersave,
"panel_overdrive" => Self::PanelOverdrive,
"panel_hd_mode" => Self::PanelHdMode,
@@ -474,10 +460,6 @@ impl From<FirmwareAttribute> for &str {
FirmwareAttribute::DgpuDisable => "dgpu_disable",
FirmwareAttribute::GpuMuxMode => "gpu_mux_mode",
FirmwareAttribute::MiniLedMode => "mini_led_mode",
FirmwareAttribute::KbdLedsAwake => "kbd_leds_awake",
FirmwareAttribute::KbdLedsSleep => "kbd_leds_sleep",
FirmwareAttribute::KbdLedsBoot => "kbd_leds_boot",
FirmwareAttribute::KbdLedsShutdown => "kbd_leds_shutdown",
FirmwareAttribute::PendingReboot => "pending_reboot",
FirmwareAttribute::ScreenAutoBrightness => "screen_auto_brightness",
FirmwareAttribute::None => "none",

View File

@@ -162,7 +162,6 @@ impl CurveData {
/// Write this curve to the device fan specified by `self.fan`
pub fn write_to_device(&self, device: &mut Device) -> std::io::Result<()> {
let pwm_num: char = self.fan.into();
let enable = if self.enabled { '1' } else { '2' };
for (index, out) in self.pwm.iter().enumerate() {
let pwm = pwm_str(pwm_num, index);
@@ -176,10 +175,20 @@ impl CurveData {
device.set_attribute_value(&temp, out.to_string())?;
}
// Enable must be done *after* all points are written pwm3_enable
// Note: pwm_enable is set by write_profile_curve_to_platform after all
// curves are written, because on some devices (e.g., ASUS Z13 2025)
// setting any pwm_enable to 2 resets ALL fan enables.
Ok(())
}
/// Set the enable state for this fan curve
pub fn set_enable(&self, device: &mut Device) -> std::io::Result<()> {
let pwm_num: char = self.fan.into();
let enable = if self.enabled { "1" } else { "2" };
let enable_attr = format!("pwm{pwm_num}_enable");
device
.set_attribute_value(format!("pwm{pwm_num}_enable"), enable.to_string())
.map_err(|e| error!("Failed to set pwm{pwm_num}_enable to {enable}: {e:?}"))
.set_attribute_value(&enable_attr, enable.to_string())
.map_err(|e| error!("Failed to set {enable_attr} to {enable}: {e:?}"))
.ok();
Ok(())
}

View File

@@ -181,15 +181,29 @@ impl FanCurveProfiles {
PlatformProfile::Quiet | PlatformProfile::LowPower => &mut self.quiet,
PlatformProfile::Custom => &mut self.custom,
};
for fan in fans.iter().filter(|f| !f.enabled) {
debug!("write_profile_curve_to_platform: writing profile:{profile}, {fan:?}");
// First write all curve data (pwm/temp values) for all fans
for fan in fans.iter() {
debug!("write_profile_curve_to_platform: writing curve data for profile:{profile}, {fan:?}");
fan.write_to_device(device)?;
}
// Write enabled fans last because the kernel currently resets *all* if one is
// disabled
// Then set enables: disabled fans first, then enabled fans last.
// This order is important because on some devices (e.g., ASUS Z13 2025)
// setting any pwm_enable to 2 (disabled) resets ALL fan enables.
for fan in fans.iter().filter(|f| !f.enabled) {
debug!(
"write_profile_curve_to_platform: disabling fan for profile:{profile}, {:?}",
fan.fan
);
fan.set_enable(device)?;
}
for fan in fans.iter().filter(|f| f.enabled) {
debug!("write_profile_curve_to_platform: writing profile:{profile}, {fan:?}");
fan.write_to_device(device)?;
debug!(
"write_profile_curve_to_platform: enabling fan for profile:{profile}, {:?}",
fan.fan
);
fan.set_enable(device)?;
}
Ok(())
}