mirror of
https://gitlab.com/asus-linux/asusctl.git
synced 2026-01-22 17:33:19 +01:00
Fix the handling of of the kernel change from "quiet" to "low-power"
A coming kernel change will convert "quiet" to "low-power" due to how platform_profile can now have multiple registered handlers. (kernel 6.14 est) Fixes #609
This commit is contained in:
@@ -216,7 +216,7 @@ impl CtrlFanCurveZbus {
|
||||
.lock()
|
||||
.await
|
||||
.profiles
|
||||
.set_active_curve_to_defaults((&active).into(), &mut find_fan_curve_node()?)?;
|
||||
.set_active_curve_to_defaults(active.as_str().into(), &mut find_fan_curve_node()?)?;
|
||||
self.platform.set_platform_profile(active.as_str())?;
|
||||
|
||||
self.config.lock().await.write();
|
||||
|
||||
@@ -211,6 +211,7 @@ impl CtrlPlatform {
|
||||
PlatformProfile::Balanced => self.config.lock().await.profile_balanced_epp,
|
||||
PlatformProfile::Performance => self.config.lock().await.profile_performance_epp,
|
||||
PlatformProfile::Quiet => self.config.lock().await.profile_quiet_epp,
|
||||
PlatformProfile::LowPower => self.config.lock().await.profile_quiet_epp,
|
||||
}
|
||||
}
|
||||
|
||||
@@ -323,7 +324,9 @@ impl CtrlPlatform {
|
||||
) -> Result<(), FdoErr> {
|
||||
let policy: PlatformProfile =
|
||||
platform_get_value!(self, platform_profile, "platform_profile").map(|n| n.into())?;
|
||||
let policy = PlatformProfile::next(policy);
|
||||
let choices =
|
||||
platform_get_value!(self, platform_profile_choices, "platform_profile_choices")?;
|
||||
let policy = PlatformProfile::next(policy, &choices);
|
||||
|
||||
if self.platform.has_platform_profile() {
|
||||
let change_epp = self.config.lock().await.platform_profile_linked_epp;
|
||||
@@ -344,9 +347,24 @@ impl CtrlPlatform {
|
||||
}
|
||||
}
|
||||
|
||||
#[zbus(property)]
|
||||
fn platform_profile_choices(&self) -> Result<Vec<PlatformProfile>, FdoErr> {
|
||||
platform_get_value!(self, platform_profile_choices, "platform_profile_choices")
|
||||
}
|
||||
|
||||
#[zbus(property)]
|
||||
fn platform_profile(&self) -> Result<PlatformProfile, FdoErr> {
|
||||
platform_get_value!(self, platform_profile, "platform_profile").map(|n| n.into())
|
||||
let choices = self.platform.get_platform_profile_choices()?;
|
||||
let policy: PlatformProfile = self.platform.get_platform_profile()?.as_str().into();
|
||||
let policy = if policy == PlatformProfile::LowPower
|
||||
&& choices.contains(&PlatformProfile::LowPower)
|
||||
{
|
||||
PlatformProfile::Quiet
|
||||
} else {
|
||||
policy
|
||||
};
|
||||
|
||||
Ok(policy)
|
||||
}
|
||||
|
||||
#[zbus(property)]
|
||||
@@ -362,7 +380,16 @@ impl CtrlPlatform {
|
||||
self.check_and_set_epp(epp, change_epp);
|
||||
|
||||
self.config.lock().await.write();
|
||||
// TODO: Need to get supported profiles here and ensure we translate to one
|
||||
|
||||
let choices = self.platform.get_platform_profile_choices()?;
|
||||
let policy = if policy == PlatformProfile::Quiet
|
||||
&& choices.contains(&PlatformProfile::LowPower)
|
||||
{
|
||||
PlatformProfile::LowPower
|
||||
} else {
|
||||
policy
|
||||
};
|
||||
|
||||
self.platform
|
||||
.set_platform_profile(policy.into())
|
||||
.map_err(|err| {
|
||||
@@ -623,6 +650,7 @@ impl ReloadAndNotify for CtrlPlatform {
|
||||
PlatformProfile::Balanced => data.profile_balanced_epp,
|
||||
PlatformProfile::Performance => data.profile_performance_epp,
|
||||
PlatformProfile::Quiet => data.profile_quiet_epp,
|
||||
PlatformProfile::LowPower => data.profile_quiet_epp,
|
||||
};
|
||||
warn!("setting epp to {epp:?}");
|
||||
self.check_and_set_epp(epp, true);
|
||||
|
||||
Reference in New Issue
Block a user