Compare commits

...

5 Commits

Author SHA1 Message Date
Luke D. Jones ad63c429cb Bugfix: urgent small fixes 2025-01-15 22:19:46 +13:00
Luke D. Jones a790d9a499 Remove dangerous use of ppt* in platform, add use of ppt_pl3_fppt in asus_armoury handler 2025-01-13 23:18:19 +13:00
Luke D. Jones be51a1ab77 Disable strip in Makefile 2025-01-13 22:38:30 +13:00
Luke D. Jones d9a88e7cc3 Notify user via message in UI if asus-armoury not loaded 2025-01-13 14:32:13 +13:00
Luke D. Jones d785e17f95 Allow version in makefile to have '-rc*' 2025-01-12 18:52:45 +13:00
16 changed files with 279 additions and 431 deletions
+6
View File
@@ -4,6 +4,12 @@
## [v6.1.0-rc2]
### Changed
- Bug fixes
- Partial support for per-profile CPU tunings (WIP)
## [v6.1.0-rc2]
### Added
- asus-armoury driver support. WIP, will be adjusted/changed further
- More "Slash" display controls
+1 -1
View File
@@ -1,5 +1,5 @@
[workspace.package]
version = "6.1.0-rc2"
version = "6.1.0-rc3"
rust-version = "1.82"
license = "MPL-2.0"
readme = "README.md"
+2 -2
View File
@@ -1,4 +1,4 @@
VERSION := $(shell /usr/bin/grep -Pm1 'version = "(\d+.\d+.\d+)"' Cargo.toml | cut -d'"' -f2)
VERSION := $(shell /usr/bin/grep -Pm1 'version = "(\d+.\d+.\d+.*)"' Cargo.toml | cut -d'"' -f2)
INSTALL = install
INSTALL_PROGRAM = ${INSTALL} -D -m 0755
@@ -19,7 +19,7 @@ LEDCFG := aura_support.ron
SRC := Cargo.toml Cargo.lock Makefile $(shell find -type f -wholename '**/src/*.rs')
STRIP_BINARIES ?= 1
STRIP_BINARIES ?= 0
DEBUG ?= 0
ifeq ($(DEBUG),0)
+51 -23
View File
@@ -1,11 +1,18 @@
use std::str::FromStr;
use std::sync::Arc;
use ::zbus::export::futures_util::lock::Mutex;
use config_traits::StdConfig;
use log::error;
use rog_platform::firmware_attributes::{
AttrValue, Attribute, FirmwareAttribute, FirmwareAttributes
};
use rog_platform::platform::{RogPlatform, ThrottlePolicy};
use serde::{Deserialize, Serialize};
use zbus::zvariant::{ObjectPath, OwnedObjectPath, OwnedValue, Type, Value};
use zbus::{fdo, interface, Connection};
use crate::config::Config;
use crate::error::RogError;
use crate::ASUS_ZBUS_PATH;
@@ -21,18 +28,27 @@ fn dbus_path_for_attr(attr_name: &str) -> OwnedObjectPath {
ObjectPath::from_str_unchecked(&format!("{ASUS_ZBUS_PATH}/{MOD_NAME}/{attr_name}")).into()
}
pub struct AsusArmouryAttribute(Attribute);
pub struct AsusArmouryAttribute {
attr: Attribute,
config: Arc<Mutex<Config>>,
/// platform control required here for access to PPD or Throttle profile
platform: RogPlatform
}
impl AsusArmouryAttribute {
pub fn new(attr: Attribute) -> Self {
Self(attr)
pub fn new(attr: Attribute, platform: RogPlatform, config: Arc<Mutex<Config>>) -> Self {
Self {
attr,
config,
platform
}
}
pub async fn start_tasks(self, connection: &Connection) -> Result<(), RogError> {
// self.reload()
// .await
// .unwrap_or_else(|err| warn!("Controller error: {}", err));
let path = dbus_path_for_attr(self.0.name());
let path = dbus_path_for_attr(self.attr.name());
connection
.object_server()
.at(path.clone(), self)
@@ -48,30 +64,30 @@ impl AsusArmouryAttribute {
#[interface(name = "xyz.ljones.AsusArmoury")]
impl AsusArmouryAttribute {
#[zbus(property)]
async fn name(&self) -> FirmwareAttribute {
self.0.name().into()
fn name(&self) -> FirmwareAttribute {
self.attr.name().into()
}
#[zbus(property)]
async fn available_attrs(&self) -> Vec<String> {
let mut attrs = Vec::new();
if !matches!(self.0.default_value(), AttrValue::None) {
if !matches!(self.attr.default_value(), AttrValue::None) {
attrs.push("default_value".to_string());
}
if !matches!(self.0.min_value(), AttrValue::None) {
if !matches!(self.attr.min_value(), AttrValue::None) {
attrs.push("min_value".to_string());
}
if !matches!(self.0.max_value(), AttrValue::None) {
if !matches!(self.attr.max_value(), AttrValue::None) {
attrs.push("max_value".to_string());
}
if !matches!(self.0.scalar_increment(), AttrValue::None) {
if !matches!(self.attr.scalar_increment(), AttrValue::None) {
attrs.push("scalar_increment".to_string());
}
if !matches!(self.0.possible_values(), AttrValue::None) {
if !matches!(self.attr.possible_values(), AttrValue::None) {
attrs.push("possible_values".to_string());
}
// TODO: Don't unwrap, use error
if let Ok(value) = self.0.current_value().map_err(|e| {
if let Ok(value) = self.attr.current_value().map_err(|e| {
error!("Failed to read: {e:?}");
e
}) {
@@ -85,7 +101,7 @@ impl AsusArmouryAttribute {
/// If return is `-1` then there is no default value
#[zbus(property)]
async fn default_value(&self) -> i32 {
match self.0.default_value() {
match self.attr.default_value() {
AttrValue::Integer(i) => *i,
_ => -1
}
@@ -93,7 +109,7 @@ impl AsusArmouryAttribute {
#[zbus(property)]
async fn min_value(&self) -> i32 {
match self.0.min_value() {
match self.attr.min_value() {
AttrValue::Integer(i) => *i,
_ => -1
}
@@ -101,7 +117,7 @@ impl AsusArmouryAttribute {
#[zbus(property)]
async fn max_value(&self) -> i32 {
match self.0.max_value() {
match self.attr.max_value() {
AttrValue::Integer(i) => *i,
_ => -1
}
@@ -109,7 +125,7 @@ impl AsusArmouryAttribute {
#[zbus(property)]
async fn scalar_increment(&self) -> i32 {
match self.0.scalar_increment() {
match self.attr.scalar_increment() {
AttrValue::Integer(i) => *i,
_ => -1
}
@@ -117,7 +133,7 @@ impl AsusArmouryAttribute {
#[zbus(property)]
async fn possible_values(&self) -> Vec<i32> {
match self.0.possible_values() {
match self.attr.possible_values() {
AttrValue::EnumInt(i) => i.clone(),
_ => Vec::default()
}
@@ -125,7 +141,7 @@ impl AsusArmouryAttribute {
#[zbus(property)]
async fn current_value(&self) -> fdo::Result<i32> {
if let Ok(AttrValue::Integer(i)) = self.0.current_value() {
if let Ok(AttrValue::Integer(i)) = self.attr.current_value() {
return Ok(i);
}
Err(fdo::Error::Failed(
@@ -135,19 +151,31 @@ impl AsusArmouryAttribute {
#[zbus(property)]
async fn set_current_value(&mut self, value: i32) -> fdo::Result<()> {
Ok(self
.0
self.attr
.set_current_value(AttrValue::Integer(value))
.map_err(|e| {
error!("Could not set value: {e:?}");
e
})?)
})?;
let profile: ThrottlePolicy =
ThrottlePolicy::from_str(self.platform.get_platform_profile()?.as_str())?;
if let Some(tunings) = self.config.lock().await.tunings.get_mut(&profile) {
if let Some(tune) = tunings.get_mut(&self.name()) {
*tune = value;
}
}
self.config.lock().await.write();
Ok(())
}
}
pub async fn start_attributes_zbus(server: &Connection) -> Result<(), RogError> {
pub async fn start_attributes_zbus(
server: &Connection,
platform: RogPlatform,
config: Arc<Mutex<Config>>
) -> Result<(), RogError> {
for attr in FirmwareAttributes::new().attributes() {
AsusArmouryAttribute::new(attr.clone())
AsusArmouryAttribute::new(attr.clone(), platform.clone(), config.clone())
.start_tasks(server)
.await?;
}
+44 -56
View File
@@ -1,11 +1,14 @@
use std::collections::HashMap;
use config_traits::{StdConfig, StdConfigLoad1};
use rog_platform::cpu::CPUEPP;
use rog_platform::firmware_attributes::FirmwareAttribute;
use rog_platform::platform::ThrottlePolicy;
use serde::{Deserialize, Serialize};
const CONFIG_FILE: &str = "asusd.ron";
#[derive(Deserialize, Serialize, Debug, PartialEq, PartialOrd)]
#[derive(Deserialize, Serialize)]
pub struct Config {
// The current charge limit applied
pub charge_control_end_threshold: u8,
@@ -37,27 +40,7 @@ pub struct Config {
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
#[serde(skip_serializing_if = "Option::is_none", default)]
pub ppt_pl1_spl: Option<u8>,
/// Defaults to `None` if not supported
#[serde(skip_serializing_if = "Option::is_none", default)]
pub ppt_pl2_sppt: Option<u8>,
/// Defaults to `None` if not supported
#[serde(skip_serializing_if = "Option::is_none", default)]
pub ppt_fppt: Option<u8>,
/// Defaults to `None` if not supported
#[serde(skip_serializing_if = "Option::is_none", default)]
pub ppt_apu_sppt: Option<u8>,
/// Defaults to `None` if not supported
#[serde(skip_serializing_if = "Option::is_none", default)]
pub ppt_platform_sppt: Option<u8>,
/// Defaults to `None` if not supported
#[serde(skip_serializing_if = "Option::is_none", default)]
pub nv_dynamic_boost: Option<u8>,
/// Defaults to `None` if not supported
#[serde(skip_serializing_if = "Option::is_none", default)]
pub nv_temp_target: Option<u8>,
pub tunings: HashMap<ThrottlePolicy, HashMap<FirmwareAttribute, i32>>,
/// Temporary state for AC/Batt
#[serde(skip)]
pub last_power_plugged: u8
@@ -82,13 +65,7 @@ impl Default for Config {
throttle_quiet_epp: CPUEPP::Power,
throttle_balanced_epp: CPUEPP::BalancePower,
throttle_performance_epp: CPUEPP::Performance,
ppt_pl1_spl: Default::default(),
ppt_pl2_sppt: Default::default(),
ppt_fppt: Default::default(),
ppt_apu_sppt: Default::default(),
ppt_platform_sppt: Default::default(),
nv_dynamic_boost: Default::default(),
nv_temp_target: Default::default(),
tunings: HashMap::default(),
last_power_plugged: Default::default()
}
}
@@ -116,58 +93,69 @@ impl StdConfig for Config {
}
}
impl StdConfigLoad1<Config507> for Config {}
impl StdConfigLoad1<Config601> for Config {}
#[derive(Deserialize, Serialize)]
pub struct Config507 {
// The current charge limit applied
pub struct Config601 {
pub charge_control_end_threshold: u8,
#[serde(skip)]
pub base_charge_control_end_threshold: u8,
pub panel_od: bool,
pub boot_sound: bool,
pub mini_led_mode: bool,
pub disable_nvidia_powerd_on_battery: bool,
pub ac_command: String,
pub bat_command: String,
pub platform_policy_linked_epp: bool,
pub platform_policy_on_battery: ThrottlePolicy,
pub platform_policy_on_ac: ThrottlePolicy,
//
pub throttle_policy_linked_epp: bool,
pub throttle_policy_on_battery: ThrottlePolicy,
pub change_throttle_policy_on_battery: bool,
pub throttle_policy_on_ac: ThrottlePolicy,
pub change_throttle_policy_on_ac: bool,
pub throttle_quiet_epp: CPUEPP,
pub throttle_balanced_epp: CPUEPP,
pub throttle_performance_epp: CPUEPP,
#[serde(skip_serializing_if = "Option::is_none", default)]
pub ppt_pl1_spl: Option<u8>,
#[serde(skip_serializing_if = "Option::is_none", default)]
pub ppt_pl2_sppt: Option<u8>,
#[serde(skip_serializing_if = "Option::is_none", default)]
pub ppt_pl3_fppt: Option<u8>,
#[serde(skip_serializing_if = "Option::is_none", default)]
pub ppt_fppt: Option<u8>,
#[serde(skip_serializing_if = "Option::is_none", default)]
pub ppt_apu_sppt: Option<u8>,
#[serde(skip_serializing_if = "Option::is_none", default)]
pub ppt_platform_sppt: Option<u8>,
#[serde(skip_serializing_if = "Option::is_none", default)]
pub nv_dynamic_boost: Option<u8>,
pub nv_temp_target: Option<u8>
#[serde(skip_serializing_if = "Option::is_none", default)]
pub nv_temp_target: Option<u8>,
#[serde(skip)]
pub last_power_plugged: u8
}
impl From<Config507> for Config {
fn from(c: Config507) -> Self {
impl From<Config601> for Config {
fn from(c: Config601) -> Self {
Self {
// Restore the base charge limit
charge_control_end_threshold: c.charge_control_end_threshold,
base_charge_control_end_threshold: c.charge_control_end_threshold,
panel_od: c.panel_od,
boot_sound: false,
boot_sound: c.boot_sound,
disable_nvidia_powerd_on_battery: c.disable_nvidia_powerd_on_battery,
ac_command: c.ac_command,
bat_command: c.bat_command,
mini_led_mode: c.mini_led_mode,
throttle_policy_linked_epp: true,
throttle_policy_on_battery: c.platform_policy_on_battery,
change_throttle_policy_on_battery: true,
throttle_policy_on_ac: c.platform_policy_on_ac,
change_throttle_policy_on_ac: true,
throttle_quiet_epp: CPUEPP::Power,
throttle_balanced_epp: CPUEPP::BalancePower,
throttle_performance_epp: CPUEPP::Performance,
ppt_pl1_spl: c.ppt_pl1_spl,
ppt_pl2_sppt: c.ppt_pl2_sppt,
ppt_fppt: c.ppt_fppt,
ppt_apu_sppt: c.ppt_apu_sppt,
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
throttle_policy_linked_epp: c.throttle_policy_linked_epp,
throttle_policy_on_battery: c.throttle_policy_on_battery,
change_throttle_policy_on_battery: c.change_throttle_policy_on_battery,
throttle_policy_on_ac: c.throttle_policy_on_ac,
change_throttle_policy_on_ac: c.change_throttle_policy_on_ac,
throttle_quiet_epp: c.throttle_quiet_epp,
throttle_balanced_epp: c.throttle_balanced_epp,
throttle_performance_epp: c.throttle_performance_epp,
last_power_plugged: c.last_power_plugged,
tunings: HashMap::default()
}
}
}
+25 -220
View File
@@ -59,28 +59,6 @@ macro_rules! platform_set_value {
}
}
macro_rules! platform_ppt_set_value {
($self:ident, $property:tt, $prop_name:literal, $new_value:expr) => {
concat_idents::concat_idents!(has = has_, $property {
if $self.platform.has() {
concat_idents::concat_idents!(set = set_, $property {
$self.platform.set($new_value).map_err(|err| {
error!("RogPlatform: {} {err}", $prop_name);
FdoErr::NotSupported(format!("RogPlatform: {} {err}", $prop_name))
})?;
});
let mut lock = $self.config.lock().await;
lock.$property = Some($new_value);
lock.write();
Ok(())
} else {
debug!("RogPlatform: ppt: setting {} not supported", $prop_name);
Err(FdoErr::NotSupported(format!("RogPlatform: {} not supported", $prop_name)))
}
})
}
}
#[derive(Clone)]
pub struct CtrlPlatform {
power: AsusPower,
@@ -345,14 +323,6 @@ impl CtrlPlatform {
platform_name!(egpu_enable, Properties::EgpuEnable);
platform_name!(throttle_thermal_policy, Properties::ThrottlePolicy);
platform_name!(ppt_pl1_spl, Properties::PptPl1Spl);
platform_name!(ppt_pl2_sppt, Properties::PptPl2Sppt);
platform_name!(ppt_fppt, Properties::PptFppt);
platform_name!(ppt_apu_sppt, Properties::PptApuSppt);
platform_name!(ppt_platform_sppt, Properties::PptPlatformSppt);
platform_name!(nv_dynamic_boost, Properties::NvDynamicBoost);
platform_name!(nv_temp_target, Properties::NvTempTarget);
supported
}
@@ -631,107 +601,6 @@ impl CtrlPlatform {
fn egpu_enable(&self) -> Result<bool, FdoErr> {
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
#[zbus(property)]
async fn ppt_pl1_spl(&self) -> Result<u8, FdoErr> {
platform_get_value!(self, ppt_pl1_spl, "ppt_pl1_spl")
}
#[zbus(property)]
async fn set_ppt_pl1_spl(&mut self, value: u8) -> Result<(), FdoErr> {
platform_ppt_set_value!(self, ppt_pl1_spl, "ppt_pl1_spl", value)?;
self.config.lock().await.write();
Ok(())
}
/// 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
#[zbus(property)]
async fn ppt_pl2_sppt(&self) -> Result<u8, FdoErr> {
platform_get_value!(self, ppt_pl2_sppt, "ppt_pl2_sppt")
}
#[zbus(property)]
async fn set_ppt_pl2_sppt(&mut self, value: u8) -> Result<(), FdoErr> {
platform_ppt_set_value!(self, ppt_pl2_sppt, "ppt_pl2_sppt", value)?;
self.config.lock().await.write();
Ok(())
}
/// Set the Fast Package Power Tracking Limit of CPU. AMD+Nvidia only:
/// * min=5, max=250
#[zbus(property)]
async fn ppt_fppt(&self) -> Result<u8, FdoErr> {
platform_get_value!(self, ppt_fppt, "ppt_fppt")
}
#[zbus(property)]
async fn set_ppt_fppt(&mut self, value: u8) -> Result<(), FdoErr> {
platform_ppt_set_value!(self, ppt_fppt, "ppt_fppt", value)?;
self.config.lock().await.write();
Ok(())
}
/// Set the APU SPPT limit. Shown on full AMD systems only:
/// * min=5, max=130
#[zbus(property)]
async fn ppt_apu_sppt(&self) -> Result<u8, FdoErr> {
platform_get_value!(self, ppt_apu_sppt, "ppt_apu_sppt")
}
#[zbus(property)]
async fn set_ppt_apu_sppt(&mut self, value: u8) -> Result<(), FdoErr> {
platform_ppt_set_value!(self, ppt_apu_sppt, "ppt_apu_sppt", value)?;
self.config.lock().await.write();
Ok(())
}
/// Set the platform SPPT limit. Shown on full AMD systems only:
/// * min=5, max=130
#[zbus(property)]
async fn ppt_platform_sppt(&self) -> Result<u8, FdoErr> {
platform_get_value!(self, ppt_platform_sppt, "ppt_platform_sppt")
}
#[zbus(property)]
async fn set_ppt_platform_sppt(&mut self, value: u8) -> Result<(), FdoErr> {
platform_ppt_set_value!(self, ppt_platform_sppt, "ppt_platform_sppt", value)?;
self.config.lock().await.write();
Ok(())
}
/// Set the dynamic boost limit of the Nvidia dGPU:
/// * min=5, max=25
#[zbus(property)]
async fn nv_dynamic_boost(&self) -> Result<u8, FdoErr> {
platform_get_value!(self, nv_dynamic_boost, "nv_dynamic_boost")
}
#[zbus(property)]
async fn set_nv_dynamic_boost(&mut self, value: u8) -> Result<(), FdoErr> {
platform_ppt_set_value!(self, nv_dynamic_boost, "nv_dynamic_boost", value)?;
self.config.lock().await.write();
Ok(())
}
/// Set the target temperature limit of the Nvidia dGPU:
/// * min=75, max=87
#[zbus(property)]
async fn nv_temp_target(&self) -> Result<u8, FdoErr> {
platform_get_value!(self, nv_temp_target, "nv_temp_target")
}
#[zbus(property)]
async fn set_nv_temp_target(&mut self, value: u8) -> Result<(), FdoErr> {
platform_ppt_set_value!(self, nv_temp_target, "nv_temp_target", value)?;
self.config.lock().await.write();
Ok(())
}
}
impl crate::ZbusRun for CtrlPlatform {
@@ -750,29 +619,28 @@ impl ReloadAndNotify for CtrlPlatform {
data: Self::Data
) -> Result<(), RogError> {
let mut config = self.config.lock().await;
if *config != data {
info!("asusd.ron updated externally, reloading and updating internal copy");
info!("asusd.ron updated externally, reloading and updating internal copy");
let mut base_charge_control_end_threshold = None;
let mut base_charge_control_end_threshold = None;
if self.power.has_charge_control_end_threshold() {
let limit = data.charge_control_end_threshold;
warn!("setting charge_control_end_threshold to {limit}");
self.power.set_charge_control_end_threshold(limit)?;
self.charge_control_end_threshold_changed(signal_context)
.await?;
base_charge_control_end_threshold = (config.base_charge_control_end_threshold > 0)
.then_some(config.base_charge_control_end_threshold)
.or(Some(limit));
}
if self.power.has_charge_control_end_threshold() {
let limit = data.charge_control_end_threshold;
warn!("setting charge_control_end_threshold to {limit}");
self.power.set_charge_control_end_threshold(limit)?;
self.charge_control_end_threshold_changed(signal_context)
.await?;
base_charge_control_end_threshold = (config.base_charge_control_end_threshold > 0)
.then_some(config.base_charge_control_end_threshold)
.or(Some(limit));
}
if self.platform.has_throttle_thermal_policy()
&& config.throttle_policy_linked_epp != data.throttle_policy_linked_epp
{
// TODO: extra stuff
}
if self.platform.has_throttle_thermal_policy()
&& config.throttle_policy_linked_epp != data.throttle_policy_linked_epp
{
// TODO: extra stuff
}
macro_rules! reload_and_notify {
macro_rules! reload_and_notify {
($property:tt, $prop_name:literal) => {
concat_idents::concat_idents!(has = has_, $property {
if self.platform.has() && config.$property != data.$property {
@@ -785,36 +653,14 @@ impl ReloadAndNotify for CtrlPlatform {
})
}
}
reload_and_notify!(mini_led_mode, "mini_led_mode");
reload_and_notify!(panel_od, "panel_od");
reload_and_notify!(boot_sound, "boot_sound");
// reload_and_notify!(throttle_thermal_policy, "throttle_thermal_policy");
reload_and_notify!(mini_led_mode, "mini_led_mode");
reload_and_notify!(panel_od, "panel_od");
reload_and_notify!(boot_sound, "boot_sound");
// reload_and_notify!(throttle_thermal_policy, "throttle_thermal_policy");
macro_rules! ppt_reload_and_notify {
($property:tt, $prop_name:literal) => {
concat_idents::concat_idents!(has = has_, $property {
if self.platform.has() && config.$property != data.$property {
concat_idents::concat_idents!(set = set_, $property {
self.platform
.set(data.$property.unwrap_or_default())?;});
concat_idents::concat_idents!(changed = $property, _changed {
self.changed(signal_context).await?;});
}
})
}
}
ppt_reload_and_notify!(ppt_pl1_spl, "ppt_pl1_spl");
ppt_reload_and_notify!(ppt_pl2_sppt, "ppt_pl2_sppt");
ppt_reload_and_notify!(ppt_fppt, "ppt_fppt");
ppt_reload_and_notify!(ppt_apu_sppt, "ppt_apu_sppt");
ppt_reload_and_notify!(ppt_platform_sppt, "ppt_platform_sppt");
ppt_reload_and_notify!(nv_dynamic_boost, "nv_dynamic_boost");
ppt_reload_and_notify!(nv_temp_target, "nv_temp_target");
*config = data;
config.base_charge_control_end_threshold =
base_charge_control_end_threshold.unwrap_or_default();
}
*config = data;
config.base_charge_control_end_threshold =
base_charge_control_end_threshold.unwrap_or_default();
Ok(())
}
@@ -848,25 +694,6 @@ impl crate::Reloadable for CtrlPlatform {
reload!(panel_od, "panel_od");
reload!(boot_sound, "boot_sound");
macro_rules! ppt_reload {
($property:tt, $prop_name:literal) => {
concat_idents::concat_idents!(has = has_, $property {
if self.platform.has() {
concat_idents::concat_idents!(set = set_, $property {
self.platform
.set(self.config.lock().await.$property.unwrap_or_default())?;});
}
})
}
}
ppt_reload!(ppt_pl1_spl, "ppt_pl1_spl");
ppt_reload!(ppt_pl2_sppt, "ppt_pl2_sppt");
ppt_reload!(ppt_fppt, "ppt_fppt");
ppt_reload!(ppt_apu_sppt, "ppt_apu_sppt");
ppt_reload!(ppt_platform_sppt, "ppt_platform_sppt");
ppt_reload!(nv_dynamic_boost, "nv_dynamic_boost");
ppt_reload!(nv_temp_target, "nv_temp_target");
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() {
@@ -896,20 +723,6 @@ impl CtrlPlatform {
// NOTE: see note further below
task_watch_item_notify!(gpu_mux_mode platform);
task_watch_item_notify!(ppt_pl1_spl platform);
task_watch_item_notify!(ppt_pl2_sppt platform);
task_watch_item_notify!(ppt_fppt platform);
task_watch_item_notify!(ppt_apu_sppt platform);
task_watch_item_notify!(ppt_platform_sppt platform);
task_watch_item_notify!(nv_dynamic_boost platform);
task_watch_item_notify!(nv_temp_target platform);
}
impl CtrlTask for CtrlPlatform {
@@ -1043,14 +856,6 @@ impl CtrlTask for CtrlPlatform {
self.watch_gpu_mux_mode(signal_ctxt.clone()).await?;
self.watch_boot_sound(signal_ctxt.clone()).await?;
self.watch_ppt_pl1_spl(signal_ctxt.clone()).await?;
self.watch_ppt_pl2_sppt(signal_ctxt.clone()).await?;
self.watch_ppt_fppt(signal_ctxt.clone()).await?;
self.watch_ppt_apu_sppt(signal_ctxt.clone()).await?;
self.watch_ppt_platform_sppt(signal_ctxt.clone()).await?;
self.watch_nv_dynamic_boost(signal_ctxt.clone()).await?;
self.watch_nv_temp_target(signal_ctxt.clone()).await?;
let watch_throttle_thermal_policy = self.platform.monitor_throttle_thermal_policy()?;
let ctrl = self.clone();
+3 -1
View File
@@ -12,6 +12,7 @@ use asusd::ctrl_platform::CtrlPlatform;
use asusd::{print_board_info, start_tasks, CtrlTask, DBUS_NAME};
use config_traits::{StdConfig, StdConfigLoad1};
use log::{error, info};
use rog_platform::platform::RogPlatform;
use zbus::fdo::ObjectManager;
#[tokio::main]
@@ -65,7 +66,8 @@ async fn start_daemon() -> Result<(), Box<dyn Error>> {
let config = Arc::new(Mutex::new(config));
// supported.add_to_server(&mut connection).await;
start_attributes_zbus(&server).await?;
let platform = RogPlatform::new()?; // TODO: maybe needs async mutex?
start_attributes_zbus(&server, platform, config.clone()).await?;
match CtrlFanCurveZbus::new() {
Ok(ctrl) => {
+1 -1
View File
@@ -203,7 +203,7 @@ macro_rules! std_config_load {
/// new one created
pub trait $trait_name<$($generic),*>
where
Self: $crate::StdConfig +std::fmt::Debug + DeserializeOwned + Serialize,
Self: $crate::StdConfig + DeserializeOwned + Serialize,
$($generic: DeserializeOwned + Into<Self>),*
{
fn load(mut self) -> Self {
+10 -10
View File
@@ -548,6 +548,15 @@
advanced_type: Zoned([SingleZone]),
power_zones: [Keyboard],
),
(
device_name: "GA605W",
product_id: "",
layout_name: "ga401q",
basic_modes: [Static, Breathe, RainbowCycle, RainbowWave, Pulse],
basic_zones: [],
advanced_type: Zoned([SingleZone]),
power_zones: [Keyboard],
),
(
device_name: "GL503",
product_id: "",
@@ -665,15 +674,6 @@
advanced_type: Zoned([SingleZone]),
power_zones: [Keyboard],
),
(
device_name: "GA605W",
product_id: "",
layout_name: "ga401q",
basic_modes: [Static, Breathe, RainbowCycle, RainbowWave, Pulse],
basic_zones: [],
advanced_type: Zoned([SingleZone]),
power_zones: [Keyboard],
),
(
device_name: "GV301Q",
product_id: "",
@@ -854,4 +854,4 @@
advanced_type: None,
power_zones: [Ally],
),
])
])
-1
View File
@@ -127,7 +127,6 @@ async fn set_tray_icon_and_tip(
};
tray.update(|tray: &mut AsusTray| {
dbg!(power);
tray.current_icon = icon;
tray.current_title = format!(
"ROG: gpu mode = {mode:?}, gpu power =
+28 -8
View File
@@ -1,6 +1,7 @@
use std::sync::{Arc, Mutex};
use concat_idents::concat_idents;
use log::error;
use rog_dbus::asus_armoury::AsusArmouryProxy;
use rog_dbus::zbus_platform::{PlatformProxy, PlatformProxyBlocking};
use rog_platform::firmware_attributes::FirmwareAttribute;
@@ -208,9 +209,6 @@ pub fn setup_system_page_callbacks(ui: &MainWindow, _states: Arc<Mutex<Config>>)
// Create the connections/proxies here to prevent future delays in process
let conn = zbus::Connection::system().await.unwrap();
let platform = PlatformProxy::new(&conn).await.unwrap();
let armoury_attrs = find_iface_async::<AsusArmouryProxy>("xyz.ljones.AsusArmoury")
.await
.unwrap();
set_ui_props_async!(
handle,
@@ -239,6 +237,23 @@ pub fn setup_system_page_callbacks(ui: &MainWindow, _states: Arc<Mutex<Config>>)
change_throttle_policy_on_ac
);
let armoury_attrs;
if let Ok(attrs) = find_iface_async::<AsusArmouryProxy>("xyz.ljones.AsusArmoury").await {
armoury_attrs = attrs;
handle
.upgrade_in_event_loop(|ui| {
ui.global::<SystemPageData>().set_asus_armoury_loaded(true)
})
.ok();
} else {
error!(
"The kernel module asus-armoury is required, if you do not have this you will \
need to either build or install a kernel which includes the patchwork. This \
driver is in process of being upstreamed"
);
return;
}
for attr in armoury_attrs {
if let Ok(value) = attr.current_value().await {
let name = attr.name().await.unwrap();
@@ -257,6 +272,16 @@ pub fn setup_system_page_callbacks(ui: &MainWindow, _states: Arc<Mutex<Config>>)
setup_callback!(ppt_pl2_sppt, handle, attr, i32);
setup_minmax_external!(ppt_pl2_sppt, handle, attr);
}
FirmwareAttribute::PptPl3Fppt => {
init_minmax_property!(ppt_pl3_fppt, handle, attr);
setup_callback!(ppt_pl3_fppt, handle, attr, i32);
setup_minmax_external!(ppt_pl3_fppt, handle, attr);
}
FirmwareAttribute::PptFppt => {
init_minmax_property!(ppt_fppt, handle, attr);
setup_callback!(ppt_fppt, handle, attr, i32);
setup_minmax_external!(ppt_fppt, handle, attr);
}
FirmwareAttribute::PptApuSppt => {
init_minmax_property!(ppt_apu_sppt, handle, attr);
setup_callback!(ppt_apu_sppt, handle, attr, i32);
@@ -267,11 +292,6 @@ pub fn setup_system_page_callbacks(ui: &MainWindow, _states: Arc<Mutex<Config>>)
setup_callback!(ppt_platform_sppt, handle, attr, i32);
setup_minmax_external!(ppt_platform_sppt, handle, attr);
}
FirmwareAttribute::PptFppt => {
init_minmax_property!(ppt_fppt, handle, attr);
setup_callback!(ppt_fppt, handle, attr, i32);
setup_minmax_external!(ppt_fppt, handle, attr);
}
FirmwareAttribute::NvDynamicBoost => {
init_minmax_property!(nv_dynamic_boost, handle, attr);
setup_callback!(nv_dynamic_boost, handle, attr, i32);
+1 -1
View File
@@ -146,5 +146,5 @@ where
return Ok(ctrl);
}
Err("No Aura interface".into())
Err("No interface".into())
}
@@ -2,7 +2,7 @@
msgid ""
msgstr ""
"Project-Id-Version: PACKAGE VERSION\n"
"POT-Creation-Date: 2025-01-12 04:36+0000\n"
"POT-Creation-Date: 2025-01-13 09:38+0000\n"
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
"Language-Team: LANGUAGE <LL@li.org>\n"
@@ -47,122 +47,132 @@ msgctxt "SystemPageData"
msgid "Power"
msgstr ""
#: rog-control-center/ui/pages/system.slint:122
#: rog-control-center/ui/pages/system.slint:123
msgctxt "PageSystem"
msgid "Power settings"
msgstr ""
#: rog-control-center/ui/pages/system.slint:127
#: rog-control-center/ui/pages/system.slint:128
msgctxt "PageSystem"
msgid "Charge limit"
msgstr ""
#: rog-control-center/ui/pages/system.slint:139
#: rog-control-center/ui/pages/system.slint:140
msgctxt "PageSystem"
msgid "Throttle Policy"
msgstr ""
#: rog-control-center/ui/pages/system.slint:149
#: rog-control-center/ui/pages/system.slint:150
msgctxt "PageSystem"
msgid "Advanced"
msgstr ""
#: rog-control-center/ui/pages/system.slint:167
#: rog-control-center/ui/pages/system.slint:168
msgctxt "PageSystem"
msgid "Armoury settings"
msgstr ""
#: rog-control-center/ui/pages/system.slint:175
#: rog-control-center/ui/pages/system.slint:176
msgctxt "PageSystem"
msgid "Panel Overdrive"
msgstr ""
#: rog-control-center/ui/pages/system.slint:183
#: rog-control-center/ui/pages/system.slint:184
msgctxt "PageSystem"
msgid "MiniLED Mode"
msgstr ""
#: rog-control-center/ui/pages/system.slint:191
#: rog-control-center/ui/pages/system.slint:192
msgctxt "PageSystem"
msgid "POST boot sound"
msgstr ""
#: rog-control-center/ui/pages/system.slint:200
#: rog-control-center/ui/pages/system.slint:203
msgctxt "PageSystem"
msgid "The asus-armoury driver is not loaded"
msgstr ""
#: rog-control-center/ui/pages/system.slint:208
msgctxt "PageSystem"
msgid "For advanced features you will require a kernel with this driver added."
msgstr ""
#: rog-control-center/ui/pages/system.slint:216
msgctxt "ppt_pl1_spl"
msgid "PL1, sustained power limit"
msgstr ""
#: rog-control-center/ui/pages/system.slint:211
#: rog-control-center/ui/pages/system.slint:227
msgctxt "ppt_pl2_sppt"
msgid "PL2, turbo power limit"
msgstr ""
#: rog-control-center/ui/pages/system.slint:222
#: rog-control-center/ui/pages/system.slint:238
msgctxt "ppt_fppt"
msgid "FPPT, Fast Power Limit"
msgstr ""
#: rog-control-center/ui/pages/system.slint:233
#: rog-control-center/ui/pages/system.slint:249
msgctxt "ppt_apu_sppt"
msgid "SPPT, APU slow power limit"
msgstr ""
#: rog-control-center/ui/pages/system.slint:244
#: rog-control-center/ui/pages/system.slint:260
msgctxt "ppt_platform_sppt"
msgid "Slow package power tracking limit"
msgstr ""
#: rog-control-center/ui/pages/system.slint:255
#: rog-control-center/ui/pages/system.slint:271
msgctxt "nv_dynamic_boost"
msgid "dGPU boost overclock"
msgstr ""
#: rog-control-center/ui/pages/system.slint:266
#: rog-control-center/ui/pages/system.slint:282
msgctxt "nv_temp_target"
msgid "dGPU temperature max"
msgstr ""
#: rog-control-center/ui/pages/system.slint:313
#: rog-control-center/ui/pages/system.slint:329
msgctxt "PageSystem"
msgid "Energy Performance Preference linked to Throttle Policy"
msgstr ""
#: rog-control-center/ui/pages/system.slint:317
#: rog-control-center/ui/pages/system.slint:333
msgctxt "PageSystem"
msgid "Change EPP based on Throttle Policy"
msgstr ""
#: rog-control-center/ui/pages/system.slint:325
#: rog-control-center/ui/pages/system.slint:341
msgctxt "PageSystem"
msgid "EPP for Balanced Policy"
msgstr ""
#: rog-control-center/ui/pages/system.slint:335
#: rog-control-center/ui/pages/system.slint:351
msgctxt "PageSystem"
msgid "EPP for Performance Policy"
msgstr ""
#: rog-control-center/ui/pages/system.slint:345
#: rog-control-center/ui/pages/system.slint:361
msgctxt "PageSystem"
msgid "EPP for Quiet Policy"
msgstr ""
#: rog-control-center/ui/pages/system.slint:363
#: rog-control-center/ui/pages/system.slint:379
msgctxt "PageSystem"
msgid "Throttle Policy for power state"
msgstr ""
#: rog-control-center/ui/pages/system.slint:369
#: rog-control-center/ui/pages/system.slint:385
msgctxt "PageSystem"
msgid "Throttle Policy on Battery"
msgstr ""
#: rog-control-center/ui/pages/system.slint:379 rog-control-center/ui/pages/system.slint:400
#: rog-control-center/ui/pages/system.slint:395 rog-control-center/ui/pages/system.slint:416
msgctxt "PageSystem"
msgid "Enabled"
msgstr ""
#: rog-control-center/ui/pages/system.slint:390
#: rog-control-center/ui/pages/system.slint:406
msgctxt "PageSystem"
msgid "Throttle Policy on AC"
msgstr ""
+33
View File
@@ -49,6 +49,7 @@ export global SystemPageData {
callback cb_boot_sound(int);
in-out property <int> mini_led_mode;
callback cb_mini_led_mode(int);
in-out property <bool> asus_armoury_loaded: false;
in-out property <AttrMinMax> ppt_pl1_spl: {
min: 0,
@@ -64,6 +65,13 @@ export global SystemPageData {
};
callback cb_ppt_pl2_sppt(int);
in-out property <AttrMinMax> ppt_pl3_fppt: {
min: 0,
max: 100,
val: 20,
};
callback cb_ppt_pl3_fppt(int);
in-out property <AttrMinMax> ppt_fppt: {
min: 0,
max: 100,
@@ -196,6 +204,21 @@ export component PageSystem inherits Rectangle {
}
}
if !SystemPageData.asus_armoury_loaded: Rectangle {
VerticalBox {
Text {
text: @tr("The asus-armoury driver is not loaded");
font-size: 16px;
horizontal-alignment: TextHorizontalAlignment.center;
}
Text {
text: @tr("For advanced features you will require a kernel with this driver added.");
font-size: 16px;
horizontal-alignment: TextHorizontalAlignment.center;
}
}
}
if SystemPageData.ppt_pl1_spl.val != -1: SystemSlider {
text: @tr("ppt_pl1_spl" => "PL1, sustained power limit");
minimum: SystemPageData.ppt_pl1_spl.min;
@@ -218,6 +241,16 @@ export component PageSystem inherits Rectangle {
}
}
if SystemPageData.ppt_pl3_fppt.val != -1: SystemSlider {
text: @tr("ppt_pl3_fppt" => "PL3, Fast Power Limit");
minimum: SystemPageData.ppt_pl3_fppt.min;
maximum: SystemPageData.ppt_pl3_fppt.max;
value: SystemPageData.ppt_pl3_fppt.val;
released => {
SystemPageData.ppt_fppt.val = self.value;
SystemPageData.cb_ppt_fppt(Math.round(self.value))
}
}
if SystemPageData.ppt_fppt.val != -1: SystemSlider {
text: @tr("ppt_fppt" => "FPPT, Fast Power Limit");
minimum: SystemPageData.ppt_fppt.min;
+38 -22
View File
@@ -230,7 +230,20 @@ define_attribute_getters!(
/// CamelCase names of the properties. Intended for use with DBUS
#[repr(u8)]
#[derive(Clone, Copy, Serialize, Deserialize, Type, Value, OwnedValue, PartialEq, PartialOrd)]
#[derive(
Clone,
Copy,
Serialize,
Deserialize,
Type,
Value,
OwnedValue,
PartialEq,
Eq,
PartialOrd,
Ord,
Hash,
)]
#[zvariant(signature = "s")]
pub enum FirmwareAttribute {
ApuMem = 0,
@@ -238,25 +251,26 @@ pub enum FirmwareAttribute {
CoresEfficiency = 2,
PptPl1Spl = 3,
PptPl2Sppt = 4,
PptApuSppt = 5,
PptPlatformSppt = 6,
PptFppt = 7,
NvDynamicBoost = 8,
NvTempTarget = 9,
DgpuBaseTgp = 10,
DgpuTgp = 11,
ChargeMode = 12,
BootSound = 13,
McuPowersave = 14,
PanelOverdrive = 15,
PanelHdMode = 16,
EgpuConnected = 17,
EgpuEnable = 18,
DgpuDisable = 19,
GpuMuxMode = 20,
MiniLedMode = 21,
PendingReboot = 22,
None = 23
PptPl3Fppt = 5,
PptFppt = 6,
PptApuSppt = 7,
PptPlatformSppt = 8,
NvDynamicBoost = 9,
NvTempTarget = 10,
DgpuBaseTgp = 11,
DgpuTgp = 12,
ChargeMode = 13,
BootSound = 14,
McuPowersave = 15,
PanelOverdrive = 16,
PanelHdMode = 17,
EgpuConnected = 18,
EgpuEnable = 19,
DgpuDisable = 20,
GpuMuxMode = 21,
MiniLedMode = 22,
PendingReboot = 23,
None = 24
}
impl From<&str> for FirmwareAttribute {
@@ -267,9 +281,10 @@ impl From<&str> for FirmwareAttribute {
"cores_efficiency" => Self::CoresEfficiency,
"ppt_pl1_spl" => Self::PptPl1Spl,
"ppt_pl2_sppt" => Self::PptPl2Sppt,
"ppt_pl3_fppt" => Self::PptPl3Fppt,
"ppt_fppt" => Self::PptFppt,
"ppt_apu_sppt" => Self::PptApuSppt,
"ppt_platform_sppt" => Self::PptPlatformSppt,
"ppt_fppt" => Self::PptFppt,
"nv_dynamic_boost" => Self::NvDynamicBoost,
"nv_temp_target" => Self::NvTempTarget,
"dgpu_base_tgp" => Self::DgpuBaseTgp,
@@ -298,9 +313,10 @@ impl From<FirmwareAttribute> for &str {
FirmwareAttribute::CoresEfficiency => "cores_efficiency",
FirmwareAttribute::PptPl1Spl => "ppt_pl1_spl",
FirmwareAttribute::PptPl2Sppt => "ppt_pl2_sppt",
FirmwareAttribute::PptPl3Fppt => "ppt_pl3_fppt",
FirmwareAttribute::PptFppt => "ppt_fppt",
FirmwareAttribute::PptApuSppt => "ppt_apu_sppt",
FirmwareAttribute::PptPlatformSppt => "ppt_platform_sppt",
FirmwareAttribute::PptFppt => "ppt_fppt",
FirmwareAttribute::NvDynamicBoost => "nv_dynamic_boost",
FirmwareAttribute::NvTempTarget => "nv_temp_target",
FirmwareAttribute::DgpuBaseTgp => "dgpu_base_tgp",
+1 -60
View File
@@ -47,57 +47,6 @@ impl RogPlatform {
pp_path
);
attr_u8!(
/// 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
"ppt_pl1_spl",
path
);
attr_u8!(
/// 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
"ppt_pl2_sppt",
path
);
attr_u8!(
/// Fast Package Power Tracking Limit of CPU. AMD+Nvidia only:
/// * min=5, max=250
"ppt_fppt",
path
);
attr_u8!(
/// APU SPPT limit. Shown on full AMD systems only:
/// * min=5, max=130
"ppt_apu_sppt",
path
);
attr_u8!(
/// Platform SPPT limit. Shown on full AMD systems only:
/// * min=5, max=130
"ppt_platform_sppt",
path
);
attr_u8!(
/// Dynamic boost limit of the Nvidia dGPU:
/// * min=5, max=25
"nv_dynamic_boost",
path
);
attr_u8!(
/// Target temperature limit of the Nvidia dGPU:
/// * min=75, max=87
"nv_temp_target",
path
);
attr_bool!(
/// Control the POST animation "FWOOoosh" sound
"boot_sound",
@@ -255,7 +204,6 @@ impl Display for GpuMode {
PartialEq,
Eq,
PartialOrd,
Ord,
Hash,
Clone,
Copy,
@@ -364,12 +312,5 @@ pub enum Properties {
PanelOd,
MiniLedMode,
EgpuEnable,
ThrottlePolicy,
PptPl1Spl,
PptPl2Sppt,
PptFppt,
PptApuSppt,
PptPlatformSppt,
NvDynamicBoost,
NvTempTarget
ThrottlePolicy
}