Small fixups

This commit is contained in:
Luke D. Jones
2024-05-11 11:09:02 +12:00
parent f855908c82
commit 9c7dfb4030
2 changed files with 12 additions and 14 deletions

View File

@@ -11,8 +11,7 @@ use rog_aura::aura_detection::LedSupportData;
use rog_aura::keyboard::KeyLayout;
use rog_dbus::zbus_anime::AnimeProxyBlocking;
use rog_dbus::zbus_aura::AuraProxyBlocking;
use rog_dbus::zbus_platform::PlatformProxyBlocking;
use rog_dbus::DBUS_NAME;
use rog_dbus::{list_iface_blocking, DBUS_NAME};
use smol::Executor;
use zbus::Connection;
@@ -36,18 +35,14 @@ fn main() -> Result<(), Box<dyn std::error::Error>> {
println!("rog-platform v{}", rog_platform::VERSION);
let conn = zbus::blocking::Connection::system().unwrap();
let platform_proxy = PlatformProxyBlocking::new(&conn).unwrap();
let supported = platform_proxy
.supported_interfaces()
.unwrap_or_default()
.contains(&"Anime".to_string());
let supported = list_iface_blocking()?;
let config = ConfigBase::new().load();
let executor = Executor::new();
let early_return = Arc::new(AtomicBool::new(false));
// Set up the anime data and run loop/thread
if supported {
if supported.contains(&"org.asuslinux.Anime".to_string()) {
if let Some(cfg) = config.active_anime {
let anime_type = get_anime_type()?;
let anime_config = ConfigAnime::new().set_name(cfg).load();

View File

@@ -792,6 +792,15 @@ impl ReloadAndNotify for CtrlPlatform {
impl crate::Reloadable for CtrlPlatform {
async fn reload(&mut self) -> Result<(), RogError> {
info!("Begin Platform settings restore");
if self.power.has_charge_control_end_threshold() {
let limit = self.config.lock().await.charge_control_end_threshold;
info!("reloading charge_control_end_threshold to {limit}");
self.power.set_charge_control_end_threshold(limit)?;
} else {
warn!("No charge_control_end_threshold found")
}
macro_rules! reload {
($property:tt, $prop_name:literal) => {
concat_idents::concat_idents!(has = has_, $property {
@@ -827,12 +836,6 @@ impl crate::Reloadable for CtrlPlatform {
ppt_reload!(nv_dynamic_boost, "nv_dynamic_boost");
ppt_reload!(nv_temp_target, "nv_temp_target");
if self.power.has_charge_control_end_threshold() {
let limit = self.config.lock().await.charge_control_end_threshold;
info!("reloading charge_control_end_threshold to {limit}");
self.power.set_charge_control_end_threshold(limit)?;
}
if let Ok(power_plugged) = self.power.get_online() {
self.config.lock().await.last_power_plugged = power_plugged;
if self.platform.has_throttle_thermal_policy() {