mirror of
https://gitlab.com/asus-linux/asusctl.git
synced 2026-02-06 00:15:04 +01:00
Compare commits
12 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
450205f9a9 | ||
|
|
82431ee25b | ||
|
|
f11aea02a8 | ||
|
|
2d6d669c22 | ||
|
|
f9cebf9221 | ||
|
|
a00808313e | ||
|
|
3426591d32 | ||
|
|
ef3b6636f5 | ||
|
|
ee9e0a1e31 | ||
|
|
9e84997cbf | ||
|
|
2b22f82b72 | ||
|
|
7a1b45071d |
20
CHANGELOG.md
20
CHANGELOG.md
@@ -2,7 +2,25 @@
|
||||
|
||||
## [Unreleased]
|
||||
|
||||
## [v6.1.0-rc2]
|
||||
## [v6.1.0-rc5]
|
||||
|
||||
### Changed
|
||||
- Per-AC/DC, per-profile tunings enabled (Battery vs AC power + platform profile)
|
||||
- Add ability to restore PPT defaults
|
||||
- Add PPT help dialogue to UI
|
||||
- Bug fix: correctly set charge limit from UI
|
||||
|
||||
## [v6.1.0-rc4]
|
||||
|
||||
### Changed
|
||||
- Bug fix: UI was setting incorrect value for FPPT
|
||||
- Bug fix: Re-add callbacks for the throttle and epp settings in UI
|
||||
- Bug fix: Fix UI settigns for AniMe Matrix display
|
||||
- Bug fix: better handle missing tray (for example gnome)
|
||||
- Strip out all outdated and unsafe tuning stuff
|
||||
- Allow each performance profile to have different PPT settings
|
||||
|
||||
## [v6.1.0-rc3]
|
||||
|
||||
### Changed
|
||||
- Bug fixes
|
||||
|
||||
30
Cargo.lock
generated
30
Cargo.lock
generated
@@ -176,10 +176,12 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "asusctl"
|
||||
version = "6.1.0-rc2"
|
||||
version = "6.1.0-rc5"
|
||||
dependencies = [
|
||||
"dmi_id",
|
||||
"env_logger",
|
||||
"gumdrop",
|
||||
"log",
|
||||
"rog_anime",
|
||||
"rog_aura",
|
||||
"rog_dbus",
|
||||
@@ -193,7 +195,7 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "asusd"
|
||||
version = "6.1.0-rc2"
|
||||
version = "6.1.0-rc5"
|
||||
dependencies = [
|
||||
"cargo-husky",
|
||||
"concat-idents",
|
||||
@@ -219,7 +221,7 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "asusd-user"
|
||||
version = "6.1.0-rc2"
|
||||
version = "6.1.0-rc5"
|
||||
dependencies = [
|
||||
"config-traits",
|
||||
"dirs",
|
||||
@@ -899,7 +901,7 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "config-traits"
|
||||
version = "6.1.0-rc2"
|
||||
version = "6.1.0-rc5"
|
||||
dependencies = [
|
||||
"log",
|
||||
"ron",
|
||||
@@ -1291,7 +1293,7 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "dmi_id"
|
||||
version = "6.1.0-rc2"
|
||||
version = "6.1.0-rc5"
|
||||
dependencies = [
|
||||
"log",
|
||||
"udev 0.8.0",
|
||||
@@ -4090,7 +4092,7 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "rog-control-center"
|
||||
version = "6.1.0-rc2"
|
||||
version = "6.1.0-rc5"
|
||||
dependencies = [
|
||||
"asusd",
|
||||
"concat-idents",
|
||||
@@ -4120,7 +4122,7 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "rog_anime"
|
||||
version = "6.1.0-rc2"
|
||||
version = "6.1.0-rc5"
|
||||
dependencies = [
|
||||
"dmi_id",
|
||||
"gif 0.12.0",
|
||||
@@ -4134,7 +4136,7 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "rog_aura"
|
||||
version = "6.1.0-rc2"
|
||||
version = "6.1.0-rc5"
|
||||
dependencies = [
|
||||
"dmi_id",
|
||||
"log",
|
||||
@@ -4145,7 +4147,7 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "rog_dbus"
|
||||
version = "6.1.0-rc2"
|
||||
version = "6.1.0-rc5"
|
||||
dependencies = [
|
||||
"asusd",
|
||||
"rog_anime",
|
||||
@@ -4159,7 +4161,7 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "rog_platform"
|
||||
version = "6.1.0-rc2"
|
||||
version = "6.1.0-rc5"
|
||||
dependencies = [
|
||||
"concat-idents",
|
||||
"inotify",
|
||||
@@ -4172,7 +4174,7 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "rog_profiles"
|
||||
version = "6.1.0-rc2"
|
||||
version = "6.1.0-rc5"
|
||||
dependencies = [
|
||||
"log",
|
||||
"rog_platform",
|
||||
@@ -4183,7 +4185,7 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "rog_scsi"
|
||||
version = "6.1.0-rc2"
|
||||
version = "6.1.0-rc5"
|
||||
dependencies = [
|
||||
"ron",
|
||||
"serde",
|
||||
@@ -4193,7 +4195,7 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "rog_simulators"
|
||||
version = "6.1.0-rc2"
|
||||
version = "6.1.0-rc5"
|
||||
dependencies = [
|
||||
"log",
|
||||
"rog_anime",
|
||||
@@ -4203,7 +4205,7 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "rog_slash"
|
||||
version = "6.1.0-rc2"
|
||||
version = "6.1.0-rc5"
|
||||
dependencies = [
|
||||
"dmi_id",
|
||||
"serde",
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
[workspace.package]
|
||||
version = "6.1.0-rc3"
|
||||
version = "6.1.0-rc5"
|
||||
rust-version = "1.82"
|
||||
license = "MPL-2.0"
|
||||
readme = "README.md"
|
||||
|
||||
@@ -18,10 +18,12 @@ rog_profiles = { path = "../rog-profiles" }
|
||||
rog_platform = { path = "../rog-platform" }
|
||||
dmi_id = { path = "../dmi-id" }
|
||||
|
||||
log.workspace = true
|
||||
env_logger.workspace = true
|
||||
|
||||
ron.workspace = true
|
||||
gumdrop.workspace = true
|
||||
zbus.workspace = true
|
||||
|
||||
[dev-dependencies]
|
||||
rog_dbus = { path = "../rog-dbus" }
|
||||
|
||||
|
||||
@@ -49,8 +49,6 @@ pub enum CliCommand {
|
||||
Slash(SlashCommand),
|
||||
#[options(name = "scsi", help = "Manage SCSI external drive")]
|
||||
Scsi(ScsiCommand),
|
||||
#[options(help = "Change bios settings")]
|
||||
PlatformOld(PlatformCommand),
|
||||
#[options(
|
||||
help = "Change platform settings. This is a new interface exposed by the asus-armoury \
|
||||
driver, some of the settings will be the same as the older platform interface"
|
||||
@@ -94,43 +92,13 @@ pub struct GraphicsCommand {
|
||||
pub help: bool
|
||||
}
|
||||
|
||||
#[derive(Options, Debug)]
|
||||
pub struct PlatformCommand {
|
||||
#[options(help = "print help message")]
|
||||
pub help: bool,
|
||||
#[options(
|
||||
meta = "",
|
||||
short = "S",
|
||||
no_long,
|
||||
help = "set bios POST sound: asusctl -S <true/false>"
|
||||
)]
|
||||
pub post_sound_set: Option<bool>,
|
||||
#[options(no_long, short = "s", help = "read bios POST sound")]
|
||||
pub post_sound_get: bool,
|
||||
#[options(
|
||||
meta = "",
|
||||
short = "D",
|
||||
no_long,
|
||||
help = "Switch GPU MUX mode: 0 = Discrete, 1 = Optimus, reboot required"
|
||||
)]
|
||||
pub gpu_mux_mode_set: Option<u8>,
|
||||
#[options(no_long, short = "d", help = "get GPU mode")]
|
||||
pub gpu_mux_mode_get: bool,
|
||||
#[options(
|
||||
meta = "",
|
||||
short = "O",
|
||||
no_long,
|
||||
help = "Set device panel overdrive <true/false>"
|
||||
)]
|
||||
pub panel_overdrive_set: Option<bool>,
|
||||
#[options(no_long, short = "o", help = "get panel overdrive")]
|
||||
pub panel_overdrive_get: bool
|
||||
}
|
||||
|
||||
#[derive(Options, Debug)]
|
||||
pub struct ArmouryCommand {
|
||||
#[options(help = "print help message")]
|
||||
pub help: bool,
|
||||
#[options(free)]
|
||||
#[options(
|
||||
free,
|
||||
help = "append each value name followed by the value to set. `-1` sets to default"
|
||||
)]
|
||||
pub free: Vec<String>
|
||||
}
|
||||
|
||||
@@ -9,6 +9,7 @@ use aura_cli::{LedPowerCommand1, LedPowerCommand2};
|
||||
use dmi_id::DMIID;
|
||||
use fan_curve_cli::FanCurveCommand;
|
||||
use gumdrop::{Opt, Options};
|
||||
use log::{error, info};
|
||||
use rog_anime::usb::get_anime_type;
|
||||
use rog_anime::{AnimTime, AnimeDataBuffer, AnimeDiagonal, AnimeGif, AnimeImage, AnimeType, Vec2};
|
||||
use rog_aura::keyboard::{AuraPowerState, LaptopAuraPower};
|
||||
@@ -21,7 +22,7 @@ use rog_dbus::zbus_aura::AuraProxyBlocking;
|
||||
use rog_dbus::zbus_fan_curves::FanCurvesProxyBlocking;
|
||||
use rog_dbus::zbus_platform::PlatformProxyBlocking;
|
||||
use rog_dbus::zbus_slash::SlashProxyBlocking;
|
||||
use rog_platform::platform::{GpuMode, Properties, ThrottlePolicy};
|
||||
use rog_platform::platform::{Properties, ThrottlePolicy};
|
||||
use rog_profiles::error::ProfileError;
|
||||
use rog_scsi::AuraMode;
|
||||
use rog_slash::SlashMode;
|
||||
@@ -42,6 +43,14 @@ mod scsi_cli;
|
||||
mod slash_cli;
|
||||
|
||||
fn main() {
|
||||
let mut logger = env_logger::Builder::new();
|
||||
logger
|
||||
.parse_default_env()
|
||||
.target(env_logger::Target::Stdout)
|
||||
.format_timestamp(None)
|
||||
.filter_level(log::LevelFilter::Debug)
|
||||
.init();
|
||||
|
||||
let self_version = env!("CARGO_PKG_VERSION");
|
||||
println!("Starting version {self_version}");
|
||||
let args: Vec<String> = args().skip(1).collect();
|
||||
@@ -163,7 +172,7 @@ where
|
||||
return Ok(ctrl);
|
||||
}
|
||||
|
||||
Err("No Aura interface".into())
|
||||
Err(format!("Did not find {iface_name}").into())
|
||||
}
|
||||
|
||||
fn do_parsed(
|
||||
@@ -186,9 +195,6 @@ fn do_parsed(
|
||||
Some(CliCommand::Anime(cmd)) => handle_anime(cmd)?,
|
||||
Some(CliCommand::Slash(cmd)) => handle_slash(cmd)?,
|
||||
Some(CliCommand::Scsi(cmd)) => handle_scsi(cmd)?,
|
||||
Some(CliCommand::PlatformOld(cmd)) => {
|
||||
handle_platform_properties(&conn, supported_properties, cmd)?
|
||||
}
|
||||
Some(CliCommand::Armoury(cmd)) => handle_armoury_command(cmd)?,
|
||||
None => {
|
||||
if (!parsed.show_supported
|
||||
@@ -370,7 +376,12 @@ fn handle_anime(cmd: &AnimeCommand) -> Result<(), Box<dyn std::error::Error>> {
|
||||
println!("\n{}", lst);
|
||||
}
|
||||
}
|
||||
let animes = find_iface::<AnimeProxyBlocking>("xyz.ljones.Anime")?;
|
||||
|
||||
let animes = find_iface::<AnimeProxyBlocking>("xyz.ljones.Anime").map_err(|e| {
|
||||
error!("Did not find any interface for xyz.ljones.Anime: {e:?}");
|
||||
e
|
||||
})?;
|
||||
|
||||
for proxy in animes {
|
||||
if let Some(enable) = cmd.enable_display {
|
||||
proxy.set_enable_display(enable)?;
|
||||
@@ -1007,70 +1018,6 @@ fn handle_fan_curve(
|
||||
Ok(())
|
||||
}
|
||||
|
||||
fn handle_platform_properties(
|
||||
conn: &Connection,
|
||||
supported: &[Properties],
|
||||
cmd: &PlatformCommand
|
||||
) -> Result<(), Box<dyn std::error::Error>> {
|
||||
{
|
||||
if (cmd.gpu_mux_mode_set.is_none()
|
||||
&& !cmd.gpu_mux_mode_get
|
||||
&& cmd.post_sound_set.is_none()
|
||||
&& !cmd.post_sound_get
|
||||
&& cmd.panel_overdrive_set.is_none()
|
||||
&& !cmd.panel_overdrive_get)
|
||||
|| cmd.help
|
||||
{
|
||||
println!("Missing arg or command\n");
|
||||
|
||||
let usage: Vec<String> = PlatformCommand::usage()
|
||||
.lines()
|
||||
.map(|s| s.to_owned())
|
||||
.collect();
|
||||
|
||||
for line in usage.iter().filter(|line| {
|
||||
line.contains("sound") && supported.contains(&Properties::PostAnimationSound)
|
||||
|| line.contains("GPU") && supported.contains(&Properties::GpuMuxMode)
|
||||
|| line.contains("panel") && supported.contains(&Properties::PanelOd)
|
||||
}) {
|
||||
println!("{}", line);
|
||||
}
|
||||
}
|
||||
|
||||
let proxy = PlatformProxyBlocking::new(conn)?;
|
||||
|
||||
if let Some(opt) = cmd.post_sound_set {
|
||||
proxy.set_boot_sound(opt)?;
|
||||
}
|
||||
if cmd.post_sound_get {
|
||||
let res = proxy.boot_sound()?;
|
||||
println!("Bios POST sound on: {}", res);
|
||||
}
|
||||
|
||||
if let Some(opt) = cmd.gpu_mux_mode_set {
|
||||
println!("Rebuilding initrd to include drivers");
|
||||
proxy.set_gpu_mux_mode(GpuMode::from_mux(opt))?;
|
||||
println!(
|
||||
"The mode change is not active until you reboot, on boot the bios will make the \
|
||||
required change"
|
||||
);
|
||||
}
|
||||
if cmd.gpu_mux_mode_get {
|
||||
let res = proxy.gpu_mux_mode()?;
|
||||
println!("Bios GPU MUX: {:?}", res);
|
||||
}
|
||||
|
||||
if let Some(opt) = cmd.panel_overdrive_set {
|
||||
proxy.set_panel_od(opt)?;
|
||||
}
|
||||
if cmd.panel_overdrive_get {
|
||||
let res = proxy.panel_od()?;
|
||||
println!("Panel overdrive on: {}", res);
|
||||
}
|
||||
}
|
||||
Ok(())
|
||||
}
|
||||
|
||||
fn check_systemd_unit_active(name: &str) -> bool {
|
||||
if let Ok(out) = Command::new("systemctl")
|
||||
.arg("is-active")
|
||||
@@ -1175,7 +1122,12 @@ fn handle_armoury_command(cmd: &ArmouryCommand) -> Result<(), Box<dyn std::error
|
||||
for attr in attr.iter() {
|
||||
let name = attr.name()?;
|
||||
if <&str>::from(name) == cmd[0] {
|
||||
attr.set_current_value(cmd[1].parse()?)?;
|
||||
let mut value: i32 = cmd[1].parse()?;
|
||||
if value == -1 {
|
||||
info!("Setting to default");
|
||||
value = attr.default_value()?;
|
||||
}
|
||||
attr.set_current_value(value)?;
|
||||
print_firmware_attr(attr)?;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -3,18 +3,18 @@ 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 log::{debug, error, info};
|
||||
use rog_platform::asus_armoury::{AttrValue, Attribute, FirmwareAttribute, FirmwareAttributes};
|
||||
use rog_platform::platform::{RogPlatform, ThrottlePolicy};
|
||||
use rog_platform::power::AsusPower;
|
||||
use serde::{Deserialize, Serialize};
|
||||
use zbus::object_server::SignalEmitter;
|
||||
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;
|
||||
use crate::{Reloadable, ASUS_ZBUS_PATH};
|
||||
|
||||
const MOD_NAME: &str = "asus_armoury";
|
||||
|
||||
@@ -28,26 +28,31 @@ fn dbus_path_for_attr(attr_name: &str) -> OwnedObjectPath {
|
||||
ObjectPath::from_str_unchecked(&format!("{ASUS_ZBUS_PATH}/{MOD_NAME}/{attr_name}")).into()
|
||||
}
|
||||
|
||||
#[derive(Clone)]
|
||||
pub struct AsusArmouryAttribute {
|
||||
attr: Attribute,
|
||||
config: Arc<Mutex<Config>>,
|
||||
/// platform control required here for access to PPD or Throttle profile
|
||||
platform: RogPlatform
|
||||
platform: RogPlatform,
|
||||
power: AsusPower
|
||||
}
|
||||
|
||||
impl AsusArmouryAttribute {
|
||||
pub fn new(attr: Attribute, platform: RogPlatform, config: Arc<Mutex<Config>>) -> Self {
|
||||
pub fn new(
|
||||
attr: Attribute,
|
||||
platform: RogPlatform,
|
||||
power: AsusPower,
|
||||
config: Arc<Mutex<Config>>
|
||||
) -> Self {
|
||||
Self {
|
||||
attr,
|
||||
config,
|
||||
platform
|
||||
platform,
|
||||
power
|
||||
}
|
||||
}
|
||||
|
||||
pub async fn start_tasks(self, connection: &Connection) -> Result<(), RogError> {
|
||||
// self.reload()
|
||||
// .await
|
||||
// .unwrap_or_else(|err| warn!("Controller error: {}", err));
|
||||
pub async fn move_to_zbus(self, connection: &Connection) -> Result<(), RogError> {
|
||||
let path = dbus_path_for_attr(self.attr.name());
|
||||
connection
|
||||
.object_server()
|
||||
@@ -57,6 +62,73 @@ impl AsusArmouryAttribute {
|
||||
.ok();
|
||||
Ok(())
|
||||
}
|
||||
|
||||
async fn watch_and_notify(
|
||||
&mut self,
|
||||
signal_ctxt: SignalEmitter<'static>
|
||||
) -> Result<(), RogError> {
|
||||
use zbus::export::futures_util::StreamExt;
|
||||
|
||||
let ctrl = self.clone();
|
||||
let name = self.name();
|
||||
match self.attr.get_watcher() {
|
||||
Ok(watch) => {
|
||||
let name = <&str>::from(name);
|
||||
tokio::spawn(async move {
|
||||
let mut buffer = [0; 32];
|
||||
watch
|
||||
.into_event_stream(&mut buffer)
|
||||
.unwrap()
|
||||
.for_each(|_| async {
|
||||
debug!("{} changed", name);
|
||||
ctrl.current_value_changed(&signal_ctxt).await.ok();
|
||||
})
|
||||
.await;
|
||||
});
|
||||
}
|
||||
Err(e) => info!(
|
||||
"inotify watch failed: {}. You can ignore this if your device does not support \
|
||||
the feature",
|
||||
e
|
||||
)
|
||||
}
|
||||
|
||||
Ok(())
|
||||
}
|
||||
}
|
||||
|
||||
impl crate::Reloadable for AsusArmouryAttribute {
|
||||
async fn reload(&mut self) -> Result<(), RogError> {
|
||||
info!("Reloading {}", self.attr.name());
|
||||
let profile: ThrottlePolicy =
|
||||
ThrottlePolicy::from_str(self.platform.get_platform_profile()?.as_str())?;
|
||||
let power_plugged = self
|
||||
.power
|
||||
.get_online()
|
||||
.map_err(|e| {
|
||||
error!("Could not get power status: {e:?}");
|
||||
e
|
||||
})
|
||||
.unwrap_or_default();
|
||||
let config = if power_plugged == 1 {
|
||||
&self.config.lock().await.ac_profile_tunings
|
||||
} else {
|
||||
&self.config.lock().await.dc_profile_tunings
|
||||
};
|
||||
if let Some(tunings) = config.get(&profile) {
|
||||
if let Some(tune) = tunings.get(&self.name()) {
|
||||
self.attr
|
||||
.set_current_value(&AttrValue::Integer(*tune))
|
||||
.map_err(|e| {
|
||||
error!("Could not set value: {e:?}");
|
||||
e
|
||||
})?;
|
||||
info!("Set {} to {:?}", self.attr.name(), tune);
|
||||
}
|
||||
}
|
||||
|
||||
Ok(())
|
||||
}
|
||||
}
|
||||
|
||||
/// If return is `-1` on a property then there is avilable value for that
|
||||
@@ -107,6 +179,32 @@ impl AsusArmouryAttribute {
|
||||
}
|
||||
}
|
||||
|
||||
async fn restore_default(&self) -> fdo::Result<()> {
|
||||
self.attr.restore_default()?;
|
||||
if self.name().is_ppt() {
|
||||
let profile: ThrottlePolicy =
|
||||
ThrottlePolicy::from_str(self.platform.get_platform_profile()?.as_str())?;
|
||||
let power_plugged = self
|
||||
.power
|
||||
.get_online()
|
||||
.map_err(|e| {
|
||||
error!("Could not get power status: {e:?}");
|
||||
e
|
||||
})
|
||||
.unwrap_or_default();
|
||||
|
||||
let mut config = self.config.lock().await;
|
||||
let tunings = config.select_tunings(power_plugged == 1, profile);
|
||||
if let Some(tune) = tunings.get_mut(&self.name()) {
|
||||
if let AttrValue::Integer(i) = self.attr.default_value() {
|
||||
*tune = *i;
|
||||
}
|
||||
}
|
||||
config.write();
|
||||
}
|
||||
Ok(())
|
||||
}
|
||||
|
||||
#[zbus(property)]
|
||||
async fn min_value(&self) -> i32 {
|
||||
match self.attr.min_value() {
|
||||
@@ -152,16 +250,58 @@ impl AsusArmouryAttribute {
|
||||
#[zbus(property)]
|
||||
async fn set_current_value(&mut self, value: i32) -> fdo::Result<()> {
|
||||
self.attr
|
||||
.set_current_value(AttrValue::Integer(value))
|
||||
.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 self.name().is_ppt() {
|
||||
let profile: ThrottlePolicy =
|
||||
ThrottlePolicy::from_str(self.platform.get_platform_profile()?.as_str())?;
|
||||
|
||||
let power_plugged = self
|
||||
.power
|
||||
.get_online()
|
||||
.map_err(|e| {
|
||||
error!("Could not get power status: {e:?}");
|
||||
e
|
||||
})
|
||||
.unwrap_or_default();
|
||||
let mut config = self.config.lock().await;
|
||||
let tunings = config.select_tunings(power_plugged == 1, profile);
|
||||
|
||||
if let Some(tune) = tunings.get_mut(&self.name()) {
|
||||
*tune = value;
|
||||
} else {
|
||||
tunings.insert(self.name(), value);
|
||||
debug!("Set tuning config for {} = {:?}", self.attr.name(), value);
|
||||
}
|
||||
} else {
|
||||
let has_attr = self
|
||||
.config
|
||||
.lock()
|
||||
.await
|
||||
.armoury_settings
|
||||
.contains_key(&self.name());
|
||||
if has_attr {
|
||||
if let Some(setting) = self
|
||||
.config
|
||||
.lock()
|
||||
.await
|
||||
.armoury_settings
|
||||
.get_mut(&self.name())
|
||||
{
|
||||
*setting = value
|
||||
}
|
||||
} else {
|
||||
debug!("Adding config for {}", self.attr.name());
|
||||
self.config
|
||||
.lock()
|
||||
.await
|
||||
.armoury_settings
|
||||
.insert(self.name(), value);
|
||||
debug!("Set config for {} = {:?}", self.attr.name(), value);
|
||||
}
|
||||
}
|
||||
self.config.lock().await.write();
|
||||
@@ -170,14 +310,63 @@ impl AsusArmouryAttribute {
|
||||
}
|
||||
|
||||
pub async fn start_attributes_zbus(
|
||||
server: &Connection,
|
||||
conn: &Connection,
|
||||
platform: RogPlatform,
|
||||
power: AsusPower,
|
||||
config: Arc<Mutex<Config>>
|
||||
) -> Result<(), RogError> {
|
||||
for attr in FirmwareAttributes::new().attributes() {
|
||||
AsusArmouryAttribute::new(attr.clone(), platform.clone(), config.clone())
|
||||
.start_tasks(server)
|
||||
.await?;
|
||||
let mut attr = AsusArmouryAttribute::new(
|
||||
attr.clone(),
|
||||
platform.clone(),
|
||||
power.clone(),
|
||||
config.clone()
|
||||
);
|
||||
attr.reload().await?;
|
||||
|
||||
let path = dbus_path_for_attr(attr.attr.name());
|
||||
let sig = zbus::object_server::SignalEmitter::new(conn, path)?;
|
||||
attr.watch_and_notify(sig).await?;
|
||||
|
||||
attr.move_to_zbus(conn).await?;
|
||||
}
|
||||
Ok(())
|
||||
}
|
||||
|
||||
pub async fn set_config_or_default(
|
||||
attrs: &FirmwareAttributes,
|
||||
config: &mut Config,
|
||||
power_plugged: bool,
|
||||
profile: ThrottlePolicy
|
||||
) {
|
||||
for attr in attrs.attributes().iter() {
|
||||
let name: FirmwareAttribute = attr.name().into();
|
||||
if name.is_ppt() {
|
||||
let tunings = config.select_tunings(power_plugged, profile);
|
||||
|
||||
if let Some(tune) = tunings.get(&name) {
|
||||
attr.set_current_value(&AttrValue::Integer(*tune))
|
||||
.map_err(|e| {
|
||||
error!("Failed to set {}: {e}", <&str>::from(name));
|
||||
})
|
||||
.ok();
|
||||
} else {
|
||||
let default = attr.default_value();
|
||||
attr.set_current_value(default)
|
||||
.map_err(|e| {
|
||||
error!("Failed to set {}: {e}", <&str>::from(name));
|
||||
})
|
||||
.ok();
|
||||
if let AttrValue::Integer(i) = default {
|
||||
tunings.insert(name, *i);
|
||||
info!(
|
||||
"Set default tuning config for {} = {:?}",
|
||||
<&str>::from(name),
|
||||
i
|
||||
);
|
||||
config.write();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -104,23 +104,28 @@ impl DeviceHandle {
|
||||
|
||||
/// Try AniMe Matrix HID. If one exists it is initialsed and returned.
|
||||
pub async fn maybe_anime_hid(
|
||||
device: Arc<Mutex<HidRaw>>,
|
||||
prod_id: &str
|
||||
_device: Arc<Mutex<HidRaw>>,
|
||||
_prod_id: &str
|
||||
) -> Result<Self, RogError> {
|
||||
debug!("Testing for HIDRAW AniMe");
|
||||
let anime_type = AnimeType::from_dmi();
|
||||
dbg!(prod_id);
|
||||
if matches!(anime_type, AnimeType::Unsupported) || prod_id != "193b" {
|
||||
log::info!("Unknown or invalid AniMe: {prod_id:?}, skipping");
|
||||
return Err(RogError::NotFound("No anime-matrix device".to_string()));
|
||||
}
|
||||
info!("Found AniMe Matrix HIDRAW {anime_type:?}: {prod_id}");
|
||||
// TODO: can't use HIDRAW for anime at the moment
|
||||
Err(RogError::NotFound(
|
||||
"Can't use anime over hidraw yet. Skip.".to_string()
|
||||
))
|
||||
|
||||
let mut config = AniMeConfig::new().load();
|
||||
config.anime_type = anime_type;
|
||||
let mut anime = AniMe::new(Some(device), None, Arc::new(Mutex::new(config)));
|
||||
anime.do_initialization().await?;
|
||||
Ok(Self::AniMe(anime))
|
||||
// debug!("Testing for HIDRAW AniMe");
|
||||
// let anime_type = AnimeType::from_dmi();
|
||||
// dbg!(prod_id);
|
||||
// if matches!(anime_type, AnimeType::Unsupported) || prod_id != "193b"
|
||||
// { log::info!("Unknown or invalid AniMe: {prod_id:?},
|
||||
// skipping"); return Err(RogError::NotFound("No
|
||||
// anime-matrix device".to_string())); }
|
||||
// info!("Found AniMe Matrix HIDRAW {anime_type:?}: {prod_id}");
|
||||
|
||||
// let mut config = AniMeConfig::new().load();
|
||||
// config.anime_type = anime_type;
|
||||
// let mut anime = AniMe::new(Some(device), None,
|
||||
// Arc::new(Mutex::new(config))); anime.do_initialization().
|
||||
// await?; Ok(Self::AniMe(anime))
|
||||
}
|
||||
|
||||
pub async fn maybe_anime_usb() -> Result<Self, RogError> {
|
||||
|
||||
@@ -1,23 +1,21 @@
|
||||
use std::collections::HashMap;
|
||||
|
||||
use config_traits::{StdConfig, StdConfigLoad1};
|
||||
use rog_platform::asus_armoury::FirmwareAttribute;
|
||||
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";
|
||||
type Tunings = HashMap<ThrottlePolicy, HashMap<FirmwareAttribute, i32>>;
|
||||
|
||||
#[derive(Deserialize, Serialize)]
|
||||
#[derive(Deserialize, Serialize, PartialEq)]
|
||||
pub struct Config {
|
||||
// The current charge limit applied
|
||||
pub charge_control_end_threshold: u8,
|
||||
/// Save charge limit for restoring
|
||||
#[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,
|
||||
/// An optional command/script to run when power is changed to AC
|
||||
pub ac_command: String,
|
||||
@@ -40,20 +38,34 @@ pub struct Config {
|
||||
pub throttle_balanced_epp: CPUEPP,
|
||||
/// The energy_performance_preference for this throttle/platform profile
|
||||
pub throttle_performance_epp: CPUEPP,
|
||||
pub tunings: HashMap<ThrottlePolicy, HashMap<FirmwareAttribute, i32>>,
|
||||
pub ac_profile_tunings: Tunings,
|
||||
pub dc_profile_tunings: Tunings,
|
||||
pub armoury_settings: HashMap<FirmwareAttribute, i32>,
|
||||
/// Temporary state for AC/Batt
|
||||
#[serde(skip)]
|
||||
pub last_power_plugged: u8
|
||||
}
|
||||
|
||||
impl Config {
|
||||
pub fn select_tunings(
|
||||
&mut self,
|
||||
power_plugged: bool,
|
||||
profile: ThrottlePolicy
|
||||
) -> &mut HashMap<FirmwareAttribute, i32> {
|
||||
let config = if power_plugged {
|
||||
&mut self.ac_profile_tunings
|
||||
} else {
|
||||
&mut self.dc_profile_tunings
|
||||
};
|
||||
config.entry(profile).or_insert_with(HashMap::new)
|
||||
}
|
||||
}
|
||||
|
||||
impl Default for Config {
|
||||
fn default() -> Self {
|
||||
Self {
|
||||
charge_control_end_threshold: 100,
|
||||
base_charge_control_end_threshold: 100,
|
||||
panel_od: false,
|
||||
boot_sound: false,
|
||||
mini_led_mode: false,
|
||||
disable_nvidia_powerd_on_battery: true,
|
||||
ac_command: Default::default(),
|
||||
bat_command: Default::default(),
|
||||
@@ -65,7 +77,9 @@ impl Default for Config {
|
||||
throttle_quiet_epp: CPUEPP::Power,
|
||||
throttle_balanced_epp: CPUEPP::BalancePower,
|
||||
throttle_performance_epp: CPUEPP::Performance,
|
||||
tunings: HashMap::default(),
|
||||
ac_profile_tunings: HashMap::default(),
|
||||
dc_profile_tunings: HashMap::default(),
|
||||
armoury_settings: HashMap::default(),
|
||||
last_power_plugged: Default::default()
|
||||
}
|
||||
}
|
||||
@@ -140,12 +154,9 @@ impl From<Config601> for Config {
|
||||
// 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: 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: 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,
|
||||
@@ -155,7 +166,9 @@ impl From<Config601> for Config {
|
||||
throttle_balanced_epp: c.throttle_balanced_epp,
|
||||
throttle_performance_epp: c.throttle_performance_epp,
|
||||
last_power_plugged: c.last_power_plugged,
|
||||
tunings: HashMap::default()
|
||||
ac_profile_tunings: HashMap::default(),
|
||||
dc_profile_tunings: HashMap::default(),
|
||||
armoury_settings: HashMap::default()
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,20 +1,23 @@
|
||||
use std::path::Path;
|
||||
use std::process::Command;
|
||||
use std::str::FromStr;
|
||||
use std::sync::Arc;
|
||||
|
||||
use config_traits::StdConfig;
|
||||
use log::{debug, error, info, warn};
|
||||
use rog_platform::asus_armoury::FirmwareAttributes;
|
||||
use rog_platform::cpu::{CPUControl, CPUGovernor, CPUEPP};
|
||||
use rog_platform::platform::{GpuMode, Properties, RogPlatform, ThrottlePolicy};
|
||||
use rog_platform::platform::{Properties, RogPlatform, ThrottlePolicy};
|
||||
use rog_platform::power::AsusPower;
|
||||
use zbus::export::futures_util::lock::Mutex;
|
||||
use zbus::fdo::Error as FdoErr;
|
||||
use zbus::object_server::SignalEmitter;
|
||||
use zbus::{interface, Connection};
|
||||
|
||||
use crate::asus_armoury::set_config_or_default;
|
||||
use crate::config::Config;
|
||||
use crate::error::RogError;
|
||||
use crate::{task_watch_item, task_watch_item_notify, CtrlTask, ReloadAndNotify};
|
||||
use crate::{task_watch_item, CtrlTask, ReloadAndNotify};
|
||||
|
||||
const PLATFORM_ZBUS_PATH: &str = "/xyz/ljones";
|
||||
|
||||
@@ -37,28 +40,6 @@ macro_rules! platform_get_value {
|
||||
}
|
||||
}
|
||||
|
||||
macro_rules! platform_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::Failed(format!("RogPlatform: {} {err}", $prop_name))
|
||||
})?;
|
||||
});
|
||||
let mut lock = $self.config.lock().await;
|
||||
lock.$property = $new_value;
|
||||
lock.write();
|
||||
Ok(())
|
||||
} else {
|
||||
debug!("RogPlatform: {} not supported", $prop_name);
|
||||
Err(FdoErr::NotSupported(format!("RogPlatform: {} not supported", $prop_name)))
|
||||
}
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
#[derive(Clone)]
|
||||
pub struct CtrlPlatform {
|
||||
power: AsusPower,
|
||||
@@ -75,12 +56,6 @@ impl CtrlPlatform {
|
||||
) -> Result<Self, RogError> {
|
||||
let platform = RogPlatform::new()?;
|
||||
let power = AsusPower::new()?;
|
||||
|
||||
if !platform.has_gpu_mux_mode() {
|
||||
info!("G-Sync Switchable Graphics or GPU MUX not detected");
|
||||
info!("Standard graphics switching will still work.");
|
||||
}
|
||||
|
||||
let config1 = config.clone();
|
||||
let config_path = config_path.to_owned();
|
||||
|
||||
@@ -146,17 +121,6 @@ impl CtrlPlatform {
|
||||
Ok(ret_self)
|
||||
}
|
||||
|
||||
fn set_gfx_mode(&self, mode: GpuMode) -> Result<(), RogError> {
|
||||
self.platform.set_gpu_mux_mode(mode.to_mux_attr())?;
|
||||
// self.update_initramfs(enable)?;
|
||||
if mode == GpuMode::Ultimate {
|
||||
info!("Set system-level graphics mode: Dedicated Nvidia");
|
||||
} else {
|
||||
info!("Set system-level graphics mode: Optimus");
|
||||
}
|
||||
Ok(())
|
||||
}
|
||||
|
||||
async fn restore_charge_limit(&self) {
|
||||
let limit = self.config.lock().await.base_charge_control_end_threshold;
|
||||
if limit > 0
|
||||
@@ -315,12 +279,6 @@ impl CtrlPlatform {
|
||||
Properties::ChargeControlEndThreshold
|
||||
);
|
||||
|
||||
platform_name!(dgpu_disable, Properties::DgpuDisable);
|
||||
platform_name!(gpu_mux_mode, Properties::GpuMuxMode);
|
||||
platform_name!(boot_sound, Properties::PostAnimationSound);
|
||||
platform_name!(panel_od, Properties::PanelOd);
|
||||
platform_name!(mini_led_mode, Properties::MiniLedMode);
|
||||
platform_name!(egpu_enable, Properties::EgpuEnable);
|
||||
platform_name!(throttle_thermal_policy, Properties::ThrottlePolicy);
|
||||
|
||||
supported
|
||||
@@ -357,30 +315,6 @@ impl CtrlPlatform {
|
||||
Ok(())
|
||||
}
|
||||
|
||||
#[zbus(property)]
|
||||
fn gpu_mux_mode(&self) -> Result<u8, FdoErr> {
|
||||
self.platform.get_gpu_mux_mode().map_err(|err| {
|
||||
warn!("get_gpu_mux_mode {err}");
|
||||
FdoErr::NotSupported("RogPlatform: set_gpu_mux_mode not supported".to_owned())
|
||||
})
|
||||
}
|
||||
|
||||
#[zbus(property)]
|
||||
async fn set_gpu_mux_mode(&mut self, mode: u8) -> Result<(), FdoErr> {
|
||||
if self.platform.has_gpu_mux_mode() {
|
||||
self.set_gfx_mode(mode.into()).map_err(|err| {
|
||||
warn!("set_gpu_mux_mode {}", err);
|
||||
FdoErr::Failed(format!("RogPlatform: set_gpu_mux_mode: {err}"))
|
||||
})?;
|
||||
self.config.lock().await.write();
|
||||
} else {
|
||||
return Err(FdoErr::NotSupported(
|
||||
"RogPlatform: set_gpu_mux_mode not supported".to_owned()
|
||||
));
|
||||
}
|
||||
Ok(())
|
||||
}
|
||||
|
||||
/// Toggle to next platform_profile. Names provided by `Profiles`.
|
||||
/// If fan-curves are supported will also activate a fan curve for profile.
|
||||
async fn next_throttle_thermal_policy(
|
||||
@@ -549,58 +483,6 @@ impl CtrlPlatform {
|
||||
self.config.lock().await.write();
|
||||
Ok(())
|
||||
}
|
||||
|
||||
/// Get the `panel_od` value from platform. Updates the stored value in
|
||||
/// internal config also.
|
||||
#[zbus(property)]
|
||||
fn panel_od(&self) -> Result<bool, FdoErr> {
|
||||
platform_get_value!(self, panel_od, "panel_od")
|
||||
}
|
||||
|
||||
#[zbus(property)]
|
||||
async fn set_panel_od(&mut self, overdrive: bool) -> Result<(), FdoErr> {
|
||||
platform_set_value!(self, panel_od, "panel_od", overdrive)?;
|
||||
self.config.lock().await.write();
|
||||
Ok(())
|
||||
}
|
||||
|
||||
/// Get the `boot_sound` value from platform. Updates the stored value in
|
||||
/// internal config also.
|
||||
#[zbus(property)]
|
||||
fn boot_sound(&self) -> Result<bool, FdoErr> {
|
||||
platform_get_value!(self, boot_sound, "boot_sound")
|
||||
}
|
||||
|
||||
#[zbus(property)]
|
||||
async fn set_boot_sound(&mut self, on: bool) -> Result<(), FdoErr> {
|
||||
platform_set_value!(self, boot_sound, "boot_sound", on)?;
|
||||
self.config.lock().await.write();
|
||||
Ok(())
|
||||
}
|
||||
|
||||
/// Get the `panel_od` value from platform. Updates the stored value in
|
||||
/// internal config also.
|
||||
#[zbus(property)]
|
||||
fn mini_led_mode(&self) -> Result<bool, FdoErr> {
|
||||
platform_get_value!(self, mini_led_mode, "mini_led_mode")
|
||||
}
|
||||
|
||||
#[zbus(property)]
|
||||
async fn set_mini_led_mode(&mut self, on: bool) -> Result<(), FdoErr> {
|
||||
platform_set_value!(self, mini_led_mode, "mini_led_mode", on)?;
|
||||
self.config.lock().await.write();
|
||||
Ok(())
|
||||
}
|
||||
|
||||
#[zbus(property)]
|
||||
fn dgpu_disable(&self) -> Result<bool, FdoErr> {
|
||||
platform_get_value!(self, dgpu_disable, "dgpu_disable")
|
||||
}
|
||||
|
||||
#[zbus(property)]
|
||||
fn egpu_enable(&self) -> Result<bool, FdoErr> {
|
||||
platform_get_value!(self, egpu_enable, "egpu_enable")
|
||||
}
|
||||
}
|
||||
|
||||
impl crate::ZbusRun for CtrlPlatform {
|
||||
@@ -619,49 +501,44 @@ impl ReloadAndNotify for CtrlPlatform {
|
||||
data: Self::Data
|
||||
) -> Result<(), RogError> {
|
||||
let mut config = self.config.lock().await;
|
||||
info!("asusd.ron updated externally, reloading and updating internal copy");
|
||||
if *config != data {
|
||||
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.platform.has_throttle_thermal_policy()
|
||||
&& config.throttle_policy_linked_epp != data.throttle_policy_linked_epp
|
||||
{
|
||||
// TODO: extra stuff
|
||||
}
|
||||
|
||||
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 {
|
||||
concat_idents::concat_idents!(set = set_, $property {
|
||||
self.platform
|
||||
.set(data.$property)?;});
|
||||
concat_idents::concat_idents!(changed = $property, _changed {
|
||||
self.changed(signal_context).await?;});
|
||||
}
|
||||
})
|
||||
}
|
||||
if self.power.has_charge_control_end_threshold()
|
||||
&& data.charge_control_end_threshold != config.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));
|
||||
}
|
||||
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");
|
||||
|
||||
*config = data;
|
||||
config.base_charge_control_end_threshold =
|
||||
base_charge_control_end_threshold.unwrap_or_default();
|
||||
if self.platform.has_throttle_thermal_policy()
|
||||
&& config.throttle_policy_linked_epp != data.throttle_policy_linked_epp
|
||||
{
|
||||
let profile: ThrottlePolicy =
|
||||
ThrottlePolicy::from_str(self.platform.get_platform_profile()?.as_str())?;
|
||||
|
||||
let epp = match profile {
|
||||
ThrottlePolicy::Balanced => data.throttle_balanced_epp,
|
||||
ThrottlePolicy::Performance => data.throttle_performance_epp,
|
||||
ThrottlePolicy::Quiet => data.throttle_quiet_epp
|
||||
};
|
||||
warn!("setting epp to {epp:?}");
|
||||
self.check_and_set_epp(epp, true);
|
||||
}
|
||||
// reload_and_notify!(throttle_thermal_policy, "throttle_thermal_policy");
|
||||
|
||||
*config = data;
|
||||
config.base_charge_control_end_threshold =
|
||||
base_charge_control_end_threshold.unwrap_or_default();
|
||||
}
|
||||
Ok(())
|
||||
}
|
||||
}
|
||||
@@ -678,22 +555,6 @@ impl crate::Reloadable for CtrlPlatform {
|
||||
warn!("No charge_control_end_threshold found")
|
||||
}
|
||||
|
||||
macro_rules! 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)?;});
|
||||
|
||||
}
|
||||
})
|
||||
}
|
||||
}
|
||||
reload!(mini_led_mode, "mini_led_mode");
|
||||
reload!(panel_od, "panel_od");
|
||||
reload!(boot_sound, "boot_sound");
|
||||
|
||||
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() {
|
||||
@@ -709,20 +570,7 @@ impl crate::Reloadable for CtrlPlatform {
|
||||
}
|
||||
|
||||
impl CtrlPlatform {
|
||||
task_watch_item!(panel_od "panel_od" platform);
|
||||
|
||||
task_watch_item!(mini_led_mode "mini_led_mode" platform);
|
||||
|
||||
task_watch_item!(charge_control_end_threshold "charge_control_end_threshold" power);
|
||||
|
||||
task_watch_item_notify!(boot_sound platform);
|
||||
|
||||
task_watch_item_notify!(dgpu_disable platform);
|
||||
|
||||
task_watch_item_notify!(egpu_enable platform);
|
||||
|
||||
// NOTE: see note further below
|
||||
task_watch_item_notify!(gpu_mux_mode platform);
|
||||
}
|
||||
|
||||
impl CtrlTask for CtrlPlatform {
|
||||
@@ -738,17 +586,6 @@ impl CtrlTask for CtrlPlatform {
|
||||
move |sleeping| {
|
||||
let platform1 = platform1.clone();
|
||||
async move {
|
||||
info!("RogPlatform reloading panel_od");
|
||||
if !sleeping && platform1.platform.has_panel_od() {
|
||||
platform1
|
||||
.platform
|
||||
.set_panel_od(platform1.config.lock().await.panel_od)
|
||||
.map_err(|err| {
|
||||
warn!("CtrlCharge: panel_od {}", err);
|
||||
err
|
||||
})
|
||||
.ok();
|
||||
}
|
||||
// This block is commented out due to some kind of issue reported. Maybe the
|
||||
// desktops used were storing a value whcih was then read here.
|
||||
// Don't store it on suspend, assume that the current config setting is desired
|
||||
@@ -788,17 +625,6 @@ impl CtrlTask for CtrlPlatform {
|
||||
async move {
|
||||
info!("RogPlatform reloading panel_od");
|
||||
let lock = platform2.config.lock().await;
|
||||
if !shutting_down && platform2.platform.has_panel_od() {
|
||||
platform2
|
||||
.platform
|
||||
.set_panel_od(lock.panel_od)
|
||||
.map_err(|err| {
|
||||
warn!("CtrlCharge: panel_od {}", err);
|
||||
err
|
||||
})
|
||||
.ok();
|
||||
}
|
||||
|
||||
if shutting_down
|
||||
&& platform2.power.has_charge_control_end_threshold()
|
||||
&& lock.base_charge_control_end_threshold > 0
|
||||
@@ -836,6 +662,24 @@ impl CtrlTask for CtrlPlatform {
|
||||
if platform3.power.has_charge_control_end_threshold() && !power_plugged {
|
||||
platform3.restore_charge_limit().await;
|
||||
}
|
||||
|
||||
if let Ok(profile) = platform3
|
||||
.platform
|
||||
.get_throttle_thermal_policy()
|
||||
.map(ThrottlePolicy::from)
|
||||
.map_err(|e| {
|
||||
error!("Platform: get_throttle_thermal_policy error: {e}");
|
||||
})
|
||||
{
|
||||
let attrs = FirmwareAttributes::new();
|
||||
set_config_or_default(
|
||||
&attrs,
|
||||
&mut *platform3.config.lock().await,
|
||||
power_plugged,
|
||||
profile
|
||||
)
|
||||
.await;
|
||||
}
|
||||
}
|
||||
}
|
||||
)
|
||||
@@ -843,22 +687,15 @@ impl CtrlTask for CtrlPlatform {
|
||||
|
||||
// This spawns a new task for every item.
|
||||
// TODO: find a better way to manage this
|
||||
self.watch_panel_od(signal_ctxt.clone()).await?;
|
||||
self.watch_mini_led_mode(signal_ctxt.clone()).await?;
|
||||
self.watch_charge_control_end_threshold(signal_ctxt.clone())
|
||||
.await?;
|
||||
|
||||
self.watch_dgpu_disable(signal_ctxt.clone()).await?;
|
||||
self.watch_egpu_enable(signal_ctxt.clone()).await?;
|
||||
|
||||
// NOTE: Can't have this as a watch because on a write to it, it reverts back to
|
||||
// booted-with value as it does not actually change until reboot.
|
||||
self.watch_gpu_mux_mode(signal_ctxt.clone()).await?;
|
||||
self.watch_boot_sound(signal_ctxt.clone()).await?;
|
||||
|
||||
let watch_throttle_thermal_policy = self.platform.monitor_throttle_thermal_policy()?;
|
||||
let ctrl = self.clone();
|
||||
|
||||
// Need a copy here, not ideal. But first use in asus_armoury.rs is
|
||||
// moved to zbus
|
||||
let attrs = FirmwareAttributes::new();
|
||||
tokio::spawn(async move {
|
||||
use futures_lite::StreamExt;
|
||||
let mut buffer = [0; 32];
|
||||
@@ -877,6 +714,24 @@ impl CtrlTask for CtrlPlatform {
|
||||
let change_epp = ctrl.config.lock().await.throttle_policy_linked_epp;
|
||||
let epp = ctrl.get_config_epp_for_throttle(profile).await;
|
||||
ctrl.check_and_set_epp(epp, change_epp);
|
||||
ctrl.throttle_thermal_policy_changed(&signal_ctxt)
|
||||
.await
|
||||
.ok();
|
||||
let power_plugged = ctrl
|
||||
.power
|
||||
.get_online()
|
||||
.map_err(|e| {
|
||||
error!("Could not get power status: {e:?}");
|
||||
e
|
||||
})
|
||||
.unwrap_or_default();
|
||||
set_config_or_default(
|
||||
&attrs,
|
||||
&mut *ctrl.config.lock().await,
|
||||
power_plugged == 1,
|
||||
profile
|
||||
)
|
||||
.await;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -13,6 +13,7 @@ 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 rog_platform::power::AsusPower;
|
||||
use zbus::fdo::ObjectManager;
|
||||
|
||||
#[tokio::main]
|
||||
@@ -67,7 +68,8 @@ async fn start_daemon() -> Result<(), Box<dyn Error>> {
|
||||
|
||||
// supported.add_to_server(&mut connection).await;
|
||||
let platform = RogPlatform::new()?; // TODO: maybe needs async mutex?
|
||||
start_attributes_zbus(&server, platform, config.clone()).await?;
|
||||
let power = AsusPower::new()?; // TODO: maybe needs async mutex?
|
||||
start_attributes_zbus(&server, platform, power, config.clone()).await?;
|
||||
|
||||
match CtrlFanCurveZbus::new() {
|
||||
Ok(ctrl) => {
|
||||
|
||||
@@ -20,7 +20,7 @@ fn main() {
|
||||
CompilerConfiguration::new()
|
||||
// .embed_resources(EmbedResourcesKind::EmbedFiles)
|
||||
.with_include_paths(vec![include])
|
||||
.with_style("fluent-dark".into())
|
||||
.with_style("fluent".into())
|
||||
)
|
||||
.unwrap();
|
||||
}
|
||||
|
||||
@@ -11,7 +11,6 @@ use std::time::Duration;
|
||||
|
||||
use log::{debug, error, info, warn};
|
||||
use notify_rust::{Hint, Notification, Timeout, Urgency};
|
||||
use rog_dbus::zbus_platform::PlatformProxy;
|
||||
use rog_platform::platform::GpuMode;
|
||||
use rog_platform::power::AsusPower;
|
||||
use serde::{Deserialize, Serialize};
|
||||
@@ -154,39 +153,41 @@ pub fn start_notifications(
|
||||
};
|
||||
|
||||
// GPU MUX Mode notif
|
||||
let enabled_notifications_copy = config.clone();
|
||||
tokio::spawn(async move {
|
||||
let conn = zbus::Connection::system().await.map_err(|e| {
|
||||
error!("zbus signal: receive_notify_gpu_mux_mode: {e}");
|
||||
e
|
||||
})?;
|
||||
let proxy = PlatformProxy::new(&conn).await.map_err(|e| {
|
||||
error!("zbus signal: receive_notify_gpu_mux_mode: {e}");
|
||||
e
|
||||
})?;
|
||||
// TODO: need to get armoury attrs and iter to find
|
||||
// let enabled_notifications_copy = config.clone();
|
||||
// tokio::spawn(async move {
|
||||
// let conn = zbus::Connection::system().await.map_err(|e| {
|
||||
// error!("zbus signal: receive_notify_gpu_mux_mode: {e}");
|
||||
// e
|
||||
// })?;
|
||||
// let proxy = PlatformProxy::new(&conn).await.map_err(|e| {
|
||||
// error!("zbus signal: receive_notify_gpu_mux_mode: {e}");
|
||||
// e
|
||||
// })?;
|
||||
|
||||
let mut actual_mux_mode = GpuMode::Error;
|
||||
if let Ok(mode) = proxy.gpu_mux_mode().await {
|
||||
actual_mux_mode = GpuMode::from(mode);
|
||||
}
|
||||
// let mut actual_mux_mode = GpuMode::Error;
|
||||
// if let Ok(mode) = proxy.gpu_mux_mode().await {
|
||||
// actual_mux_mode = GpuMode::from(mode);
|
||||
// }
|
||||
|
||||
info!("Started zbus signal thread: receive_notify_gpu_mux_mode");
|
||||
while let Some(e) = proxy.receive_gpu_mux_mode_changed().await.next().await {
|
||||
if let Ok(config) = enabled_notifications_copy.lock() {
|
||||
if !config.notifications.enabled || !config.notifications.receive_notify_gfx {
|
||||
continue;
|
||||
}
|
||||
}
|
||||
if let Ok(out) = e.get().await {
|
||||
let mode = GpuMode::from(out);
|
||||
if mode == actual_mux_mode {
|
||||
continue;
|
||||
}
|
||||
do_mux_notification("Reboot required. BIOS GPU MUX mode set to", &mode).ok();
|
||||
}
|
||||
}
|
||||
Ok::<(), zbus::Error>(())
|
||||
});
|
||||
// info!("Started zbus signal thread: receive_notify_gpu_mux_mode");
|
||||
// while let Some(e) =
|
||||
// proxy.receive_gpu_mux_mode_changed().await.next().await { if let
|
||||
// Ok(config) = enabled_notifications_copy.lock() { if
|
||||
// !config.notifications.enabled || !config.notifications.receive_notify_gfx {
|
||||
// continue;
|
||||
// }
|
||||
// }
|
||||
// if let Ok(out) = e.get().await {
|
||||
// let mode = GpuMode::from(out);
|
||||
// if mode == actual_mux_mode {
|
||||
// continue;
|
||||
// }
|
||||
// do_mux_notification("Reboot required. BIOS GPU MUX mode set to",
|
||||
// &mode).ok(); }
|
||||
// }
|
||||
// Ok::<(), zbus::Error>(())
|
||||
// });
|
||||
|
||||
let enabled_notifications_copy = config.clone();
|
||||
// GPU Mode change/action notif
|
||||
|
||||
@@ -159,21 +159,23 @@ pub fn init_tray(_supported_properties: Vec<Properties>, config: Arc<Mutex<Confi
|
||||
|
||||
let rog_red = read_icon(&PathBuf::from("asus_notif_red.png"));
|
||||
|
||||
let tray = AsusTray {
|
||||
let tray_init = AsusTray {
|
||||
current_title: TRAY_LABEL.to_string(),
|
||||
current_icon: rog_red.clone(),
|
||||
proxy
|
||||
};
|
||||
|
||||
let mut tray = tray
|
||||
.spawn_without_dbus_name()
|
||||
.await
|
||||
.map_err(|e| {
|
||||
// TODO: return an error to the UI
|
||||
let mut tray;
|
||||
match tray_init.spawn_without_dbus_name().await {
|
||||
Ok(t) => tray = t,
|
||||
Err(e) => {
|
||||
log::error!(
|
||||
"Tray unable to be initialised: {e:?}. Do you have a system tray enabled?"
|
||||
)
|
||||
})
|
||||
.unwrap();
|
||||
);
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
info!("Tray started");
|
||||
let rog_blue = read_icon(&PathBuf::from("asus_notif_blue.png"));
|
||||
|
||||
@@ -26,7 +26,7 @@ macro_rules! set_ui_callbacks {
|
||||
let handle_copy = $handle.as_weak();
|
||||
let proxy_copy = $proxy.clone();
|
||||
let data = $handle.global::<$data>();
|
||||
concat_idents::concat_idents!(on_set = on_set_, $proxy_fn {
|
||||
concat_idents::concat_idents!(on_set = on_cb_, $proxy_fn {
|
||||
data.on_set(move |value| {
|
||||
let proxy_copy = proxy_copy.clone();
|
||||
let handle_copy = handle_copy.clone();
|
||||
|
||||
@@ -1,7 +1,8 @@
|
||||
use std::sync::{Arc, Mutex};
|
||||
|
||||
use log::{error, info, warn};
|
||||
use log::{error, info};
|
||||
use rog_anime::Animations;
|
||||
use rog_dbus::find_iface_async;
|
||||
use rog_dbus::zbus_anime::AnimeProxy;
|
||||
use slint::ComponentHandle;
|
||||
|
||||
@@ -12,124 +13,123 @@ use crate::{set_ui_callbacks, set_ui_props_async, AnimePageData, MainWindow};
|
||||
pub fn setup_anime_page(ui: &MainWindow, _states: Arc<Mutex<Config>>) {
|
||||
let handle = ui.as_weak();
|
||||
tokio::spawn(async move {
|
||||
let Ok(conn) = zbus::Connection::system().await.map_err(|e| warn!("{e:}")) else {
|
||||
return;
|
||||
};
|
||||
let Ok(anime) = AnimeProxy::new(&conn).await.map_err(|e| warn!("{e:}")) else {
|
||||
info!("This device may not have an AniMe. If not then the error can be ignored");
|
||||
let Ok(animes) = find_iface_async::<AnimeProxy>("xyz.ljones.Anime").await else {
|
||||
info!("This device appears to have no aura interfaces");
|
||||
return;
|
||||
};
|
||||
|
||||
set_ui_props_async!(handle, anime, AnimePageData, brightness);
|
||||
set_ui_props_async!(handle, anime, AnimePageData, builtins_enabled);
|
||||
set_ui_props_async!(handle, anime, AnimePageData, enable_display);
|
||||
set_ui_props_async!(handle, anime, AnimePageData, off_when_lid_closed);
|
||||
set_ui_props_async!(handle, anime, AnimePageData, off_when_suspended);
|
||||
set_ui_props_async!(handle, anime, AnimePageData, off_when_unplugged);
|
||||
for anime in animes {
|
||||
set_ui_props_async!(handle, anime, AnimePageData, brightness);
|
||||
set_ui_props_async!(handle, anime, AnimePageData, builtins_enabled);
|
||||
set_ui_props_async!(handle, anime, AnimePageData, enable_display);
|
||||
set_ui_props_async!(handle, anime, AnimePageData, off_when_lid_closed);
|
||||
set_ui_props_async!(handle, anime, AnimePageData, off_when_suspended);
|
||||
set_ui_props_async!(handle, anime, AnimePageData, off_when_unplugged);
|
||||
|
||||
let builtins = anime.builtin_animations().await.unwrap_or_default();
|
||||
handle
|
||||
.upgrade_in_event_loop(move |handle| {
|
||||
{
|
||||
let global = handle.global::<AnimePageData>();
|
||||
global.set_boot_anim(builtins.boot as i32);
|
||||
global.set_awake_anim(builtins.awake as i32);
|
||||
global.set_sleep_anim(builtins.sleep as i32);
|
||||
global.set_shutdown_anim(builtins.shutdown as i32);
|
||||
let builtins = anime.builtin_animations().await.unwrap_or_default();
|
||||
handle
|
||||
.upgrade_in_event_loop(move |handle| {
|
||||
{
|
||||
let global = handle.global::<AnimePageData>();
|
||||
global.set_boot_anim(builtins.boot as i32);
|
||||
global.set_awake_anim(builtins.awake as i32);
|
||||
global.set_sleep_anim(builtins.sleep as i32);
|
||||
global.set_shutdown_anim(builtins.shutdown as i32);
|
||||
|
||||
let handle_copy = handle.as_weak();
|
||||
let anime_copy = anime.clone();
|
||||
global.on_set_builtin_animations(move |boot, awake, sleep, shutdown| {
|
||||
let handle_copy = handle_copy.clone();
|
||||
let anime_copy = anime_copy.clone();
|
||||
tokio::spawn(async move {
|
||||
show_toast(
|
||||
"Anime builtin animations changed".into(),
|
||||
"Failed to set Anime builtin animations".into(),
|
||||
handle_copy,
|
||||
anime_copy
|
||||
.set_builtin_animations(Animations {
|
||||
boot: boot.into(),
|
||||
awake: awake.into(),
|
||||
sleep: sleep.into(),
|
||||
shutdown: shutdown.into()
|
||||
})
|
||||
.await
|
||||
);
|
||||
let handle_copy = handle.as_weak();
|
||||
let anime_copy = anime.clone();
|
||||
global.on_cb_builtin_animations(move |boot, awake, sleep, shutdown| {
|
||||
let handle_copy = handle_copy.clone();
|
||||
let anime_copy = anime_copy.clone();
|
||||
tokio::spawn(async move {
|
||||
show_toast(
|
||||
"Anime builtin animations changed".into(),
|
||||
"Failed to set Anime builtin animations".into(),
|
||||
handle_copy,
|
||||
anime_copy
|
||||
.set_builtin_animations(Animations {
|
||||
boot: boot.into(),
|
||||
awake: awake.into(),
|
||||
sleep: sleep.into(),
|
||||
shutdown: shutdown.into()
|
||||
})
|
||||
.await
|
||||
);
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
let handle_copy = handle.as_weak();
|
||||
let anime_copy = anime.clone();
|
||||
tokio::spawn(async move {
|
||||
let mut x = anime_copy.receive_builtin_animations_changed().await;
|
||||
use zbus::export::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::<AnimePageData>()
|
||||
.set_boot_anim(out.boot.into());
|
||||
handle
|
||||
.global::<AnimePageData>()
|
||||
.set_awake_anim(out.awake.into());
|
||||
handle
|
||||
.global::<AnimePageData>()
|
||||
.set_sleep_anim(out.sleep.into());
|
||||
handle
|
||||
.global::<AnimePageData>()
|
||||
.set_shutdown_anim(out.shutdown.into());
|
||||
})
|
||||
.ok();
|
||||
let handle_copy = handle.as_weak();
|
||||
let anime_copy = anime.clone();
|
||||
tokio::spawn(async move {
|
||||
let mut x = anime_copy.receive_builtin_animations_changed().await;
|
||||
use zbus::export::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::<AnimePageData>()
|
||||
.set_boot_anim(out.boot.into());
|
||||
handle
|
||||
.global::<AnimePageData>()
|
||||
.set_awake_anim(out.awake.into());
|
||||
handle
|
||||
.global::<AnimePageData>()
|
||||
.set_sleep_anim(out.sleep.into());
|
||||
handle
|
||||
.global::<AnimePageData>()
|
||||
.set_shutdown_anim(out.shutdown.into());
|
||||
})
|
||||
.ok();
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
set_ui_callbacks!(handle,
|
||||
AnimePageData(.into()),
|
||||
anime.brightness(.into()),
|
||||
"Anime LED brightness successfully set to {}",
|
||||
"Setting Anime LED brightness failed"
|
||||
);
|
||||
set_ui_callbacks!(
|
||||
handle,
|
||||
AnimePageData(),
|
||||
anime.builtins_enabled(),
|
||||
"Keyboard LED mode successfully set to {}",
|
||||
"Setting keyboard LEDmode failed"
|
||||
);
|
||||
set_ui_callbacks!(
|
||||
handle,
|
||||
AnimePageData(),
|
||||
anime.enable_display(),
|
||||
"Anime display successfully set to {}",
|
||||
"Setting Anime display failed"
|
||||
);
|
||||
set_ui_callbacks!(
|
||||
handle,
|
||||
AnimePageData(),
|
||||
anime.off_when_lid_closed(),
|
||||
"Anime off_when_lid_closed successfully set to {}",
|
||||
"Setting Anime off_when_lid_closed failed"
|
||||
);
|
||||
set_ui_callbacks!(
|
||||
handle,
|
||||
AnimePageData(),
|
||||
anime.off_when_suspended(),
|
||||
"Anime off_when_suspended successfully set to {}",
|
||||
"Setting Anime off_when_suspended failed"
|
||||
);
|
||||
set_ui_callbacks!(
|
||||
handle,
|
||||
AnimePageData(),
|
||||
anime.off_when_unplugged(),
|
||||
"Anime off_when_unplugged successfully set to {}",
|
||||
"Setting Anime off_when_unplugged failed"
|
||||
);
|
||||
})
|
||||
.map_err(|e| error!("setup_anime_page: upgrade_in_event_loop: {e:?}"))
|
||||
.ok();
|
||||
set_ui_callbacks!(handle,
|
||||
AnimePageData(.into()),
|
||||
anime.brightness(.into()),
|
||||
"Anime LED brightness successfully set to {}",
|
||||
"Setting Anime LED brightness failed"
|
||||
);
|
||||
set_ui_callbacks!(
|
||||
handle,
|
||||
AnimePageData(),
|
||||
anime.builtins_enabled(),
|
||||
"Keyboard LED mode successfully set to {}",
|
||||
"Setting keyboard LEDmode failed"
|
||||
);
|
||||
set_ui_callbacks!(
|
||||
handle,
|
||||
AnimePageData(),
|
||||
anime.enable_display(),
|
||||
"Anime display successfully set to {}",
|
||||
"Setting Anime display failed"
|
||||
);
|
||||
set_ui_callbacks!(
|
||||
handle,
|
||||
AnimePageData(),
|
||||
anime.off_when_lid_closed(),
|
||||
"Anime off_when_lid_closed successfully set to {}",
|
||||
"Setting Anime off_when_lid_closed failed"
|
||||
);
|
||||
set_ui_callbacks!(
|
||||
handle,
|
||||
AnimePageData(),
|
||||
anime.off_when_suspended(),
|
||||
"Anime off_when_suspended successfully set to {}",
|
||||
"Setting Anime off_when_suspended failed"
|
||||
);
|
||||
set_ui_callbacks!(
|
||||
handle,
|
||||
AnimePageData(),
|
||||
anime.off_when_unplugged(),
|
||||
"Anime off_when_unplugged successfully set to {}",
|
||||
"Setting Anime off_when_unplugged failed"
|
||||
);
|
||||
})
|
||||
.map_err(|e| error!("setup_anime_page: upgrade_in_event_loop: {e:?}"))
|
||||
.ok();
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@@ -65,12 +65,12 @@ async fn find_aura_iface() -> Result<AuraProxy<'static>, Box<dyn std::error::Err
|
||||
}
|
||||
|
||||
pub fn setup_aura_page(ui: &MainWindow, _states: Arc<Mutex<Config>>) {
|
||||
ui.global::<AuraPageData>().on_set_hex_from_colour(|c| {
|
||||
ui.global::<AuraPageData>().on_cb_hex_from_colour(|c| {
|
||||
format!("#{:02X}{:02X}{:02X}", c.red(), c.green(), c.blue()).into()
|
||||
});
|
||||
|
||||
ui.global::<AuraPageData>()
|
||||
.on_set_hex_to_colour(|s| decode_hex(s.as_str()).into());
|
||||
.on_cb_hex_to_colour(|s| decode_hex(s.as_str()).into());
|
||||
|
||||
let handle = ui.as_weak();
|
||||
tokio::spawn(async move {
|
||||
@@ -189,7 +189,7 @@ pub fn setup_aura_page(ui: &MainWindow, _states: Arc<Mutex<Config>>) {
|
||||
.upgrade_in_event_loop(|handle| {
|
||||
handle
|
||||
.global::<AuraPageData>()
|
||||
.on_set_led_power(move |power| {
|
||||
.on_cb_led_power(move |power| {
|
||||
let handle_copy = handle_copy.clone();
|
||||
let proxy_copy = aura.clone();
|
||||
let power: LaptopAuraPower = power.into();
|
||||
|
||||
@@ -1,17 +1,17 @@
|
||||
use std::sync::{Arc, Mutex};
|
||||
|
||||
use concat_idents::concat_idents;
|
||||
use log::error;
|
||||
use log::{debug, error};
|
||||
use rog_dbus::asus_armoury::AsusArmouryProxy;
|
||||
use rog_dbus::zbus_platform::{PlatformProxy, PlatformProxyBlocking};
|
||||
use rog_platform::firmware_attributes::FirmwareAttribute;
|
||||
use rog_platform::asus_armoury::FirmwareAttribute;
|
||||
use rog_platform::platform::Properties;
|
||||
use slint::ComponentHandle;
|
||||
|
||||
use super::show_toast;
|
||||
use crate::config::Config;
|
||||
use crate::zbus_proxies::find_iface_async;
|
||||
use crate::{set_ui_props_async, AttrMinMax, MainWindow, SystemPageData};
|
||||
use crate::{set_ui_callbacks, set_ui_props_async, AttrMinMax, MainWindow, SystemPageData};
|
||||
|
||||
const MINMAX: AttrMinMax = AttrMinMax {
|
||||
min: 0,
|
||||
@@ -35,6 +35,7 @@ pub fn setup_system_page(ui: &MainWindow, _config: Arc<Mutex<Config>>) {
|
||||
ui.global::<SystemPageData>().set_mini_led_mode(-1);
|
||||
ui.global::<SystemPageData>().set_ppt_pl1_spl(MINMAX);
|
||||
ui.global::<SystemPageData>().set_ppt_pl2_sppt(MINMAX);
|
||||
ui.global::<SystemPageData>().set_ppt_pl3_fppt(MINMAX);
|
||||
ui.global::<SystemPageData>().set_ppt_fppt(MINMAX);
|
||||
ui.global::<SystemPageData>().set_ppt_apu_sppt(MINMAX);
|
||||
ui.global::<SystemPageData>().set_ppt_platform_sppt(MINMAX);
|
||||
@@ -131,6 +132,23 @@ macro_rules! setup_callback {
|
||||
};
|
||||
}
|
||||
|
||||
// For handling callbacks from UI value changes
|
||||
macro_rules! setup_callback_restore_default {
|
||||
($property:ident, $handle:expr, $attr:expr) => {
|
||||
let proxy_copy = $attr.clone();
|
||||
concat_idents!(on_callback = on_cb_default_, $property {
|
||||
$handle
|
||||
.global::<SystemPageData>()
|
||||
.on_callback(move || {
|
||||
let proxy_copy = proxy_copy.clone();
|
||||
tokio::spawn(async move {
|
||||
proxy_copy.restore_default().await.ok();
|
||||
});
|
||||
});
|
||||
});
|
||||
};
|
||||
}
|
||||
|
||||
macro_rules! setup_external {
|
||||
($property:ident, $type:tt, $handle:expr, $attr:expr, $value:expr) => {{
|
||||
// EXTERNAL CHANGES
|
||||
@@ -142,7 +160,6 @@ macro_rules! setup_external {
|
||||
use zbus::export::futures_util::StreamExt;
|
||||
while let Some(e) = x.next().await {
|
||||
if let Ok(out) = e.get().await {
|
||||
dbg!(out);
|
||||
handle_copy
|
||||
.upgrade_in_event_loop(move |handle| {
|
||||
handle
|
||||
@@ -159,7 +176,7 @@ macro_rules! setup_external {
|
||||
|
||||
// For handling external value changes
|
||||
macro_rules! setup_minmax_external {
|
||||
($property:ident, $handle:expr, $attr:expr) => {
|
||||
($property:ident, $handle:expr, $attr:expr, $platform:expr) => {
|
||||
let handle_copy = $handle.as_weak();
|
||||
let proxy_copy = $attr.clone();
|
||||
tokio::spawn(async move {
|
||||
@@ -182,6 +199,31 @@ macro_rules! setup_minmax_external {
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
let handle_copy = $handle.as_weak();
|
||||
let proxy_copy = $attr.clone();
|
||||
let platform_proxy_copy = $platform.clone();
|
||||
tokio::spawn(async move {
|
||||
let mut x = platform_proxy_copy.receive_throttle_thermal_policy_changed().await;
|
||||
use zbus::export::futures_util::StreamExt;
|
||||
while let Some(e) = x.next().await {
|
||||
if let Ok(_) = e.get().await {
|
||||
debug!("receive_throttle_thermal_policy_changed, getting new {}", stringify!(attr));
|
||||
let min = proxy_copy.min_value().await.unwrap();
|
||||
let max = proxy_copy.max_value().await.unwrap();
|
||||
let val = proxy_copy.current_value().await.unwrap() as f32;
|
||||
handle_copy
|
||||
.upgrade_in_event_loop(move |handle| {
|
||||
concat_idents!(setter = set_, $property {
|
||||
handle
|
||||
.global::<SystemPageData>()
|
||||
.setter(AttrMinMax { min, max, val });
|
||||
});
|
||||
})
|
||||
.ok();
|
||||
}
|
||||
}
|
||||
});
|
||||
};
|
||||
}
|
||||
|
||||
@@ -216,8 +258,8 @@ pub fn setup_system_page_callbacks(ui: &MainWindow, _states: Arc<Mutex<Config>>)
|
||||
SystemPageData,
|
||||
charge_control_end_threshold
|
||||
);
|
||||
set_ui_props_async!(handle, platform, SystemPageData, throttle_thermal_policy);
|
||||
|
||||
set_ui_props_async!(handle, platform, SystemPageData, throttle_thermal_policy);
|
||||
set_ui_props_async!(handle, platform, SystemPageData, throttle_policy_linked_epp);
|
||||
set_ui_props_async!(handle, platform, SystemPageData, throttle_balanced_epp);
|
||||
set_ui_props_async!(handle, platform, SystemPageData, throttle_performance_epp);
|
||||
@@ -237,6 +279,73 @@ pub fn setup_system_page_callbacks(ui: &MainWindow, _states: Arc<Mutex<Config>>)
|
||||
change_throttle_policy_on_ac
|
||||
);
|
||||
|
||||
let platform_copy = platform.clone();
|
||||
handle
|
||||
.upgrade_in_event_loop(move |handle| {
|
||||
set_ui_callbacks!(handle,
|
||||
SystemPageData(as f32),
|
||||
platform_copy.charge_control_end_threshold(as u8),
|
||||
"Charge limit successfully set to {}",
|
||||
"Setting Charge limit failed"
|
||||
);
|
||||
set_ui_callbacks!(handle,
|
||||
SystemPageData(as i32),
|
||||
platform_copy.throttle_thermal_policy(.into()),
|
||||
"Throttle policy set to {}",
|
||||
"Setting Throttle policy failed"
|
||||
);
|
||||
set_ui_callbacks!(handle,
|
||||
SystemPageData(as i32),
|
||||
platform_copy.throttle_balanced_epp(.into()),
|
||||
"Throttle policy EPP set to {}",
|
||||
"Setting Throttle policy EPP failed"
|
||||
);
|
||||
set_ui_callbacks!(handle,
|
||||
SystemPageData(as i32),
|
||||
platform_copy.throttle_performance_epp(.into()),
|
||||
"Throttle policy EPP set to {}",
|
||||
"Setting Throttle policy EPP failed"
|
||||
);
|
||||
set_ui_callbacks!(handle,
|
||||
SystemPageData(as i32),
|
||||
platform_copy.throttle_quiet_epp(.into()),
|
||||
"Throttle policy EPP set to {}",
|
||||
"Setting Throttle policy EPP failed"
|
||||
);
|
||||
set_ui_callbacks!(
|
||||
handle,
|
||||
SystemPageData(),
|
||||
platform_copy.throttle_policy_linked_epp(),
|
||||
"Throttle policy linked to EPP: {}",
|
||||
"Setting Throttle policy linked to EPP failed"
|
||||
);
|
||||
set_ui_callbacks!(handle,
|
||||
SystemPageData(as i32),
|
||||
platform_copy.throttle_policy_on_ac(.into()),
|
||||
"Throttle policy on AC set to {}",
|
||||
"Setting Throttle policy on AC failed"
|
||||
);
|
||||
set_ui_callbacks!(handle,
|
||||
SystemPageData(as bool),
|
||||
platform_copy.change_throttle_policy_on_ac(.into()),
|
||||
"Throttle policy on AC enabled: {}",
|
||||
"Setting Throttle policy on AC failed"
|
||||
);
|
||||
set_ui_callbacks!(handle,
|
||||
SystemPageData(as i32),
|
||||
platform_copy.throttle_policy_on_battery(.into()),
|
||||
"Throttle policy on abttery set to {}",
|
||||
"Setting Throttle policy on battery failed"
|
||||
);
|
||||
set_ui_callbacks!(handle,
|
||||
SystemPageData(as bool),
|
||||
platform_copy.change_throttle_policy_on_battery(.into()),
|
||||
"Throttle policy on battery enabled: {}",
|
||||
"Setting Throttle policy on AC failed"
|
||||
);
|
||||
})
|
||||
.ok();
|
||||
|
||||
let armoury_attrs;
|
||||
if let Ok(attrs) = find_iface_async::<AsusArmouryProxy>("xyz.ljones.AsusArmoury").await {
|
||||
armoury_attrs = attrs;
|
||||
@@ -257,6 +366,7 @@ pub fn setup_system_page_callbacks(ui: &MainWindow, _states: Arc<Mutex<Config>>)
|
||||
for attr in armoury_attrs {
|
||||
if let Ok(value) = attr.current_value().await {
|
||||
let name = attr.name().await.unwrap();
|
||||
let platform = platform.clone();
|
||||
handle
|
||||
.upgrade_in_event_loop(move |handle| match name {
|
||||
FirmwareAttribute::ApuMem => {}
|
||||
@@ -265,42 +375,50 @@ pub fn setup_system_page_callbacks(ui: &MainWindow, _states: Arc<Mutex<Config>>)
|
||||
FirmwareAttribute::PptPl1Spl => {
|
||||
init_minmax_property!(ppt_pl1_spl, handle, attr);
|
||||
setup_callback!(ppt_pl1_spl, handle, attr, i32);
|
||||
setup_minmax_external!(ppt_pl1_spl, handle, attr);
|
||||
setup_callback_restore_default!(ppt_pl1_spl, handle, attr);
|
||||
setup_minmax_external!(ppt_pl1_spl, handle, attr, platform);
|
||||
}
|
||||
FirmwareAttribute::PptPl2Sppt => {
|
||||
init_minmax_property!(ppt_pl2_sppt, handle, attr);
|
||||
setup_callback!(ppt_pl2_sppt, handle, attr, i32);
|
||||
setup_minmax_external!(ppt_pl2_sppt, handle, attr);
|
||||
setup_callback_restore_default!(ppt_pl2_sppt, handle, attr);
|
||||
setup_minmax_external!(ppt_pl2_sppt, handle, attr, platform);
|
||||
}
|
||||
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);
|
||||
setup_callback_restore_default!(ppt_pl3_fppt, handle, attr);
|
||||
setup_minmax_external!(ppt_pl3_fppt, handle, attr, platform);
|
||||
}
|
||||
FirmwareAttribute::PptFppt => {
|
||||
init_minmax_property!(ppt_fppt, handle, attr);
|
||||
setup_callback!(ppt_fppt, handle, attr, i32);
|
||||
setup_minmax_external!(ppt_fppt, handle, attr);
|
||||
setup_callback_restore_default!(ppt_fppt, handle, attr);
|
||||
setup_minmax_external!(ppt_fppt, handle, attr, platform);
|
||||
}
|
||||
FirmwareAttribute::PptApuSppt => {
|
||||
init_minmax_property!(ppt_apu_sppt, handle, attr);
|
||||
setup_callback!(ppt_apu_sppt, handle, attr, i32);
|
||||
setup_minmax_external!(ppt_apu_sppt, handle, attr);
|
||||
setup_callback_restore_default!(ppt_apu_sppt, handle, attr);
|
||||
setup_minmax_external!(ppt_apu_sppt, handle, attr, platform);
|
||||
}
|
||||
FirmwareAttribute::PptPlatformSppt => {
|
||||
init_minmax_property!(ppt_platform_sppt, handle, attr);
|
||||
setup_callback!(ppt_platform_sppt, handle, attr, i32);
|
||||
setup_minmax_external!(ppt_platform_sppt, handle, attr);
|
||||
setup_callback_restore_default!(ppt_platform_sppt, handle, attr);
|
||||
setup_minmax_external!(ppt_platform_sppt, handle, attr, platform);
|
||||
}
|
||||
FirmwareAttribute::NvDynamicBoost => {
|
||||
init_minmax_property!(nv_dynamic_boost, handle, attr);
|
||||
setup_callback!(nv_dynamic_boost, handle, attr, i32);
|
||||
setup_minmax_external!(nv_dynamic_boost, handle, attr);
|
||||
setup_callback_restore_default!(nv_dynamic_boost, handle, attr);
|
||||
setup_minmax_external!(nv_dynamic_boost, handle, attr, platform);
|
||||
}
|
||||
FirmwareAttribute::NvTempTarget => {
|
||||
init_minmax_property!(nv_temp_target, handle, attr);
|
||||
setup_callback!(nv_temp_target, handle, attr, i32);
|
||||
setup_minmax_external!(nv_temp_target, handle, attr);
|
||||
setup_callback_restore_default!(nv_temp_target, handle, attr);
|
||||
setup_minmax_external!(nv_temp_target, handle, attr, platform);
|
||||
}
|
||||
FirmwareAttribute::DgpuBaseTgp => {}
|
||||
FirmwareAttribute::DgpuTgp => {}
|
||||
@@ -324,7 +442,7 @@ pub fn setup_system_page_callbacks(ui: &MainWindow, _states: Arc<Mutex<Config>>)
|
||||
FirmwareAttribute::MiniLedMode => {
|
||||
init_property!(mini_led_mode, handle, value, i32);
|
||||
setup_callback!(mini_led_mode, handle, attr, i32);
|
||||
setup_external!(mini_led_mode, i32, handle, attr, value)
|
||||
setup_external!(mini_led_mode, i32, handle, attr, value);
|
||||
}
|
||||
FirmwareAttribute::PendingReboot => {}
|
||||
FirmwareAttribute::None => {}
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
msgid ""
|
||||
msgstr ""
|
||||
"Project-Id-Version: PACKAGE VERSION\n"
|
||||
"POT-Creation-Date: 2025-01-13 09:38+0000\n"
|
||||
"POT-Creation-Date: 2025-01-19 02:34+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"
|
||||
@@ -12,214 +12,79 @@ msgstr ""
|
||||
"Language: \n"
|
||||
"Plural-Forms: nplurals=1; plural=0;\n"
|
||||
|
||||
#: rog-control-center/ui/pages/system.slint:19
|
||||
msgctxt "SystemPageData"
|
||||
msgid "Balanced"
|
||||
#: rog-control-center/ui/pages/app_settings.slint:26
|
||||
msgctxt "PageAppSettings"
|
||||
msgid "Run in background after closing"
|
||||
msgstr ""
|
||||
|
||||
#: rog-control-center/ui/pages/system.slint:19 rog-control-center/ui/pages/system.slint:23
|
||||
msgctxt "SystemPageData"
|
||||
msgid "Performance"
|
||||
#: rog-control-center/ui/pages/app_settings.slint:34
|
||||
msgctxt "PageAppSettings"
|
||||
msgid "Start app in background (UI closed)"
|
||||
msgstr ""
|
||||
|
||||
#: rog-control-center/ui/pages/system.slint:19
|
||||
msgctxt "SystemPageData"
|
||||
msgid "Quiet"
|
||||
#: rog-control-center/ui/pages/app_settings.slint:42
|
||||
msgctxt "PageAppSettings"
|
||||
msgid "Enable system tray icon"
|
||||
msgstr ""
|
||||
|
||||
#: rog-control-center/ui/pages/system.slint:22
|
||||
msgctxt "SystemPageData"
|
||||
msgid "Default"
|
||||
#: rog-control-center/ui/pages/app_settings.slint:50
|
||||
msgctxt "PageAppSettings"
|
||||
msgid "Enable dGPU notifications"
|
||||
msgstr ""
|
||||
|
||||
#: rog-control-center/ui/pages/system.slint:24
|
||||
msgctxt "SystemPageData"
|
||||
msgid "BalancePerformance"
|
||||
#: rog-control-center/ui/pages/fans.slint:26
|
||||
msgctxt "FanTab"
|
||||
msgid "This fan is not avilable on this machine"
|
||||
msgstr ""
|
||||
|
||||
#: rog-control-center/ui/pages/system.slint:25
|
||||
msgctxt "SystemPageData"
|
||||
msgid "BalancePower"
|
||||
msgstr ""
|
||||
|
||||
#: rog-control-center/ui/pages/system.slint:26
|
||||
msgctxt "SystemPageData"
|
||||
msgid "Power"
|
||||
msgstr ""
|
||||
|
||||
#: rog-control-center/ui/pages/system.slint:123
|
||||
msgctxt "PageSystem"
|
||||
msgid "Power settings"
|
||||
msgstr ""
|
||||
|
||||
#: rog-control-center/ui/pages/system.slint:128
|
||||
msgctxt "PageSystem"
|
||||
msgid "Charge limit"
|
||||
msgstr ""
|
||||
|
||||
#: rog-control-center/ui/pages/system.slint:140
|
||||
msgctxt "PageSystem"
|
||||
msgid "Throttle Policy"
|
||||
msgstr ""
|
||||
|
||||
#: rog-control-center/ui/pages/system.slint:150
|
||||
msgctxt "PageSystem"
|
||||
msgid "Advanced"
|
||||
msgstr ""
|
||||
|
||||
#: rog-control-center/ui/pages/system.slint:168
|
||||
msgctxt "PageSystem"
|
||||
msgid "Armoury settings"
|
||||
msgstr ""
|
||||
|
||||
#: rog-control-center/ui/pages/system.slint:176
|
||||
msgctxt "PageSystem"
|
||||
msgid "Panel Overdrive"
|
||||
msgstr ""
|
||||
|
||||
#: rog-control-center/ui/pages/system.slint:184
|
||||
msgctxt "PageSystem"
|
||||
msgid "MiniLED Mode"
|
||||
msgstr ""
|
||||
|
||||
#: rog-control-center/ui/pages/system.slint:192
|
||||
msgctxt "PageSystem"
|
||||
msgid "POST boot sound"
|
||||
msgstr ""
|
||||
|
||||
#: 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:227
|
||||
msgctxt "ppt_pl2_sppt"
|
||||
msgid "PL2, turbo power limit"
|
||||
msgstr ""
|
||||
|
||||
#: rog-control-center/ui/pages/system.slint:238
|
||||
msgctxt "ppt_fppt"
|
||||
msgid "FPPT, Fast Power Limit"
|
||||
msgstr ""
|
||||
|
||||
#: 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:260
|
||||
msgctxt "ppt_platform_sppt"
|
||||
msgid "Slow package power tracking limit"
|
||||
msgstr ""
|
||||
|
||||
#: rog-control-center/ui/pages/system.slint:271
|
||||
msgctxt "nv_dynamic_boost"
|
||||
msgid "dGPU boost overclock"
|
||||
msgstr ""
|
||||
|
||||
#: rog-control-center/ui/pages/system.slint:282
|
||||
msgctxt "nv_temp_target"
|
||||
msgid "dGPU temperature max"
|
||||
msgstr ""
|
||||
|
||||
#: 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:333
|
||||
msgctxt "PageSystem"
|
||||
msgid "Change EPP based on Throttle Policy"
|
||||
msgstr ""
|
||||
|
||||
#: rog-control-center/ui/pages/system.slint:341
|
||||
msgctxt "PageSystem"
|
||||
msgid "EPP for Balanced Policy"
|
||||
msgstr ""
|
||||
|
||||
#: rog-control-center/ui/pages/system.slint:351
|
||||
msgctxt "PageSystem"
|
||||
msgid "EPP for Performance Policy"
|
||||
msgstr ""
|
||||
|
||||
#: rog-control-center/ui/pages/system.slint:361
|
||||
msgctxt "PageSystem"
|
||||
msgid "EPP for Quiet Policy"
|
||||
msgstr ""
|
||||
|
||||
#: rog-control-center/ui/pages/system.slint:379
|
||||
msgctxt "PageSystem"
|
||||
msgid "Throttle Policy for power state"
|
||||
msgstr ""
|
||||
|
||||
#: rog-control-center/ui/pages/system.slint:385
|
||||
msgctxt "PageSystem"
|
||||
msgid "Throttle Policy on Battery"
|
||||
msgstr ""
|
||||
|
||||
#: rog-control-center/ui/pages/system.slint:395 rog-control-center/ui/pages/system.slint:416
|
||||
msgctxt "PageSystem"
|
||||
#: rog-control-center/ui/pages/fans.slint:34
|
||||
msgctxt "FanTab"
|
||||
msgid "Enabled"
|
||||
msgstr ""
|
||||
|
||||
#: rog-control-center/ui/pages/system.slint:406
|
||||
msgctxt "PageSystem"
|
||||
msgid "Throttle Policy on AC"
|
||||
#: rog-control-center/ui/pages/fans.slint:43
|
||||
msgctxt "FanTab"
|
||||
msgid "Apply"
|
||||
msgstr ""
|
||||
|
||||
#: rog-control-center/ui/pages/aura.slint:28
|
||||
msgctxt "PageAura"
|
||||
msgid "Brightness"
|
||||
#: rog-control-center/ui/pages/fans.slint:51
|
||||
msgctxt "FanTab"
|
||||
msgid "Cancel"
|
||||
msgstr ""
|
||||
|
||||
#: rog-control-center/ui/pages/aura.slint:39
|
||||
msgctxt "PageAura"
|
||||
msgid "Aura mode"
|
||||
#: rog-control-center/ui/pages/fans.slint:59
|
||||
msgctxt "FanTab"
|
||||
msgid "Factory Default (all fans)"
|
||||
msgstr ""
|
||||
|
||||
#: rog-control-center/ui/pages/aura.slint:59
|
||||
msgctxt "PageAura"
|
||||
msgid "Colour 1"
|
||||
#: rog-control-center/ui/pages/fans.slint:72
|
||||
msgctxt "PageFans"
|
||||
msgid "Balanced"
|
||||
msgstr ""
|
||||
|
||||
#: rog-control-center/ui/pages/aura.slint:85
|
||||
msgctxt "PageAura"
|
||||
msgid "Colour 2"
|
||||
#: rog-control-center/ui/pages/fans.slint:75 rog-control-center/ui/pages/fans.slint:134 rog-control-center/ui/pages/fans.slint:193
|
||||
msgctxt "PageFans"
|
||||
msgid "CPU"
|
||||
msgstr ""
|
||||
|
||||
#: rog-control-center/ui/pages/aura.slint:119
|
||||
msgctxt "PageAura"
|
||||
msgid "Zone"
|
||||
#: rog-control-center/ui/pages/fans.slint:93 rog-control-center/ui/pages/fans.slint:152 rog-control-center/ui/pages/fans.slint:211
|
||||
msgctxt "PageFans"
|
||||
msgid "Mid"
|
||||
msgstr ""
|
||||
|
||||
#: rog-control-center/ui/pages/aura.slint:142
|
||||
msgctxt "PageAura"
|
||||
msgid "Direction"
|
||||
#: rog-control-center/ui/pages/fans.slint:111 rog-control-center/ui/pages/fans.slint:170 rog-control-center/ui/pages/fans.slint:229
|
||||
msgctxt "PageFans"
|
||||
msgid "GPU"
|
||||
msgstr ""
|
||||
|
||||
#: rog-control-center/ui/pages/aura.slint:164
|
||||
msgctxt "PageAura"
|
||||
msgid "Speed"
|
||||
#: rog-control-center/ui/pages/fans.slint:131
|
||||
msgctxt "PageFans"
|
||||
msgid "Performance"
|
||||
msgstr ""
|
||||
|
||||
#: rog-control-center/ui/pages/aura.slint:185
|
||||
msgctxt "PageAura"
|
||||
msgid "Power Settings"
|
||||
msgstr ""
|
||||
|
||||
#: rog-control-center/ui/pages/aura.slint:270
|
||||
msgctxt "PageAura"
|
||||
msgid "Power Zones"
|
||||
#: rog-control-center/ui/pages/fans.slint:190
|
||||
msgctxt "PageFans"
|
||||
msgid "Quiet"
|
||||
msgstr ""
|
||||
|
||||
#: rog-control-center/ui/pages/anime.slint:6
|
||||
@@ -347,79 +212,280 @@ msgctxt "PageAnime"
|
||||
msgid "Off when on battery"
|
||||
msgstr ""
|
||||
|
||||
#: rog-control-center/ui/pages/fans.slint:26
|
||||
msgctxt "FanTab"
|
||||
msgid "This fan is not avilable on this machine"
|
||||
#: rog-control-center/ui/pages/aura.slint:28
|
||||
msgctxt "PageAura"
|
||||
msgid "Brightness"
|
||||
msgstr ""
|
||||
|
||||
#: rog-control-center/ui/pages/fans.slint:34
|
||||
msgctxt "FanTab"
|
||||
msgid "Enabled"
|
||||
#: rog-control-center/ui/pages/aura.slint:39
|
||||
msgctxt "PageAura"
|
||||
msgid "Aura mode"
|
||||
msgstr ""
|
||||
|
||||
#: rog-control-center/ui/pages/fans.slint:43
|
||||
msgctxt "FanTab"
|
||||
msgid "Apply"
|
||||
#: rog-control-center/ui/pages/aura.slint:59
|
||||
msgctxt "PageAura"
|
||||
msgid "Colour 1"
|
||||
msgstr ""
|
||||
|
||||
#: rog-control-center/ui/pages/fans.slint:51
|
||||
msgctxt "FanTab"
|
||||
msgid "Cancel"
|
||||
#: rog-control-center/ui/pages/aura.slint:85
|
||||
msgctxt "PageAura"
|
||||
msgid "Colour 2"
|
||||
msgstr ""
|
||||
|
||||
#: rog-control-center/ui/pages/fans.slint:59
|
||||
msgctxt "FanTab"
|
||||
msgid "Factory Default (all fans)"
|
||||
#: rog-control-center/ui/pages/aura.slint:119
|
||||
msgctxt "PageAura"
|
||||
msgid "Zone"
|
||||
msgstr ""
|
||||
|
||||
#: rog-control-center/ui/pages/fans.slint:72
|
||||
msgctxt "PageFans"
|
||||
#: rog-control-center/ui/pages/aura.slint:142
|
||||
msgctxt "PageAura"
|
||||
msgid "Direction"
|
||||
msgstr ""
|
||||
|
||||
#: rog-control-center/ui/pages/aura.slint:164
|
||||
msgctxt "PageAura"
|
||||
msgid "Speed"
|
||||
msgstr ""
|
||||
|
||||
#: rog-control-center/ui/pages/aura.slint:185
|
||||
msgctxt "PageAura"
|
||||
msgid "Power Settings"
|
||||
msgstr ""
|
||||
|
||||
#: rog-control-center/ui/pages/aura.slint:270
|
||||
msgctxt "PageAura"
|
||||
msgid "Power Zones"
|
||||
msgstr ""
|
||||
|
||||
#: rog-control-center/ui/pages/system.slint:19
|
||||
msgctxt "SystemPageData"
|
||||
msgid "Balanced"
|
||||
msgstr ""
|
||||
|
||||
#: rog-control-center/ui/pages/fans.slint:75 rog-control-center/ui/pages/fans.slint:134 rog-control-center/ui/pages/fans.slint:193
|
||||
msgctxt "PageFans"
|
||||
msgid "CPU"
|
||||
msgstr ""
|
||||
|
||||
#: rog-control-center/ui/pages/fans.slint:93 rog-control-center/ui/pages/fans.slint:152 rog-control-center/ui/pages/fans.slint:211
|
||||
msgctxt "PageFans"
|
||||
msgid "Mid"
|
||||
msgstr ""
|
||||
|
||||
#: rog-control-center/ui/pages/fans.slint:111 rog-control-center/ui/pages/fans.slint:170 rog-control-center/ui/pages/fans.slint:229
|
||||
msgctxt "PageFans"
|
||||
msgid "GPU"
|
||||
msgstr ""
|
||||
|
||||
#: rog-control-center/ui/pages/fans.slint:131
|
||||
msgctxt "PageFans"
|
||||
#: rog-control-center/ui/pages/system.slint:19 rog-control-center/ui/pages/system.slint:23
|
||||
msgctxt "SystemPageData"
|
||||
msgid "Performance"
|
||||
msgstr ""
|
||||
|
||||
#: rog-control-center/ui/pages/fans.slint:190
|
||||
msgctxt "PageFans"
|
||||
#: rog-control-center/ui/pages/system.slint:19
|
||||
msgctxt "SystemPageData"
|
||||
msgid "Quiet"
|
||||
msgstr ""
|
||||
|
||||
#: rog-control-center/ui/pages/app_settings.slint:26
|
||||
msgctxt "PageAppSettings"
|
||||
msgid "Run in background after closing"
|
||||
#: rog-control-center/ui/pages/system.slint:22
|
||||
msgctxt "SystemPageData"
|
||||
msgid "Default"
|
||||
msgstr ""
|
||||
|
||||
#: rog-control-center/ui/pages/app_settings.slint:34
|
||||
msgctxt "PageAppSettings"
|
||||
msgid "Start app in background (UI closed)"
|
||||
#: rog-control-center/ui/pages/system.slint:24
|
||||
msgctxt "SystemPageData"
|
||||
msgid "BalancePerformance"
|
||||
msgstr ""
|
||||
|
||||
#: rog-control-center/ui/pages/app_settings.slint:42
|
||||
msgctxt "PageAppSettings"
|
||||
msgid "Enable system tray icon"
|
||||
#: rog-control-center/ui/pages/system.slint:25
|
||||
msgctxt "SystemPageData"
|
||||
msgid "BalancePower"
|
||||
msgstr ""
|
||||
|
||||
#: rog-control-center/ui/pages/app_settings.slint:50
|
||||
msgctxt "PageAppSettings"
|
||||
msgid "Enable dGPU notifications"
|
||||
#: rog-control-center/ui/pages/system.slint:26
|
||||
msgctxt "SystemPageData"
|
||||
msgid "Power"
|
||||
msgstr ""
|
||||
|
||||
#: rog-control-center/ui/pages/system.slint:139
|
||||
msgctxt "PageSystem"
|
||||
msgid "Power settings"
|
||||
msgstr ""
|
||||
|
||||
#: rog-control-center/ui/pages/system.slint:144
|
||||
msgctxt "PageSystem"
|
||||
msgid "Charge limit"
|
||||
msgstr ""
|
||||
|
||||
#: rog-control-center/ui/pages/system.slint:157
|
||||
msgctxt "PageSystem"
|
||||
msgid "Throttle Policy"
|
||||
msgstr ""
|
||||
|
||||
#: rog-control-center/ui/pages/system.slint:167
|
||||
msgctxt "PageSystem"
|
||||
msgid "Advanced"
|
||||
msgstr ""
|
||||
|
||||
#: rog-control-center/ui/pages/system.slint:185
|
||||
msgctxt "PageSystem"
|
||||
msgid "Armoury settings"
|
||||
msgstr ""
|
||||
|
||||
#: rog-control-center/ui/pages/system.slint:193
|
||||
msgctxt "PageSystem"
|
||||
msgid "Panel Overdrive"
|
||||
msgstr ""
|
||||
|
||||
#: rog-control-center/ui/pages/system.slint:201
|
||||
msgctxt "PageSystem"
|
||||
msgid "MiniLED Mode"
|
||||
msgstr ""
|
||||
|
||||
#: rog-control-center/ui/pages/system.slint:209
|
||||
msgctxt "PageSystem"
|
||||
msgid "POST boot sound"
|
||||
msgstr ""
|
||||
|
||||
#: rog-control-center/ui/pages/system.slint:223
|
||||
msgctxt "no_asus_armoury_driver_2"
|
||||
msgid "The asus-armoury driver is not loaded"
|
||||
msgstr ""
|
||||
|
||||
#: rog-control-center/ui/pages/system.slint:229
|
||||
msgctxt "no_asus_armoury_driver_2"
|
||||
msgid "For advanced features you will require a kernel with this driver added."
|
||||
msgstr ""
|
||||
|
||||
#: rog-control-center/ui/pages/system.slint:240
|
||||
msgctxt "ppt_warning"
|
||||
msgid "The following settings may not be safe, please review the help."
|
||||
msgstr ""
|
||||
|
||||
#: rog-control-center/ui/pages/system.slint:245 rog-control-center/ui/pages/system.slint:246
|
||||
msgctxt "ppt_pl1_spl"
|
||||
msgid "CPU Sustained Power Limit"
|
||||
msgstr ""
|
||||
|
||||
#: rog-control-center/ui/pages/system.slint:247
|
||||
msgctxt "ppt_pl1_spl_help"
|
||||
msgid ""
|
||||
"Long-term CPU power limit that affects sustained workload performance. "
|
||||
"Higher values may increase heat and power consumption."
|
||||
msgstr ""
|
||||
|
||||
#: rog-control-center/ui/pages/system.slint:262 rog-control-center/ui/pages/system.slint:263
|
||||
msgctxt "ppt_pl2_sppt"
|
||||
msgid "CPU Turbo Power Limit"
|
||||
msgstr ""
|
||||
|
||||
#: rog-control-center/ui/pages/system.slint:264
|
||||
msgctxt "ppt_pl2_sppt_help"
|
||||
msgid ""
|
||||
"Short-term CPU power limit for boost periods. Controls maximum power during "
|
||||
"brief high-performance bursts."
|
||||
msgstr ""
|
||||
|
||||
#: rog-control-center/ui/pages/system.slint:279 rog-control-center/ui/pages/system.slint:280
|
||||
msgctxt "ppt_pl3_fppt"
|
||||
msgid "CPU Fast Burst Power Limit"
|
||||
msgstr ""
|
||||
|
||||
#: rog-control-center/ui/pages/system.slint:281
|
||||
msgctxt "ppt_pl3_fppt_help"
|
||||
msgid ""
|
||||
"Ultra-short duration power limit for instantaneous CPU bursts. Affects "
|
||||
"responsiveness during sudden workload spikes."
|
||||
msgstr ""
|
||||
|
||||
#: rog-control-center/ui/pages/system.slint:295 rog-control-center/ui/pages/system.slint:296
|
||||
msgctxt "ppt_fppt"
|
||||
msgid "Fast Package Power Limit"
|
||||
msgstr ""
|
||||
|
||||
#: rog-control-center/ui/pages/system.slint:297
|
||||
msgctxt "ppt_fppt_help"
|
||||
msgid ""
|
||||
"Ultra-short duration power limit for system package. Controls maximum power "
|
||||
"during millisecond-scale load spikes."
|
||||
msgstr ""
|
||||
|
||||
#: rog-control-center/ui/pages/system.slint:312 rog-control-center/ui/pages/system.slint:313
|
||||
msgctxt "ppt_apu_sppt"
|
||||
msgid "APU Sustained Power Limit"
|
||||
msgstr ""
|
||||
|
||||
#: rog-control-center/ui/pages/system.slint:314
|
||||
msgctxt "ppt_apu_sppt_help"
|
||||
msgid ""
|
||||
"Long-term power limit for integrated graphics and CPU combined. Affects "
|
||||
"sustained performance of APU-based workloads."
|
||||
msgstr ""
|
||||
|
||||
#: rog-control-center/ui/pages/system.slint:329 rog-control-center/ui/pages/system.slint:330
|
||||
msgctxt "ppt_platform_sppt"
|
||||
msgid "Platform Sustained Power Limit"
|
||||
msgstr ""
|
||||
|
||||
#: rog-control-center/ui/pages/system.slint:331
|
||||
msgctxt "ppt_platform_sppt_help"
|
||||
msgid ""
|
||||
"Overall system power limit for sustained operations. Controls total platform "
|
||||
"power consumption over extended periods."
|
||||
msgstr ""
|
||||
|
||||
#: rog-control-center/ui/pages/system.slint:346 rog-control-center/ui/pages/system.slint:347
|
||||
msgctxt "nv_dynamic_boost"
|
||||
msgid "GPU Power Boost"
|
||||
msgstr ""
|
||||
|
||||
#: rog-control-center/ui/pages/system.slint:348
|
||||
msgctxt "nv_dynamic_boost_help"
|
||||
msgid ""
|
||||
"Additional power allocation for GPU dynamic boost. Higher values increase "
|
||||
"GPU performance but generate more heat."
|
||||
msgstr ""
|
||||
|
||||
#: rog-control-center/ui/pages/system.slint:363 rog-control-center/ui/pages/system.slint:364
|
||||
msgctxt "nv_temp_target"
|
||||
msgid "GPU Temperature Limit"
|
||||
msgstr ""
|
||||
|
||||
#: rog-control-center/ui/pages/system.slint:365
|
||||
msgctxt "nv_temp_target_help"
|
||||
msgid ""
|
||||
"Maximum GPU temperature threshold in Celsius. GPU will throttle to maintain "
|
||||
"temperature below this limit."
|
||||
msgstr ""
|
||||
|
||||
#: rog-control-center/ui/pages/system.slint:416
|
||||
msgctxt "PageSystem"
|
||||
msgid "Energy Performance Preference linked to Throttle Policy"
|
||||
msgstr ""
|
||||
|
||||
#: rog-control-center/ui/pages/system.slint:420
|
||||
msgctxt "PageSystem"
|
||||
msgid "Change EPP based on Throttle Policy"
|
||||
msgstr ""
|
||||
|
||||
#: rog-control-center/ui/pages/system.slint:428
|
||||
msgctxt "PageSystem"
|
||||
msgid "EPP for Balanced Policy"
|
||||
msgstr ""
|
||||
|
||||
#: rog-control-center/ui/pages/system.slint:438
|
||||
msgctxt "PageSystem"
|
||||
msgid "EPP for Performance Policy"
|
||||
msgstr ""
|
||||
|
||||
#: rog-control-center/ui/pages/system.slint:448
|
||||
msgctxt "PageSystem"
|
||||
msgid "EPP for Quiet Policy"
|
||||
msgstr ""
|
||||
|
||||
#: rog-control-center/ui/pages/system.slint:466
|
||||
msgctxt "PageSystem"
|
||||
msgid "Throttle Policy for power state"
|
||||
msgstr ""
|
||||
|
||||
#: rog-control-center/ui/pages/system.slint:472
|
||||
msgctxt "PageSystem"
|
||||
msgid "Throttle Policy on Battery"
|
||||
msgstr ""
|
||||
|
||||
#: rog-control-center/ui/pages/system.slint:482 rog-control-center/ui/pages/system.slint:503
|
||||
msgctxt "PageSystem"
|
||||
msgid "Enabled"
|
||||
msgstr ""
|
||||
|
||||
#: rog-control-center/ui/pages/system.slint:493
|
||||
msgctxt "PageSystem"
|
||||
msgid "Throttle Policy on AC"
|
||||
msgstr ""
|
||||
|
||||
#: rog-control-center/ui/types/aura_types.slint:52
|
||||
@@ -657,6 +723,11 @@ msgctxt "AuraPowerGroupOld"
|
||||
msgid "Sleep"
|
||||
msgstr ""
|
||||
|
||||
#: rog-control-center/ui/widgets/common.slint:133
|
||||
msgctxt "confirm_reset"
|
||||
msgid "Are you sure you want to reset this?"
|
||||
msgstr ""
|
||||
|
||||
#: rog-control-center/ui/main_window.slint:51
|
||||
msgctxt "MainWindow"
|
||||
msgid "ROG"
|
||||
|
||||
@@ -21,8 +21,8 @@ export component MainWindow inherits Window {
|
||||
title: "ROG Control";
|
||||
default-font-family: "DejaVu Sans";
|
||||
in property <[bool]> sidebar_items_avilable: [true, true, true, true, true, true];
|
||||
private property <bool> show-notif;
|
||||
private property <bool> fade-cover;
|
||||
private property <bool> show_notif;
|
||||
private property <bool> fade_cover;
|
||||
private property <bool> toast: false;
|
||||
private property <string> toast_text: "I show when something is waiting";
|
||||
callback show_toast(string);
|
||||
@@ -31,10 +31,10 @@ export component MainWindow inherits Window {
|
||||
toast_text = text;
|
||||
}
|
||||
callback exit-app();
|
||||
callback show-notification(bool);
|
||||
show-notification(yes) => {
|
||||
show-notif = yes;
|
||||
fade-cover = yes;
|
||||
callback show_notification(bool);
|
||||
show_notification(yes) => {
|
||||
show_notif = yes;
|
||||
fade_cover = yes;
|
||||
}
|
||||
callback external_colour_change();
|
||||
external_colour_change() => {
|
||||
@@ -109,7 +109,7 @@ export component MainWindow inherits Window {
|
||||
}
|
||||
}
|
||||
|
||||
if fade-cover: Rectangle {
|
||||
if fade_cover: Rectangle {
|
||||
x: 0px;
|
||||
y: 0px;
|
||||
width: root.width;
|
||||
@@ -121,10 +121,10 @@ export component MainWindow inherits Window {
|
||||
width: 100%;
|
||||
clicked => {
|
||||
// toolbar-dropdown.close();
|
||||
if (show-notif) {
|
||||
show-notif = false;
|
||||
if (show_notif) {
|
||||
show_notif = false;
|
||||
}
|
||||
fade-cover = false;
|
||||
fade_cover = false;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -156,7 +156,7 @@ export component MainWindow inherits Window {
|
||||
}
|
||||
|
||||
// // TODO: or use Dialogue
|
||||
if show-notif: Rectangle {
|
||||
if show_notif: Rectangle {
|
||||
x: root.width / 8;
|
||||
y: root.height / 8;
|
||||
height: (root.height / 8) * 6;
|
||||
@@ -165,7 +165,7 @@ export component MainWindow inherits Window {
|
||||
height: 100%;
|
||||
width: 100%;
|
||||
clicked => {
|
||||
show-notif = false;
|
||||
show_notif = false;
|
||||
exit-app();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -17,7 +17,7 @@ export component PageAbout inherits VerticalLayout {
|
||||
|
||||
Text {
|
||||
wrap: TextWrap.word-wrap;
|
||||
text: "You will require these patches: https://lore.kernel.org/platform-driver-x86/20240404001652.86207-1-luke@ljones.dev/, they have been merged upstream for kernel 6.10. The main thing is that the PPT settings will apply without them, but the read/back will fail";
|
||||
text: "You will require a kernel built with my work from here: https://github.com/flukejones/linux";
|
||||
}
|
||||
|
||||
Text {
|
||||
@@ -28,19 +28,7 @@ export component PageAbout inherits VerticalLayout {
|
||||
}
|
||||
|
||||
Text {
|
||||
text: "- [x] Theme the widgets";
|
||||
}
|
||||
|
||||
Text {
|
||||
text: "- [x] Add a fullscreen mode (cli arg)";
|
||||
}
|
||||
|
||||
Text {
|
||||
text: "- [x] Disable aura items depending if mode supports or not";
|
||||
}
|
||||
|
||||
Text {
|
||||
text: "- [x] Add fan curve graph controls";
|
||||
text: "- [ ] Theme the widgets";
|
||||
}
|
||||
|
||||
Text {
|
||||
@@ -48,11 +36,15 @@ export component PageAbout inherits VerticalLayout {
|
||||
}
|
||||
|
||||
Text {
|
||||
text: "- [ ] Supergfx control";
|
||||
text: "- [ ] Include fan speeds, temps in a bottom bar";
|
||||
}
|
||||
|
||||
Text {
|
||||
text: "- [ ] Include fan speeds, temps in a bottom bar";
|
||||
text: "- [ ] Slash control";
|
||||
}
|
||||
|
||||
Text {
|
||||
text: "- [ ] Supergfx control";
|
||||
}
|
||||
|
||||
Text {
|
||||
|
||||
@@ -9,17 +9,17 @@ export global AnimePageData {
|
||||
@tr("Anime Brightness" => "High"),
|
||||
];
|
||||
in-out property <int> brightness;
|
||||
callback set_brightness(int);
|
||||
callback cb_brightness(int);
|
||||
in-out property <bool> builtins_enabled;
|
||||
callback set_builtins_enabled(bool);
|
||||
callback cb_builtins_enabled(bool);
|
||||
in-out property <bool> enable_display;
|
||||
callback set_enable_display(bool);
|
||||
callback cb_enable_display(bool);
|
||||
in-out property <bool> off_when_lid_closed;
|
||||
callback set_off_when_lid_closed(bool);
|
||||
callback cb_off_when_lid_closed(bool);
|
||||
in-out property <bool> off_when_suspended;
|
||||
callback set_off_when_suspended(bool);
|
||||
callback cb_off_when_suspended(bool);
|
||||
in-out property <bool> off_when_unplugged;
|
||||
callback set_off_when_unplugged(bool);
|
||||
callback cb_off_when_unplugged(bool);
|
||||
in-out property <[string]> boot_anim_choices: [@tr("Glitch Construction"), @tr("Static Emergence")];
|
||||
in property <int> boot_anim: 0;
|
||||
in-out property <[string]> awake_anim_choices: [@tr("Binary Banner Scroll"), @tr("Rog Logo Glitch")];
|
||||
@@ -28,7 +28,7 @@ export global AnimePageData {
|
||||
in property <int> sleep_anim: 0;
|
||||
in-out property <[string]> shutdown_anim_choices: [@tr("Glitch Out"), @tr("See Ya")];
|
||||
in property <int> shutdown_anim: 0;
|
||||
callback set_builtin_animations(int, int, int, int);
|
||||
callback cb_builtin_animations(int, int, int, int);
|
||||
}
|
||||
|
||||
export component PageAnime inherits Rectangle {
|
||||
@@ -53,7 +53,7 @@ export component PageAnime inherits Rectangle {
|
||||
model <=> AnimePageData.brightness_names;
|
||||
selected => {
|
||||
self.current_value = AnimePageData.brightness_names[AnimePageData.brightness];
|
||||
AnimePageData.set_brightness(AnimePageData.brightness)
|
||||
AnimePageData.cb_brightness(AnimePageData.brightness)
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -66,7 +66,7 @@ export component PageAnime inherits Rectangle {
|
||||
text: @tr("Enable display");
|
||||
checked <=> AnimePageData.enable_display;
|
||||
toggled => {
|
||||
AnimePageData.set_enable_display(AnimePageData.enable_display)
|
||||
AnimePageData.cb_enable_display(AnimePageData.enable_display)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -89,7 +89,7 @@ export component PageAnime inherits Rectangle {
|
||||
text: @tr("Use built-in animations");
|
||||
checked <=> AnimePageData.builtins_enabled;
|
||||
toggled => {
|
||||
AnimePageData.set_builtins_enabled(AnimePageData.builtins_enabled)
|
||||
AnimePageData.cb_builtins_enabled(AnimePageData.builtins_enabled)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -152,7 +152,7 @@ export component PageAnime inherits Rectangle {
|
||||
current_value: AnimePageData.boot_anim_choices[AnimePageData.boot_anim];
|
||||
model <=> AnimePageData.boot_anim_choices;
|
||||
selected => {
|
||||
AnimePageData.set_builtin_animations(AnimePageData.boot_anim, AnimePageData.awake_anim, AnimePageData.sleep_anim, AnimePageData.shutdown_anim)
|
||||
AnimePageData.cb_builtin_animations(AnimePageData.boot_anim, AnimePageData.awake_anim, AnimePageData.sleep_anim, AnimePageData.shutdown_anim)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -162,7 +162,7 @@ export component PageAnime inherits Rectangle {
|
||||
current_value: AnimePageData.awake_anim_choices[AnimePageData.awake_anim];
|
||||
model <=> AnimePageData.awake_anim_choices;
|
||||
selected => {
|
||||
AnimePageData.set_builtin_animations(AnimePageData.boot_anim, AnimePageData.awake_anim, AnimePageData.sleep_anim, AnimePageData.shutdown_anim)
|
||||
AnimePageData.cb_builtin_animations(AnimePageData.boot_anim, AnimePageData.awake_anim, AnimePageData.sleep_anim, AnimePageData.shutdown_anim)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -172,7 +172,7 @@ export component PageAnime inherits Rectangle {
|
||||
current_value: AnimePageData.sleep_anim_choices[AnimePageData.sleep_anim];
|
||||
model <=> AnimePageData.sleep_anim_choices;
|
||||
selected => {
|
||||
AnimePageData.set_builtin_animations(AnimePageData.boot_anim, AnimePageData.awake_anim, AnimePageData.sleep_anim, AnimePageData.shutdown_anim)
|
||||
AnimePageData.cb_builtin_animations(AnimePageData.boot_anim, AnimePageData.awake_anim, AnimePageData.sleep_anim, AnimePageData.shutdown_anim)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -182,7 +182,7 @@ export component PageAnime inherits Rectangle {
|
||||
current_value: AnimePageData.shutdown_anim_choices[AnimePageData.shutdown_anim];
|
||||
model <=> AnimePageData.shutdown_anim_choices;
|
||||
selected => {
|
||||
AnimePageData.set_builtin_animations(AnimePageData.boot_anim, AnimePageData.awake_anim, AnimePageData.sleep_anim, AnimePageData.shutdown_anim)
|
||||
AnimePageData.cb_builtin_animations(AnimePageData.boot_anim, AnimePageData.awake_anim, AnimePageData.sleep_anim, AnimePageData.shutdown_anim)
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -225,7 +225,7 @@ export component PageAnime inherits Rectangle {
|
||||
text: @tr("Off when lid closed");
|
||||
checked <=> AnimePageData.off_when_lid_closed;
|
||||
toggled => {
|
||||
AnimePageData.set_off_when_lid_closed(AnimePageData.off_when_lid_closed)
|
||||
AnimePageData.cb_off_when_lid_closed(AnimePageData.off_when_lid_closed)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -234,7 +234,7 @@ export component PageAnime inherits Rectangle {
|
||||
text: @tr("Off when suspended");
|
||||
checked <=> AnimePageData.off_when_suspended;
|
||||
toggled => {
|
||||
AnimePageData.set_off_when_suspended(AnimePageData.off_when_suspended)
|
||||
AnimePageData.cb_off_when_suspended(AnimePageData.off_when_suspended)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -243,7 +243,7 @@ export component PageAnime inherits Rectangle {
|
||||
text: @tr("Off when on battery");
|
||||
checked <=> AnimePageData.off_when_unplugged;
|
||||
toggled => {
|
||||
AnimePageData.set_off_when_unplugged(AnimePageData.off_when_unplugged)
|
||||
AnimePageData.cb_off_when_unplugged(AnimePageData.off_when_unplugged)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -30,7 +30,7 @@ export component PageAura inherits Rectangle {
|
||||
current_value: AuraPageData.brightness_names[self.current-index];
|
||||
model <=> AuraPageData.brightness_names;
|
||||
selected => {
|
||||
AuraPageData.set_brightness(AuraPageData.brightness)
|
||||
AuraPageData.cb_brightness(AuraPageData.brightness)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -44,7 +44,7 @@ export component PageAura inherits Rectangle {
|
||||
AuraPageData.led_mode_data.mode = AuraPageData.led_mode;
|
||||
AuraPageData.led_mode_data.mode = AuraPageData.current_available_mode;
|
||||
self.current_value = AuraPageData.available_mode_names[self.current-index];
|
||||
AuraPageData.set_led_mode(AuraPageData.current_available_mode);
|
||||
AuraPageData.cb_led_mode(AuraPageData.current_available_mode);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -67,14 +67,14 @@ export component PageAura inherits Rectangle {
|
||||
final_colour <=> AuraPageData.color1;
|
||||
colourbox <=> AuraPageData.colorbox1;
|
||||
set_hex_from_colour(c1) => {
|
||||
return AuraPageData.set_hex_from_colour(c1);
|
||||
return AuraPageData.cb_hex_from_colour(c1);
|
||||
}
|
||||
hex_to_colour(s) => {
|
||||
return AuraPageData.set_hex_to_colour(s);
|
||||
return AuraPageData.cb_hex_to_colour(s);
|
||||
}
|
||||
released => {
|
||||
AuraPageData.led_mode_data.colour1 = AuraPageData.color1;
|
||||
AuraPageData.set_led_mode_data(AuraPageData.led_mode_data);
|
||||
AuraPageData.cb_led_mode_data(AuraPageData.led_mode_data);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -93,14 +93,14 @@ export component PageAura inherits Rectangle {
|
||||
final_colour <=> AuraPageData.color2;
|
||||
colourbox <=> AuraPageData.colorbox2;
|
||||
set_hex_from_colour(c1) => {
|
||||
return AuraPageData.set_hex_from_colour(c1);
|
||||
return AuraPageData.cb_hex_from_colour(c1);
|
||||
}
|
||||
hex_to_colour(s) => {
|
||||
return AuraPageData.set_hex_to_colour(s);
|
||||
return AuraPageData.cb_hex_to_colour(s);
|
||||
}
|
||||
released => {
|
||||
AuraPageData.led_mode_data.colour2 = AuraPageData.color2;
|
||||
AuraPageData.set_led_mode_data(AuraPageData.led_mode_data);
|
||||
AuraPageData.cb_led_mode_data(AuraPageData.led_mode_data);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -129,7 +129,7 @@ export component PageAura inherits Rectangle {
|
||||
model <=> AuraPageData.zone_names;
|
||||
selected => {
|
||||
AuraPageData.led_mode_data.zone = self.current-index;
|
||||
AuraPageData.set_led_mode_data(AuraPageData.led_mode_data);
|
||||
AuraPageData.cb_led_mode_data(AuraPageData.led_mode_data);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -151,7 +151,7 @@ export component PageAura inherits Rectangle {
|
||||
model <=> AuraPageData.direction_names;
|
||||
selected => {
|
||||
AuraPageData.led_mode_data.direction = self.current-index;
|
||||
AuraPageData.set_led_mode_data(AuraPageData.led_mode_data);
|
||||
AuraPageData.cb_led_mode_data(AuraPageData.led_mode_data);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -173,7 +173,7 @@ export component PageAura inherits Rectangle {
|
||||
model <=> AuraPageData.speed_names;
|
||||
selected => {
|
||||
AuraPageData.led_mode_data.speed = self.current-index;
|
||||
AuraPageData.set_led_mode_data(AuraPageData.led_mode_data);
|
||||
AuraPageData.cb_led_mode_data(AuraPageData.led_mode_data);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -218,22 +218,22 @@ export component PageAura inherits Rectangle {
|
||||
boot_checked: state.boot;
|
||||
boot_toggled => {
|
||||
AuraPageData.led_power.states[idx].boot = zone.boot_checked;
|
||||
AuraPageData.set_led_power(AuraPageData.led_power);
|
||||
AuraPageData.cb_led_power(AuraPageData.led_power);
|
||||
}
|
||||
awake_checked: state.awake;
|
||||
awake_toggled => {
|
||||
AuraPageData.led_power.states[idx].awake = zone.awake_checked;
|
||||
AuraPageData.set_led_power(AuraPageData.led_power);
|
||||
AuraPageData.cb_led_power(AuraPageData.led_power);
|
||||
}
|
||||
sleep_checked: state.sleep;
|
||||
sleep_toggled => {
|
||||
AuraPageData.led_power.states[idx].sleep = zone.sleep_checked;
|
||||
AuraPageData.set_led_power(AuraPageData.led_power);
|
||||
AuraPageData.cb_led_power(AuraPageData.led_power);
|
||||
}
|
||||
shutdown_checked: state.shutdown;
|
||||
shutdown_toggled => {
|
||||
AuraPageData.led_power.states[idx].shutdown = zone.shutdown_checked;
|
||||
AuraPageData.set_led_power(AuraPageData.led_power);
|
||||
AuraPageData.cb_led_power(AuraPageData.led_power);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -271,22 +271,22 @@ export component PageAura inherits Rectangle {
|
||||
zone_strings <=> AuraPageData.power_zone_names_old;
|
||||
selected_zone => {
|
||||
AuraPageData.led_power.states[idx].zone = AuraPageData.supported_power_zones[old_zone.current_zone];
|
||||
AuraPageData.set_led_power(AuraPageData.led_power);
|
||||
AuraPageData.cb_led_power(AuraPageData.led_power);
|
||||
}
|
||||
boot_checked: state.boot;
|
||||
boot_toggled => {
|
||||
AuraPageData.led_power.states[idx].boot = old_zone.boot_checked;
|
||||
AuraPageData.set_led_power(AuraPageData.led_power);
|
||||
AuraPageData.cb_led_power(AuraPageData.led_power);
|
||||
}
|
||||
awake_checked: state.awake;
|
||||
awake_toggled => {
|
||||
AuraPageData.led_power.states[idx].awake = old_zone.awake_checked;
|
||||
AuraPageData.set_led_power(AuraPageData.led_power);
|
||||
AuraPageData.cb_led_power(AuraPageData.led_power);
|
||||
}
|
||||
sleep_checked: state.sleep;
|
||||
sleep_toggled => {
|
||||
AuraPageData.led_power.states[idx].sleep = old_zone.sleep_checked;
|
||||
AuraPageData.set_led_power(AuraPageData.led_power);
|
||||
AuraPageData.cb_led_power(AuraPageData.led_power);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -57,6 +57,7 @@ export global SystemPageData {
|
||||
val: 20,
|
||||
};
|
||||
callback cb_ppt_pl1_spl(int);
|
||||
callback cb_default_ppt_pl1_spl();
|
||||
|
||||
in-out property <AttrMinMax> ppt_pl2_sppt: {
|
||||
min: 0,
|
||||
@@ -64,6 +65,7 @@ export global SystemPageData {
|
||||
val: 20,
|
||||
};
|
||||
callback cb_ppt_pl2_sppt(int);
|
||||
callback cb_default_ppt_pl2_sppt();
|
||||
|
||||
in-out property <AttrMinMax> ppt_pl3_fppt: {
|
||||
min: 0,
|
||||
@@ -71,6 +73,7 @@ export global SystemPageData {
|
||||
val: 20,
|
||||
};
|
||||
callback cb_ppt_pl3_fppt(int);
|
||||
callback cb_default_ppt_pl3_fppt();
|
||||
|
||||
in-out property <AttrMinMax> ppt_fppt: {
|
||||
min: 0,
|
||||
@@ -78,6 +81,7 @@ export global SystemPageData {
|
||||
val: 20,
|
||||
};
|
||||
callback cb_ppt_fppt(int);
|
||||
callback cb_default_ppt_fppt();
|
||||
|
||||
in-out property <AttrMinMax> ppt_apu_sppt: {
|
||||
min: 0,
|
||||
@@ -85,6 +89,7 @@ export global SystemPageData {
|
||||
val: 20,
|
||||
};
|
||||
callback cb_ppt_apu_sppt(int);
|
||||
callback cb_default_ppt_apu_sppt();
|
||||
|
||||
in-out property <AttrMinMax> ppt_platform_sppt: {
|
||||
min: 0,
|
||||
@@ -92,6 +97,7 @@ export global SystemPageData {
|
||||
val: 20,
|
||||
};
|
||||
callback cb_ppt_platform_sppt(int);
|
||||
callback cb_default_ppt_platform_sppt();
|
||||
|
||||
in-out property <AttrMinMax> nv_dynamic_boost: {
|
||||
min: 0,
|
||||
@@ -99,6 +105,7 @@ export global SystemPageData {
|
||||
val: 5,
|
||||
};
|
||||
callback cb_nv_dynamic_boost(int);
|
||||
callback cb_default_nv_dynamic_boost();
|
||||
|
||||
in-out property <AttrMinMax> nv_temp_target: {
|
||||
min: 0,
|
||||
@@ -106,6 +113,7 @@ export global SystemPageData {
|
||||
val: 75,
|
||||
};
|
||||
callback cb_nv_temp_target(int);
|
||||
callback cb_default_nv_temp_target();
|
||||
}
|
||||
|
||||
export component PageSystem inherits Rectangle {
|
||||
@@ -117,6 +125,7 @@ export component PageSystem inherits Rectangle {
|
||||
VerticalLayout {
|
||||
padding: 10px;
|
||||
spacing: 10px;
|
||||
alignment: LayoutAlignment.start;
|
||||
Rectangle {
|
||||
background: Palette.alternate-background;
|
||||
border-color: Palette.accent-background;
|
||||
@@ -135,8 +144,10 @@ export component PageSystem inherits Rectangle {
|
||||
text: @tr("Charge limit");
|
||||
minimum: 20;
|
||||
maximum: 100;
|
||||
value <=> SystemPageData.charge_control_end_threshold;
|
||||
has_reset: false;
|
||||
value: SystemPageData.charge_control_end_threshold;
|
||||
released => {
|
||||
SystemPageData.charge_control_end_threshold = self.value;
|
||||
SystemPageData.cb_charge_control_end_threshold(Math.round(SystemPageData.charge_control_end_threshold))
|
||||
}
|
||||
}
|
||||
@@ -205,25 +216,43 @@ 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;
|
||||
border-width: 3px;
|
||||
border-color: red;
|
||||
max-height: 30px;
|
||||
VerticalBox {
|
||||
Text {
|
||||
text: @tr("no_asus_armoury_driver_2" => "The asus-armoury driver is not loaded");
|
||||
font-size: 16px;
|
||||
horizontal-alignment: TextHorizontalAlignment.center;
|
||||
}
|
||||
|
||||
Text {
|
||||
text: @tr("no_asus_armoury_driver_2" => "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: Rectangle {
|
||||
height: 32px;
|
||||
Text {
|
||||
text: @tr("For advanced features you will require a kernel with this driver added.");
|
||||
font-size: 16px;
|
||||
horizontal-alignment: TextHorizontalAlignment.center;
|
||||
font-size: 16px;
|
||||
text: @tr("ppt_warning" => "The following settings may not be safe, please review the help.");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if SystemPageData.ppt_pl1_spl.val != -1: SystemSlider {
|
||||
text: @tr("ppt_pl1_spl" => "PL1, sustained power limit");
|
||||
text: @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.");
|
||||
minimum: SystemPageData.ppt_pl1_spl.min;
|
||||
maximum: SystemPageData.ppt_pl1_spl.max;
|
||||
value: SystemPageData.ppt_pl1_spl.val;
|
||||
has_reset: true;
|
||||
cb_do_reset => {
|
||||
SystemPageData.cb_default_ppt_pl1_spl();
|
||||
}
|
||||
released => {
|
||||
SystemPageData.ppt_pl1_spl.val = self.value;
|
||||
SystemPageData.cb_ppt_pl1_spl(Math.round(self.value))
|
||||
@@ -231,10 +260,16 @@ export component PageSystem inherits Rectangle {
|
||||
}
|
||||
|
||||
if SystemPageData.ppt_pl2_sppt.val != -1: SystemSlider {
|
||||
text: @tr("ppt_pl2_sppt" => "PL2, turbo power limit");
|
||||
text: @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.");
|
||||
minimum: SystemPageData.ppt_pl2_sppt.min;
|
||||
maximum: SystemPageData.ppt_pl2_sppt.max;
|
||||
value: SystemPageData.ppt_pl2_sppt.val;
|
||||
has_reset: true;
|
||||
cb_do_reset => {
|
||||
SystemPageData.cb_default_ppt_pl2_sppt();
|
||||
}
|
||||
released => {
|
||||
SystemPageData.ppt_pl2_sppt.val = self.value;
|
||||
SystemPageData.cb_ppt_pl2_sppt(Math.round(self.value))
|
||||
@@ -242,20 +277,32 @@ export component PageSystem inherits Rectangle {
|
||||
}
|
||||
|
||||
if SystemPageData.ppt_pl3_fppt.val != -1: SystemSlider {
|
||||
text: @tr("ppt_pl3_fppt" => "PL3, Fast Power Limit");
|
||||
text: @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.");
|
||||
minimum: SystemPageData.ppt_pl3_fppt.min;
|
||||
maximum: SystemPageData.ppt_pl3_fppt.max;
|
||||
value: SystemPageData.ppt_pl3_fppt.val;
|
||||
has_reset: true;
|
||||
cb_do_reset => {
|
||||
SystemPageData.cb_default_ppt_pl3_fppt();
|
||||
}
|
||||
released => {
|
||||
SystemPageData.ppt_fppt.val = self.value;
|
||||
SystemPageData.cb_ppt_fppt(Math.round(self.value))
|
||||
SystemPageData.ppt_pl3_fppt.val = self.value;
|
||||
SystemPageData.cb_ppt_pl3_fppt(Math.round(self.value))
|
||||
}
|
||||
}
|
||||
if SystemPageData.ppt_fppt.val != -1: SystemSlider {
|
||||
text: @tr("ppt_fppt" => "FPPT, Fast Power Limit");
|
||||
text: @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.");
|
||||
minimum: SystemPageData.ppt_fppt.min;
|
||||
maximum: SystemPageData.ppt_fppt.max;
|
||||
value: SystemPageData.ppt_fppt.val;
|
||||
has_reset: true;
|
||||
cb_do_reset => {
|
||||
SystemPageData.cb_default_ppt_fppt();
|
||||
}
|
||||
released => {
|
||||
SystemPageData.ppt_fppt.val = self.value;
|
||||
SystemPageData.cb_ppt_fppt(Math.round(self.value))
|
||||
@@ -263,10 +310,16 @@ export component PageSystem inherits Rectangle {
|
||||
}
|
||||
|
||||
if SystemPageData.ppt_apu_sppt.val != -1: SystemSlider {
|
||||
text: @tr("ppt_apu_sppt" => "SPPT, APU slow power limit");
|
||||
text: @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.");
|
||||
minimum: SystemPageData.ppt_apu_sppt.min;
|
||||
maximum: SystemPageData.ppt_apu_sppt.max;
|
||||
value: SystemPageData.ppt_apu_sppt.val;
|
||||
has_reset: true;
|
||||
cb_do_reset => {
|
||||
SystemPageData.cb_default_ppt_apu_sppt();
|
||||
}
|
||||
released => {
|
||||
SystemPageData.ppt_apu_sppt.val = self.value;
|
||||
SystemPageData.cb_ppt_apu_sppt(Math.round(self.value))
|
||||
@@ -274,10 +327,16 @@ export component PageSystem inherits Rectangle {
|
||||
}
|
||||
|
||||
if SystemPageData.ppt_platform_sppt.val != -1: SystemSlider {
|
||||
text: @tr("ppt_platform_sppt" => "Slow package power tracking limit");
|
||||
text: @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.");
|
||||
minimum: SystemPageData.ppt_platform_sppt.min;
|
||||
maximum: SystemPageData.ppt_platform_sppt.max;
|
||||
value: SystemPageData.ppt_platform_sppt.val;
|
||||
has_reset: true;
|
||||
cb_do_reset => {
|
||||
SystemPageData.cb_default_ppt_platform_sppt();
|
||||
}
|
||||
released => {
|
||||
SystemPageData.ppt_platform_sppt.val = self.value;
|
||||
SystemPageData.cb_ppt_platform_sppt(Math.round(self.value))
|
||||
@@ -285,10 +344,16 @@ export component PageSystem inherits Rectangle {
|
||||
}
|
||||
|
||||
if SystemPageData.nv_dynamic_boost.val != -1: SystemSlider {
|
||||
text: @tr("nv_dynamic_boost" => "dGPU boost overclock");
|
||||
text: @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.");
|
||||
minimum: SystemPageData.nv_dynamic_boost.min;
|
||||
maximum: SystemPageData.nv_dynamic_boost.max;
|
||||
value: SystemPageData.nv_dynamic_boost.val;
|
||||
has_reset: true;
|
||||
cb_do_reset => {
|
||||
SystemPageData.cb_default_nv_dynamic_boost();
|
||||
}
|
||||
released => {
|
||||
SystemPageData.nv_dynamic_boost.val = self.value;
|
||||
SystemPageData.cb_nv_dynamic_boost(Math.round(self.value))
|
||||
@@ -296,10 +361,16 @@ export component PageSystem inherits Rectangle {
|
||||
}
|
||||
|
||||
if SystemPageData.nv_temp_target.val != -1: SystemSlider {
|
||||
text: @tr("nv_temp_target" => "dGPU temperature max");
|
||||
text: @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.");
|
||||
minimum: SystemPageData.nv_temp_target.min;
|
||||
maximum: SystemPageData.nv_temp_target.max;
|
||||
value: SystemPageData.nv_temp_target.val;
|
||||
has_reset: true;
|
||||
cb_do_reset => {
|
||||
SystemPageData.cb_default_nv_temp_target();
|
||||
}
|
||||
released => {
|
||||
SystemPageData.nv_temp_target.val = self.value;
|
||||
SystemPageData.cb_nv_temp_target(Math.round(self.value))
|
||||
|
||||
@@ -71,7 +71,7 @@ export global AuraPageData {
|
||||
@tr("Aura brightness" => "High"),
|
||||
];
|
||||
in-out property <int> brightness;
|
||||
callback set_brightness(int);
|
||||
callback cb_brightness(int);
|
||||
in-out property <[string]> mode_names: [
|
||||
@tr("Basic aura mode" => "Static"),
|
||||
@tr("Basic aura mode" => "Breathe"),
|
||||
@@ -95,7 +95,7 @@ export global AuraPageData {
|
||||
in-out property <int> current_available_mode: 0;
|
||||
in-out property <[int]> supported_basic_modes: [0, 1, 2, 3, 4, 5, 6, 7, 8, 10, 11, 12];
|
||||
in-out property <int> led_mode;
|
||||
callback set_led_mode(int);
|
||||
callback cb_led_mode(int);
|
||||
in-out property <[string]> zone_names: [
|
||||
@tr("Aura zone" => "None"),
|
||||
@tr("Aura zone" => "Key1"),
|
||||
@@ -130,7 +130,7 @@ export global AuraPageData {
|
||||
speed: 0,
|
||||
direction: 0,
|
||||
};
|
||||
callback set_led_mode_data(AuraEffect);
|
||||
callback cb_led_mode_data(AuraEffect);
|
||||
in-out property <color> color1;
|
||||
in-out property <brush> colorbox1;
|
||||
in-out property <color> color2;
|
||||
@@ -147,8 +147,8 @@ export global AuraPageData {
|
||||
colorbox1 = data.colour1;
|
||||
colorbox2 = data.colour2;
|
||||
}
|
||||
callback set_hex_from_colour(color) -> string;
|
||||
callback set_hex_to_colour(string) -> color;
|
||||
callback cb_hex_from_colour(color) -> string;
|
||||
callback cb_hex_to_colour(string) -> color;
|
||||
in-out property <AuraDevType> device_type: AuraDevType.Old;
|
||||
// List of indexes to power_zone_names. Must correspond to rog-aura crate
|
||||
in-out property <[PowerZones]> supported_power_zones: [
|
||||
@@ -165,5 +165,5 @@ export global AuraPageData {
|
||||
shutdown: true,
|
||||
}]
|
||||
};
|
||||
callback set_led_power(LaptopAuraPower);
|
||||
callback cb_led_power(LaptopAuraPower);
|
||||
}
|
||||
|
||||
@@ -10,40 +10,46 @@ export component RogItem inherits Rectangle {
|
||||
}
|
||||
|
||||
export component SystemSlider inherits RogItem {
|
||||
in property <string> title;
|
||||
in property <string> text;
|
||||
in-out property <float> value;
|
||||
in-out property <float> minimum;
|
||||
in-out property <float> maximum;
|
||||
callback released(int);
|
||||
|
||||
in-out property <string> help_text;
|
||||
in-out property <bool> has_reset: false;
|
||||
callback cb_do_reset();
|
||||
|
||||
HorizontalLayout {
|
||||
HorizontalLayout {
|
||||
width: 50%;
|
||||
width: 40%;
|
||||
alignment: LayoutAlignment.stretch;
|
||||
padding-left: 10px;
|
||||
TouchArea {
|
||||
clicked => {
|
||||
slider.value += 1;
|
||||
if slider.value > slider.maximum {
|
||||
slider.value = slider.minimum;
|
||||
clicked => {
|
||||
slider.value += 1;
|
||||
if slider.value > slider.maximum {
|
||||
slider.value = slider.minimum;
|
||||
}
|
||||
}
|
||||
}
|
||||
HorizontalLayout {
|
||||
spacing: 6px;
|
||||
Text {
|
||||
font-size: 16px;
|
||||
vertical-alignment: TextVerticalAlignment.center;
|
||||
color: Palette.control-foreground;
|
||||
text <=> root.text;
|
||||
HorizontalLayout {
|
||||
spacing: 6px;
|
||||
Text {
|
||||
font-size: 16px;
|
||||
vertical-alignment: TextVerticalAlignment.center;
|
||||
color: Palette.control-foreground;
|
||||
text <=> root.text;
|
||||
}
|
||||
|
||||
Text {
|
||||
font-size: 16px;
|
||||
horizontal-alignment: TextHorizontalAlignment.right;
|
||||
vertical-alignment: TextVerticalAlignment.center;
|
||||
color: Palette.control-foreground;
|
||||
text: "\{Math.round(root.value)}";
|
||||
}
|
||||
}
|
||||
Text {
|
||||
font-size: 16px;
|
||||
horizontal-alignment: TextHorizontalAlignment.right;
|
||||
vertical-alignment: TextVerticalAlignment.center;
|
||||
color: Palette.control-foreground;
|
||||
text: "\{Math.round(root.value)}";
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -59,6 +65,96 @@ export component SystemSlider inherits RogItem {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
help_popup := PopupWindow {
|
||||
x: help.x - self.width + help.width - 10px;
|
||||
y: help.y - self.height + help.height - 10px;
|
||||
Rectangle {
|
||||
drop-shadow-blur: 10px;
|
||||
drop-shadow-color: black;
|
||||
border-radius: 10px;
|
||||
border-color: Palette.accent-background;
|
||||
background: Palette.background;
|
||||
Dialog {
|
||||
title <=> root.title;
|
||||
VerticalBox {
|
||||
Text {
|
||||
max-width: 420px;
|
||||
font-size: 18px;
|
||||
wrap: TextWrap.word-wrap;
|
||||
horizontal-alignment: TextHorizontalAlignment.center;
|
||||
text <=> root.title;
|
||||
}
|
||||
|
||||
Rectangle {
|
||||
height: 1px;
|
||||
border-color: black;
|
||||
border-width: 1px;
|
||||
}
|
||||
|
||||
Text {
|
||||
max-width: 420px;
|
||||
font-size: 16px;
|
||||
wrap: TextWrap.word-wrap;
|
||||
text <=> root.help_text;
|
||||
}
|
||||
}
|
||||
|
||||
StandardButton {
|
||||
kind: ok;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
help := HorizontalBox {
|
||||
if (help_text != ""): StandardButton {
|
||||
kind: StandardButtonKind.help;
|
||||
clicked => {
|
||||
help_popup.show();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
reset_popup := PopupWindow {
|
||||
x: reset.x - self.width + reset.width;
|
||||
y: reset.y - self.height + reset.height;
|
||||
Rectangle {
|
||||
drop-shadow-blur: 10px;
|
||||
drop-shadow-color: black;
|
||||
border-radius: 10px;
|
||||
border-color: Palette.accent-background;
|
||||
background: Palette.background;
|
||||
Dialog {
|
||||
Text {
|
||||
max-width: 420px;
|
||||
font-size: 16px;
|
||||
wrap: TextWrap.word-wrap;
|
||||
text: @tr("confirm_reset" => "Are you sure you want to reset this?");
|
||||
}
|
||||
|
||||
StandardButton {
|
||||
kind: ok;
|
||||
clicked => {
|
||||
root.cb_do_reset();
|
||||
}
|
||||
}
|
||||
|
||||
StandardButton {
|
||||
kind: cancel;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
reset := HorizontalBox {
|
||||
if (has_reset): StandardButton {
|
||||
kind: StandardButtonKind.reset;
|
||||
clicked => {
|
||||
reset_popup.show();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -114,7 +210,7 @@ export component SystemToggleInt inherits RogItem {
|
||||
alignment: LayoutAlignment.end;
|
||||
padding-right: 20px;
|
||||
Switch {
|
||||
checked: root.checked_int != 0;
|
||||
checked: root.checked_int != 0;
|
||||
toggled => {
|
||||
root.checked_int = self.checked ? 1 : 0;
|
||||
root.toggled(root.checked_int);
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
//!
|
||||
//! `zbus-xmlgen system xyz.ljones.Asusd
|
||||
//! /xyz/ljones/asus_armoury/nv_temp_target`
|
||||
use rog_platform::firmware_attributes::FirmwareAttribute;
|
||||
use rog_platform::asus_armoury::FirmwareAttribute;
|
||||
use zbus::proxy;
|
||||
#[proxy(
|
||||
interface = "xyz.ljones.AsusArmoury",
|
||||
@@ -48,4 +48,6 @@ pub trait AsusArmoury {
|
||||
/// take. Returns `-1` if not used or set.
|
||||
#[zbus(property)]
|
||||
fn scalar_increment(&self) -> zbus::Result<i32>;
|
||||
|
||||
async fn restore_default(&self) -> zbus::Result<()>;
|
||||
}
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
pub use asusd::{DBUS_IFACE, DBUS_NAME, DBUS_PATH};
|
||||
use zbus::proxy::ProxyImpl;
|
||||
|
||||
pub mod asus_armoury;
|
||||
pub mod scsi_aura;
|
||||
@@ -50,3 +51,42 @@ pub async fn has_iface(iface: &str) -> Result<bool, Box<dyn std::error::Error>>
|
||||
}
|
||||
Ok(false)
|
||||
}
|
||||
|
||||
pub async fn find_iface_async<T>(iface_name: &str) -> Result<Vec<T>, Box<dyn std::error::Error>>
|
||||
where
|
||||
T: ProxyImpl<'static> + From<zbus::Proxy<'static>>
|
||||
{
|
||||
let conn = zbus::Connection::system().await?;
|
||||
let f = zbus::fdo::ObjectManagerProxy::new(&conn, "xyz.ljones.Asusd", "/").await?;
|
||||
let interfaces = f.get_managed_objects().await?;
|
||||
let mut paths = Vec::new();
|
||||
for v in interfaces.iter() {
|
||||
// let o: Vec<zbus::names::OwnedInterfaceName> = v.1.keys().map(|e|
|
||||
// e.to_owned()).collect(); println!("{}, {:?}", v.0, o);
|
||||
for k in v.1.keys() {
|
||||
if k.as_str() == iface_name {
|
||||
// println!("Found {iface_name} device at {}, {}", v.0, k);
|
||||
paths.push(v.0.clone());
|
||||
}
|
||||
}
|
||||
}
|
||||
if paths.len() > 1 {
|
||||
println!("Multiple asusd interfaces devices found");
|
||||
}
|
||||
if !paths.is_empty() {
|
||||
let mut ctrl = Vec::new();
|
||||
paths.sort_by(|a, b| a.cmp(b));
|
||||
for path in paths {
|
||||
ctrl.push(
|
||||
T::builder(&conn)
|
||||
.path(path.clone())?
|
||||
.destination("xyz.ljones.Asusd")?
|
||||
.build()
|
||||
.await?
|
||||
);
|
||||
}
|
||||
return Ok(ctrl);
|
||||
}
|
||||
|
||||
Err(format!("Did not find {iface_name}").into())
|
||||
}
|
||||
|
||||
@@ -21,7 +21,7 @@
|
||||
//! …consequently `zbus-xmlgen` did not generate code for the above interfaces.
|
||||
|
||||
use rog_platform::cpu::CPUEPP;
|
||||
use rog_platform::platform::{GpuMode, Properties, ThrottlePolicy};
|
||||
use rog_platform::platform::{Properties, ThrottlePolicy};
|
||||
use zbus::proxy;
|
||||
|
||||
#[proxy(
|
||||
@@ -48,80 +48,6 @@ pub trait Platform {
|
||||
// Toggle one-shot charge to 100%
|
||||
fn one_shot_full_charge(&self) -> zbus::Result<()>;
|
||||
|
||||
/// DgpuDisable property
|
||||
#[zbus(property)]
|
||||
fn dgpu_disable(&self) -> zbus::Result<bool>;
|
||||
|
||||
/// EgpuEnable property
|
||||
#[zbus(property)]
|
||||
fn egpu_enable(&self) -> zbus::Result<bool>;
|
||||
|
||||
/// GpuMuxMode property
|
||||
#[zbus(property)]
|
||||
fn gpu_mux_mode(&self) -> zbus::Result<u8>;
|
||||
#[zbus(property)]
|
||||
fn set_gpu_mux_mode(&self, value: GpuMode) -> zbus::Result<()>;
|
||||
|
||||
/// MiniLedMode property
|
||||
#[zbus(property)]
|
||||
fn mini_led_mode(&self) -> zbus::Result<bool>;
|
||||
#[zbus(property)]
|
||||
fn set_mini_led_mode(&self, value: bool) -> zbus::Result<()>;
|
||||
|
||||
/// NvDynamicBoost property
|
||||
#[zbus(property)]
|
||||
fn nv_dynamic_boost(&self) -> zbus::Result<u8>;
|
||||
#[zbus(property)]
|
||||
fn set_nv_dynamic_boost(&self, value: u8) -> zbus::Result<()>;
|
||||
|
||||
/// NvTempTarget property
|
||||
#[zbus(property)]
|
||||
fn nv_temp_target(&self) -> zbus::Result<u8>;
|
||||
#[zbus(property)]
|
||||
fn set_nv_temp_target(&self, value: u8) -> zbus::Result<()>;
|
||||
|
||||
/// PanelOd property
|
||||
#[zbus(property)]
|
||||
fn panel_od(&self) -> zbus::Result<bool>;
|
||||
#[zbus(property)]
|
||||
fn set_panel_od(&self, value: bool) -> zbus::Result<()>;
|
||||
|
||||
/// PostAnimationSound property
|
||||
#[zbus(property)]
|
||||
fn boot_sound(&self) -> zbus::Result<bool>;
|
||||
#[zbus(property)]
|
||||
fn set_boot_sound(&self, value: bool) -> zbus::Result<()>;
|
||||
|
||||
/// PptApuSppt property
|
||||
#[zbus(property)]
|
||||
fn ppt_apu_sppt(&self) -> zbus::Result<u8>;
|
||||
#[zbus(property)]
|
||||
fn set_ppt_apu_sppt(&self, value: u8) -> zbus::Result<()>;
|
||||
|
||||
/// PptFppt property
|
||||
#[zbus(property)]
|
||||
fn ppt_fppt(&self) -> zbus::Result<u8>;
|
||||
#[zbus(property)]
|
||||
fn set_ppt_fppt(&self, value: u8) -> zbus::Result<()>;
|
||||
|
||||
/// PptPl1Spl property
|
||||
#[zbus(property)]
|
||||
fn ppt_pl1_spl(&self) -> zbus::Result<u8>;
|
||||
#[zbus(property)]
|
||||
fn set_ppt_pl1_spl(&self, value: u8) -> zbus::Result<()>;
|
||||
|
||||
/// PptPl2Sppt property
|
||||
#[zbus(property)]
|
||||
fn ppt_pl2_sppt(&self) -> zbus::Result<u8>;
|
||||
#[zbus(property)]
|
||||
fn set_ppt_pl2_sppt(&self, value: u8) -> zbus::Result<()>;
|
||||
|
||||
/// PptPlatformSppt property
|
||||
#[zbus(property)]
|
||||
fn ppt_platform_sppt(&self) -> zbus::Result<u8>;
|
||||
#[zbus(property)]
|
||||
fn set_ppt_platform_sppt(&self, value: u8) -> zbus::Result<()>;
|
||||
|
||||
/// ThrottleBalancedEpp property
|
||||
#[zbus(property)]
|
||||
fn throttle_balanced_epp(&self) -> zbus::Result<CPUEPP>;
|
||||
|
||||
@@ -76,11 +76,11 @@ impl Attribute {
|
||||
}
|
||||
|
||||
/// Write the `current_value` directly to the attribute path
|
||||
pub fn set_current_value(&self, new_value: AttrValue) -> Result<(), PlatformError> {
|
||||
pub fn set_current_value(&self, new_value: &AttrValue) -> Result<(), PlatformError> {
|
||||
let path = self.base_path.join("current_value");
|
||||
|
||||
let value_str = match new_value {
|
||||
AttrValue::Integer(val) => val.to_string(),
|
||||
AttrValue::Integer(val) => &val.to_string(),
|
||||
AttrValue::String(val) => val,
|
||||
_ => return Err(PlatformError::InvalidValue)
|
||||
};
|
||||
@@ -94,6 +94,10 @@ impl Attribute {
|
||||
&self.default_value
|
||||
}
|
||||
|
||||
pub fn restore_default(&self) -> Result<(), PlatformError> {
|
||||
self.set_current_value(&self.default_value)
|
||||
}
|
||||
|
||||
pub fn possible_values(&self) -> &AttrValue {
|
||||
&self.possible_values
|
||||
}
|
||||
@@ -157,8 +161,28 @@ impl Attribute {
|
||||
default_value, possible_values, min_value, max_value, scalar_increment
|
||||
)
|
||||
}
|
||||
|
||||
pub fn get_watcher(&self) -> Result<inotify::Inotify, PlatformError> {
|
||||
let path = self.base_path.join("current_value");
|
||||
if let Some(path) = path.to_str() {
|
||||
let inotify = inotify::Inotify::init()?;
|
||||
inotify
|
||||
.watches()
|
||||
.add(path, inotify::WatchMask::MODIFY)
|
||||
.map_err(|e| {
|
||||
if e.kind() == std::io::ErrorKind::NotFound {
|
||||
PlatformError::AttrNotFound(self.name().to_string())
|
||||
} else {
|
||||
PlatformError::IoPath(path.to_string(), e)
|
||||
}
|
||||
})?;
|
||||
return Ok(inotify);
|
||||
}
|
||||
Err(PlatformError::AttrNotFound(self.name().to_string()))
|
||||
}
|
||||
}
|
||||
|
||||
#[derive(Clone)]
|
||||
pub struct FirmwareAttributes {
|
||||
attrs: Vec<Attribute>
|
||||
}
|
||||
@@ -273,6 +297,24 @@ pub enum FirmwareAttribute {
|
||||
None = 24
|
||||
}
|
||||
|
||||
impl FirmwareAttribute {
|
||||
pub fn is_ppt(&self) -> bool {
|
||||
matches!(
|
||||
self,
|
||||
FirmwareAttribute::PptPl1Spl
|
||||
| FirmwareAttribute::PptPl2Sppt
|
||||
| FirmwareAttribute::PptPl3Fppt
|
||||
| FirmwareAttribute::PptFppt
|
||||
| FirmwareAttribute::PptApuSppt
|
||||
| FirmwareAttribute::PptPlatformSppt
|
||||
| FirmwareAttribute::NvDynamicBoost
|
||||
| FirmwareAttribute::NvTempTarget
|
||||
| FirmwareAttribute::DgpuBaseTgp
|
||||
| FirmwareAttribute::DgpuTgp
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
impl From<&str> for FirmwareAttribute {
|
||||
fn from(s: &str) -> Self {
|
||||
match s {
|
||||
@@ -415,6 +457,6 @@ mod tests {
|
||||
if let AttrValue::Integer(val) = &mut val {
|
||||
*val = 0;
|
||||
}
|
||||
attr.set_current_value(val).unwrap();
|
||||
attr.set_current_value(&val).unwrap();
|
||||
}
|
||||
}
|
||||
@@ -1,9 +1,9 @@
|
||||
//! This crate functions as a wrapper of all the relevant ASUS functionality
|
||||
//! on ROG, Strix, and TUF laptops.
|
||||
|
||||
pub mod asus_armoury;
|
||||
pub mod cpu;
|
||||
pub mod error;
|
||||
pub mod firmware_attributes;
|
||||
pub mod hid_raw;
|
||||
pub mod keyboard_led;
|
||||
pub(crate) mod macros;
|
||||
|
||||
@@ -7,7 +7,7 @@ use serde::{Deserialize, Serialize};
|
||||
use zbus::zvariant::{OwnedValue, Type, Value};
|
||||
|
||||
use crate::error::{PlatformError, Result};
|
||||
use crate::{attr_bool, attr_string, attr_u8, to_device};
|
||||
use crate::{attr_string, attr_u8, to_device};
|
||||
|
||||
/// The "platform" device provides access to things like:
|
||||
/// - `dgpu_disable`
|
||||
@@ -24,16 +24,6 @@ pub struct RogPlatform {
|
||||
}
|
||||
|
||||
impl RogPlatform {
|
||||
attr_bool!("dgpu_disable", path);
|
||||
|
||||
attr_bool!("egpu_enable", path);
|
||||
|
||||
attr_u8!("gpu_mux_mode", path);
|
||||
|
||||
attr_bool!("panel_od", path);
|
||||
|
||||
attr_bool!("mini_led_mode", path);
|
||||
|
||||
attr_u8!(
|
||||
/// This is technically the same as `platform_profile` since both are
|
||||
/// tied in-kernel
|
||||
@@ -47,12 +37,6 @@ impl RogPlatform {
|
||||
pp_path
|
||||
);
|
||||
|
||||
attr_bool!(
|
||||
/// Control the POST animation "FWOOoosh" sound
|
||||
"boot_sound",
|
||||
path
|
||||
);
|
||||
|
||||
pub fn new() -> Result<Self> {
|
||||
let mut enumerator = udev::Enumerator::new().map_err(|err| {
|
||||
warn!("{}", err);
|
||||
|
||||
Reference in New Issue
Block a user