mirror of
https://gitlab.com/asus-linux/asusctl.git
synced 2026-02-06 00:15:04 +01:00
Various bugfixes
This commit is contained in:
@@ -6,7 +6,9 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
|||||||
|
|
||||||
## [Unreleased]
|
## [Unreleased]
|
||||||
### Changed
|
### Changed
|
||||||
- Fix to suspend process in anime thread to let custom anims run on wake
|
- Fix to suspend process in anime thread to let custom anims run on wake.
|
||||||
|
- Fix to reload the fan curves correctly on boot.
|
||||||
|
- Add new config option `platform_policy_linked_epp` to set if energy_performance_preference should be paired with platform_profile/throttle_thermal_policy
|
||||||
|
|
||||||
## [v5.0.6]
|
## [v5.0.6]
|
||||||
- Revert egui update due to a lot of issues arising from window closing.
|
- Revert egui update due to a lot of issues arising from window closing.
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
use config_traits::{StdConfig, StdConfigLoad2};
|
use config_traits::{StdConfig, StdConfigLoad3};
|
||||||
use rog_platform::platform::PlatformPolicy;
|
use rog_platform::platform::PlatformPolicy;
|
||||||
use serde_derive::{Deserialize, Serialize};
|
use serde_derive::{Deserialize, Serialize};
|
||||||
|
|
||||||
@@ -13,9 +13,7 @@ pub struct Config {
|
|||||||
pub disable_nvidia_powerd_on_battery: bool,
|
pub disable_nvidia_powerd_on_battery: bool,
|
||||||
pub ac_command: String,
|
pub ac_command: String,
|
||||||
pub bat_command: String,
|
pub bat_command: String,
|
||||||
/// Restored on boot as well as when power is plugged
|
pub platform_policy_linked_epp: bool,
|
||||||
#[serde(skip)]
|
|
||||||
pub platform_policy_to_restore: PlatformPolicy,
|
|
||||||
pub platform_policy_on_battery: PlatformPolicy,
|
pub platform_policy_on_battery: PlatformPolicy,
|
||||||
pub platform_policy_on_ac: PlatformPolicy,
|
pub platform_policy_on_ac: PlatformPolicy,
|
||||||
//
|
//
|
||||||
@@ -50,9 +48,56 @@ impl StdConfig for Config {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
impl StdConfigLoad2<Config462, Config472> for Config {}
|
impl StdConfigLoad3<Config462, Config472, Config506> for Config {}
|
||||||
|
|
||||||
#[derive(Deserialize, Serialize, Default, Debug)]
|
#[derive(Deserialize, Serialize)]
|
||||||
|
pub struct Config506 {
|
||||||
|
/// Save charge limit for restoring on boot
|
||||||
|
pub charge_control_end_threshold: u8,
|
||||||
|
pub panel_od: bool,
|
||||||
|
pub mini_led_mode: bool,
|
||||||
|
pub disable_nvidia_powerd_on_battery: bool,
|
||||||
|
pub ac_command: String,
|
||||||
|
pub bat_command: String,
|
||||||
|
/// Restored on boot as well as when power is plugged
|
||||||
|
#[serde(skip)]
|
||||||
|
pub platform_policy_to_restore: PlatformPolicy,
|
||||||
|
pub platform_policy_on_battery: PlatformPolicy,
|
||||||
|
pub platform_policy_on_ac: PlatformPolicy,
|
||||||
|
//
|
||||||
|
pub ppt_pl1_spl: Option<u8>,
|
||||||
|
pub ppt_pl2_sppt: Option<u8>,
|
||||||
|
pub ppt_fppt: Option<u8>,
|
||||||
|
pub ppt_apu_sppt: Option<u8>,
|
||||||
|
pub ppt_platform_sppt: Option<u8>,
|
||||||
|
pub nv_dynamic_boost: Option<u8>,
|
||||||
|
pub nv_temp_target: Option<u8>,
|
||||||
|
}
|
||||||
|
|
||||||
|
impl From<Config506> for Config {
|
||||||
|
fn from(c: Config506) -> Self {
|
||||||
|
Self {
|
||||||
|
charge_control_end_threshold: c.charge_control_end_threshold,
|
||||||
|
panel_od: c.panel_od,
|
||||||
|
disable_nvidia_powerd_on_battery: c.disable_nvidia_powerd_on_battery,
|
||||||
|
ac_command: c.ac_command,
|
||||||
|
bat_command: c.bat_command,
|
||||||
|
mini_led_mode: c.mini_led_mode,
|
||||||
|
platform_policy_linked_epp: true,
|
||||||
|
platform_policy_on_battery: c.platform_policy_on_battery,
|
||||||
|
platform_policy_on_ac: c.platform_policy_on_ac,
|
||||||
|
ppt_pl1_spl: c.ppt_pl1_spl,
|
||||||
|
ppt_pl2_sppt: c.ppt_pl2_sppt,
|
||||||
|
ppt_fppt: c.ppt_fppt,
|
||||||
|
ppt_apu_sppt: c.ppt_apu_sppt,
|
||||||
|
ppt_platform_sppt: c.ppt_platform_sppt,
|
||||||
|
nv_dynamic_boost: c.nv_dynamic_boost,
|
||||||
|
nv_temp_target: c.nv_temp_target,
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
#[derive(Deserialize, Serialize)]
|
||||||
pub struct Config472 {
|
pub struct Config472 {
|
||||||
/// Save charge limit for restoring on boot
|
/// Save charge limit for restoring on boot
|
||||||
pub bat_charge_limit: u8,
|
pub bat_charge_limit: u8,
|
||||||
|
|||||||
@@ -296,16 +296,18 @@ impl CtrlTask for CtrlFanCurveZbus {
|
|||||||
impl crate::Reloadable for CtrlFanCurveZbus {
|
impl crate::Reloadable for CtrlFanCurveZbus {
|
||||||
/// Fetch the active profile and use that to set all related components up
|
/// Fetch the active profile and use that to set all related components up
|
||||||
async fn reload(&mut self) -> Result<(), RogError> {
|
async fn reload(&mut self) -> Result<(), RogError> {
|
||||||
// let active = self.platform.get_throttle_thermal_policy()?.into();
|
let active = self.platform.get_throttle_thermal_policy()?.into();
|
||||||
// if let Ok(mut device) = find_fan_curve_node() {
|
if let Ok(mut device) = find_fan_curve_node() {
|
||||||
// // There is a possibility that the curve was default zeroed, so this call
|
// There is a possibility that the curve was default zeroed, so this call
|
||||||
// // initialises the data from system read and we need to save it
|
// initialises the data from system read and we need to save it
|
||||||
// // after
|
// after
|
||||||
// self.fan_curves
|
loop {
|
||||||
// .lock()
|
if let Ok(mut curves) = self.fan_curves.try_lock() {
|
||||||
// .await
|
curves.write_profile_curve_to_platform(active, &mut device)?;
|
||||||
// .write_profile_curve_to_platform(active, &mut device)?;
|
break;
|
||||||
// }
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
Ok(())
|
Ok(())
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -180,7 +180,11 @@ impl CtrlPlatform {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
fn check_and_set_epp(&self, profile: PlatformPolicy) {
|
fn check_and_set_epp(&self, profile: PlatformPolicy, change_epp: bool) {
|
||||||
|
if !change_epp {
|
||||||
|
info!("PlatformPolicy unlinked from EPP");
|
||||||
|
return;
|
||||||
|
}
|
||||||
info!("PlatformPolicy setting EPP");
|
info!("PlatformPolicy setting EPP");
|
||||||
if let Some(cpu) = self.cpu_control.as_ref() {
|
if let Some(cpu) = self.cpu_control.as_ref() {
|
||||||
if let Ok(epp) = cpu.get_available_epp() {
|
if let Ok(epp) = cpu.get_available_epp() {
|
||||||
@@ -197,7 +201,7 @@ impl CtrlPlatform {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
async fn update_policy_ac_or_bat(&self, power_plugged: bool) {
|
async fn update_policy_ac_or_bat(&self, power_plugged: bool, change_epp: bool) {
|
||||||
let profile = if power_plugged {
|
let profile = if power_plugged {
|
||||||
self.config.lock().await.platform_policy_on_ac
|
self.config.lock().await.platform_policy_on_ac
|
||||||
} else {
|
} else {
|
||||||
@@ -206,7 +210,7 @@ impl CtrlPlatform {
|
|||||||
self.platform
|
self.platform
|
||||||
.set_throttle_thermal_policy(profile.into())
|
.set_throttle_thermal_policy(profile.into())
|
||||||
.ok();
|
.ok();
|
||||||
self.check_and_set_epp(profile);
|
self.check_and_set_epp(profile, change_epp);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -340,14 +344,14 @@ impl CtrlPlatform {
|
|||||||
let policy = PlatformPolicy::next(&policy);
|
let policy = PlatformPolicy::next(&policy);
|
||||||
|
|
||||||
if self.platform.has_throttle_thermal_policy() {
|
if self.platform.has_throttle_thermal_policy() {
|
||||||
self.check_and_set_epp(policy);
|
let change_epp = self.config.lock().await.platform_policy_linked_epp;
|
||||||
|
self.check_and_set_epp(policy, change_epp);
|
||||||
self.platform
|
self.platform
|
||||||
.set_throttle_thermal_policy(policy.into())
|
.set_throttle_thermal_policy(policy.into())
|
||||||
.map_err(|err| {
|
.map_err(|err| {
|
||||||
warn!("RogPlatform: throttle_thermal_policy {}", err);
|
warn!("RogPlatform: throttle_thermal_policy {}", err);
|
||||||
FdoErr::Failed(format!("RogPlatform: throttle_thermal_policy: {err}"))
|
FdoErr::Failed(format!("RogPlatform: throttle_thermal_policy: {err}"))
|
||||||
})?;
|
})?;
|
||||||
self.config.lock().await.platform_policy_to_restore = policy;
|
|
||||||
Ok(self.throttle_thermal_policy_changed(&ctxt).await?)
|
Ok(self.throttle_thermal_policy_changed(&ctxt).await?)
|
||||||
} else {
|
} else {
|
||||||
Err(FdoErr::NotSupported(
|
Err(FdoErr::NotSupported(
|
||||||
@@ -366,8 +370,8 @@ impl CtrlPlatform {
|
|||||||
async fn set_throttle_thermal_policy(&mut self, policy: PlatformPolicy) -> Result<(), FdoErr> {
|
async fn set_throttle_thermal_policy(&mut self, policy: PlatformPolicy) -> Result<(), FdoErr> {
|
||||||
// TODO: watch for external changes
|
// TODO: watch for external changes
|
||||||
if self.platform.has_throttle_thermal_policy() {
|
if self.platform.has_throttle_thermal_policy() {
|
||||||
self.check_and_set_epp(policy);
|
let change_epp = self.config.lock().await.platform_policy_linked_epp;
|
||||||
self.config.lock().await.platform_policy_to_restore = policy;
|
self.check_and_set_epp(policy, change_epp);
|
||||||
self.platform
|
self.platform
|
||||||
.set_throttle_thermal_policy(policy.into())
|
.set_throttle_thermal_policy(policy.into())
|
||||||
.map_err(|err| {
|
.map_err(|err| {
|
||||||
@@ -534,7 +538,9 @@ impl crate::Reloadable for CtrlPlatform {
|
|||||||
|
|
||||||
if let Ok(power_plugged) = self.power.get_online() {
|
if let Ok(power_plugged) = self.power.get_online() {
|
||||||
if self.platform.has_throttle_thermal_policy() {
|
if self.platform.has_throttle_thermal_policy() {
|
||||||
self.update_policy_ac_or_bat(power_plugged > 0).await;
|
let change_epp = self.config.lock().await.platform_policy_linked_epp;
|
||||||
|
self.update_policy_ac_or_bat(power_plugged > 0, change_epp)
|
||||||
|
.await;
|
||||||
}
|
}
|
||||||
self.run_ac_or_bat_cmd(power_plugged > 0).await;
|
self.run_ac_or_bat_cmd(power_plugged > 0).await;
|
||||||
}
|
}
|
||||||
@@ -614,7 +620,11 @@ impl CtrlTask for CtrlPlatform {
|
|||||||
}
|
}
|
||||||
if let Ok(power_plugged) = platform1.power.get_online() {
|
if let Ok(power_plugged) = platform1.power.get_online() {
|
||||||
if !sleeping && platform1.platform.has_throttle_thermal_policy() {
|
if !sleeping && platform1.platform.has_throttle_thermal_policy() {
|
||||||
platform1.update_policy_ac_or_bat(power_plugged > 0).await;
|
let change_epp =
|
||||||
|
platform1.config.lock().await.platform_policy_linked_epp;
|
||||||
|
platform1
|
||||||
|
.update_policy_ac_or_bat(power_plugged > 0, change_epp)
|
||||||
|
.await;
|
||||||
}
|
}
|
||||||
if !sleeping {
|
if !sleeping {
|
||||||
platform1.run_ac_or_bat_cmd(power_plugged > 0).await;
|
platform1.run_ac_or_bat_cmd(power_plugged > 0).await;
|
||||||
@@ -648,7 +658,10 @@ impl CtrlTask for CtrlPlatform {
|
|||||||
// power change
|
// power change
|
||||||
async move {
|
async move {
|
||||||
if platform3.platform.has_throttle_thermal_policy() {
|
if platform3.platform.has_throttle_thermal_policy() {
|
||||||
platform3.update_policy_ac_or_bat(power_plugged).await;
|
let change_epp = platform3.config.lock().await.platform_policy_linked_epp;
|
||||||
|
platform3
|
||||||
|
.update_policy_ac_or_bat(power_plugged, change_epp)
|
||||||
|
.await;
|
||||||
}
|
}
|
||||||
platform3.run_ac_or_bat_cmd(power_plugged).await;
|
platform3.run_ac_or_bat_cmd(power_plugged).await;
|
||||||
}
|
}
|
||||||
@@ -697,8 +710,8 @@ impl CtrlTask for CtrlPlatform {
|
|||||||
error!("Platform: get_throttle_thermal_policy error: {e}");
|
error!("Platform: get_throttle_thermal_policy error: {e}");
|
||||||
})
|
})
|
||||||
{
|
{
|
||||||
ctrl.check_and_set_epp(profile);
|
let change_epp = ctrl.config.lock().await.platform_policy_linked_epp;
|
||||||
ctrl.config.lock().await.platform_policy_to_restore = profile;
|
ctrl.check_and_set_epp(profile, change_epp);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -15,7 +15,7 @@ use asusd::ctrl_aura::trait_impls::CtrlAuraZbus;
|
|||||||
use asusd::ctrl_fancurves::CtrlFanCurveZbus;
|
use asusd::ctrl_fancurves::CtrlFanCurveZbus;
|
||||||
use asusd::ctrl_platform::CtrlPlatform;
|
use asusd::ctrl_platform::CtrlPlatform;
|
||||||
use asusd::{print_board_info, CtrlTask, Reloadable, ZbusRun, DBUS_NAME};
|
use asusd::{print_board_info, CtrlTask, Reloadable, ZbusRun, DBUS_NAME};
|
||||||
use config_traits::{StdConfig, StdConfigLoad2};
|
use config_traits::{StdConfig, StdConfigLoad2, StdConfigLoad3};
|
||||||
use log::{error, info, warn};
|
use log::{error, info, warn};
|
||||||
use rog_aura::aura_detection::LaptopLedData;
|
use rog_aura::aura_detection::LaptopLedData;
|
||||||
use tokio::time::sleep;
|
use tokio::time::sleep;
|
||||||
|
|||||||
@@ -10,10 +10,9 @@ pub mod effects;
|
|||||||
pub mod advanced;
|
pub mod advanced;
|
||||||
/// Convert the `RgbAddress` to `&str` labels
|
/// Convert the `RgbAddress` to `&str` labels
|
||||||
pub mod advanced_to_str;
|
pub mod advanced_to_str;
|
||||||
pub mod error;
|
|
||||||
pub use advanced_to_str::*;
|
|
||||||
/// Helper for detecting what is available
|
/// Helper for detecting what is available
|
||||||
pub mod aura_detection;
|
pub mod aura_detection;
|
||||||
|
pub mod error;
|
||||||
/// Helpers for consructing keyboard layouts for UI use and effects
|
/// Helpers for consructing keyboard layouts for UI use and effects
|
||||||
pub mod layouts;
|
pub mod layouts;
|
||||||
pub mod usb;
|
pub mod usb;
|
||||||
|
|||||||
Reference in New Issue
Block a user