mirror of
https://gitlab.com/asus-linux/asusctl.git
synced 2026-01-22 17:33:19 +01:00
Doc and feature fixes
This commit is contained in:
@@ -8,6 +8,9 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
||||
|
||||
### Changed
|
||||
- Added ability to change what EPP is linked with each throttle profile
|
||||
- Don't change EPP or thermal profile if the battery/ac state hasn't actually changed on resume
|
||||
- Re-implement the `asusctl -s` command (not fully)
|
||||
- Add more docs to some parts of code, and dbus interfaces
|
||||
|
||||
## [v5.0.7]
|
||||
### Changed
|
||||
|
||||
@@ -180,10 +180,23 @@ fn do_parsed(
|
||||
dbus.proxies().aura().set_brightness(brightness.prev())?;
|
||||
}
|
||||
|
||||
// TODO:
|
||||
// if parsed.show_supported {
|
||||
// println!("Supported laptop functions:\n\n{}", supported);
|
||||
// }
|
||||
if parsed.show_supported {
|
||||
println!("Supported Core Functions:\n{:#?}", supported_interfaces);
|
||||
println!(
|
||||
"Supported Platform Properties:\n{:#?}",
|
||||
supported_properties
|
||||
);
|
||||
if supported_interfaces.contains(&"Aura".to_owned()) {
|
||||
let bright = dbus.proxies().aura().supported_brightness()?;
|
||||
let modes = dbus.proxies().aura().supported_basic_modes()?;
|
||||
let zones = dbus.proxies().aura().supported_basic_zones()?;
|
||||
let power = dbus.proxies().aura().supported_power_zones()?;
|
||||
println!("Supported Keyboard Brightness:\n{:#?}", bright);
|
||||
println!("Supported Aura Modes:\n{:#?}", modes);
|
||||
println!("Supported Aura Zones:\n{:#?}", zones);
|
||||
println!("Supported Aura Power Zones:\n{:#?}", power);
|
||||
}
|
||||
}
|
||||
|
||||
if let Some(chg_limit) = parsed.chg_limit {
|
||||
dbus.proxies()
|
||||
|
||||
@@ -7,29 +7,45 @@ const CONFIG_FILE: &str = "asusd.ron";
|
||||
|
||||
#[derive(Deserialize, Serialize, Default, Debug)]
|
||||
pub struct Config {
|
||||
/// Save charge limit for restoring on boot
|
||||
/// Save charge limit for restoring on boot/resume
|
||||
pub charge_control_end_threshold: u8,
|
||||
pub panel_od: bool,
|
||||
pub mini_led_mode: bool,
|
||||
pub disable_nvidia_powerd_on_battery: bool,
|
||||
/// An optional command/script to run when power is changed to AC
|
||||
pub ac_command: String,
|
||||
/// An optional command/script to run when power is changed to battery
|
||||
pub bat_command: String,
|
||||
/// Set true if energy_performance_preference should be set if the
|
||||
/// throttle/platform profile is changed
|
||||
pub throttle_policy_linked_epp: bool,
|
||||
/// Which throttle/profile to use on battery power
|
||||
pub throttle_policy_on_battery: ThrottlePolicy,
|
||||
/// Which throttle/profile to use on AC power
|
||||
pub throttle_policy_on_ac: ThrottlePolicy,
|
||||
//
|
||||
/// The energy_performance_preference for this throttle/platform profile
|
||||
pub throttle_quiet_epp: CPUEPP,
|
||||
/// The energy_performance_preference for this throttle/platform profile
|
||||
pub throttle_balanced_epp: CPUEPP,
|
||||
/// The energy_performance_preference for this throttle/platform profile
|
||||
pub throttle_performance_epp: CPUEPP,
|
||||
|
||||
//
|
||||
/// Defaults to `None` if not supported
|
||||
pub ppt_pl1_spl: Option<u8>,
|
||||
/// Defaults to `None` if not supported
|
||||
pub ppt_pl2_sppt: Option<u8>,
|
||||
/// Defaults to `None` if not supported
|
||||
pub ppt_fppt: Option<u8>,
|
||||
/// Defaults to `None` if not supported
|
||||
pub ppt_apu_sppt: Option<u8>,
|
||||
/// Defaults to `None` if not supported
|
||||
pub ppt_platform_sppt: Option<u8>,
|
||||
/// Defaults to `None` if not supported
|
||||
pub nv_dynamic_boost: Option<u8>,
|
||||
/// Defaults to `None` if not supported
|
||||
pub nv_temp_target: Option<u8>,
|
||||
/// Temporary state for AC/Batt
|
||||
#[serde(skip)]
|
||||
pub last_power_plugged: u8,
|
||||
}
|
||||
|
||||
impl StdConfig for Config {
|
||||
@@ -100,6 +116,7 @@ impl From<Config507> for Config {
|
||||
ppt_platform_sppt: c.ppt_platform_sppt,
|
||||
nv_dynamic_boost: c.nv_dynamic_boost,
|
||||
nv_temp_target: c.nv_temp_target,
|
||||
last_power_plugged: 0,
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -150,6 +167,7 @@ impl From<Config506> for Config {
|
||||
ppt_platform_sppt: c.ppt_platform_sppt,
|
||||
nv_dynamic_boost: c.nv_dynamic_boost,
|
||||
nv_temp_target: c.nv_temp_target,
|
||||
last_power_plugged: 0,
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -17,7 +17,8 @@ use crate::ctrl_fancurves::{CtrlFanCurveZbus, FAN_CURVE_ZBUS_NAME, FAN_CURVE_ZBU
|
||||
use crate::error::RogError;
|
||||
use crate::{task_watch_item, task_watch_item_notify, CtrlTask};
|
||||
|
||||
const ZBUS_PATH: &str = "/org/asuslinux/Platform";
|
||||
const PLATFORM_ZBUS_NAME: &str = "Platform";
|
||||
const PLATFORM_ZBUS_PATH: &str = "/org/asuslinux/Platform";
|
||||
|
||||
macro_rules! platform_get_value {
|
||||
($self:ident, $property:tt, $prop_name:literal) => {
|
||||
@@ -300,6 +301,13 @@ impl CtrlPlatform {
|
||||
{
|
||||
interfaces.push(FAN_CURVE_ZBUS_NAME.to_owned());
|
||||
}
|
||||
if server
|
||||
.interface::<_, CtrlPlatform>(PLATFORM_ZBUS_PATH)
|
||||
.await
|
||||
.is_ok()
|
||||
{
|
||||
interfaces.push(PLATFORM_ZBUS_NAME.to_owned());
|
||||
}
|
||||
interfaces
|
||||
}
|
||||
|
||||
@@ -434,6 +442,8 @@ impl CtrlPlatform {
|
||||
Ok(())
|
||||
}
|
||||
|
||||
/// The energy_performance_preference for the quiet throttle/platform
|
||||
/// profile
|
||||
#[dbus_interface(property)]
|
||||
async fn throttle_quiet_epp(&self) -> Result<CPUEPP, FdoErr> {
|
||||
Ok(self.config.lock().await.throttle_quiet_epp)
|
||||
@@ -447,6 +457,8 @@ impl CtrlPlatform {
|
||||
Ok(())
|
||||
}
|
||||
|
||||
/// The energy_performance_preference for the balanced throttle/platform
|
||||
/// profile
|
||||
#[dbus_interface(property)]
|
||||
async fn throttle_balanced_epp(&self) -> Result<CPUEPP, FdoErr> {
|
||||
Ok(self.config.lock().await.throttle_balanced_epp)
|
||||
@@ -460,6 +472,8 @@ impl CtrlPlatform {
|
||||
Ok(())
|
||||
}
|
||||
|
||||
/// The energy_performance_preference for the performance throttle/platform
|
||||
/// profile
|
||||
#[dbus_interface(property)]
|
||||
async fn throttle_performance_epp(&self) -> Result<CPUEPP, FdoErr> {
|
||||
Ok(self.config.lock().await.throttle_performance_epp)
|
||||
@@ -528,7 +542,10 @@ impl CtrlPlatform {
|
||||
platform_get_value!(self, egpu_enable, "egpu_enable")
|
||||
}
|
||||
|
||||
/// ************************************************************************
|
||||
/// ***********************************************************************
|
||||
/// Set the Package Power Target total of CPU: PL1 on Intel, SPL on AMD.
|
||||
/// Shown on Intel+Nvidia or AMD+Nvidia based systems:
|
||||
/// * min=5, max=250
|
||||
#[dbus_interface(property)]
|
||||
async fn ppt_pl1_spl(&self) -> Result<u8, FdoErr> {
|
||||
platform_get_value_if_some!(self, ppt_pl1_spl, "ppt_pl1_spl", 5)
|
||||
@@ -539,6 +556,9 @@ impl CtrlPlatform {
|
||||
platform_set_with_min_max!(self, ppt_pl1_spl, "ppt_pl1_spl", value, 5, 250)
|
||||
}
|
||||
|
||||
/// Set the Slow Package Power Tracking Limit of CPU: PL2 on Intel, SPPT,
|
||||
/// on AMD. Shown on Intel+Nvidia or AMD+Nvidia based systems:
|
||||
/// * min=5, max=250
|
||||
#[dbus_interface(property)]
|
||||
async fn ppt_pl2_sppt(&self) -> Result<u8, FdoErr> {
|
||||
platform_get_value_if_some!(self, ppt_pl2_sppt, "ppt_pl2_sppt", 5)
|
||||
@@ -549,6 +569,8 @@ impl CtrlPlatform {
|
||||
platform_set_with_min_max!(self, ppt_pl2_sppt, "ppt_pl2_sppt", value, 5, 250)
|
||||
}
|
||||
|
||||
/// Set the Fast Package Power Tracking Limit of CPU. AMD+Nvidia only:
|
||||
/// * min=5, max=250
|
||||
#[dbus_interface(property)]
|
||||
async fn ppt_fppt(&self) -> Result<u8, FdoErr> {
|
||||
platform_get_value_if_some!(self, ppt_fppt, "ppt_fppt", 5)
|
||||
@@ -559,6 +581,8 @@ impl CtrlPlatform {
|
||||
platform_set_with_min_max!(self, ppt_fppt, "ppt_fppt", value, 5, 250)
|
||||
}
|
||||
|
||||
/// Set the APU SPPT limit. Shown on full AMD systems only:
|
||||
/// * min=5, max=130
|
||||
#[dbus_interface(property)]
|
||||
async fn ppt_apu_sppt(&self) -> Result<u8, FdoErr> {
|
||||
platform_get_value_if_some!(self, ppt_apu_sppt, "ppt_apu_sppt", 5)
|
||||
@@ -569,6 +593,8 @@ impl CtrlPlatform {
|
||||
platform_set_with_min_max!(self, ppt_apu_sppt, "ppt_apu_sppt", value, 5, 130)
|
||||
}
|
||||
|
||||
/// Set the platform SPPT limit. Shown on full AMD systems only:
|
||||
/// * min=5, max=130
|
||||
#[dbus_interface(property)]
|
||||
async fn ppt_platform_sppt(&self) -> Result<u8, FdoErr> {
|
||||
platform_get_value_if_some!(self, ppt_platform_sppt, "ppt_platform_sppt", 5)
|
||||
@@ -579,6 +605,8 @@ impl CtrlPlatform {
|
||||
platform_set_with_min_max!(self, ppt_platform_sppt, "ppt_platform_sppt", value, 5, 130)
|
||||
}
|
||||
|
||||
/// Set the dynamic boost limit of the Nvidia dGPU:
|
||||
/// * min=5, max=25
|
||||
#[dbus_interface(property)]
|
||||
async fn nv_dynamic_boost(&self) -> Result<u8, FdoErr> {
|
||||
platform_get_value_if_some!(self, nv_dynamic_boost, "nv_dynamic_boost", 5)
|
||||
@@ -589,6 +617,8 @@ impl CtrlPlatform {
|
||||
platform_set_with_min_max!(self, nv_dynamic_boost, "nv_dynamic_boost", value, 5, 25)
|
||||
}
|
||||
|
||||
/// Set the target temperature limit of the Nvidia dGPU:
|
||||
/// * min=75, max=87
|
||||
#[dbus_interface(property)]
|
||||
async fn nv_temp_target(&self) -> Result<u8, FdoErr> {
|
||||
platform_get_value_if_some!(self, nv_temp_target, "nv_temp_target", 5)
|
||||
@@ -602,7 +632,7 @@ impl CtrlPlatform {
|
||||
|
||||
impl crate::ZbusRun for CtrlPlatform {
|
||||
async fn add_to_server(self, server: &mut Connection) {
|
||||
Self::add_to_server_helper(self, ZBUS_PATH, server).await;
|
||||
Self::add_to_server_helper(self, PLATFORM_ZBUS_PATH, server).await;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -625,6 +655,7 @@ impl crate::Reloadable for CtrlPlatform {
|
||||
}
|
||||
|
||||
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() {
|
||||
let change_epp = self.config.lock().await.throttle_policy_linked_epp;
|
||||
self.update_policy_ac_or_bat(power_plugged > 0, change_epp)
|
||||
@@ -670,7 +701,7 @@ impl CtrlPlatform {
|
||||
|
||||
impl CtrlTask for CtrlPlatform {
|
||||
fn zbus_path() -> &'static str {
|
||||
ZBUS_PATH
|
||||
PLATFORM_ZBUS_PATH
|
||||
}
|
||||
|
||||
async fn create_tasks(&self, signal_ctxt: SignalContext<'static>) -> Result<(), RogError> {
|
||||
@@ -706,15 +737,18 @@ impl CtrlTask for CtrlPlatform {
|
||||
.ok();
|
||||
}
|
||||
if let Ok(power_plugged) = platform1.power.get_online() {
|
||||
if !sleeping && platform1.platform.has_throttle_thermal_policy() {
|
||||
let change_epp =
|
||||
platform1.config.lock().await.throttle_policy_linked_epp;
|
||||
platform1
|
||||
.update_policy_ac_or_bat(power_plugged > 0, change_epp)
|
||||
.await;
|
||||
}
|
||||
if !sleeping {
|
||||
platform1.run_ac_or_bat_cmd(power_plugged > 0).await;
|
||||
if platform1.config.lock().await.last_power_plugged != power_plugged {
|
||||
if !sleeping && platform1.platform.has_throttle_thermal_policy() {
|
||||
let change_epp =
|
||||
platform1.config.lock().await.throttle_policy_linked_epp;
|
||||
platform1
|
||||
.update_policy_ac_or_bat(power_plugged > 0, change_epp)
|
||||
.await;
|
||||
}
|
||||
if !sleeping {
|
||||
platform1.run_ac_or_bat_cmd(power_plugged > 0).await;
|
||||
}
|
||||
platform1.config.lock().await.last_power_plugged = power_plugged;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user