Compare commits

...

20 Commits

Author SHA1 Message Date
Luke Jones b2726f3a67 Fix: charge control 2025-02-10 22:18:34 +13:00
Luke Jones 663f87d5e2 Checkpoint 2025-02-10 13:56:26 +13:00
Luke Jones 377bb4d6ad Merge branch 'private/Rohitrajak1807/G513RW-ledfix' into 'main'
Add ROG G513RW led cfgs

See merge request asus-linux/asusctl!217
2025-02-10 00:55:33 +00:00
Rohit Rajak 98e60db2da Add ROG G513RW led cfgs 2025-02-10 00:55:33 +00:00
Luke Jones 11ac46df11 Edit README.md 2025-02-08 02:39:30 +00:00
Luke Jones 05bec93644 Edit README.md 2025-02-08 02:33:08 +00:00
Luke Jones c77e7cf1ce Fix: correction to wrong matching function used for aura data find
Closes #607
2025-02-07 09:45:05 +13:00
Luke Jones d30f7dc2ea Merge branch 'main' into 'main'
feat (rog-aura): ASUS TUF FA617NS AURA Support

See merge request asus-linux/asusctl!214
2025-02-05 02:58:05 +00:00
Luke Jones 759606fca3 Merge branch 'aura' into 'main'
Update 'led-mode' -> 'aura' in example command.

See merge request asus-linux/asusctl!215
2025-02-05 02:57:38 +00:00
Luke Jones 25ed8bdeed Fix spelling mistake 2025-02-05 14:35:17 +13:00
Luke Jones de61a15b7a Prep 6.1.0 2025-02-04 18:52:55 +13:00
Luke Jones 16700e55f4 ROGCC: refactor many more parts of the PPT settings 2025-02-04 18:50:48 +13:00
Luke Jones 5833a011ce Merge branch 'g513rc-zonefix' into 'main'
Add basic zones for G513RC

See merge request asus-linux/asusctl!216
2025-02-03 04:08:29 +00:00
loystonpais 62577ee0e4 Add basic zones for G513RC 2025-02-03 07:36:32 +05:30
Luke Jones dac35996b1 Enable use of GAMESCOPE_WAYLAND_DISPLAY 2025-02-02 20:02:51 +13:00
Luke Jones 5c2bcad7c6 Various UI fixes 2025-02-01 20:31:09 +13:00
armdebug 81f6c18a24 Update 'led-mode' -> 'aura' in example command.
led-mode is renamed to aura in 19ffcf3376
2025-01-28 02:18:56 +05:30
riarumoda bcc3d42789 feat (rog-aura): ASUS TUF FA617NS AURA Support 2025-01-23 15:14:52 +08:00
Luke Jones 36c34cb3dd Merge branch 'fix/anime-animation-crash' into 'main'
fix: Use spawn instead of spawn_local in anime animation callback

Closes #588

See merge request asus-linux/asusctl!213
2025-01-22 02:05:04 +00:00
I-Al-Istannen 9b82b875f1 fix: Use spawn instead of spawn_local in anime animation callback
Closes #588
2025-01-21 21:04:20 +01:00
32 changed files with 1237 additions and 477 deletions
+19
View File
@@ -2,6 +2,25 @@
## [Unreleased] ## [Unreleased]
## [v6.1.2]
### Changed
- Try a slightly different tact to fix charge control slider
## [v6.1.1]
### Changed
- Fix aura data matching
- Fix charge control slider
## [v6.1.0]
### Changed
- Update deps
- Add support for G513RC RGB modes
- Many UI fixes
- Fixes to PPT settings in UI
## [v6.1.0-rc7] ## [v6.1.0-rc7]
- Refactor PPT handling more: - Refactor PPT handling more:
Generated
+807 -203
View File
File diff suppressed because it is too large Load Diff
+8 -7
View File
@@ -1,5 +1,5 @@
[workspace.package] [workspace.package]
version = "6.1.0-rc7" version = "6.1.2"
rust-version = "1.82" rust-version = "1.82"
license = "MPL-2.0" license = "MPL-2.0"
readme = "README.md" readme = "README.md"
@@ -43,7 +43,8 @@ dirs = "^4.0"
smol = "^2.0" smol = "^2.0"
mio = "0.8.11" mio = "0.8.11"
zbus = "5.1" futures-util = "0.3.31"
zbus = "5.1.1"
logind-zbus = { version = "5.0.0" } #, default-features = false, features = ["non_blocking"] } logind-zbus = { version = "5.0.0" } #, default-features = false, features = ["non_blocking"] }
serde = { version = "^1.0", features = ["serde_derive"] } serde = { version = "^1.0", features = ["serde_derive"] }
@@ -65,26 +66,26 @@ gif = "^0.12.0"
versions = "6.2" versions = "6.2"
notify-rust = { version = "4.11.0", features = ["z", "async"] } notify-rust = { version = "4.11.4", features = ["z", "async"] }
sg = { git = "https://github.com/flukejones/sg-rs.git" } sg = { git = "https://github.com/flukejones/sg-rs.git" }
[profile.release] [profile.release]
# thin = 57s, asusd = 9.0M # thin = 57s, asusd = 9.0M
# fat = 72s, asusd = 6.4M # fat = 72s, asusd = 6.4M
lto = "fat" lto = "thin"
debug = false debug = false
opt-level = 3 opt-level = 3
panic = "abort" panic = "abort"
codegen-units = 1 # codegen-units = 1
[profile.dev] [profile.dev]
opt-level = 1 opt-level = 1
codegen-units = 16 # codegen-units = 1
[profile.dev.package."*"] [profile.dev.package."*"]
opt-level = 1 opt-level = 1
codegen-units = 16 # codegen-units = 1
[profile.bench] [profile.bench]
debug = false debug = false
+1 -1
View File
@@ -39,7 +39,7 @@ See the [rog-aura readme](./rog-aura/README.md) for more details.
## Discord ## Discord
[![Discord](https://img.shields.io/badge/Discord-7289DA?style=for-the-badge&logo=discord&logoColor=white)](https://discord.gg/z8y99XqPb7) [![Discord](https://img.shields.io/badge/Discord-7289DA?style=for-the-badge&logo=discord&logoColor=white)](https://discord.gg/B8GftRW2Hd)
## SUPPORTED LAPTOPS ## SUPPORTED LAPTOPS
+2 -2
View File
@@ -281,8 +281,8 @@ fn do_parsed(
} }
println!("\nExtra help can be requested on any command or subcommand:"); println!("\nExtra help can be requested on any command or subcommand:");
println!(" asusctl led-mode --help"); println!(" asusctl aura --help");
println!(" asusctl led-mode static --help"); println!(" asusctl aura static --help");
} }
} }
} }
+1 -1
View File
@@ -7,7 +7,7 @@ pub struct SlashCommand {
pub help: bool, pub help: bool,
#[options(help = "Enable the Slash Ledbar")] #[options(help = "Enable the Slash Ledbar")]
pub enable: bool, pub enable: bool,
#[options(help = "Ddisable the Slash Ledbar")] #[options(help = "Disable the Slash Ledbar")]
pub disable: bool, pub disable: bool,
#[options(short = "l", meta = "", help = "Set brightness value <0-255>")] #[options(short = "l", meta = "", help = "Set brightness value <0-255>")]
pub brightness: Option<u8>, pub brightness: Option<u8>,
+1
View File
@@ -34,6 +34,7 @@ tokio.workspace = true
log.workspace = true log.workspace = true
env_logger.workspace = true env_logger.workspace = true
futures-util.workspace = true
zbus.workspace = true zbus.workspace = true
logind-zbus.workspace = true logind-zbus.workspace = true
+35 -24
View File
@@ -1,7 +1,7 @@
use std::sync::Arc; use std::sync::Arc;
use ::zbus::export::futures_util::lock::Mutex;
use config_traits::StdConfig; use config_traits::StdConfig;
use futures_util::lock::Mutex;
use log::{debug, error, info}; use log::{debug, error, info};
use rog_platform::asus_armoury::{AttrValue, Attribute, FirmwareAttribute, FirmwareAttributes}; use rog_platform::asus_armoury::{AttrValue, Attribute, FirmwareAttribute, FirmwareAttributes};
use rog_platform::platform::{PlatformProfile, RogPlatform}; use rog_platform::platform::{PlatformProfile, RogPlatform};
@@ -66,32 +66,43 @@ impl AsusArmouryAttribute {
&mut self, &mut self,
signal_ctxt: SignalEmitter<'static> signal_ctxt: SignalEmitter<'static>
) -> Result<(), RogError> { ) -> Result<(), RogError> {
use zbus::export::futures_util::StreamExt; use futures_util::StreamExt;
let ctrl = self.clone();
let name = self.name(); let name = self.name();
match self.attr.get_watcher() { macro_rules! watch_value_notify {
Ok(watch) => { ($attr_str:expr, $fn_prop_changed:ident) => {
let name = <&str>::from(name); match self.attr.get_watcher($attr_str) {
tokio::spawn(async move { Ok(watch) => {
let mut buffer = [0; 32]; let name = <&str>::from(name);
watch let ctrl = self.clone();
.into_event_stream(&mut buffer) let sig = signal_ctxt.clone();
.unwrap() tokio::spawn(async move {
.for_each(|_| async { let mut buffer = [0; 32];
debug!("{} changed", name); watch
ctrl.current_value_changed(&signal_ctxt).await.ok(); .into_event_stream(&mut buffer)
}) .unwrap()
.await; .for_each(|_| async {
}); debug!("{} changed", name);
} ctrl.$fn_prop_changed(&sig).await.ok();
Err(e) => info!( })
"inotify watch failed: {}. You can ignore this if your device does not support \ .await;
the feature", });
e }
) Err(e) => info!(
"inotify watch failed: {}. You can ignore this if your device does not \
support the feature",
e
)
}
};
} }
// "current_value", "default_value", "min_value", "max_value"
watch_value_notify!("current_value", current_value_changed);
watch_value_notify!("default_value", default_value_changed);
watch_value_notify!("min_value", min_value_changed);
watch_value_notify!("max_value", max_value_changed);
Ok(()) Ok(())
} }
} }
@@ -406,7 +417,7 @@ pub async fn set_config_or_default(
<&str>::from(name), <&str>::from(name),
i i
); );
config.write(); // config.write();
} }
} }
} }
+3 -3
View File
@@ -8,6 +8,7 @@ use std::sync::Arc;
use std::thread::sleep; use std::thread::sleep;
use config_traits::StdConfig; use config_traits::StdConfig;
use futures_util::lock::Mutex;
use log::{debug, error, info, warn}; use log::{debug, error, info, warn};
use rog_anime::usb::{ use rog_anime::usb::{
pkt_flush, pkt_set_brightness, pkt_set_enable_display, pkt_set_enable_powersave_anim, pkt_flush, pkt_set_brightness, pkt_set_enable_display, pkt_set_enable_powersave_anim,
@@ -16,7 +17,6 @@ use rog_anime::usb::{
use rog_anime::{ActionData, AnimeDataBuffer, AnimePacketType}; use rog_anime::{ActionData, AnimeDataBuffer, AnimePacketType};
use rog_platform::hid_raw::HidRaw; use rog_platform::hid_raw::HidRaw;
use rog_platform::usb_raw::USBRaw; use rog_platform::usb_raw::USBRaw;
use tokio::sync::Mutex;
use self::config::{AniMeConfig, AniMeConfigCached}; use self::config::{AniMeConfig, AniMeConfigCached};
use crate::error::RogError; use crate::error::RogError;
@@ -51,7 +51,7 @@ impl AniMe {
/// Will fail if something is already holding the config lock /// Will fail if something is already holding the config lock
async fn do_init_cache(&mut self) { async fn do_init_cache(&mut self) {
if let Ok(mut config) = self.config.try_lock() { if let Some(mut config) = self.config.try_lock() {
if let Err(e) = self.cache.init_from_config(&config, config.anime_type) { if let Err(e) = self.cache.init_from_config(&config, config.anime_type) {
error!( error!(
"Trying to cache the Anime Config failed, will reset to default config: {e:?}" "Trying to cache the Anime Config failed, will reset to default config: {e:?}"
@@ -176,7 +176,7 @@ impl AniMe {
return Ok(true); // Do safe exit return Ok(true); // Do safe exit
} }
let inner = inner.clone(); let inner = inner.clone();
tokio::task::spawn_local(async move { tokio::task::spawn(async move {
inner inner
.write_data_buffer(frame) .write_data_buffer(frame)
.await .await
+7 -7
View File
@@ -81,7 +81,7 @@ impl AniMeZbus {
/// Set base brightness level /// Set base brightness level
#[zbus(property)] #[zbus(property)]
async fn brightness(&self) -> Brightness { async fn brightness(&self) -> Brightness {
if let Ok(config) = self.0.config.try_lock() { if let Some(config) = self.0.config.try_lock() {
return config.display_brightness; return config.display_brightness;
} }
Brightness::Off Brightness::Off
@@ -113,7 +113,7 @@ impl AniMeZbus {
#[zbus(property)] #[zbus(property)]
async fn builtins_enabled(&self) -> bool { async fn builtins_enabled(&self) -> bool {
if let Ok(config) = self.0.config.try_lock() { if let Some(config) = self.0.config.try_lock() {
return config.builtin_anims_enabled; return config.builtin_anims_enabled;
} }
false false
@@ -158,7 +158,7 @@ impl AniMeZbus {
#[zbus(property)] #[zbus(property)]
async fn builtin_animations(&self) -> Animations { async fn builtin_animations(&self) -> Animations {
if let Ok(config) = self.0.config.try_lock() { if let Some(config) = self.0.config.try_lock() {
return config.builtin_anims; return config.builtin_anims;
} }
Animations::default() Animations::default()
@@ -191,7 +191,7 @@ impl AniMeZbus {
#[zbus(property)] #[zbus(property)]
async fn enable_display(&self) -> bool { async fn enable_display(&self) -> bool {
if let Ok(config) = self.0.config.try_lock() { if let Some(config) = self.0.config.try_lock() {
return config.display_enabled; return config.display_enabled;
} }
false false
@@ -214,7 +214,7 @@ impl AniMeZbus {
#[zbus(property)] #[zbus(property)]
async fn off_when_unplugged(&self) -> bool { async fn off_when_unplugged(&self) -> bool {
if let Ok(config) = self.0.config.try_lock() { if let Some(config) = self.0.config.try_lock() {
return config.off_when_unplugged; return config.off_when_unplugged;
} }
false false
@@ -241,7 +241,7 @@ impl AniMeZbus {
#[zbus(property)] #[zbus(property)]
async fn off_when_suspended(&self) -> bool { async fn off_when_suspended(&self) -> bool {
if let Ok(config) = self.0.config.try_lock() { if let Some(config) = self.0.config.try_lock() {
return config.off_when_suspended; return config.off_when_suspended;
} }
false false
@@ -257,7 +257,7 @@ impl AniMeZbus {
#[zbus(property)] #[zbus(property)]
async fn off_when_lid_closed(&self) -> bool { async fn off_when_lid_closed(&self) -> bool {
if let Ok(config) = self.0.config.try_lock() { if let Some(config) = self.0.config.try_lock() {
return config.off_when_lid_closed; return config.off_when_lid_closed;
} }
false false
+1 -1
View File
@@ -2,13 +2,13 @@ use std::sync::Arc;
use config::AuraConfig; use config::AuraConfig;
use config_traits::StdConfig; use config_traits::StdConfig;
use futures_util::lock::{Mutex, MutexGuard};
use log::info; use log::info;
use rog_aura::keyboard::{AuraLaptopUsbPackets, LedUsbPackets}; use rog_aura::keyboard::{AuraLaptopUsbPackets, LedUsbPackets};
use rog_aura::usb::{AURA_LAPTOP_LED_APPLY, AURA_LAPTOP_LED_SET}; use rog_aura::usb::{AURA_LAPTOP_LED_APPLY, AURA_LAPTOP_LED_SET};
use rog_aura::{AuraDeviceType, AuraEffect, LedBrightness, PowerZones, AURA_LAPTOP_LED_MSG_LEN}; use rog_aura::{AuraDeviceType, AuraEffect, LedBrightness, PowerZones, AURA_LAPTOP_LED_MSG_LEN};
use rog_platform::hid_raw::HidRaw; use rog_platform::hid_raw::HidRaw;
use rog_platform::keyboard_led::KeyboardBacklight; use rog_platform::keyboard_led::KeyboardBacklight;
use tokio::sync::{Mutex, MutexGuard};
use crate::error::RogError; use crate::error::RogError;
+2 -2
View File
@@ -112,7 +112,7 @@ impl AuraZbus {
// entirely possible to deadlock here, so use try instead of lock() // entirely possible to deadlock here, so use try instead of lock()
// let ctrl = self.0.lock().await; // let ctrl = self.0.lock().await;
// Ok(config.current_mode) // Ok(config.current_mode)
if let Ok(config) = self.0.config.try_lock() { if let Some(config) = self.0.config.try_lock() {
Ok(config.current_mode) Ok(config.current_mode)
} else { } else {
Err(ZbErr::Failed("Aura control couldn't lock self".to_string())) Err(ZbErr::Failed("Aura control couldn't lock self".to_string()))
@@ -140,7 +140,7 @@ impl AuraZbus {
#[zbus(property)] #[zbus(property)]
async fn led_mode_data(&self) -> Result<AuraEffect, ZbErr> { async fn led_mode_data(&self) -> Result<AuraEffect, ZbErr> {
// entirely possible to deadlock here, so use try instead of lock() // entirely possible to deadlock here, so use try instead of lock()
if let Ok(config) = self.0.config.try_lock() { if let Some(config) = self.0.config.try_lock() {
let mode = config.current_mode; let mode = config.current_mode;
match config.builtins.get(&mode) { match config.builtins.get(&mode) {
Some(effect) => Ok(effect.clone()), Some(effect) => Ok(effect.clone()),
+1 -1
View File
@@ -8,11 +8,11 @@ use std::sync::Arc;
use dmi_id::DMIID; use dmi_id::DMIID;
use futures_lite::future::block_on; use futures_lite::future::block_on;
use futures_util::lock::Mutex;
use log::{debug, error, info, warn}; use log::{debug, error, info, warn};
use mio::{Events, Interest, Poll, Token}; use mio::{Events, Interest, Poll, Token};
use rog_platform::error::PlatformError; use rog_platform::error::PlatformError;
use rog_platform::hid_raw::HidRaw; use rog_platform::hid_raw::HidRaw;
use tokio::sync::Mutex;
use udev::{Device, MonitorBuilder}; use udev::{Device, MonitorBuilder};
use zbus::zvariant::{ObjectPath, OwnedObjectPath}; use zbus::zvariant::{ObjectPath, OwnedObjectPath};
use zbus::Connection; use zbus::Connection;
+1 -1
View File
@@ -1,8 +1,8 @@
use std::sync::Arc; use std::sync::Arc;
use config::ScsiConfig; use config::ScsiConfig;
use futures_util::lock::{Mutex, MutexGuard};
use rog_scsi::{AuraEffect, Device, Task}; use rog_scsi::{AuraEffect, Device, Task};
use tokio::sync::{Mutex, MutexGuard};
use crate::error::RogError; use crate::error::RogError;
+1 -1
View File
@@ -83,7 +83,7 @@ impl ScsiZbus {
#[zbus(property)] #[zbus(property)]
async fn led_mode_data(&self) -> Result<AuraEffect, ZbErr> { async fn led_mode_data(&self) -> Result<AuraEffect, ZbErr> {
// entirely possible to deadlock here, so use try instead of lock() // entirely possible to deadlock here, so use try instead of lock()
if let Ok(config) = self.0.config.try_lock() { if let Some(config) = self.0.config.try_lock() {
let mode = config.current_mode; let mode = config.current_mode;
match config.modes.get(&mode) { match config.modes.get(&mode) {
Some(effect) => Ok(effect.clone()), Some(effect) => Ok(effect.clone()),
+1 -1
View File
@@ -1,11 +1,11 @@
use std::sync::Arc; use std::sync::Arc;
use config::SlashConfig; use config::SlashConfig;
use futures_util::lock::{Mutex, MutexGuard};
use rog_platform::hid_raw::HidRaw; use rog_platform::hid_raw::HidRaw;
use rog_platform::usb_raw::USBRaw; use rog_platform::usb_raw::USBRaw;
use rog_slash::usb::{get_options_packet, pkt_set_mode, pkts_for_init}; use rog_slash::usb::{get_options_packet, pkt_set_mode, pkts_for_init};
use rog_slash::SlashType; use rog_slash::SlashType;
use tokio::sync::{Mutex, MutexGuard};
use crate::error::RogError; use crate::error::RogError;
+1 -1
View File
@@ -1,6 +1,7 @@
use std::sync::Arc; use std::sync::Arc;
use config_traits::{StdConfig, StdConfigLoad}; use config_traits::{StdConfig, StdConfigLoad};
use futures_util::lock::Mutex;
use log::{debug, error, info}; use log::{debug, error, info};
use rog_anime::error::AnimeError; use rog_anime::error::AnimeError;
use rog_anime::usb::get_anime_type; use rog_anime::usb::get_anime_type;
@@ -12,7 +13,6 @@ use rog_platform::usb_raw::USBRaw;
use rog_scsi::{open_device, ScsiType}; use rog_scsi::{open_device, ScsiType};
use rog_slash::error::SlashError; use rog_slash::error::SlashError;
use rog_slash::SlashType; use rog_slash::SlashType;
use tokio::sync::Mutex;
use crate::aura_anime::config::AniMeConfig; use crate::aura_anime::config::AniMeConfig;
use crate::aura_anime::AniMe; use crate::aura_anime::AniMe;
+1 -1
View File
@@ -3,13 +3,13 @@ use std::sync::Arc;
use config_traits::{StdConfig, StdConfigLoad}; use config_traits::{StdConfig, StdConfigLoad};
use futures_lite::StreamExt; use futures_lite::StreamExt;
use futures_util::lock::Mutex;
use log::{debug, error, info, warn}; use log::{debug, error, info, warn};
use rog_platform::platform::{PlatformProfile, RogPlatform}; use rog_platform::platform::{PlatformProfile, RogPlatform};
use rog_profiles::error::ProfileError; use rog_profiles::error::ProfileError;
use rog_profiles::fan_curve_set::CurveData; use rog_profiles::fan_curve_set::CurveData;
use rog_profiles::{find_fan_curve_node, FanCurvePU, FanCurveProfiles}; use rog_profiles::{find_fan_curve_node, FanCurvePU, FanCurveProfiles};
use serde::{Deserialize, Serialize}; use serde::{Deserialize, Serialize};
use tokio::sync::Mutex;
use zbus::object_server::SignalEmitter; use zbus::object_server::SignalEmitter;
use zbus::{interface, Connection}; use zbus::{interface, Connection};
+56 -56
View File
@@ -3,12 +3,12 @@ use std::process::Command;
use std::sync::Arc; use std::sync::Arc;
use config_traits::StdConfig; use config_traits::StdConfig;
use futures_util::lock::Mutex;
use log::{debug, error, info, warn}; use log::{debug, error, info, warn};
use rog_platform::asus_armoury::{AttrValue, FirmwareAttribute, FirmwareAttributes}; use rog_platform::asus_armoury::{AttrValue, FirmwareAttribute, FirmwareAttributes};
use rog_platform::cpu::{CPUControl, CPUGovernor, CPUEPP}; use rog_platform::cpu::{CPUControl, CPUGovernor, CPUEPP};
use rog_platform::platform::{PlatformProfile, Properties, RogPlatform}; use rog_platform::platform::{PlatformProfile, Properties, RogPlatform};
use rog_platform::power::AsusPower; use rog_platform::power::AsusPower;
use zbus::export::futures_util::lock::Mutex;
use zbus::fdo::Error as FdoErr; use zbus::fdo::Error as FdoErr;
use zbus::object_server::SignalEmitter; use zbus::object_server::SignalEmitter;
use zbus::{interface, Connection}; use zbus::{interface, Connection};
@@ -72,7 +72,7 @@ impl CtrlPlatform {
let mut inotify_self = ret_self.clone(); let mut inotify_self = ret_self.clone();
tokio::spawn(async move { tokio::spawn(async move {
use zbus::export::futures_util::StreamExt; use futures_util::StreamExt;
info!("Starting inotify watch for asusd config file"); info!("Starting inotify watch for asusd config file");
let mut buffer = [0; 32]; let mut buffer = [0; 32];
@@ -350,34 +350,27 @@ impl CtrlPlatform {
} }
#[zbus(property)] #[zbus(property)]
async fn set_platform_profile(&mut self, policy: PlatformProfile) -> Result<(), FdoErr> { async fn set_platform_profile(
&mut self,
#[zbus(signal_context)] ctxt: SignalEmitter<'_>,
policy: PlatformProfile
) -> Result<(), FdoErr> {
// TODO: watch for external changes // TODO: watch for external changes
if self.platform.has_platform_profile() { if self.platform.has_platform_profile() {
let change_epp = self.config.lock().await.platform_profile_linked_epp; let change_epp = self.config.lock().await.platform_profile_linked_epp;
let epp = self.get_config_epp_for_throttle(policy).await; let epp = self.get_config_epp_for_throttle(policy).await;
self.check_and_set_epp(epp, change_epp); self.check_and_set_epp(epp, change_epp);
let power_plugged = self
.power
.get_online()
.map_err(|e| {
error!("Could not get power status: {e:?}");
e
})
.unwrap_or_default();
self.config
.lock()
.await
.select_tunings(power_plugged == 1, policy)
.enabled = false;
self.config.lock().await.write(); self.config.lock().await.write();
// TODO: Need to get supported profiles here and ensure we translate to one
self.platform self.platform
.set_platform_profile(policy.into()) .set_platform_profile(policy.into())
.map_err(|err| { .map_err(|err| {
warn!("platform_profile {}", err); warn!("platform_profile {}", err);
FdoErr::Failed(format!("RogPlatform: platform_profile: {err}")) FdoErr::Failed(format!("RogPlatform: platform_profile: {err}"))
}) })?;
self.enable_ppt_group_changed(&ctxt).await?;
Ok(())
} else { } else {
Err(FdoErr::NotSupported( Err(FdoErr::NotSupported(
"RogPlatform: platform_profile not supported".to_owned() "RogPlatform: platform_profile not supported".to_owned()
@@ -405,10 +398,11 @@ impl CtrlPlatform {
#[zbus(property)] #[zbus(property)]
async fn set_platform_profile_on_battery( async fn set_platform_profile_on_battery(
&mut self, &mut self,
#[zbus(signal_context)] ctxt: SignalEmitter<'_>,
policy: PlatformProfile policy: PlatformProfile
) -> Result<(), FdoErr> { ) -> Result<(), FdoErr> {
self.config.lock().await.platform_profile_on_battery = policy; self.config.lock().await.platform_profile_on_battery = policy;
self.set_platform_profile(policy).await?; self.set_platform_profile(ctxt, policy).await?;
self.config.lock().await.write(); self.config.lock().await.write();
Ok(()) Ok(())
} }
@@ -431,9 +425,13 @@ impl CtrlPlatform {
} }
#[zbus(property)] #[zbus(property)]
async fn set_platform_profile_on_ac(&mut self, policy: PlatformProfile) -> Result<(), FdoErr> { async fn set_platform_profile_on_ac(
&mut self,
#[zbus(signal_context)] ctxt: SignalEmitter<'_>,
policy: PlatformProfile
) -> Result<(), FdoErr> {
self.config.lock().await.platform_profile_on_ac = policy; self.config.lock().await.platform_profile_on_ac = policy;
self.set_platform_profile(policy).await?; self.set_platform_profile(ctxt, policy).await?;
self.config.lock().await.write(); self.config.lock().await.write();
Ok(()) Ok(())
} }
@@ -532,45 +530,41 @@ impl CtrlPlatform {
.unwrap_or_default(); .unwrap_or_default();
let profile: PlatformProfile = self.platform.get_platform_profile()?.into(); let profile: PlatformProfile = self.platform.get_platform_profile()?.into();
// Clone to reduce blocking if enable {
let tuning = self // Clone to reduce blocking
.config let tuning = self
.lock() .config
.await .lock()
.select_tunings(power_plugged == 1, profile) .await
.clone(); .select_tunings(power_plugged == 1, profile)
.clone();
for attr in self.attributes.attributes() { for attr in self.attributes.attributes() {
let name: FirmwareAttribute = attr.name().into(); let name: FirmwareAttribute = attr.name().into();
if name.is_ppt() { if name.is_ppt() {
// reset stored value // reset stored value
if let Some(tune) = self if let Some(tune) = self
.config .config
.lock() .lock()
.await .await
.select_tunings(power_plugged == 1, profile) .select_tunings(power_plugged == 1, profile)
.group .group
.get_mut(&name) .get_mut(&name)
{ {
let value = if !enable { let value = tuning
attr.default_value().clone()
} else {
tuning
.group .group
.get(&name) .get(&name)
.map(|v| AttrValue::Integer(*v)) .map(|v| AttrValue::Integer(*v))
.unwrap_or_else(|| attr.default_value().clone()) .unwrap_or_else(|| attr.default_value().clone());
}; // restore default
// restore default attr.set_current_value(&value)?;
attr.set_current_value(&value)?; if let AttrValue::Integer(i) = value {
if let AttrValue::Integer(i) = value { *tune = i
*tune = i }
} }
} }
} }
} } else {
if !enable {
// finally, reapply the profile to ensure acpi does the thingy // finally, reapply the profile to ensure acpi does the thingy
self.platform.set_platform_profile(profile.into())?; self.platform.set_platform_profile(profile.into())?;
} }
@@ -682,6 +676,7 @@ impl CtrlTask for CtrlPlatform {
let platform1 = self.clone(); let platform1 = self.clone();
let platform2 = self.clone(); let platform2 = self.clone();
let platform3 = self.clone(); let platform3 = self.clone();
let signal_ctxt_copy = signal_ctxt.clone();
self.create_sys_event_tasks( self.create_sys_event_tasks(
move |sleeping| { move |sleeping| {
let platform1 = platform1.clone(); let platform1 = platform1.clone();
@@ -749,6 +744,7 @@ impl CtrlTask for CtrlPlatform {
}, },
move |power_plugged| { move |power_plugged| {
let platform3 = platform3.clone(); let platform3 = platform3.clone();
let signal_ctxt_copy = signal_ctxt.clone();
// power change // power change
async move { async move {
if platform3.platform.has_platform_profile() { if platform3.platform.has_platform_profile() {
@@ -780,6 +776,10 @@ impl CtrlTask for CtrlPlatform {
profile profile
) )
.await; .await;
platform3
.enable_ppt_group_changed(&signal_ctxt_copy)
.await
.ok();
} }
} }
} }
@@ -788,7 +788,7 @@ impl CtrlTask for CtrlPlatform {
// This spawns a new task for every item. // This spawns a new task for every item.
// TODO: find a better way to manage this // TODO: find a better way to manage this
self.watch_charge_control_end_threshold(signal_ctxt.clone()) self.watch_charge_control_end_threshold(signal_ctxt_copy.clone())
.await?; .await?;
let watch_platform_profile = self.platform.monitor_platform_profile()?; let watch_platform_profile = self.platform.monitor_platform_profile()?;
@@ -815,8 +815,8 @@ impl CtrlTask for CtrlPlatform {
let change_epp = ctrl.config.lock().await.platform_profile_linked_epp; let change_epp = ctrl.config.lock().await.platform_profile_linked_epp;
let epp = ctrl.get_config_epp_for_throttle(profile).await; let epp = ctrl.get_config_epp_for_throttle(profile).await;
ctrl.check_and_set_epp(epp, change_epp); ctrl.check_and_set_epp(epp, change_epp);
ctrl.platform_profile_changed(&signal_ctxt).await.ok(); ctrl.platform_profile_changed(&signal_ctxt_copy).await.ok();
ctrl.enable_ppt_group_changed(&signal_ctxt).await.ok(); ctrl.enable_ppt_group_changed(&signal_ctxt_copy).await.ok();
let power_plugged = ctrl let power_plugged = ctrl
.power .power
.get_online() .get_online()
+1 -1
View File
@@ -2,7 +2,6 @@ use std::env;
use std::error::Error; use std::error::Error;
use std::sync::Arc; use std::sync::Arc;
use ::zbus::export::futures_util::lock::Mutex;
use ::zbus::Connection; use ::zbus::Connection;
use asusd::asus_armoury::start_attributes_zbus; use asusd::asus_armoury::start_attributes_zbus;
use asusd::aura_manager::DeviceManager; use asusd::aura_manager::DeviceManager;
@@ -11,6 +10,7 @@ use asusd::ctrl_fancurves::CtrlFanCurveZbus;
use asusd::ctrl_platform::CtrlPlatform; use asusd::ctrl_platform::CtrlPlatform;
use asusd::{print_board_info, start_tasks, CtrlTask, DBUS_NAME}; use asusd::{print_board_info, start_tasks, CtrlTask, DBUS_NAME};
use config_traits::{StdConfig, StdConfigLoad1}; use config_traits::{StdConfig, StdConfigLoad1};
use futures_util::lock::Mutex;
use log::{error, info}; use log::{error, info};
use rog_platform::asus_armoury::FirmwareAttributes; use rog_platform::asus_armoury::FirmwareAttributes;
use rog_platform::platform::RogPlatform; use rog_platform::platform::RogPlatform;
+1 -1
View File
@@ -67,7 +67,7 @@ macro_rules! task_watch_item {
&self, &self,
signal_ctxt: SignalEmitter<'static>, signal_ctxt: SignalEmitter<'static>,
) -> Result<(), RogError> { ) -> Result<(), RogError> {
use zbus::export::futures_util::StreamExt; use futures_util::StreamExt;
let ctrl = self.clone(); let ctrl = self.clone();
concat_idents::concat_idents!(watch_fn = monitor_, $name { concat_idents::concat_idents!(watch_fn = monitor_, $name {
+28 -10
View File
@@ -35,6 +35,15 @@
advanced_type: None, advanced_type: None,
power_zones: [Keyboard], power_zones: [Keyboard],
), ),
(
device_name: "FA617NS",
product_id: "",
layout_name: "fa617ns",
basic_modes: [Static, Breathe, Pulse],
basic_zones: [],
advanced_type: None,
power_zones: [Keyboard],
),
( (
device_name: "FX505", device_name: "FX505",
product_id: "", product_id: "",
@@ -80,6 +89,15 @@
advanced_type: None, advanced_type: None,
power_zones: [Keyboard], power_zones: [Keyboard],
), ),
(
device_name: "FX617X",
product_id: "",
layout_name: "fa506i",
basic_modes: [Static, Breathe, Pulse],
basic_zones: [],
advanced_type: None,
power_zones: [Keyboard],
),
( (
device_name: "FX705D", device_name: "FX705D",
product_id: "", product_id: "",
@@ -134,12 +152,21 @@
advanced_type: PerKey, advanced_type: PerKey,
power_zones: [Keyboard, Lightbar], power_zones: [Keyboard, Lightbar],
), ),
(
device_name: "G513RW",
product_id: "",
layout_name: "g513i-per-key",
basic_modes: [Static, Breathe, RainbowCycle, RainbowWave, Star, Rain, Highlight, Laser, Ripple, Pulse, Comet, Flash],
basic_zones: [],
advanced_type: PerKey,
power_zones: [Keyboard, Lightbar],
),
( (
device_name: "G513RC", device_name: "G513RC",
product_id: "", product_id: "",
layout_name: "g513i", layout_name: "g513i",
basic_modes: [Static, Breathe, RainbowCycle, RainbowWave, Pulse], basic_modes: [Static, Breathe, RainbowCycle, RainbowWave, Pulse],
basic_zones: [], basic_zones: [Key1, Key2, Key3, Key4],
advanced_type: Zoned([ZonedKbLeft, ZonedKbLeftMid, ZonedKbRightMid, ZonedKbRight, LightbarRight, LightbarRightCorner, LightbarRightBottom, LightbarLeftBottom, LightbarLeftCorner, LightbarLeft]), advanced_type: Zoned([ZonedKbLeft, ZonedKbLeftMid, ZonedKbRightMid, ZonedKbRight, LightbarRight, LightbarRightCorner, LightbarRightBottom, LightbarLeftBottom, LightbarLeftCorner, LightbarLeft]),
power_zones: [Keyboard, Lightbar], power_zones: [Keyboard, Lightbar],
), ),
@@ -548,15 +575,6 @@
advanced_type: Zoned([SingleZone]), advanced_type: Zoned([SingleZone]),
power_zones: [Keyboard], 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", device_name: "GL503",
product_id: "", product_id: "",
+1
View File
@@ -41,6 +41,7 @@ zbus.workspace = true
dirs.workspace = true dirs.workspace = true
notify-rust.workspace = true notify-rust.workspace = true
concat-idents.workspace = true concat-idents.workspace = true
futures-util.workspace = true
versions.workspace = true versions.workspace = true
-2
View File
@@ -5,7 +5,6 @@ use slint_build::CompilerConfiguration;
fn main() { fn main() {
// write_locales(); // write_locales();
let root = env!("CARGO_MANIFEST_DIR"); let root = env!("CARGO_MANIFEST_DIR");
let mut main = PathBuf::from_str(root).unwrap(); let mut main = PathBuf::from_str(root).unwrap();
main.push("ui/main_window.slint"); main.push("ui/main_window.slint");
@@ -14,7 +13,6 @@ fn main() {
include.push("ui"); include.push("ui");
slint_build::print_rustc_flags().unwrap(); slint_build::print_rustc_flags().unwrap();
// slint_build::compile("ui/main_window.slint").unwrap();
slint_build::compile_with_config( slint_build::compile_with_config(
main, main,
CompilerConfiguration::new() CompilerConfiguration::new()
+42 -15
View File
@@ -1,4 +1,4 @@
use std::env::args; use std::env::{self, args};
use std::path::{Path, PathBuf}; use std::path::{Path, PathBuf};
use std::process::exit; use std::process::exit;
use std::sync::{Arc, Mutex}; use std::sync::{Arc, Mutex};
@@ -32,6 +32,12 @@ async fn main() -> Result<()> {
.format_timestamp(None) .format_timestamp(None)
.init(); .init();
// If we're running under gamescope we have to set WAYLAND_DISPLAY for winit to
// use
if let Ok(gamescope) = env::var("GAMESCOPE_WAYLAND_DISPLAY") {
env::set_var("WAYLAND_DISPLAY", gamescope);
}
// Try to open a proxy and check for app state first // Try to open a proxy and check for app state first
{ {
let user_con = zbus::blocking::Connection::session()?; let user_con = zbus::blocking::Connection::session()?;
@@ -84,7 +90,7 @@ async fn main() -> Result<()> {
let board_name = dmi.board_name; let board_name = dmi.board_name;
let prod_family = dmi.product_family; let prod_family = dmi.product_family;
info!("Running on {board_name}, product: {prod_family}"); info!("Running on {board_name}, product: {prod_family}");
let is_rog_ally = prod_family == "RC71L"; let is_rog_ally = prod_family == "RC71L" || prod_family == "RC72L";
let args: Vec<String> = args().skip(1).collect(); let args: Vec<String> = args().skip(1).collect();
@@ -120,7 +126,9 @@ async fn main() -> Result<()> {
config.enable_tray_icon = false; config.enable_tray_icon = false;
config.run_in_background = false; config.run_in_background = false;
config.startup_in_background = false; config.startup_in_background = false;
config.start_fullscreen = true;
} }
config.write();
let enable_tray_icon = config.enable_tray_icon; let enable_tray_icon = config.enable_tray_icon;
let startup_in_background = config.startup_in_background; let startup_in_background = config.startup_in_background;
@@ -136,8 +144,8 @@ async fn main() -> Result<()> {
// i_slint_backend_selector::with_platform(|_| Ok(())).unwrap(); // i_slint_backend_selector::with_platform(|_| Ok(())).unwrap();
if !startup_in_background { if !startup_in_background {
if let Ok(mut lock) = app_state.lock() { if let Ok(mut app_state) = app_state.lock() {
*lock = AppState::MainWindowShouldOpen; *app_state = AppState::MainWindowShouldOpen;
} }
} }
@@ -154,15 +162,15 @@ async fn main() -> Result<()> {
let mut state = AppState::StartingUp; let mut state = AppState::StartingUp;
loop { loop {
// save as a var, don't hold the lock the entire time or deadlocks happen // save as a var, don't hold the lock the entire time or deadlocks happen
if let Ok(lock) = app_state.lock() { if let Ok(app_state) = app_state.lock() {
state = *lock; state = *app_state;
} }
// This sleep is required to give the event loop time to react // This sleep is required to give the event loop time to react
sleep(Duration::from_millis(300)); sleep(Duration::from_millis(300));
if state == AppState::MainWindowShouldOpen { if state == AppState::MainWindowShouldOpen {
if let Ok(mut lock) = app_state.lock() { if let Ok(mut app_state) = app_state.lock() {
*lock = AppState::MainWindowOpen; *app_state = AppState::MainWindowOpen;
} }
let config_copy = config.clone(); let config_copy = config.clone();
@@ -174,20 +182,39 @@ async fn main() -> Result<()> {
if let Some(ui) = ui.as_mut() { if let Some(ui) = ui.as_mut() {
ui.window().show().unwrap(); ui.window().show().unwrap();
ui.window().on_close_requested(move || { ui.window().on_close_requested(move || {
if let Ok(mut lock) = app_state_copy.lock() { if let Ok(mut app_state) = app_state_copy.lock() {
*lock = AppState::MainWindowClosed; *app_state = AppState::MainWindowClosed;
} }
slint::CloseRequestResponse::HideWindow slint::CloseRequestResponse::HideWindow
}); });
} else { } else {
let config_copy_2 = config_copy.clone();
let newui = setup_window(config_copy); let newui = setup_window(config_copy);
newui.window().show().unwrap();
newui.window().on_close_requested(move || { newui.window().on_close_requested(move || {
if let Ok(mut lock) = app_state_copy.lock() { if let Ok(mut app_state) = app_state_copy.lock() {
*lock = AppState::MainWindowClosed; *app_state = AppState::MainWindowClosed;
} }
slint::CloseRequestResponse::HideWindow slint::CloseRequestResponse::HideWindow
}); });
let ui_copy = newui.as_weak();
newui
.window()
.set_rendering_notifier(move |s, _| {
if let slint::RenderingState::RenderingSetup = s {
let config = config_copy_2.clone();
ui_copy
.upgrade_in_event_loop(move |w| {
let fullscreen =
config.lock().is_ok_and(|c| c.start_fullscreen);
if fullscreen && !w.window().is_fullscreen() {
w.window().set_fullscreen(fullscreen);
}
})
.ok();
}
})
.ok();
ui.replace(newui); ui.replace(newui);
} }
}); });
@@ -197,8 +224,8 @@ async fn main() -> Result<()> {
slint::quit_event_loop().unwrap(); slint::quit_event_loop().unwrap();
exit(0); exit(0);
} else if state != AppState::MainWindowOpen { } else if state != AppState::MainWindowOpen {
if let Ok(lock) = config.lock() { if let Ok(config) = config.lock() {
if !lock.run_in_background { if !config.run_in_background {
slint::quit_event_loop().unwrap(); slint::quit_event_loop().unwrap();
exit(0); exit(0);
} }
+3 -10
View File
@@ -8,7 +8,7 @@ use std::sync::{Arc, Mutex};
use config_traits::StdConfig; use config_traits::StdConfig;
use log::warn; use log::warn;
use rog_dbus::list_iface_blocking; use rog_dbus::list_iface_blocking;
use slint::{ComponentHandle, PhysicalSize, SharedString, Weak}; use slint::{ComponentHandle, SharedString, Weak};
use crate::config::Config; use crate::config::Config;
use crate::ui::setup_anime::setup_anime_page; use crate::ui::setup_anime::setup_anime_page;
@@ -87,15 +87,7 @@ pub fn setup_window(config: Arc<Mutex<Config>>) -> MainWindow {
.map_err(|e| warn!("Couldn't set application ID: {e:?}")) .map_err(|e| warn!("Couldn't set application ID: {e:?}"))
.ok(); .ok();
let ui = MainWindow::new().unwrap(); let ui = MainWindow::new().unwrap();
if let Ok(lock) = config.try_lock() { ui.window().show().unwrap();
let fullscreen = lock.start_fullscreen;
let width = lock.fullscreen_width;
let height = lock.fullscreen_height;
if fullscreen {
ui.window().set_fullscreen(fullscreen);
ui.window().set_size(PhysicalSize { width, height });
}
};
let available = list_iface_blocking().unwrap_or_default(); let available = list_iface_blocking().unwrap_or_default();
ui.set_sidebar_items_avilable( ui.set_sidebar_items_avilable(
@@ -129,6 +121,7 @@ pub fn setup_window(config: Arc<Mutex<Config>>) -> MainWindow {
if available.contains(&"xyz.ljones.FanCurves".to_string()) { if available.contains(&"xyz.ljones.FanCurves".to_string()) {
setup_fan_curve_page(&ui, config); setup_fan_curve_page(&ui, config);
} }
ui ui
} }
+72 -25
View File
@@ -16,18 +16,20 @@ use crate::{set_ui_callbacks, set_ui_props_async, AttrMinMax, MainWindow, System
const MINMAX: AttrMinMax = AttrMinMax { const MINMAX: AttrMinMax = AttrMinMax {
min: 0, min: 0,
max: 0, max: 0,
val: -1.0 current: -1.0
}; };
pub fn setup_system_page(ui: &MainWindow, _config: Arc<Mutex<Config>>) { pub fn setup_system_page(ui: &MainWindow, _config: Arc<Mutex<Config>>) {
let conn = zbus::blocking::Connection::system().unwrap(); let conn = zbus::blocking::Connection::system().unwrap();
let platform = PlatformProxyBlocking::new(&conn).unwrap(); let platform = PlatformProxyBlocking::builder(&conn).build().unwrap();
// let armoury_attrs = // let armoury_attrs =
// find_iface::<AsusArmouryProxyBlocking>("xyz.ljones.AsusArmoury").unwrap(); // find_iface::<AsusArmouryProxyBlocking>("xyz.ljones.AsusArmoury").unwrap();
// Null everything before the setup step // Null everything before the setup step
ui.global::<SystemPageData>() ui.global::<SystemPageData>()
.set_charge_control_end_threshold(-1.0); .set_charge_control_end_threshold(-1.0);
ui.global::<SystemPageData>()
.set_charge_control_enabled(false);
ui.global::<SystemPageData>().set_platform_profile(-1); ui.global::<SystemPageData>().set_platform_profile(-1);
ui.global::<SystemPageData>().set_panel_overdrive(-1); ui.global::<SystemPageData>().set_panel_overdrive(-1);
ui.global::<SystemPageData>().set_boot_sound(-1); ui.global::<SystemPageData>().set_boot_sound(-1);
@@ -40,12 +42,17 @@ pub fn setup_system_page(ui: &MainWindow, _config: Arc<Mutex<Config>>) {
ui.global::<SystemPageData>().set_ppt_platform_sppt(MINMAX); ui.global::<SystemPageData>().set_ppt_platform_sppt(MINMAX);
ui.global::<SystemPageData>().set_nv_dynamic_boost(MINMAX); ui.global::<SystemPageData>().set_nv_dynamic_boost(MINMAX);
ui.global::<SystemPageData>().set_nv_temp_target(MINMAX); ui.global::<SystemPageData>().set_nv_temp_target(MINMAX);
ui.global::<SystemPageData>().set_ppt_enabled(false);
ui.global::<SystemPageData>()
.set_ppt_enabled_available(false);
let sys_props = platform.supported_properties().unwrap(); let sys_props = platform.supported_properties().unwrap();
log::debug!("Available system properties: {sys_props:?}"); log::debug!("Available system properties: {:?}", &sys_props);
if sys_props.contains(&Properties::ChargeControlEndThreshold) { if sys_props.contains(&Properties::ChargeControlEndThreshold) {
ui.global::<SystemPageData>() ui.global::<SystemPageData>()
.set_charge_control_end_threshold(60.0); .set_charge_control_end_threshold(60.0);
ui.global::<SystemPageData>()
.set_charge_control_enabled(true);
} }
} }
@@ -93,13 +100,13 @@ macro_rules! init_minmax_property {
tokio::spawn(async move { tokio::spawn(async move {
let min = proxy_copy.min_value().await.unwrap(); let min = proxy_copy.min_value().await.unwrap();
let max = proxy_copy.max_value().await.unwrap(); let max = proxy_copy.max_value().await.unwrap();
let val = proxy_copy.current_value().await.unwrap() as f32; let current = proxy_copy.current_value().await.unwrap() as f32;
handle_copy handle_copy
.upgrade_in_event_loop(move |handle| { .upgrade_in_event_loop(move |handle| {
concat_idents!(setter = set_, $property { concat_idents!(setter = set_, $property {
handle handle
.global::<SystemPageData>() .global::<SystemPageData>()
.setter(AttrMinMax { min, max, val }); .setter(AttrMinMax { min, max, current });
}); });
}) })
.ok(); .ok();
@@ -156,7 +163,7 @@ macro_rules! setup_external {
concat_idents!(setter = set_, $property { concat_idents!(setter = set_, $property {
tokio::spawn(async move { tokio::spawn(async move {
let mut x = proxy_copy.receive_current_value_changed().await; let mut x = proxy_copy.receive_current_value_changed().await;
use zbus::export::futures_util::StreamExt; use futures_util::StreamExt;
while let Some(e) = x.next().await { while let Some(e) = x.next().await {
if let Ok(out) = e.get().await { if let Ok(out) = e.get().await {
handle_copy handle_copy
@@ -174,49 +181,59 @@ macro_rules! setup_external {
} }
// For handling external value changes // For handling external value changes
macro_rules! setup_minmax_external { macro_rules! setup_value_watch {
($property:ident, $handle:expr, $attr:expr, $platform:expr) => { ($property:ident, $handle:expr, $proxy:expr, $value_type:ident $($conv: tt)*) => {
let handle_copy = $handle.as_weak(); let handle_copy = $handle.as_weak();
let proxy_copy = $attr.clone(); let proxy_copy = $proxy.clone();
tokio::spawn(async move { tokio::spawn(async move {
let mut x = proxy_copy.receive_current_value_changed().await; let mut x = concat_idents!(recv = receive_, $value_type, _value_changed {
use zbus::export::futures_util::StreamExt; proxy_copy.recv().await
});
use futures_util::StreamExt;
while let Some(e) = x.next().await { while let Some(e) = x.next().await {
if let Ok(out) = e.get().await { if let Ok(out) = e.get().await {
concat_idents!(getter = get_, $property { concat_idents!(getter = get_, $property {
handle_copy handle_copy
.upgrade_in_event_loop(move |handle| { .upgrade_in_event_loop(move |handle| {
let mut tmp: AttrMinMax = let mut tmp: AttrMinMax =
handle.global::<SystemPageData>().getter(); handle.global::<SystemPageData>().getter();
tmp.val = out as f32; tmp.$value_type = out $($conv)*;
concat_idents!(setter = set_, $property { concat_idents!(setter = set_, $property {
handle.global::<SystemPageData>().setter(tmp); handle.global::<SystemPageData>().setter(tmp);
}); });
}) })
.ok(); .ok();
}); });
} }
} }
}); });
};
}
macro_rules! setup_minmax_external {
($property:ident, $handle:expr, $attr:expr, $platform:expr) => {
setup_value_watch!($property, $handle, $attr, current as f32);
setup_value_watch!($property, $handle, $attr, min);
setup_value_watch!($property, $handle, $attr, max);
let handle_copy = $handle.as_weak(); let handle_copy = $handle.as_weak();
let proxy_copy = $attr.clone(); let proxy_copy = $attr.clone();
let platform_proxy_copy = $platform.clone(); let platform_proxy_copy = $platform.clone();
tokio::spawn(async move { tokio::spawn(async move {
let mut x = platform_proxy_copy.receive_platform_profile_changed().await; let mut x = platform_proxy_copy.receive_platform_profile_changed().await;
use zbus::export::futures_util::StreamExt; use futures_util::StreamExt;
while let Some(e) = x.next().await { while let Some(e) = x.next().await {
if let Ok(_) = e.get().await { if let Ok(_) = e.get().await {
debug!("receive_platform_profile_changed, getting new {}", stringify!(attr)); debug!("receive_platform_profile_changed, getting new {}", stringify!(attr));
let min = proxy_copy.min_value().await.unwrap(); let min = proxy_copy.min_value().await.unwrap();
let max = proxy_copy.max_value().await.unwrap(); let max = proxy_copy.max_value().await.unwrap();
let val = proxy_copy.current_value().await.unwrap() as f32; let current = proxy_copy.current_value().await.unwrap() as f32;
handle_copy handle_copy
.upgrade_in_event_loop(move |handle| { .upgrade_in_event_loop(move |handle| {
concat_idents!(setter = set_, $property { concat_idents!(setter = set_, $property {
handle handle
.global::<SystemPageData>() .global::<SystemPageData>()
.setter(AttrMinMax { min, max, val }); .setter(AttrMinMax { min, max, current });
}); });
}) })
.ok(); .ok();
@@ -249,7 +266,7 @@ pub fn setup_system_page_callbacks(ui: &MainWindow, _states: Arc<Mutex<Config>>)
tokio::spawn(async move { tokio::spawn(async move {
// Create the connections/proxies here to prevent future delays in process // Create the connections/proxies here to prevent future delays in process
let conn = zbus::Connection::system().await.unwrap(); let conn = zbus::Connection::system().await.unwrap();
let platform = PlatformProxy::new(&conn).await.unwrap(); let platform = PlatformProxy::builder(&conn).build().await.unwrap();
set_ui_props_async!( set_ui_props_async!(
handle, handle,
@@ -390,6 +407,36 @@ pub fn setup_system_page_callbacks(ui: &MainWindow, _states: Arc<Mutex<Config>>)
FirmwareAttribute::ApuMem => {} FirmwareAttribute::ApuMem => {}
FirmwareAttribute::CoresPerformance => {} FirmwareAttribute::CoresPerformance => {}
FirmwareAttribute::CoresEfficiency => {} FirmwareAttribute::CoresEfficiency => {}
FirmwareAttribute::PptEnabled => {
init_property!(ppt_enabled, handle, value, bool);
setup_callback!(ppt_enabled, handle, attr, bool);
let handle_copy = handle.as_weak();
let proxy_copy = attr.clone();
tokio::spawn(async move {
let mut x = proxy_copy.receive_current_value_changed().await;
use futures_util::StreamExt;
while let Some(e) = x.next().await {
if let Ok(out) = e.get().await {
handle_copy
.upgrade_in_event_loop(move |handle| {
handle
.global::<SystemPageData>()
.set_enable_ppt_group(out == 1);
handle
.global::<SystemPageData>()
.set_ppt_enabled(out == 1);
})
.ok();
}
}
});
handle
.global::<SystemPageData>()
.set_ppt_enabled_available(true);
handle
.global::<SystemPageData>()
.set_enable_ppt_group(value == 1);
}
FirmwareAttribute::PptPl1Spl => { FirmwareAttribute::PptPl1Spl => {
init_minmax_property!(ppt_pl1_spl, handle, attr); init_minmax_property!(ppt_pl1_spl, handle, attr);
setup_callback!(ppt_pl1_spl, handle, attr, i32); setup_callback!(ppt_pl1_spl, handle, attr, i32);
@@ -2,7 +2,7 @@
msgid "" msgid ""
msgstr "" msgstr ""
"Project-Id-Version: PACKAGE VERSION\n" "Project-Id-Version: PACKAGE VERSION\n"
"POT-Creation-Date: 2025-01-21 06:49+0000\n" "POT-Creation-Date: 2025-02-10 09:04+0000\n"
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n" "Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
"Language-Team: LANGUAGE <LL@li.org>\n" "Language-Team: LANGUAGE <LL@li.org>\n"
@@ -12,238 +12,238 @@ msgstr ""
"Language: \n" "Language: \n"
"Plural-Forms: nplurals=1; plural=0;\n" "Plural-Forms: nplurals=1; plural=0;\n"
#: rog-control-center/ui/pages/system.slint:19 #: rog-control-center/ui/pages/system.slint:20
msgctxt "SystemPageData" msgctxt "SystemPageData"
msgid "Balanced" msgid "Balanced"
msgstr "" msgstr ""
#: rog-control-center/ui/pages/system.slint:19 rog-control-center/ui/pages/system.slint:23 #: rog-control-center/ui/pages/system.slint:20 rog-control-center/ui/pages/system.slint:24
msgctxt "SystemPageData" msgctxt "SystemPageData"
msgid "Performance" msgid "Performance"
msgstr "" msgstr ""
#: rog-control-center/ui/pages/system.slint:19 #: rog-control-center/ui/pages/system.slint:20
msgctxt "SystemPageData" msgctxt "SystemPageData"
msgid "Quiet" msgid "Quiet"
msgstr "" msgstr ""
#: rog-control-center/ui/pages/system.slint:22 #: rog-control-center/ui/pages/system.slint:23
msgctxt "SystemPageData" msgctxt "SystemPageData"
msgid "Default" msgid "Default"
msgstr "" msgstr ""
#: rog-control-center/ui/pages/system.slint:24 #: rog-control-center/ui/pages/system.slint:25
msgctxt "SystemPageData" msgctxt "SystemPageData"
msgid "BalancePerformance" msgid "BalancePerformance"
msgstr "" msgstr ""
#: rog-control-center/ui/pages/system.slint:25 #: rog-control-center/ui/pages/system.slint:26
msgctxt "SystemPageData" msgctxt "SystemPageData"
msgid "BalancePower" msgid "BalancePower"
msgstr "" msgstr ""
#: rog-control-center/ui/pages/system.slint:26 #: rog-control-center/ui/pages/system.slint:27
msgctxt "SystemPageData" msgctxt "SystemPageData"
msgid "Power" msgid "Power"
msgstr "" msgstr ""
#: rog-control-center/ui/pages/system.slint:142 #: rog-control-center/ui/pages/system.slint:147
msgctxt "PageSystem" msgctxt "PageSystem"
msgid "Power settings" msgid "Power settings"
msgstr "" msgstr ""
#: rog-control-center/ui/pages/system.slint:147 #: rog-control-center/ui/pages/system.slint:152
msgctxt "PageSystem" msgctxt "PageSystem"
msgid "Charge limit" msgid "Charge limit"
msgstr "" msgstr ""
#: rog-control-center/ui/pages/system.slint:161 #: rog-control-center/ui/pages/system.slint:167
msgctxt "PageSystem" msgctxt "PageSystem"
msgid "Platform Profile" msgid "Platform Profile"
msgstr "" msgstr ""
#: rog-control-center/ui/pages/system.slint:171 #: rog-control-center/ui/pages/system.slint:177
msgctxt "PageSystem" msgctxt "PageSystem"
msgid "Advanced" msgid "Advanced"
msgstr "" msgstr ""
#: rog-control-center/ui/pages/system.slint:189 #: rog-control-center/ui/pages/system.slint:195
msgctxt "PageSystem" msgctxt "PageSystem"
msgid "Armoury settings" msgid "Armoury settings"
msgstr "" msgstr ""
#: rog-control-center/ui/pages/system.slint:199 #: rog-control-center/ui/pages/system.slint:205
msgctxt "no_asus_armoury_driver_1" msgctxt "no_asus_armoury_driver_1"
msgid "The asus-armoury driver is not loaded" msgid "The asus-armoury driver is not loaded"
msgstr "" msgstr ""
#: rog-control-center/ui/pages/system.slint:205 #: rog-control-center/ui/pages/system.slint:211
msgctxt "no_asus_armoury_driver_2" msgctxt "no_asus_armoury_driver_2"
msgid "For advanced features you will require a kernel with this driver added." msgid "For advanced features you will require a kernel with this driver added."
msgstr "" msgstr ""
#: rog-control-center/ui/pages/system.slint:216 #: rog-control-center/ui/pages/system.slint:222
msgctxt "PageSystem" msgctxt "PageSystem"
msgid "Panel Overdrive" msgid "Panel Overdrive"
msgstr "" msgstr ""
#: rog-control-center/ui/pages/system.slint:224 #: rog-control-center/ui/pages/system.slint:230
msgctxt "PageSystem" msgctxt "PageSystem"
msgid "MiniLED Mode" msgid "MiniLED Mode"
msgstr "" msgstr ""
#: rog-control-center/ui/pages/system.slint:232 #: rog-control-center/ui/pages/system.slint:238
msgctxt "PageSystem" msgctxt "PageSystem"
msgid "POST boot sound" msgid "POST boot sound"
msgstr "" msgstr ""
#: rog-control-center/ui/pages/system.slint:248 #: rog-control-center/ui/pages/system.slint:254
msgctxt "ppt_warning" msgctxt "ppt_warning"
msgid "The following settings are not applied until the toggle is enabled." msgid "The following settings are not applied until the toggle is enabled."
msgstr "" msgstr ""
#: rog-control-center/ui/pages/system.slint:253 #: rog-control-center/ui/pages/system.slint:259 rog-control-center/ui/pages/system.slint:266
msgctxt "ppt_group_enabled" msgctxt "ppt_group_enabled"
msgid "Enable Tuning" msgid "Enable Tuning"
msgstr "" msgstr ""
#: rog-control-center/ui/pages/system.slint:262 rog-control-center/ui/pages/system.slint:263 #: rog-control-center/ui/pages/system.slint:277 rog-control-center/ui/pages/system.slint:278
msgctxt "ppt_pl1_spl" msgctxt "ppt_pl1_spl"
msgid "CPU Sustained Power Limit" msgid "CPU Sustained Power Limit"
msgstr "" msgstr ""
#: rog-control-center/ui/pages/system.slint:264 #: rog-control-center/ui/pages/system.slint:279
msgctxt "ppt_pl1_spl_help" msgctxt "ppt_pl1_spl_help"
msgid "" msgid ""
"Long-term CPU power limit that affects sustained workload performance. " "Long-term CPU power limit that affects sustained workload performance. "
"Higher values may increase heat and power consumption." "Higher values may increase heat and power consumption."
msgstr "" msgstr ""
#: rog-control-center/ui/pages/system.slint:279 rog-control-center/ui/pages/system.slint:280 #: rog-control-center/ui/pages/system.slint:295 rog-control-center/ui/pages/system.slint:296
msgctxt "ppt_pl2_sppt" msgctxt "ppt_pl2_sppt"
msgid "CPU Turbo Power Limit" msgid "CPU Turbo Power Limit"
msgstr "" msgstr ""
#: rog-control-center/ui/pages/system.slint:281 #: rog-control-center/ui/pages/system.slint:297
msgctxt "ppt_pl2_sppt_help" msgctxt "ppt_pl2_sppt_help"
msgid "" msgid ""
"Short-term CPU power limit for boost periods. Controls maximum power during " "Short-term CPU power limit for boost periods. Controls maximum power during "
"brief high-performance bursts." "brief high-performance bursts."
msgstr "" msgstr ""
#: rog-control-center/ui/pages/system.slint:296 rog-control-center/ui/pages/system.slint:297 #: rog-control-center/ui/pages/system.slint:313 rog-control-center/ui/pages/system.slint:314
msgctxt "ppt_pl3_fppt" msgctxt "ppt_pl3_fppt"
msgid "CPU Fast Burst Power Limit" msgid "CPU Fast Burst Power Limit"
msgstr "" msgstr ""
#: rog-control-center/ui/pages/system.slint:298 #: rog-control-center/ui/pages/system.slint:315
msgctxt "ppt_pl3_fppt_help" msgctxt "ppt_pl3_fppt_help"
msgid "" msgid ""
"Ultra-short duration power limit for instantaneous CPU bursts. Affects " "Ultra-short duration power limit for instantaneous CPU bursts. Affects "
"responsiveness during sudden workload spikes." "responsiveness during sudden workload spikes."
msgstr "" msgstr ""
#: rog-control-center/ui/pages/system.slint:312 rog-control-center/ui/pages/system.slint:313 #: rog-control-center/ui/pages/system.slint:330 rog-control-center/ui/pages/system.slint:331
msgctxt "ppt_fppt" msgctxt "ppt_fppt"
msgid "Fast Package Power Limit" msgid "Fast Package Power Limit"
msgstr "" msgstr ""
#: rog-control-center/ui/pages/system.slint:314 #: rog-control-center/ui/pages/system.slint:332
msgctxt "ppt_fppt_help" msgctxt "ppt_fppt_help"
msgid "" msgid ""
"Ultra-short duration power limit for system package. Controls maximum power " "Ultra-short duration power limit for system package. Controls maximum power "
"during millisecond-scale load spikes." "during millisecond-scale load spikes."
msgstr "" msgstr ""
#: rog-control-center/ui/pages/system.slint:329 rog-control-center/ui/pages/system.slint:330 #: rog-control-center/ui/pages/system.slint:348 rog-control-center/ui/pages/system.slint:349
msgctxt "ppt_apu_sppt" msgctxt "ppt_apu_sppt"
msgid "APU Sustained Power Limit" msgid "APU Sustained Power Limit"
msgstr "" msgstr ""
#: rog-control-center/ui/pages/system.slint:331 #: rog-control-center/ui/pages/system.slint:350
msgctxt "ppt_apu_sppt_help" msgctxt "ppt_apu_sppt_help"
msgid "" msgid ""
"Long-term power limit for integrated graphics and CPU combined. Affects " "Long-term power limit for integrated graphics and CPU combined. Affects "
"sustained performance of APU-based workloads." "sustained performance of APU-based workloads."
msgstr "" msgstr ""
#: rog-control-center/ui/pages/system.slint:346 rog-control-center/ui/pages/system.slint:347 #: rog-control-center/ui/pages/system.slint:366 rog-control-center/ui/pages/system.slint:367
msgctxt "ppt_platform_sppt" msgctxt "ppt_platform_sppt"
msgid "Platform Sustained Power Limit" msgid "Platform Sustained Power Limit"
msgstr "" msgstr ""
#: rog-control-center/ui/pages/system.slint:348 #: rog-control-center/ui/pages/system.slint:368
msgctxt "ppt_platform_sppt_help" msgctxt "ppt_platform_sppt_help"
msgid "" msgid ""
"Overall system power limit for sustained operations. Controls total platform " "Overall system power limit for sustained operations. Controls total platform "
"power consumption over extended periods." "power consumption over extended periods."
msgstr "" msgstr ""
#: rog-control-center/ui/pages/system.slint:363 rog-control-center/ui/pages/system.slint:364 #: rog-control-center/ui/pages/system.slint:384 rog-control-center/ui/pages/system.slint:385
msgctxt "nv_dynamic_boost" msgctxt "nv_dynamic_boost"
msgid "GPU Power Boost" msgid "GPU Power Boost"
msgstr "" msgstr ""
#: rog-control-center/ui/pages/system.slint:365 #: rog-control-center/ui/pages/system.slint:386
msgctxt "nv_dynamic_boost_help" msgctxt "nv_dynamic_boost_help"
msgid "" msgid ""
"Additional power allocation for GPU dynamic boost. Higher values increase " "Additional power allocation for GPU dynamic boost. Higher values increase "
"GPU performance but generate more heat." "GPU performance but generate more heat."
msgstr "" msgstr ""
#: rog-control-center/ui/pages/system.slint:380 rog-control-center/ui/pages/system.slint:381 #: rog-control-center/ui/pages/system.slint:402 rog-control-center/ui/pages/system.slint:403
msgctxt "nv_temp_target" msgctxt "nv_temp_target"
msgid "GPU Temperature Limit" msgid "GPU Temperature Limit"
msgstr "" msgstr ""
#: rog-control-center/ui/pages/system.slint:382 #: rog-control-center/ui/pages/system.slint:404
msgctxt "nv_temp_target_help" msgctxt "nv_temp_target_help"
msgid "" msgid ""
"Maximum GPU temperature threshold in Celsius. GPU will throttle to maintain " "Maximum GPU temperature threshold in Celsius. GPU will throttle to maintain "
"temperature below this limit." "temperature below this limit."
msgstr "" msgstr ""
#: rog-control-center/ui/pages/system.slint:433 #: rog-control-center/ui/pages/system.slint:456
msgctxt "PageSystem" msgctxt "PageSystem"
msgid "Energy Performance Preference linked to Throttle Policy" msgid "Energy Performance Preference linked to Throttle Policy"
msgstr "" msgstr ""
#: rog-control-center/ui/pages/system.slint:437 #: rog-control-center/ui/pages/system.slint:460
msgctxt "PageSystem" msgctxt "PageSystem"
msgid "Change EPP based on Throttle Policy" msgid "Change EPP based on Throttle Policy"
msgstr "" msgstr ""
#: rog-control-center/ui/pages/system.slint:445 #: rog-control-center/ui/pages/system.slint:468
msgctxt "PageSystem" msgctxt "PageSystem"
msgid "EPP for Balanced Policy" msgid "EPP for Balanced Policy"
msgstr "" msgstr ""
#: rog-control-center/ui/pages/system.slint:455 #: rog-control-center/ui/pages/system.slint:478
msgctxt "PageSystem" msgctxt "PageSystem"
msgid "EPP for Performance Policy" msgid "EPP for Performance Policy"
msgstr "" msgstr ""
#: rog-control-center/ui/pages/system.slint:465 #: rog-control-center/ui/pages/system.slint:488
msgctxt "PageSystem" msgctxt "PageSystem"
msgid "EPP for Quiet Policy" msgid "EPP for Quiet Policy"
msgstr "" msgstr ""
#: rog-control-center/ui/pages/system.slint:483 #: rog-control-center/ui/pages/system.slint:506
msgctxt "PageSystem" msgctxt "PageSystem"
msgid "Throttle Policy for power state" msgid "Throttle Policy for power state"
msgstr "" msgstr ""
#: rog-control-center/ui/pages/system.slint:489 #: rog-control-center/ui/pages/system.slint:512
msgctxt "PageSystem" msgctxt "PageSystem"
msgid "Throttle Policy on Battery" msgid "Throttle Policy on Battery"
msgstr "" msgstr ""
#: rog-control-center/ui/pages/system.slint:499 rog-control-center/ui/pages/system.slint:520 #: rog-control-center/ui/pages/system.slint:522 rog-control-center/ui/pages/system.slint:543
msgctxt "PageSystem" msgctxt "PageSystem"
msgid "Enabled" msgid "Enabled"
msgstr "" msgstr ""
#: rog-control-center/ui/pages/system.slint:510 #: rog-control-center/ui/pages/system.slint:533
msgctxt "PageSystem" msgctxt "PageSystem"
msgid "Throttle Policy on AC" msgid "Throttle Policy on AC"
msgstr "" msgstr ""
@@ -728,47 +728,47 @@ msgctxt "AuraPowerGroupOld"
msgid "Sleep" msgid "Sleep"
msgstr "" msgstr ""
#: rog-control-center/ui/widgets/common.slint:133 #: rog-control-center/ui/widgets/common.slint:136
msgctxt "confirm_reset" msgctxt "confirm_reset"
msgid "Are you sure you want to reset this?" msgid "Are you sure you want to reset this?"
msgstr "" msgstr ""
#: rog-control-center/ui/main_window.slint:54 #: rog-control-center/ui/main_window.slint:55
msgctxt "MainWindow" msgctxt "MainWindow"
msgid "ROG" msgid "ROG"
msgstr "" msgstr ""
#: rog-control-center/ui/main_window.slint:56 #: rog-control-center/ui/main_window.slint:57
msgctxt "Menu1" msgctxt "Menu1"
msgid "System Control" msgid "System Control"
msgstr "" msgstr ""
#: rog-control-center/ui/main_window.slint:57 #: rog-control-center/ui/main_window.slint:58
msgctxt "Menu2" msgctxt "Menu2"
msgid "Keyboard Aura" msgid "Keyboard Aura"
msgstr "" msgstr ""
#: rog-control-center/ui/main_window.slint:58 #: rog-control-center/ui/main_window.slint:59
msgctxt "Menu3" msgctxt "Menu3"
msgid "AniMe Matrix" msgid "AniMe Matrix"
msgstr "" msgstr ""
#: rog-control-center/ui/main_window.slint:59 #: rog-control-center/ui/main_window.slint:60
msgctxt "Menu4" msgctxt "Menu4"
msgid "Fan Curves" msgid "Fan Curves"
msgstr "" msgstr ""
#: rog-control-center/ui/main_window.slint:60 #: rog-control-center/ui/main_window.slint:61
msgctxt "Menu5" msgctxt "Menu5"
msgid "App Settings" msgid "App Settings"
msgstr "" msgstr ""
#: rog-control-center/ui/main_window.slint:61 #: rog-control-center/ui/main_window.slint:62
msgctxt "Menu6" msgctxt "Menu6"
msgid "About" msgid "About"
msgstr "" msgstr ""
#: rog-control-center/ui/main_window.slint:73 #: rog-control-center/ui/main_window.slint:74
msgctxt "MainWindow" msgctxt "MainWindow"
msgid "Quit App" msgid "Quit App"
msgstr "" msgstr ""
+1
View File
@@ -19,6 +19,7 @@ export { AppSize, AttrMinMax, SystemPageData, AnimePageData, AppSettingsPageData
export component MainWindow inherits Window { export component MainWindow inherits Window {
title: "ROG Control"; title: "ROG Control";
always-on-top: true;
default-font-family: "Noto Sans"; default-font-family: "Noto Sans";
default-font-size: 14px; default-font-size: 14px;
default-font-weight: 400; default-font-weight: 400;
+61 -38
View File
@@ -4,15 +4,16 @@ import { Palette, HorizontalBox , VerticalBox, ScrollView, Slider, Button, Switc
export struct AttrMinMax { export struct AttrMinMax {
min: int, min: int,
max: int, max: int,
val: float, current: float,
} }
export struct AttrPossible { export struct AttrPossible {
range: [int], range: [int],
val: int, current: int,
} }
export global SystemPageData { export global SystemPageData {
in-out property <bool> charge_control_enabled: true;
in-out property <float> charge_control_end_threshold: 30; in-out property <float> charge_control_end_threshold: 30;
callback cb_charge_control_end_threshold(/* charge limit */ int); callback cb_charge_control_end_threshold(/* charge limit */ int);
in-out property <int> platform_profile: 0; in-out property <int> platform_profile: 0;
@@ -54,7 +55,7 @@ export global SystemPageData {
in-out property <AttrMinMax> ppt_pl1_spl: { in-out property <AttrMinMax> ppt_pl1_spl: {
min: 0, min: 0,
max: 100, max: 100,
val: 20, current: 20,
}; };
callback cb_ppt_pl1_spl(int); callback cb_ppt_pl1_spl(int);
callback cb_default_ppt_pl1_spl(); callback cb_default_ppt_pl1_spl();
@@ -62,7 +63,7 @@ export global SystemPageData {
in-out property <AttrMinMax> ppt_pl2_sppt: { in-out property <AttrMinMax> ppt_pl2_sppt: {
min: 0, min: 0,
max: 100, max: 100,
val: 20, current: 20,
}; };
callback cb_ppt_pl2_sppt(int); callback cb_ppt_pl2_sppt(int);
callback cb_default_ppt_pl2_sppt(); callback cb_default_ppt_pl2_sppt();
@@ -70,7 +71,7 @@ export global SystemPageData {
in-out property <AttrMinMax> ppt_pl3_fppt: { in-out property <AttrMinMax> ppt_pl3_fppt: {
min: 0, min: 0,
max: 100, max: 100,
val: 20, current: 20,
}; };
callback cb_ppt_pl3_fppt(int); callback cb_ppt_pl3_fppt(int);
callback cb_default_ppt_pl3_fppt(); callback cb_default_ppt_pl3_fppt();
@@ -78,7 +79,7 @@ export global SystemPageData {
in-out property <AttrMinMax> ppt_fppt: { in-out property <AttrMinMax> ppt_fppt: {
min: 0, min: 0,
max: 100, max: 100,
val: 20, current: 20,
}; };
callback cb_ppt_fppt(int); callback cb_ppt_fppt(int);
callback cb_default_ppt_fppt(); callback cb_default_ppt_fppt();
@@ -86,7 +87,7 @@ export global SystemPageData {
in-out property <AttrMinMax> ppt_apu_sppt: { in-out property <AttrMinMax> ppt_apu_sppt: {
min: 0, min: 0,
max: 100, max: 100,
val: 20, current: 20,
}; };
callback cb_ppt_apu_sppt(int); callback cb_ppt_apu_sppt(int);
callback cb_default_ppt_apu_sppt(); callback cb_default_ppt_apu_sppt();
@@ -94,7 +95,7 @@ export global SystemPageData {
in-out property <AttrMinMax> ppt_platform_sppt: { in-out property <AttrMinMax> ppt_platform_sppt: {
min: 0, min: 0,
max: 100, max: 100,
val: 20, current: 20,
}; };
callback cb_ppt_platform_sppt(int); callback cb_ppt_platform_sppt(int);
callback cb_default_ppt_platform_sppt(); callback cb_default_ppt_platform_sppt();
@@ -102,7 +103,7 @@ export global SystemPageData {
in-out property <AttrMinMax> nv_dynamic_boost: { in-out property <AttrMinMax> nv_dynamic_boost: {
min: 0, min: 0,
max: 30, max: 30,
val: 5, current: 5,
}; };
callback cb_nv_dynamic_boost(int); callback cb_nv_dynamic_boost(int);
callback cb_default_nv_dynamic_boost(); callback cb_default_nv_dynamic_boost();
@@ -110,13 +111,17 @@ export global SystemPageData {
in-out property <AttrMinMax> nv_temp_target: { in-out property <AttrMinMax> nv_temp_target: {
min: 0, min: 0,
max: 80, max: 80,
val: 75, current: 75,
}; };
callback cb_nv_temp_target(int); callback cb_nv_temp_target(int);
callback cb_default_nv_temp_target(); callback cb_default_nv_temp_target();
in-out property <bool> enable_ppt_group; in-out property <bool> enable_ppt_group: false;
callback cb_enable_ppt_group(bool); callback cb_enable_ppt_group(bool);
in-out property <bool> ppt_enabled_available;
in-out property <bool> ppt_enabled;
callback cb_ppt_enabled(bool);
} }
export component PageSystem inherits Rectangle { export component PageSystem inherits Rectangle {
@@ -148,6 +153,7 @@ export component PageSystem inherits Rectangle {
minimum: 20; minimum: 20;
maximum: 100; maximum: 100;
has_reset: false; has_reset: false;
enabled <=> SystemPageData.charge_control_enabled;
value: SystemPageData.charge_control_end_threshold; value: SystemPageData.charge_control_end_threshold;
released => { released => {
SystemPageData.charge_control_end_threshold = self.value; SystemPageData.charge_control_end_threshold = self.value;
@@ -237,7 +243,7 @@ export component PageSystem inherits Rectangle {
} }
} }
if SystemPageData.ppt_pl1_spl.val != -1 || SystemPageData.ppt_pl2_sppt.val != -1 || SystemPageData.nv_dynamic_boost.val != -1: HorizontalLayout { if SystemPageData.ppt_pl1_spl.current != -1 || SystemPageData.ppt_pl2_sppt.current != -1 || SystemPageData.nv_dynamic_boost.current != -1: HorizontalLayout {
padding-right: 10px; padding-right: 10px;
padding-left: 10px; padding-left: 10px;
alignment: LayoutAlignment.space-between; alignment: LayoutAlignment.space-between;
@@ -249,146 +255,163 @@ export component PageSystem inherits Rectangle {
} }
} }
Switch { if !SystemPageData.ppt_enabled_available: Switch {
text: @tr("ppt_group_enabled" => "Enable Tuning"); text: @tr("ppt_group_enabled" => "Enable Tuning");
checked <=> SystemPageData.enable_ppt_group; checked <=> SystemPageData.enable_ppt_group;
toggled => { toggled => {
SystemPageData.cb_enable_ppt_group(SystemPageData.enable_ppt_group) SystemPageData.cb_enable_ppt_group(SystemPageData.enable_ppt_group)
} }
} }
if SystemPageData.ppt_enabled_available: Switch {
text: @tr("ppt_group_enabled" => "Enable Tuning");
checked <=> SystemPageData.ppt_enabled;
toggled => {
SystemPageData.enable_ppt_group = self.checked;
SystemPageData.cb_ppt_enabled(SystemPageData.ppt_enabled)
}
}
} }
if SystemPageData.ppt_pl1_spl.val != -1: SystemSlider { if SystemPageData.ppt_pl1_spl.current != -1: SystemSlider {
text: @tr("ppt_pl1_spl" => "CPU Sustained Power Limit"); text: @tr("ppt_pl1_spl" => "CPU Sustained Power Limit");
title: @tr("ppt_pl1_spl" => "CPU Sustained Power Limit"); title: @tr("ppt_pl1_spl" => "CPU Sustained Power Limit");
help_text: @tr("ppt_pl1_spl_help" => "Long-term CPU power limit that affects sustained workload performance. Higher values may increase heat and power consumption."); help_text: @tr("ppt_pl1_spl_help" => "Long-term CPU power limit that affects sustained workload performance. Higher values may increase heat and power consumption.");
minimum: SystemPageData.ppt_pl1_spl.min; minimum: SystemPageData.ppt_pl1_spl.min;
maximum: SystemPageData.ppt_pl1_spl.max; maximum: SystemPageData.ppt_pl1_spl.max;
value: SystemPageData.ppt_pl1_spl.val; value: SystemPageData.ppt_pl1_spl.current;
enabled <=> SystemPageData.enable_ppt_group;
has_reset: true; has_reset: true;
cb_do_reset => { cb_do_reset => {
SystemPageData.cb_default_ppt_pl1_spl(); SystemPageData.cb_default_ppt_pl1_spl();
} }
released => { released => {
SystemPageData.ppt_pl1_spl.val = self.value; SystemPageData.ppt_pl1_spl.current = self.value;
SystemPageData.cb_ppt_pl1_spl(Math.round(self.value)); SystemPageData.cb_ppt_pl1_spl(Math.round(self.value));
} }
} }
if SystemPageData.ppt_pl2_sppt.val != -1: SystemSlider { if SystemPageData.ppt_pl2_sppt.current != -1: SystemSlider {
text: @tr("ppt_pl2_sppt" => "CPU Turbo Power Limit"); text: @tr("ppt_pl2_sppt" => "CPU Turbo Power Limit");
title: @tr("ppt_pl2_sppt" => "CPU Turbo Power Limit"); title: @tr("ppt_pl2_sppt" => "CPU Turbo Power Limit");
help_text: @tr("ppt_pl2_sppt_help" => "Short-term CPU power limit for boost periods. Controls maximum power during brief high-performance bursts."); help_text: @tr("ppt_pl2_sppt_help" => "Short-term CPU power limit for boost periods. Controls maximum power during brief high-performance bursts.");
minimum: SystemPageData.ppt_pl2_sppt.min; minimum: SystemPageData.ppt_pl2_sppt.min;
maximum: SystemPageData.ppt_pl2_sppt.max; maximum: SystemPageData.ppt_pl2_sppt.max;
value: SystemPageData.ppt_pl2_sppt.val; value: SystemPageData.ppt_pl2_sppt.current;
enabled <=> SystemPageData.enable_ppt_group;
has_reset: true; has_reset: true;
cb_do_reset => { cb_do_reset => {
SystemPageData.cb_default_ppt_pl2_sppt(); SystemPageData.cb_default_ppt_pl2_sppt();
} }
released => { released => {
SystemPageData.ppt_pl2_sppt.val = self.value; SystemPageData.ppt_pl2_sppt.current = self.value;
SystemPageData.cb_ppt_pl2_sppt(Math.round(self.value)) SystemPageData.cb_ppt_pl2_sppt(Math.round(self.value))
} }
} }
if SystemPageData.ppt_pl3_fppt.val != -1: SystemSlider { if SystemPageData.ppt_pl3_fppt.current != -1: SystemSlider {
text: @tr("ppt_pl3_fppt" => "CPU Fast Burst Power Limit"); text: @tr("ppt_pl3_fppt" => "CPU Fast Burst Power Limit");
title: @tr("ppt_pl3_fppt" => "CPU Fast Burst Power Limit"); title: @tr("ppt_pl3_fppt" => "CPU Fast Burst Power Limit");
help_text: @tr("ppt_pl3_fppt_help" => "Ultra-short duration power limit for instantaneous CPU bursts. Affects responsiveness during sudden workload spikes."); help_text: @tr("ppt_pl3_fppt_help" => "Ultra-short duration power limit for instantaneous CPU bursts. Affects responsiveness during sudden workload spikes.");
minimum: SystemPageData.ppt_pl3_fppt.min; minimum: SystemPageData.ppt_pl3_fppt.min;
maximum: SystemPageData.ppt_pl3_fppt.max; maximum: SystemPageData.ppt_pl3_fppt.max;
value: SystemPageData.ppt_pl3_fppt.val; value: SystemPageData.ppt_pl3_fppt.current;
enabled <=> SystemPageData.enable_ppt_group;
has_reset: true; has_reset: true;
cb_do_reset => { cb_do_reset => {
SystemPageData.cb_default_ppt_pl3_fppt(); SystemPageData.cb_default_ppt_pl3_fppt();
} }
released => { released => {
SystemPageData.ppt_pl3_fppt.val = self.value; SystemPageData.ppt_pl3_fppt.current = self.value;
SystemPageData.cb_ppt_pl3_fppt(Math.round(self.value)) SystemPageData.cb_ppt_pl3_fppt(Math.round(self.value))
} }
} }
if SystemPageData.ppt_fppt.val != -1: SystemSlider { if SystemPageData.ppt_fppt.current != -1: SystemSlider {
text: @tr("ppt_fppt" => "Fast Package Power Limit"); text: @tr("ppt_fppt" => "Fast Package Power Limit");
title: @tr("ppt_fppt" => "Fast Package Power Limit"); title: @tr("ppt_fppt" => "Fast Package Power Limit");
help_text: @tr("ppt_fppt_help" => "Ultra-short duration power limit for system package. Controls maximum power during millisecond-scale load spikes."); help_text: @tr("ppt_fppt_help" => "Ultra-short duration power limit for system package. Controls maximum power during millisecond-scale load spikes.");
minimum: SystemPageData.ppt_fppt.min; minimum: SystemPageData.ppt_fppt.min;
maximum: SystemPageData.ppt_fppt.max; maximum: SystemPageData.ppt_fppt.max;
value: SystemPageData.ppt_fppt.val; value: SystemPageData.ppt_fppt.current;
enabled <=> SystemPageData.enable_ppt_group;
has_reset: true; has_reset: true;
cb_do_reset => { cb_do_reset => {
SystemPageData.cb_default_ppt_fppt(); SystemPageData.cb_default_ppt_fppt();
} }
released => { released => {
SystemPageData.ppt_fppt.val = self.value; SystemPageData.ppt_fppt.current = self.value;
SystemPageData.cb_ppt_fppt(Math.round(self.value)) SystemPageData.cb_ppt_fppt(Math.round(self.value))
} }
} }
if SystemPageData.ppt_apu_sppt.val != -1: SystemSlider { if SystemPageData.ppt_apu_sppt.current != -1: SystemSlider {
text: @tr("ppt_apu_sppt" => "APU Sustained Power Limit"); text: @tr("ppt_apu_sppt" => "APU Sustained Power Limit");
title: @tr("ppt_apu_sppt" => "APU Sustained Power Limit"); title: @tr("ppt_apu_sppt" => "APU Sustained Power Limit");
help_text: @tr("ppt_apu_sppt_help" => "Long-term power limit for integrated graphics and CPU combined. Affects sustained performance of APU-based workloads."); help_text: @tr("ppt_apu_sppt_help" => "Long-term power limit for integrated graphics and CPU combined. Affects sustained performance of APU-based workloads.");
minimum: SystemPageData.ppt_apu_sppt.min; minimum: SystemPageData.ppt_apu_sppt.min;
maximum: SystemPageData.ppt_apu_sppt.max; maximum: SystemPageData.ppt_apu_sppt.max;
value: SystemPageData.ppt_apu_sppt.val; value: SystemPageData.ppt_apu_sppt.current;
enabled <=> SystemPageData.enable_ppt_group;
has_reset: true; has_reset: true;
cb_do_reset => { cb_do_reset => {
SystemPageData.cb_default_ppt_apu_sppt(); SystemPageData.cb_default_ppt_apu_sppt();
} }
released => { released => {
SystemPageData.ppt_apu_sppt.val = self.value; SystemPageData.ppt_apu_sppt.current = self.value;
SystemPageData.cb_ppt_apu_sppt(Math.round(self.value)) SystemPageData.cb_ppt_apu_sppt(Math.round(self.value))
} }
} }
if SystemPageData.ppt_platform_sppt.val != -1: SystemSlider { if SystemPageData.ppt_platform_sppt.current != -1: SystemSlider {
text: @tr("ppt_platform_sppt" => "Platform Sustained Power Limit"); text: @tr("ppt_platform_sppt" => "Platform Sustained Power Limit");
title: @tr("ppt_platform_sppt" => "Platform Sustained Power Limit"); title: @tr("ppt_platform_sppt" => "Platform Sustained Power Limit");
help_text: @tr("ppt_platform_sppt_help" => "Overall system power limit for sustained operations. Controls total platform power consumption over extended periods."); help_text: @tr("ppt_platform_sppt_help" => "Overall system power limit for sustained operations. Controls total platform power consumption over extended periods.");
minimum: SystemPageData.ppt_platform_sppt.min; minimum: SystemPageData.ppt_platform_sppt.min;
maximum: SystemPageData.ppt_platform_sppt.max; maximum: SystemPageData.ppt_platform_sppt.max;
value: SystemPageData.ppt_platform_sppt.val; value: SystemPageData.ppt_platform_sppt.current;
enabled <=> SystemPageData.enable_ppt_group;
has_reset: true; has_reset: true;
cb_do_reset => { cb_do_reset => {
SystemPageData.cb_default_ppt_platform_sppt(); SystemPageData.cb_default_ppt_platform_sppt();
} }
released => { released => {
SystemPageData.ppt_platform_sppt.val = self.value; SystemPageData.ppt_platform_sppt.current = self.value;
SystemPageData.cb_ppt_platform_sppt(Math.round(self.value)) SystemPageData.cb_ppt_platform_sppt(Math.round(self.value))
} }
} }
if SystemPageData.nv_dynamic_boost.val != -1: SystemSlider { if SystemPageData.nv_dynamic_boost.current != -1: SystemSlider {
text: @tr("nv_dynamic_boost" => "GPU Power Boost"); text: @tr("nv_dynamic_boost" => "GPU Power Boost");
title: @tr("nv_dynamic_boost" => "GPU Power Boost"); title: @tr("nv_dynamic_boost" => "GPU Power Boost");
help_text: @tr("nv_dynamic_boost_help" => "Additional power allocation for GPU dynamic boost. Higher values increase GPU performance but generate more heat."); help_text: @tr("nv_dynamic_boost_help" => "Additional power allocation for GPU dynamic boost. Higher values increase GPU performance but generate more heat.");
minimum: SystemPageData.nv_dynamic_boost.min; minimum: SystemPageData.nv_dynamic_boost.min;
maximum: SystemPageData.nv_dynamic_boost.max; maximum: SystemPageData.nv_dynamic_boost.max;
value: SystemPageData.nv_dynamic_boost.val; value: SystemPageData.nv_dynamic_boost.current;
enabled <=> SystemPageData.enable_ppt_group;
has_reset: true; has_reset: true;
cb_do_reset => { cb_do_reset => {
SystemPageData.cb_default_nv_dynamic_boost(); SystemPageData.cb_default_nv_dynamic_boost();
} }
released => { released => {
SystemPageData.nv_dynamic_boost.val = self.value; SystemPageData.nv_dynamic_boost.current = self.value;
SystemPageData.cb_nv_dynamic_boost(Math.round(self.value)) SystemPageData.cb_nv_dynamic_boost(Math.round(self.value))
} }
} }
if SystemPageData.nv_temp_target.val != -1: SystemSlider { if SystemPageData.nv_temp_target.current != -1: SystemSlider {
text: @tr("nv_temp_target" => "GPU Temperature Limit"); text: @tr("nv_temp_target" => "GPU Temperature Limit");
title: @tr("nv_temp_target" => "GPU Temperature Limit"); title: @tr("nv_temp_target" => "GPU Temperature Limit");
help_text: @tr("nv_temp_target_help" => "Maximum GPU temperature threshold in Celsius. GPU will throttle to maintain temperature below this limit."); help_text: @tr("nv_temp_target_help" => "Maximum GPU temperature threshold in Celsius. GPU will throttle to maintain temperature below this limit.");
minimum: SystemPageData.nv_temp_target.min; minimum: SystemPageData.nv_temp_target.min;
maximum: SystemPageData.nv_temp_target.max; maximum: SystemPageData.nv_temp_target.max;
value: SystemPageData.nv_temp_target.val; value: SystemPageData.nv_temp_target.current;
enabled <=> SystemPageData.enable_ppt_group;
has_reset: true; has_reset: true;
cb_do_reset => { cb_do_reset => {
SystemPageData.cb_default_nv_temp_target(); SystemPageData.cb_default_nv_temp_target();
} }
released => { released => {
SystemPageData.nv_temp_target.val = self.value; SystemPageData.nv_temp_target.current = self.value;
SystemPageData.cb_nv_temp_target(Math.round(self.value)) SystemPageData.cb_nv_temp_target(Math.round(self.value))
} }
} }
@@ -12,6 +12,7 @@ export component RogItem inherits Rectangle {
export component SystemSlider inherits RogItem { export component SystemSlider inherits RogItem {
in property <string> title; in property <string> title;
in property <string> text; in property <string> text;
in-out property <bool> enabled: true;
in-out property <float> value; in-out property <float> value;
in-out property <float> minimum; in-out property <float> minimum;
in-out property <float> maximum; in-out property <float> maximum;
@@ -27,6 +28,7 @@ export component SystemSlider inherits RogItem {
alignment: LayoutAlignment.stretch; alignment: LayoutAlignment.stretch;
padding-left: 10px; padding-left: 10px;
TouchArea { TouchArea {
enabled <=> root.enabled;
clicked => { clicked => {
slider.value += 1; slider.value += 1;
if slider.value > slider.maximum { if slider.value > slider.maximum {
@@ -57,6 +59,7 @@ export component SystemSlider inherits RogItem {
// alignment: LayoutAlignment.end; // alignment: LayoutAlignment.end;
padding-right: 20px; padding-right: 20px;
slider := Slider { slider := Slider {
enabled <=> root.enabled;
maximum: root.maximum; maximum: root.maximum;
minimum: root.minimum; minimum: root.minimum;
value <=> root.value; value <=> root.value;
@@ -150,6 +153,7 @@ export component SystemSlider inherits RogItem {
reset := HorizontalBox { reset := HorizontalBox {
if (has_reset): StandardButton { if (has_reset): StandardButton {
kind: StandardButtonKind.reset; kind: StandardButtonKind.reset;
enabled <=> root.enabled;
clicked => { clicked => {
reset_popup.show(); reset_popup.show();
} }
+19 -7
View File
@@ -2,7 +2,7 @@ use std::fs::{read_dir, File, OpenOptions};
use std::io::{Read, Write}; use std::io::{Read, Write};
use std::path::{Path, PathBuf}; use std::path::{Path, PathBuf};
use log::debug; use log::{debug, error};
use serde::{Deserialize, Serialize}; use serde::{Deserialize, Serialize};
use zbus::zvariant::{OwnedValue, Type, Value}; use zbus::zvariant::{OwnedValue, Type, Value};
@@ -172,8 +172,8 @@ impl Attribute {
) )
} }
pub fn get_watcher(&self) -> Result<inotify::Inotify, PlatformError> { pub fn get_watcher(&self, attr: &str) -> Result<inotify::Inotify, PlatformError> {
let path = self.base_path.join("current_value"); let path = self.base_path.join(attr);
if let Some(path) = path.to_str() { if let Some(path) = path.to_str() {
let inotify = inotify::Inotify::init()?; let inotify = inotify::Inotify::init()?;
inotify inotify
@@ -304,7 +304,8 @@ pub enum FirmwareAttribute {
GpuMuxMode = 21, GpuMuxMode = 21,
MiniLedMode = 22, MiniLedMode = 22,
PendingReboot = 23, PendingReboot = 23,
None = 24 PptEnabled = 24,
None = 25
} }
impl FirmwareAttribute { impl FirmwareAttribute {
@@ -317,7 +318,13 @@ impl FirmwareAttribute {
| FirmwareAttribute::PptFppt | FirmwareAttribute::PptFppt
| FirmwareAttribute::PptApuSppt | FirmwareAttribute::PptApuSppt
| FirmwareAttribute::PptPlatformSppt | FirmwareAttribute::PptPlatformSppt
| FirmwareAttribute::NvDynamicBoost )
}
pub fn is_dgpu(&self) -> bool {
matches!(
self,
FirmwareAttribute::NvDynamicBoost
| FirmwareAttribute::NvTempTarget | FirmwareAttribute::NvTempTarget
| FirmwareAttribute::DgpuTgp | FirmwareAttribute::DgpuTgp
) )
@@ -330,6 +337,7 @@ impl From<&str> for FirmwareAttribute {
"apu_mem" => Self::ApuMem, "apu_mem" => Self::ApuMem,
"cores_performance" => Self::CoresPerformance, "cores_performance" => Self::CoresPerformance,
"cores_efficiency" => Self::CoresEfficiency, "cores_efficiency" => Self::CoresEfficiency,
"ppt_enabled" => Self::PptEnabled,
"ppt_pl1_spl" => Self::PptPl1Spl, "ppt_pl1_spl" => Self::PptPl1Spl,
"ppt_pl2_sppt" => Self::PptPl2Sppt, "ppt_pl2_sppt" => Self::PptPl2Sppt,
"ppt_pl3_fppt" => Self::PptPl3Fppt, "ppt_pl3_fppt" => Self::PptPl3Fppt,
@@ -338,7 +346,7 @@ impl From<&str> for FirmwareAttribute {
"ppt_platform_sppt" => Self::PptPlatformSppt, "ppt_platform_sppt" => Self::PptPlatformSppt,
"nv_dynamic_boost" => Self::NvDynamicBoost, "nv_dynamic_boost" => Self::NvDynamicBoost,
"nv_temp_target" => Self::NvTempTarget, "nv_temp_target" => Self::NvTempTarget,
"dgpu_base_tgp" => Self::DgpuBaseTgp, "nv_base_tgp" => Self::DgpuBaseTgp,
"dgpu_tgp" => Self::DgpuTgp, "dgpu_tgp" => Self::DgpuTgp,
"charge_mode" => Self::ChargeMode, "charge_mode" => Self::ChargeMode,
"boot_sound" => Self::BootSound, "boot_sound" => Self::BootSound,
@@ -351,7 +359,10 @@ impl From<&str> for FirmwareAttribute {
"gpu_mux_mode" => Self::GpuMuxMode, "gpu_mux_mode" => Self::GpuMuxMode,
"mini_led_mode" => Self::MiniLedMode, "mini_led_mode" => Self::MiniLedMode,
"pending_reboot" => Self::PendingReboot, "pending_reboot" => Self::PendingReboot,
_ => panic!("Invalid firmware attribute: {}", s) _ => {
error!("Invalid firmware attribute: {}", s);
Self::None
}
} }
} }
} }
@@ -362,6 +373,7 @@ impl From<FirmwareAttribute> for &str {
FirmwareAttribute::ApuMem => "apu_mem", FirmwareAttribute::ApuMem => "apu_mem",
FirmwareAttribute::CoresPerformance => "cores_performance", FirmwareAttribute::CoresPerformance => "cores_performance",
FirmwareAttribute::CoresEfficiency => "cores_efficiency", FirmwareAttribute::CoresEfficiency => "cores_efficiency",
FirmwareAttribute::PptEnabled => "ppt_enabled",
FirmwareAttribute::PptPl1Spl => "ppt_pl1_spl", FirmwareAttribute::PptPl1Spl => "ppt_pl1_spl",
FirmwareAttribute::PptPl2Sppt => "ppt_pl2_sppt", FirmwareAttribute::PptPl2Sppt => "ppt_pl2_sppt",
FirmwareAttribute::PptPl3Fppt => "ppt_pl3_fppt", FirmwareAttribute::PptPl3Fppt => "ppt_pl3_fppt",