mirror of
https://gitlab.com/asus-linux/asusctl.git
synced 2026-02-06 00:15:04 +01:00
fix: apply panel overdrive and other properties on asusd startup
This commit is contained in:
@@ -110,33 +110,49 @@ impl AsusArmouryAttribute {
|
|||||||
impl crate::Reloadable for AsusArmouryAttribute {
|
impl crate::Reloadable for AsusArmouryAttribute {
|
||||||
async fn reload(&mut self) -> Result<(), RogError> {
|
async fn reload(&mut self) -> Result<(), RogError> {
|
||||||
info!("Reloading {}", self.attr.name());
|
info!("Reloading {}", self.attr.name());
|
||||||
let profile: PlatformProfile = self.platform.get_platform_profile()?.into();
|
let name: FirmwareAttribute = self.attr.name().into();
|
||||||
let power_plugged = self
|
|
||||||
.power
|
if name.is_ppt() {
|
||||||
.get_online()
|
let profile: PlatformProfile = self.platform.get_platform_profile()?.into();
|
||||||
.map_err(|e| {
|
let power_plugged = self
|
||||||
error!("Could not get power status: {e:?}");
|
.power
|
||||||
e
|
.get_online()
|
||||||
})
|
.map_err(|e| {
|
||||||
.unwrap_or_default();
|
error!("Could not get power status: {e:?}");
|
||||||
let config = if power_plugged == 1 {
|
e
|
||||||
&self.config.lock().await.ac_profile_tunings
|
})
|
||||||
} else {
|
.unwrap_or_default();
|
||||||
&self.config.lock().await.dc_profile_tunings
|
let config = if power_plugged == 1 {
|
||||||
};
|
&self.config.lock().await.ac_profile_tunings
|
||||||
if let Some(tuning) = config.get(&profile) {
|
} else {
|
||||||
if tuning.enabled {
|
&self.config.lock().await.dc_profile_tunings
|
||||||
if let Some(tune) = tuning.group.get(&self.name()) {
|
};
|
||||||
self.attr
|
if let Some(tuning) = config.get(&profile) {
|
||||||
.set_current_value(&AttrValue::Integer(*tune))
|
if tuning.enabled {
|
||||||
.map_err(|e| {
|
if let Some(tune) = tuning.group.get(&self.name()) {
|
||||||
error!("Could not set {} value: {e:?}", self.attr.name());
|
self.attr
|
||||||
self.attr.base_path_exists();
|
.set_current_value(&AttrValue::Integer(*tune))
|
||||||
e
|
.map_err(|e| {
|
||||||
})?;
|
error!("Could not set {} value: {e:?}", self.attr.name());
|
||||||
info!("Set {} to {:?}", self.attr.name(), tune);
|
self.attr.base_path_exists();
|
||||||
|
e
|
||||||
|
})?;
|
||||||
|
info!("Set {} to {:?}", self.attr.name(), tune);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
} else {
|
||||||
|
// Handle non-PPT attributes (boolean and other settings)
|
||||||
|
if let Some(saved_value) = self.config.lock().await.armoury_settings.get(&name) {
|
||||||
|
self.attr
|
||||||
|
.set_current_value(&AttrValue::Integer(*saved_value))
|
||||||
|
.map_err(|e| {
|
||||||
|
error!("Could not set {} value: {e:?}", self.attr.name());
|
||||||
|
self.attr.base_path_exists();
|
||||||
|
e
|
||||||
|
})?;
|
||||||
|
info!("Restored armoury setting {} to {:?}", self.attr.name(), saved_value);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
Ok(())
|
Ok(())
|
||||||
@@ -420,6 +436,20 @@ pub async fn set_config_or_default(
|
|||||||
// config.write();
|
// config.write();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
} else {
|
||||||
|
// Handle non-PPT attributes (boolean and other settings)
|
||||||
|
if let Some(saved_value) = config.armoury_settings.get(&name) {
|
||||||
|
attr.set_current_value(&AttrValue::Integer(*saved_value))
|
||||||
|
.map_err(|e| {
|
||||||
|
error!("Failed to set {}: {e}", <&str>::from(name));
|
||||||
|
})
|
||||||
|
.ok();
|
||||||
|
info!(
|
||||||
|
"Restored armoury setting for {} = {:?}",
|
||||||
|
<&str>::from(name),
|
||||||
|
saved_value
|
||||||
|
);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user