mirror of
https://gitlab.com/asus-linux/asusctl.git
synced 2026-02-06 00:15:04 +01:00
Dbus expand (#24)
* Dbus changes - Changed "FanMode", "ChargeLimit" to "SetFanMode", "SetChargeLimit" - Added dbus signals "FanModeChanged", "ChargeLimitChanged" - Added dbus methods "GetFanMode", "GetChargeLimit" * Refactor of internal loop and tokio tasks * Add support for ROG Strix G712LV_G712LV * Correctly read the config before writing changes
This commit is contained in:
@@ -154,8 +154,10 @@ impl RogCore {
|
||||
}
|
||||
|
||||
pub fn fan_mode_step(&mut self, config: &mut Config) -> Result<(), Box<dyn Error>> {
|
||||
// re-read the config here in case a user changed the pstate settings
|
||||
config.read();
|
||||
|
||||
let mut n = config.fan_mode;
|
||||
info!("Current fan mode: {:?}", FanLevel::from(n));
|
||||
// wrap around the step number
|
||||
if n < 2 {
|
||||
n += 1;
|
||||
@@ -170,18 +172,15 @@ impl RogCore {
|
||||
mode: FanLevel,
|
||||
config: &mut Config,
|
||||
) -> Result<(), Box<dyn Error>> {
|
||||
// re-read the config here in case a user changed the pstate settings
|
||||
config.read();
|
||||
// Set CPU pstate
|
||||
if let Ok(pstate) = intel_pstate::PState::new() {
|
||||
info!("Setting pstate for Intel CPU");
|
||||
match mode {
|
||||
FanLevel::Normal => {
|
||||
pstate.set_min_perf_pct(config.mode_performance.normal.min_percentage)?;
|
||||
pstate.set_max_perf_pct(config.mode_performance.normal.max_percentage)?;
|
||||
pstate.set_no_turbo(config.mode_performance.normal.no_turbo)?;
|
||||
info!(
|
||||
"CPU Power: min-freq: {:?}, max-freq: {:?}, turbo: {:?}",
|
||||
"Intel CPU Power: min: {:?}%, max: {:?}%, turbo: {:?}",
|
||||
config.mode_performance.normal.min_percentage,
|
||||
config.mode_performance.normal.max_percentage,
|
||||
!config.mode_performance.normal.no_turbo
|
||||
@@ -192,7 +191,7 @@ impl RogCore {
|
||||
pstate.set_max_perf_pct(config.mode_performance.boost.max_percentage)?;
|
||||
pstate.set_no_turbo(config.mode_performance.boost.no_turbo)?;
|
||||
info!(
|
||||
"CPU Power: min-freq: {:?}, max-freq: {:?}, turbo: {:?}",
|
||||
"Intel CPU Power: min: {:?}%, max: {:?}%, turbo: {:?}",
|
||||
config.mode_performance.boost.min_percentage,
|
||||
config.mode_performance.boost.max_percentage,
|
||||
!config.mode_performance.boost.no_turbo
|
||||
@@ -203,7 +202,7 @@ impl RogCore {
|
||||
pstate.set_max_perf_pct(config.mode_performance.silent.max_percentage)?;
|
||||
pstate.set_no_turbo(config.mode_performance.silent.no_turbo)?;
|
||||
info!(
|
||||
"CPU Power: min-freq: {:?}, max-freq: {:?}, turbo: {:?}",
|
||||
"Intel CPU Power: min: {:?}%, max: {:?}%, turbo: {:?}",
|
||||
config.mode_performance.silent.min_percentage,
|
||||
config.mode_performance.silent.max_percentage,
|
||||
!config.mode_performance.silent.no_turbo
|
||||
@@ -230,7 +229,7 @@ impl RogCore {
|
||||
file.write_all(boost.as_bytes()).unwrap_or_else(|err| {
|
||||
error!("Could not write to {}, {:?}", AMD_BOOST_PATH, err)
|
||||
});
|
||||
info!("CPU Power: turbo: {:?}", boost);
|
||||
info!("AMD CPU Turbo: {:?}", boost);
|
||||
}
|
||||
FanLevel::Boost => {
|
||||
let boost = if config.mode_performance.boost.no_turbo {
|
||||
@@ -241,7 +240,7 @@ impl RogCore {
|
||||
file.write_all(boost.as_bytes()).unwrap_or_else(|err| {
|
||||
error!("Could not write to {}, {:?}", AMD_BOOST_PATH, err)
|
||||
});
|
||||
info!("CPU Power: turbo: {:?}", boost);
|
||||
info!("AMD CPU Turbo: {:?}", boost);
|
||||
}
|
||||
FanLevel::Silent => {
|
||||
let boost = if config.mode_performance.silent.no_turbo {
|
||||
@@ -252,7 +251,7 @@ impl RogCore {
|
||||
file.write_all(boost.as_bytes()).unwrap_or_else(|err| {
|
||||
error!("Could not write to {}, {:?}", AMD_BOOST_PATH, err)
|
||||
});
|
||||
info!("CPU Power: turbo: {:?}", boost);
|
||||
info!("AMD CPU Turbo: {:?}", boost);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user