From 2cce83d164b74703922507d0389e3ff86d22b0fb Mon Sep 17 00:00:00 2001 From: "Luke D. Jones" Date: Tue, 1 Aug 2023 09:30:54 +1200 Subject: [PATCH] Fix: asusd should reload defualt fan-curves if the config file fails Closes #385 --- CHANGELOG.md | 3 +++ asusd/src/ctrl_profiles/config.rs | 8 ++++---- asusd/src/ctrl_profiles/controller.rs | 6 +++++- 3 files changed, 12 insertions(+), 5 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index b33c0d73..206c21ba 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -5,6 +5,9 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/), and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). ## [Unreleased] +### Changed +- Fixes to asusctl CLI tool to show fan curves +- Fixes to asusd to ensure fan curve defaults are loaded if the config file fails ### Added - Support for GV601V LED modes diff --git a/asusd/src/ctrl_profiles/config.rs b/asusd/src/ctrl_profiles/config.rs index 2e2ce56f..dcb93866 100644 --- a/asusd/src/ctrl_profiles/config.rs +++ b/asusd/src/ctrl_profiles/config.rs @@ -48,13 +48,13 @@ impl StdConfig for FanCurveConfig { Self::default() } - fn config_dir() -> std::path::PathBuf { - PathBuf::from(CONFIG_PATH_BASE) - } - fn file_name(&self) -> String { CONFIG_FAN_FILE.to_owned() } + + fn config_dir() -> std::path::PathBuf { + PathBuf::from(CONFIG_PATH_BASE) + } } impl StdConfigLoad for FanCurveConfig {} diff --git a/asusd/src/ctrl_profiles/controller.rs b/asusd/src/ctrl_profiles/controller.rs index ebf58439..e6802298 100644 --- a/asusd/src/ctrl_profiles/controller.rs +++ b/asusd/src/ctrl_profiles/controller.rs @@ -87,7 +87,11 @@ impl CtrlPlatformProfile { info!("{MOD_NAME}: Device has fan curves available"); let fan_config = FanCurveConfig::new(); // Only do defaults if the config doesn't already exist - if !fan_config.file_path().exists() { + if !fan_config.file_path().exists() + || fan_config.balanced.is_empty() + || fan_config.performance.is_empty() + || fan_config.quiet.is_empty() + { info!("{MOD_NAME}: Fetching default fan curves"); controller.fan_curves = Some(FanCurves { config_file: fan_config,