mirror of
https://gitlab.com/asus-linux/asusctl.git
synced 2026-02-06 00:15:04 +01:00
Small fixups
This commit is contained in:
@@ -11,8 +11,7 @@ use rog_aura::aura_detection::LedSupportData;
|
|||||||
use rog_aura::keyboard::KeyLayout;
|
use rog_aura::keyboard::KeyLayout;
|
||||||
use rog_dbus::zbus_anime::AnimeProxyBlocking;
|
use rog_dbus::zbus_anime::AnimeProxyBlocking;
|
||||||
use rog_dbus::zbus_aura::AuraProxyBlocking;
|
use rog_dbus::zbus_aura::AuraProxyBlocking;
|
||||||
use rog_dbus::zbus_platform::PlatformProxyBlocking;
|
use rog_dbus::{list_iface_blocking, DBUS_NAME};
|
||||||
use rog_dbus::DBUS_NAME;
|
|
||||||
use smol::Executor;
|
use smol::Executor;
|
||||||
use zbus::Connection;
|
use zbus::Connection;
|
||||||
|
|
||||||
@@ -36,18 +35,14 @@ fn main() -> Result<(), Box<dyn std::error::Error>> {
|
|||||||
println!("rog-platform v{}", rog_platform::VERSION);
|
println!("rog-platform v{}", rog_platform::VERSION);
|
||||||
|
|
||||||
let conn = zbus::blocking::Connection::system().unwrap();
|
let conn = zbus::blocking::Connection::system().unwrap();
|
||||||
let platform_proxy = PlatformProxyBlocking::new(&conn).unwrap();
|
|
||||||
|
|
||||||
let supported = platform_proxy
|
let supported = list_iface_blocking()?;
|
||||||
.supported_interfaces()
|
|
||||||
.unwrap_or_default()
|
|
||||||
.contains(&"Anime".to_string());
|
|
||||||
let config = ConfigBase::new().load();
|
let config = ConfigBase::new().load();
|
||||||
let executor = Executor::new();
|
let executor = Executor::new();
|
||||||
|
|
||||||
let early_return = Arc::new(AtomicBool::new(false));
|
let early_return = Arc::new(AtomicBool::new(false));
|
||||||
// Set up the anime data and run loop/thread
|
// 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 {
|
if let Some(cfg) = config.active_anime {
|
||||||
let anime_type = get_anime_type()?;
|
let anime_type = get_anime_type()?;
|
||||||
let anime_config = ConfigAnime::new().set_name(cfg).load();
|
let anime_config = ConfigAnime::new().set_name(cfg).load();
|
||||||
|
|||||||
@@ -792,6 +792,15 @@ impl ReloadAndNotify for CtrlPlatform {
|
|||||||
|
|
||||||
impl crate::Reloadable for CtrlPlatform {
|
impl crate::Reloadable for CtrlPlatform {
|
||||||
async fn reload(&mut self) -> Result<(), RogError> {
|
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 {
|
macro_rules! reload {
|
||||||
($property:tt, $prop_name:literal) => {
|
($property:tt, $prop_name:literal) => {
|
||||||
concat_idents::concat_idents!(has = has_, $property {
|
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_dynamic_boost, "nv_dynamic_boost");
|
||||||
ppt_reload!(nv_temp_target, "nv_temp_target");
|
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() {
|
if let Ok(power_plugged) = self.power.get_online() {
|
||||||
self.config.lock().await.last_power_plugged = power_plugged;
|
self.config.lock().await.last_power_plugged = power_plugged;
|
||||||
if self.platform.has_throttle_thermal_policy() {
|
if self.platform.has_throttle_thermal_policy() {
|
||||||
|
|||||||
Reference in New Issue
Block a user