mirror of
https://gitlab.com/asus-linux/asusctl.git
synced 2026-02-06 00:15:04 +01:00
Compare commits
40 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 11ac46df11 | |||
| 05bec93644 | |||
| c77e7cf1ce | |||
| d30f7dc2ea | |||
| 759606fca3 | |||
| 25ed8bdeed | |||
| de61a15b7a | |||
| 16700e55f4 | |||
| 5833a011ce | |||
| 62577ee0e4 | |||
| dac35996b1 | |||
| 5c2bcad7c6 | |||
| 81f6c18a24 | |||
| bcc3d42789 | |||
| 36c34cb3dd | |||
| 9b82b875f1 | |||
| bddccc696f | |||
| 51e9f10087 | |||
| 911ff8690e | |||
| 25823dc6b7 | |||
| cba8e1a473 | |||
| fb98827a1a | |||
| b9296862df | |||
| 450205f9a9 | |||
| 82431ee25b | |||
| f11aea02a8 | |||
| 2d6d669c22 | |||
| f9cebf9221 | |||
| a00808313e | |||
| 3426591d32 | |||
| ef3b6636f5 | |||
| ee9e0a1e31 | |||
| 9e84997cbf | |||
| 2b22f82b72 | |||
| 7a1b45071d | |||
| ad63c429cb | |||
| a790d9a499 | |||
| be51a1ab77 | |||
| d9a88e7cc3 | |||
| d785e17f95 |
@@ -2,6 +2,56 @@
|
||||
|
||||
## [Unreleased]
|
||||
|
||||
### Changed
|
||||
- Fix aura data matching
|
||||
|
||||
## [v6.1.0]
|
||||
|
||||
### Changed
|
||||
- Update deps
|
||||
- Add support for G513RC RGB modes
|
||||
- Many UI fixes
|
||||
- Fixes to PPT settings in UI
|
||||
|
||||
## [v6.1.0-rc7]
|
||||
|
||||
- Refactor PPT handling more:
|
||||
1. Per profile, per-ac/dc
|
||||
2. Do not apply unless group is enabled
|
||||
3. Better reset/disable handling
|
||||
4. Selecting a profile defaults PPT to off/disabled
|
||||
- Bugfix: prevent an AniMe thread async deadlock
|
||||
|
||||
## [v6.1.0-rc6]
|
||||
|
||||
### Changed
|
||||
- Two small fixes, one for `low-power` profile name, and one for base gpu tdp
|
||||
- Move to using platform_profile api only (no throttle_thermal_policy)
|
||||
|
||||
## [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
|
||||
- Partial support for per-profile CPU tunings (WIP)
|
||||
|
||||
## [v6.1.0-rc2]
|
||||
|
||||
### Added
|
||||
|
||||
Generated
+1119
-495
File diff suppressed because it is too large
Load Diff
+1
-1
@@ -1,5 +1,5 @@
|
||||
[workspace.package]
|
||||
version = "6.1.0-rc2"
|
||||
version = "6.1.0"
|
||||
rust-version = "1.82"
|
||||
license = "MPL-2.0"
|
||||
readme = "README.md"
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
VERSION := $(shell /usr/bin/grep -Pm1 'version = "(\d+.\d+.\d+)"' Cargo.toml | cut -d'"' -f2)
|
||||
VERSION := $(shell /usr/bin/grep -Pm1 'version = "(\d+.\d+.\d+.*)"' Cargo.toml | cut -d'"' -f2)
|
||||
|
||||
INSTALL = install
|
||||
INSTALL_PROGRAM = ${INSTALL} -D -m 0755
|
||||
@@ -19,7 +19,7 @@ LEDCFG := aura_support.ron
|
||||
|
||||
SRC := Cargo.toml Cargo.lock Makefile $(shell find -type f -wholename '**/src/*.rs')
|
||||
|
||||
STRIP_BINARIES ?= 1
|
||||
STRIP_BINARIES ?= 0
|
||||
|
||||
DEBUG ?= 0
|
||||
ifeq ($(DEBUG),0)
|
||||
|
||||
@@ -39,7 +39,7 @@ See the [rog-aura readme](./rog-aura/README.md) for more details.
|
||||
|
||||
## Discord
|
||||
|
||||
[](https://discord.gg/z8y99XqPb7)
|
||||
[](https://discord.gg/B8GftRW2Hd)
|
||||
|
||||
## SUPPORTED LAPTOPS
|
||||
|
||||
|
||||
+3
-1
@@ -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" }
|
||||
|
||||
|
||||
+6
-38
@@ -1,5 +1,5 @@
|
||||
use gumdrop::Options;
|
||||
use rog_platform::platform::ThrottlePolicy;
|
||||
use rog_platform::platform::PlatformProfile;
|
||||
|
||||
use crate::anime_cli::AnimeCommand;
|
||||
use crate::aura_cli::{LedBrightness, LedPowerCommand1, LedPowerCommand2, SetAuraBuiltin};
|
||||
@@ -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"
|
||||
@@ -73,7 +71,7 @@ pub struct ProfileCommand {
|
||||
pub profile_get: bool,
|
||||
|
||||
#[options(meta = "", help = "set the active profile")]
|
||||
pub profile_set: Option<ThrottlePolicy>
|
||||
pub profile_set: Option<PlatformProfile>
|
||||
}
|
||||
|
||||
#[derive(Options)]
|
||||
@@ -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>
|
||||
}
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
use gumdrop::Options;
|
||||
use rog_platform::platform::ThrottlePolicy;
|
||||
use rog_platform::platform::PlatformProfile;
|
||||
use rog_profiles::fan_curve_set::CurveData;
|
||||
use rog_profiles::FanCurvePU;
|
||||
|
||||
@@ -18,7 +18,7 @@ pub struct FanCurveCommand {
|
||||
meta = "",
|
||||
help = "profile to modify fan-curve for. Shows data if no options provided"
|
||||
)]
|
||||
pub mod_profile: Option<ThrottlePolicy>,
|
||||
pub mod_profile: Option<PlatformProfile>,
|
||||
|
||||
#[options(
|
||||
meta = "",
|
||||
|
||||
+40
-80
@@ -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::{PlatformProfile, Properties};
|
||||
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();
|
||||
@@ -65,7 +74,15 @@ fn main() {
|
||||
println!("\nError: {e}\n");
|
||||
print_info();
|
||||
}) {
|
||||
let asusd_version = platform_proxy.version().unwrap();
|
||||
let asusd_version = platform_proxy
|
||||
.version()
|
||||
.map_err(|e| {
|
||||
error!(
|
||||
"Could not get asusd version: {e:?}\nIs asusd.service running? {}",
|
||||
check_service("asusd")
|
||||
);
|
||||
})
|
||||
.unwrap();
|
||||
if asusd_version != self_version {
|
||||
println!("Version mismatch: asusctl = {self_version}, asusd = {asusd_version}");
|
||||
return;
|
||||
@@ -163,7 +180,7 @@ where
|
||||
return Ok(ctrl);
|
||||
}
|
||||
|
||||
Err("No Aura interface".into())
|
||||
Err(format!("Did not find {iface_name}").into())
|
||||
}
|
||||
|
||||
fn do_parsed(
|
||||
@@ -186,9 +203,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
|
||||
@@ -267,8 +281,8 @@ fn do_parsed(
|
||||
}
|
||||
|
||||
println!("\nExtra help can be requested on any command or subcommand:");
|
||||
println!(" asusctl led-mode --help");
|
||||
println!(" asusctl led-mode static --help");
|
||||
println!(" asusctl aura --help");
|
||||
println!(" asusctl aura static --help");
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -370,7 +384,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)?;
|
||||
@@ -907,16 +926,16 @@ fn handle_throttle_profile(
|
||||
}
|
||||
|
||||
let proxy = PlatformProxyBlocking::new(conn)?;
|
||||
let current = proxy.throttle_thermal_policy()?;
|
||||
let current = proxy.platform_profile()?;
|
||||
|
||||
if cmd.next {
|
||||
proxy.set_throttle_thermal_policy(current.next())?;
|
||||
proxy.set_platform_profile(current.next())?;
|
||||
} else if let Some(profile) = cmd.profile_set {
|
||||
proxy.set_throttle_thermal_policy(profile)?;
|
||||
proxy.set_platform_profile(profile)?;
|
||||
}
|
||||
|
||||
if cmd.list {
|
||||
let res = ThrottlePolicy::list();
|
||||
let res = PlatformProfile::list();
|
||||
for p in &res {
|
||||
println!("{:?}", p);
|
||||
}
|
||||
@@ -963,7 +982,7 @@ fn handle_fan_curve(
|
||||
|
||||
let plat_proxy = PlatformProxyBlocking::new(conn)?;
|
||||
if cmd.get_enabled {
|
||||
let profile = plat_proxy.throttle_thermal_policy()?;
|
||||
let profile = plat_proxy.platform_profile()?;
|
||||
let curves = fan_proxy.fan_curve_data(profile)?;
|
||||
for curve in curves.iter() {
|
||||
println!("{}", String::from(curve));
|
||||
@@ -971,7 +990,7 @@ fn handle_fan_curve(
|
||||
}
|
||||
|
||||
if cmd.default {
|
||||
let active = plat_proxy.throttle_thermal_policy()?;
|
||||
let active = plat_proxy.platform_profile()?;
|
||||
fan_proxy.set_curves_to_defaults(active)?;
|
||||
}
|
||||
|
||||
@@ -1007,70 +1026,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 +1130,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)?;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -7,7 +7,7 @@ pub struct SlashCommand {
|
||||
pub help: bool,
|
||||
#[options(help = "Enable the Slash Ledbar")]
|
||||
pub enable: bool,
|
||||
#[options(help = "Ddisable the Slash Ledbar")]
|
||||
#[options(help = "Disable the Slash Ledbar")]
|
||||
pub disable: bool,
|
||||
#[options(short = "l", meta = "", help = "Set brightness value <0-255>")]
|
||||
pub brightness: Option<u8>,
|
||||
|
||||
+309
-39
@@ -1,13 +1,19 @@
|
||||
use log::error;
|
||||
use rog_platform::firmware_attributes::{
|
||||
AttrValue, Attribute, FirmwareAttribute, FirmwareAttributes
|
||||
};
|
||||
use std::sync::Arc;
|
||||
|
||||
use ::zbus::export::futures_util::lock::Mutex;
|
||||
use config_traits::StdConfig;
|
||||
use log::{debug, error, info};
|
||||
use rog_platform::asus_armoury::{AttrValue, Attribute, FirmwareAttribute, FirmwareAttributes};
|
||||
use rog_platform::platform::{PlatformProfile, RogPlatform};
|
||||
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";
|
||||
|
||||
@@ -21,18 +27,32 @@ fn dbus_path_for_attr(attr_name: &str) -> OwnedObjectPath {
|
||||
ObjectPath::from_str_unchecked(&format!("{ASUS_ZBUS_PATH}/{MOD_NAME}/{attr_name}")).into()
|
||||
}
|
||||
|
||||
pub struct AsusArmouryAttribute(Attribute);
|
||||
#[derive(Clone)]
|
||||
pub struct AsusArmouryAttribute {
|
||||
attr: Attribute,
|
||||
config: Arc<Mutex<Config>>,
|
||||
/// platform control required here for access to PPD or Throttle profile
|
||||
platform: RogPlatform,
|
||||
power: AsusPower
|
||||
}
|
||||
|
||||
impl AsusArmouryAttribute {
|
||||
pub fn new(attr: Attribute) -> Self {
|
||||
Self(attr)
|
||||
pub fn new(
|
||||
attr: Attribute,
|
||||
platform: RogPlatform,
|
||||
power: AsusPower,
|
||||
config: Arc<Mutex<Config>>
|
||||
) -> Self {
|
||||
Self {
|
||||
attr,
|
||||
config,
|
||||
platform,
|
||||
power
|
||||
}
|
||||
}
|
||||
|
||||
pub async fn start_tasks(self, connection: &Connection) -> Result<(), RogError> {
|
||||
// self.reload()
|
||||
// .await
|
||||
// .unwrap_or_else(|err| warn!("Controller error: {}", err));
|
||||
let path = dbus_path_for_attr(self.0.name());
|
||||
pub async fn move_to_zbus(self, connection: &Connection) -> Result<(), RogError> {
|
||||
let path = dbus_path_for_attr(self.attr.name());
|
||||
connection
|
||||
.object_server()
|
||||
.at(path.clone(), self)
|
||||
@@ -41,6 +61,86 @@ impl AsusArmouryAttribute {
|
||||
.ok();
|
||||
Ok(())
|
||||
}
|
||||
|
||||
async fn watch_and_notify(
|
||||
&mut self,
|
||||
signal_ctxt: SignalEmitter<'static>
|
||||
) -> Result<(), RogError> {
|
||||
use zbus::export::futures_util::StreamExt;
|
||||
|
||||
let name = self.name();
|
||||
macro_rules! watch_value_notify {
|
||||
($attr_str:expr, $fn_prop_changed:ident) => {
|
||||
match self.attr.get_watcher($attr_str) {
|
||||
Ok(watch) => {
|
||||
let name = <&str>::from(name);
|
||||
let ctrl = self.clone();
|
||||
let sig = signal_ctxt.clone();
|
||||
tokio::spawn(async move {
|
||||
let mut buffer = [0; 32];
|
||||
watch
|
||||
.into_event_stream(&mut buffer)
|
||||
.unwrap()
|
||||
.for_each(|_| async {
|
||||
debug!("{} changed", name);
|
||||
ctrl.$fn_prop_changed(&sig).await.ok();
|
||||
})
|
||||
.await;
|
||||
});
|
||||
}
|
||||
Err(e) => info!(
|
||||
"inotify watch failed: {}. You can ignore this if your device does not \
|
||||
support the feature",
|
||||
e
|
||||
)
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
// "current_value", "default_value", "min_value", "max_value"
|
||||
watch_value_notify!("current_value", current_value_changed);
|
||||
watch_value_notify!("default_value", default_value_changed);
|
||||
watch_value_notify!("min_value", min_value_changed);
|
||||
watch_value_notify!("max_value", max_value_changed);
|
||||
|
||||
Ok(())
|
||||
}
|
||||
}
|
||||
|
||||
impl crate::Reloadable for AsusArmouryAttribute {
|
||||
async fn reload(&mut self) -> Result<(), RogError> {
|
||||
info!("Reloading {}", self.attr.name());
|
||||
let profile: PlatformProfile = self.platform.get_platform_profile()?.into();
|
||||
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(tuning) = config.get(&profile) {
|
||||
if tuning.enabled {
|
||||
if let Some(tune) = tuning.group.get(&self.name()) {
|
||||
self.attr
|
||||
.set_current_value(&AttrValue::Integer(*tune))
|
||||
.map_err(|e| {
|
||||
error!("Could not set {} value: {e:?}", self.attr.name());
|
||||
self.attr.base_path_exists();
|
||||
e
|
||||
})?;
|
||||
info!("Set {} to {:?}", self.attr.name(), tune);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Ok(())
|
||||
}
|
||||
}
|
||||
|
||||
/// If return is `-1` on a property then there is avilable value for that
|
||||
@@ -48,30 +148,30 @@ impl AsusArmouryAttribute {
|
||||
#[interface(name = "xyz.ljones.AsusArmoury")]
|
||||
impl AsusArmouryAttribute {
|
||||
#[zbus(property)]
|
||||
async fn name(&self) -> FirmwareAttribute {
|
||||
self.0.name().into()
|
||||
fn name(&self) -> FirmwareAttribute {
|
||||
self.attr.name().into()
|
||||
}
|
||||
|
||||
#[zbus(property)]
|
||||
async fn available_attrs(&self) -> Vec<String> {
|
||||
let mut attrs = Vec::new();
|
||||
if !matches!(self.0.default_value(), AttrValue::None) {
|
||||
if !matches!(self.attr.default_value(), AttrValue::None) {
|
||||
attrs.push("default_value".to_string());
|
||||
}
|
||||
if !matches!(self.0.min_value(), AttrValue::None) {
|
||||
if !matches!(self.attr.min_value(), AttrValue::None) {
|
||||
attrs.push("min_value".to_string());
|
||||
}
|
||||
if !matches!(self.0.max_value(), AttrValue::None) {
|
||||
if !matches!(self.attr.max_value(), AttrValue::None) {
|
||||
attrs.push("max_value".to_string());
|
||||
}
|
||||
if !matches!(self.0.scalar_increment(), AttrValue::None) {
|
||||
if !matches!(self.attr.scalar_increment(), AttrValue::None) {
|
||||
attrs.push("scalar_increment".to_string());
|
||||
}
|
||||
if !matches!(self.0.possible_values(), AttrValue::None) {
|
||||
if !matches!(self.attr.possible_values(), AttrValue::None) {
|
||||
attrs.push("possible_values".to_string());
|
||||
}
|
||||
// TODO: Don't unwrap, use error
|
||||
if let Ok(value) = self.0.current_value().map_err(|e| {
|
||||
if let Ok(value) = self.attr.current_value().map_err(|e| {
|
||||
error!("Failed to read: {e:?}");
|
||||
e
|
||||
}) {
|
||||
@@ -85,15 +185,48 @@ impl AsusArmouryAttribute {
|
||||
/// If return is `-1` then there is no default value
|
||||
#[zbus(property)]
|
||||
async fn default_value(&self) -> i32 {
|
||||
match self.0.default_value() {
|
||||
match self.attr.default_value() {
|
||||
AttrValue::Integer(i) => *i,
|
||||
_ => -1
|
||||
}
|
||||
}
|
||||
|
||||
async fn restore_default(&self) -> fdo::Result<()> {
|
||||
self.attr.restore_default()?;
|
||||
if self.name().is_ppt() {
|
||||
let profile: PlatformProfile = self.platform.get_platform_profile()?.into();
|
||||
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 tuning = config.select_tunings(power_plugged == 1, profile);
|
||||
if let Some(tune) = tuning.group.get_mut(&self.name()) {
|
||||
if let AttrValue::Integer(i) = self.attr.default_value() {
|
||||
*tune = *i;
|
||||
}
|
||||
}
|
||||
if tuning.enabled {
|
||||
self.attr
|
||||
.set_current_value(self.attr.default_value())
|
||||
.map_err(|e| {
|
||||
error!("Could not set value: {e:?}");
|
||||
e
|
||||
})?;
|
||||
}
|
||||
config.write();
|
||||
}
|
||||
Ok(())
|
||||
}
|
||||
|
||||
#[zbus(property)]
|
||||
async fn min_value(&self) -> i32 {
|
||||
match self.0.min_value() {
|
||||
match self.attr.min_value() {
|
||||
AttrValue::Integer(i) => *i,
|
||||
_ => -1
|
||||
}
|
||||
@@ -101,7 +234,7 @@ impl AsusArmouryAttribute {
|
||||
|
||||
#[zbus(property)]
|
||||
async fn max_value(&self) -> i32 {
|
||||
match self.0.max_value() {
|
||||
match self.attr.max_value() {
|
||||
AttrValue::Integer(i) => *i,
|
||||
_ => -1
|
||||
}
|
||||
@@ -109,7 +242,7 @@ impl AsusArmouryAttribute {
|
||||
|
||||
#[zbus(property)]
|
||||
async fn scalar_increment(&self) -> i32 {
|
||||
match self.0.scalar_increment() {
|
||||
match self.attr.scalar_increment() {
|
||||
AttrValue::Integer(i) => *i,
|
||||
_ => -1
|
||||
}
|
||||
@@ -117,7 +250,7 @@ impl AsusArmouryAttribute {
|
||||
|
||||
#[zbus(property)]
|
||||
async fn possible_values(&self) -> Vec<i32> {
|
||||
match self.0.possible_values() {
|
||||
match self.attr.possible_values() {
|
||||
AttrValue::EnumInt(i) => i.clone(),
|
||||
_ => Vec::default()
|
||||
}
|
||||
@@ -125,7 +258,29 @@ impl AsusArmouryAttribute {
|
||||
|
||||
#[zbus(property)]
|
||||
async fn current_value(&self) -> fdo::Result<i32> {
|
||||
if let Ok(AttrValue::Integer(i)) = self.0.current_value() {
|
||||
if self.name().is_ppt() {
|
||||
let profile: PlatformProfile = self.platform.get_platform_profile()?.into();
|
||||
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 tuning = config.select_tunings(power_plugged == 1, profile);
|
||||
if let Some(tune) = tuning.group.get(&self.name()) {
|
||||
return Ok(*tune);
|
||||
} else if let AttrValue::Integer(i) = self.attr.default_value() {
|
||||
return Ok(*i);
|
||||
}
|
||||
return Err(fdo::Error::Failed(
|
||||
"Could not read current value".to_string()
|
||||
));
|
||||
}
|
||||
|
||||
if let Ok(AttrValue::Integer(i)) = self.attr.current_value() {
|
||||
return Ok(i);
|
||||
}
|
||||
Err(fdo::Error::Failed(
|
||||
@@ -135,21 +290,136 @@ impl AsusArmouryAttribute {
|
||||
|
||||
#[zbus(property)]
|
||||
async fn set_current_value(&mut self, value: i32) -> fdo::Result<()> {
|
||||
Ok(self
|
||||
.0
|
||||
.set_current_value(AttrValue::Integer(value))
|
||||
.map_err(|e| {
|
||||
error!("Could not set value: {e:?}");
|
||||
e
|
||||
})?)
|
||||
if self.name().is_ppt() {
|
||||
let profile: PlatformProfile = self.platform.get_platform_profile()?.into();
|
||||
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 tuning = config.select_tunings(power_plugged == 1, profile);
|
||||
|
||||
if let Some(tune) = tuning.group.get_mut(&self.name()) {
|
||||
*tune = value;
|
||||
} else {
|
||||
tuning.group.insert(self.name(), value);
|
||||
debug!("Store tuning config for {} = {:?}", self.attr.name(), value);
|
||||
}
|
||||
if tuning.enabled {
|
||||
self.attr
|
||||
.set_current_value(&AttrValue::Integer(value))
|
||||
.map_err(|e| {
|
||||
error!("Could not set value: {e:?}");
|
||||
e
|
||||
})?;
|
||||
}
|
||||
} else {
|
||||
self.attr
|
||||
.set_current_value(&AttrValue::Integer(value))
|
||||
.map_err(|e| {
|
||||
error!("Could not set value: {e:?}");
|
||||
e
|
||||
})?;
|
||||
|
||||
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();
|
||||
Ok(())
|
||||
}
|
||||
}
|
||||
|
||||
pub async fn start_attributes_zbus(server: &Connection) -> Result<(), RogError> {
|
||||
for attr in FirmwareAttributes::new().attributes() {
|
||||
AsusArmouryAttribute::new(attr.clone())
|
||||
.start_tasks(server)
|
||||
.await?;
|
||||
pub async fn start_attributes_zbus(
|
||||
conn: &Connection,
|
||||
platform: RogPlatform,
|
||||
power: AsusPower,
|
||||
attributes: FirmwareAttributes,
|
||||
config: Arc<Mutex<Config>>
|
||||
) -> Result<(), RogError> {
|
||||
for attr in attributes.attributes() {
|
||||
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: PlatformProfile
|
||||
) {
|
||||
for attr in attrs.attributes().iter() {
|
||||
let name: FirmwareAttribute = attr.name().into();
|
||||
if name.is_ppt() {
|
||||
let tuning = config.select_tunings(power_plugged, profile);
|
||||
if !tuning.enabled {
|
||||
debug!("Tuning group is not enabled, skipping");
|
||||
return;
|
||||
}
|
||||
|
||||
if let Some(tune) = tuning.group.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 {
|
||||
tuning.group.insert(name, *i);
|
||||
info!(
|
||||
"Set default tuning config for {} = {:?}",
|
||||
<&str>::from(name),
|
||||
i
|
||||
);
|
||||
// config.write();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
+12
-11
@@ -8,7 +8,7 @@ use std::sync::Arc;
|
||||
use std::thread::sleep;
|
||||
|
||||
use config_traits::StdConfig;
|
||||
use log::{error, info, warn};
|
||||
use log::{debug, error, info, warn};
|
||||
use rog_anime::usb::{
|
||||
pkt_flush, pkt_set_brightness, pkt_set_enable_display, pkt_set_enable_powersave_anim,
|
||||
pkts_for_init, Brightness
|
||||
@@ -16,7 +16,7 @@ use rog_anime::usb::{
|
||||
use rog_anime::{ActionData, AnimeDataBuffer, AnimePacketType};
|
||||
use rog_platform::hid_raw::HidRaw;
|
||||
use rog_platform::usb_raw::USBRaw;
|
||||
use tokio::sync::{Mutex, MutexGuard};
|
||||
use tokio::sync::Mutex;
|
||||
|
||||
use self::config::{AniMeConfig, AniMeConfigCached};
|
||||
use crate::error::RogError;
|
||||
@@ -59,6 +59,8 @@ impl AniMe {
|
||||
config.rename_file_old();
|
||||
*config = AniMeConfig::new();
|
||||
config.write();
|
||||
} else {
|
||||
debug!("Initialised AniMe cache");
|
||||
}
|
||||
} else {
|
||||
error!("AniMe Matrix could not init cache")
|
||||
@@ -70,11 +72,9 @@ impl AniMe {
|
||||
self.do_init_cache().await;
|
||||
let pkts = pkts_for_init();
|
||||
self.write_bytes(&pkts[0]).await?;
|
||||
self.write_bytes(&pkts[1]).await
|
||||
}
|
||||
|
||||
pub async fn lock_config(&self) -> MutexGuard<AniMeConfig> {
|
||||
self.config.lock().await
|
||||
self.write_bytes(&pkts[1]).await?;
|
||||
debug!("Succesfully initialised AniMe matrix display");
|
||||
Ok(())
|
||||
}
|
||||
|
||||
pub async fn write_bytes(&self, message: &[u8]) -> Result<(), RogError> {
|
||||
@@ -176,7 +176,7 @@ impl AniMe {
|
||||
return Ok(true); // Do safe exit
|
||||
}
|
||||
let inner = inner.clone();
|
||||
tokio::task::spawn_local(async move {
|
||||
tokio::task::spawn(async move {
|
||||
inner
|
||||
.write_data_buffer(frame)
|
||||
.await
|
||||
@@ -227,10 +227,11 @@ impl AniMe {
|
||||
})
|
||||
.ok();
|
||||
}
|
||||
// A write can block for many milliseconds so lets not hold the config lock for
|
||||
// the same period
|
||||
let enabled = inner.config.lock().await.builtin_anims_enabled;
|
||||
inner
|
||||
.write_bytes(&pkt_set_enable_powersave_anim(
|
||||
inner.config.lock().await.builtin_anims_enabled
|
||||
))
|
||||
.write_bytes(&pkt_set_enable_powersave_anim(enabled))
|
||||
.await
|
||||
.map_err(|err| {
|
||||
warn!("rog_anime::run_animation:callback {}", err);
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
use std::sync::atomic::Ordering;
|
||||
|
||||
use config_traits::StdConfig;
|
||||
use log::{error, warn};
|
||||
use log::{debug, error, warn};
|
||||
use logind_zbus::manager::ManagerProxy;
|
||||
use rog_anime::usb::{
|
||||
pkt_set_brightness, pkt_set_builtin_animations, pkt_set_enable_display,
|
||||
@@ -51,8 +51,11 @@ impl AniMeZbus {
|
||||
.object_server()
|
||||
.at(path.clone(), self)
|
||||
.await
|
||||
.map_err(|e| error!("Couldn't add server at path: {path}, {e:?}"))
|
||||
.ok();
|
||||
.map_err(|e| {
|
||||
error!("Couldn't add server at path: {path}, {e:?}");
|
||||
e
|
||||
})?;
|
||||
debug!("start_tasks was successful");
|
||||
Ok(())
|
||||
}
|
||||
}
|
||||
@@ -440,50 +443,60 @@ impl crate::CtrlTask for AniMeZbus {
|
||||
|
||||
impl crate::Reloadable for AniMeZbus {
|
||||
async fn reload(&mut self) -> Result<(), RogError> {
|
||||
if let Ok(config) = self.0.config.try_lock() {
|
||||
let anim = &config.builtin_anims;
|
||||
// Set builtins
|
||||
if config.builtin_anims_enabled {
|
||||
self.0
|
||||
.write_bytes(&pkt_set_builtin_animations(
|
||||
anim.boot, anim.awake, anim.sleep, anim.shutdown
|
||||
))
|
||||
.await?;
|
||||
}
|
||||
// Builtins enabled or na?
|
||||
let AniMeConfig {
|
||||
builtin_anims_enabled,
|
||||
builtin_anims,
|
||||
display_enabled,
|
||||
display_brightness,
|
||||
off_when_lid_closed,
|
||||
off_when_unplugged,
|
||||
..
|
||||
} = *self.0.config.lock().await;
|
||||
|
||||
// Set builtins
|
||||
if builtin_anims_enabled {
|
||||
self.0
|
||||
.set_builtins_enabled(config.builtin_anims_enabled, config.display_brightness)
|
||||
.write_bytes(&pkt_set_builtin_animations(
|
||||
builtin_anims.boot,
|
||||
builtin_anims.awake,
|
||||
builtin_anims.sleep,
|
||||
builtin_anims.shutdown
|
||||
))
|
||||
.await?;
|
||||
}
|
||||
// Builtins enabled or na?
|
||||
self.0
|
||||
.set_builtins_enabled(builtin_anims_enabled, display_brightness)
|
||||
.await?;
|
||||
|
||||
let manager = get_logind_manager().await;
|
||||
let lid_closed = manager.lid_closed().await.unwrap_or_default();
|
||||
let power_plugged = manager.on_external_power().await.unwrap_or_default();
|
||||
let manager = get_logind_manager().await;
|
||||
let lid_closed = manager.lid_closed().await.unwrap_or_default();
|
||||
let power_plugged = manager.on_external_power().await.unwrap_or_default();
|
||||
|
||||
let turn_off = (lid_closed && config.off_when_lid_closed)
|
||||
|| (!power_plugged && config.off_when_unplugged);
|
||||
let turn_off =
|
||||
(lid_closed && off_when_lid_closed) || (!power_plugged && off_when_unplugged);
|
||||
self.0
|
||||
.write_bytes(&pkt_set_enable_display(!turn_off))
|
||||
.await
|
||||
.map_err(|err| {
|
||||
warn!("create_sys_event_tasks::reload {}", err);
|
||||
})
|
||||
.ok();
|
||||
|
||||
if turn_off || !display_enabled {
|
||||
self.0.write_bytes(&pkt_set_enable_display(false)).await?;
|
||||
// early return so we don't run animation thread
|
||||
return Ok(());
|
||||
}
|
||||
|
||||
if !builtin_anims_enabled && !self.0.cache.boot.is_empty() {
|
||||
self.0
|
||||
.write_bytes(&pkt_set_enable_display(!turn_off))
|
||||
.write_bytes(&pkt_set_enable_powersave_anim(false))
|
||||
.await
|
||||
.map_err(|err| {
|
||||
warn!("create_sys_event_tasks::reload {}", err);
|
||||
})
|
||||
.ok();
|
||||
|
||||
if turn_off || !config.display_enabled {
|
||||
self.0.write_bytes(&pkt_set_enable_display(false)).await?;
|
||||
// early return so we don't run animation thread
|
||||
return Ok(());
|
||||
}
|
||||
|
||||
if !config.builtin_anims_enabled && !self.0.cache.boot.is_empty() {
|
||||
self.0
|
||||
.write_bytes(&pkt_set_enable_powersave_anim(false))
|
||||
.await
|
||||
.ok();
|
||||
|
||||
let action = self.0.cache.boot.clone();
|
||||
self.0.run_thread(action, true).await;
|
||||
}
|
||||
let action = self.0.cache.boot.clone();
|
||||
self.0.run_thread(action, true).await;
|
||||
}
|
||||
Ok(())
|
||||
}
|
||||
|
||||
@@ -319,11 +319,17 @@ impl DeviceManager {
|
||||
if let DeviceHandle::AniMe(anime) = dev_type.clone() {
|
||||
let path = dbus_path_for_anime();
|
||||
let ctrl = AniMeZbus::new(anime);
|
||||
ctrl.start_tasks(connection, path.clone()).await.unwrap();
|
||||
devices.push(AsusDevice {
|
||||
device: dev_type,
|
||||
dbus_path: path
|
||||
});
|
||||
if ctrl
|
||||
.start_tasks(connection, path.clone())
|
||||
.await
|
||||
.map_err(|e| error!("Failed to start tasks: {e:?}, not adding this device"))
|
||||
.is_ok()
|
||||
{
|
||||
devices.push(AsusDevice {
|
||||
device: dev_type,
|
||||
dbus_path: path
|
||||
});
|
||||
}
|
||||
}
|
||||
} else {
|
||||
info!("Tested device was not AniMe Matrix");
|
||||
@@ -364,7 +370,9 @@ impl DeviceManager {
|
||||
|
||||
pub async fn new(connection: Connection) -> Result<Self, RogError> {
|
||||
let conn_copy = connection.clone();
|
||||
let devices = Arc::new(Mutex::new(Self::find_all_devices(&conn_copy).await));
|
||||
let devices = Self::find_all_devices(&conn_copy).await;
|
||||
info!("Found {} valid devices on startup", devices.len());
|
||||
let devices = Arc::new(Mutex::new(devices));
|
||||
let manager = Self {
|
||||
_dbus_connection: connection
|
||||
};
|
||||
@@ -372,8 +380,6 @@ impl DeviceManager {
|
||||
// TODO: The /sysfs/ LEDs don't cause events, so they need to be manually
|
||||
// checked for and added
|
||||
|
||||
// detect all plugged in aura devices (eventually)
|
||||
// only USB devices are detected for here
|
||||
std::thread::spawn(move || {
|
||||
let mut monitor = MonitorBuilder::new()?.listen()?;
|
||||
let mut poll = Poll::new()?;
|
||||
@@ -420,7 +426,10 @@ impl DeviceManager {
|
||||
{
|
||||
index
|
||||
} else {
|
||||
warn!("No device for dbus path: {path:?}");
|
||||
if dev_prop_matches(&event.device(), "ID_VENDOR_ID", "0b05")
|
||||
{
|
||||
warn!("No device for dbus path: {path:?}");
|
||||
}
|
||||
return Ok(());
|
||||
};
|
||||
info!("removing: {path:?}");
|
||||
|
||||
+20
-15
@@ -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> {
|
||||
|
||||
+93
-90
@@ -1,94 +1,87 @@
|
||||
use std::collections::HashMap;
|
||||
|
||||
use config_traits::{StdConfig, StdConfigLoad1};
|
||||
use rog_platform::asus_armoury::FirmwareAttribute;
|
||||
use rog_platform::cpu::CPUEPP;
|
||||
use rog_platform::platform::ThrottlePolicy;
|
||||
use rog_platform::platform::PlatformProfile;
|
||||
use serde::{Deserialize, Serialize};
|
||||
|
||||
const CONFIG_FILE: &str = "asusd.ron";
|
||||
|
||||
#[derive(Deserialize, Serialize, Debug, PartialEq, PartialOrd)]
|
||||
#[derive(Default, Clone, Deserialize, Serialize, PartialEq)]
|
||||
pub struct Tuning {
|
||||
pub enabled: bool,
|
||||
pub group: HashMap<FirmwareAttribute, i32>
|
||||
}
|
||||
type Tunings = HashMap<PlatformProfile, Tuning>;
|
||||
|
||||
#[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,
|
||||
/// An optional command/script to run when power is changed to battery
|
||||
pub bat_command: String,
|
||||
/// Set true if energy_performance_preference should be set if the
|
||||
/// throttle/platform profile is changed
|
||||
pub throttle_policy_linked_epp: bool,
|
||||
/// Which throttle/profile to use on battery power
|
||||
pub throttle_policy_on_battery: ThrottlePolicy,
|
||||
/// platform profile is changed
|
||||
pub platform_profile_linked_epp: bool,
|
||||
/// Which platform profile to use on battery power
|
||||
pub platform_profile_on_battery: PlatformProfile,
|
||||
/// Should the throttle policy be set on bat/ac change?
|
||||
pub change_throttle_policy_on_battery: bool,
|
||||
/// Which throttle/profile to use on AC power
|
||||
pub throttle_policy_on_ac: ThrottlePolicy,
|
||||
/// Should the throttle policy be set on bat/ac change?
|
||||
pub change_throttle_policy_on_ac: bool,
|
||||
/// The energy_performance_preference for this throttle/platform profile
|
||||
pub throttle_quiet_epp: CPUEPP,
|
||||
/// The energy_performance_preference for this throttle/platform profile
|
||||
pub throttle_balanced_epp: CPUEPP,
|
||||
/// The energy_performance_preference for this throttle/platform profile
|
||||
pub throttle_performance_epp: CPUEPP,
|
||||
/// Defaults to `None` if not supported
|
||||
#[serde(skip_serializing_if = "Option::is_none", default)]
|
||||
pub ppt_pl1_spl: Option<u8>,
|
||||
/// Defaults to `None` if not supported
|
||||
#[serde(skip_serializing_if = "Option::is_none", default)]
|
||||
pub ppt_pl2_sppt: Option<u8>,
|
||||
/// Defaults to `None` if not supported
|
||||
#[serde(skip_serializing_if = "Option::is_none", default)]
|
||||
pub ppt_fppt: Option<u8>,
|
||||
/// Defaults to `None` if not supported
|
||||
#[serde(skip_serializing_if = "Option::is_none", default)]
|
||||
pub ppt_apu_sppt: Option<u8>,
|
||||
/// Defaults to `None` if not supported
|
||||
#[serde(skip_serializing_if = "Option::is_none", default)]
|
||||
pub ppt_platform_sppt: Option<u8>,
|
||||
/// Defaults to `None` if not supported
|
||||
#[serde(skip_serializing_if = "Option::is_none", default)]
|
||||
pub nv_dynamic_boost: Option<u8>,
|
||||
/// Defaults to `None` if not supported
|
||||
#[serde(skip_serializing_if = "Option::is_none", default)]
|
||||
pub nv_temp_target: Option<u8>,
|
||||
pub change_platform_profile_on_battery: bool,
|
||||
/// Which platform profile to use on AC power
|
||||
pub platform_profile_on_ac: PlatformProfile,
|
||||
/// Should the platform profile be set on bat/ac change?
|
||||
pub change_platform_profile_on_ac: bool,
|
||||
/// The energy_performance_preference for this platform profile
|
||||
pub profile_quiet_epp: CPUEPP,
|
||||
/// The energy_performance_preference for this platform profile
|
||||
pub profile_balanced_epp: CPUEPP,
|
||||
/// The energy_performance_preference for this platform profile
|
||||
pub profile_performance_epp: CPUEPP,
|
||||
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: PlatformProfile) -> &mut Tuning {
|
||||
let config = if power_plugged {
|
||||
&mut self.ac_profile_tunings
|
||||
} else {
|
||||
&mut self.dc_profile_tunings
|
||||
};
|
||||
config.entry(profile).or_insert_with(Tuning::default)
|
||||
}
|
||||
}
|
||||
|
||||
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(),
|
||||
throttle_policy_linked_epp: true,
|
||||
throttle_policy_on_battery: ThrottlePolicy::Quiet,
|
||||
change_throttle_policy_on_battery: true,
|
||||
throttle_policy_on_ac: ThrottlePolicy::Performance,
|
||||
change_throttle_policy_on_ac: true,
|
||||
throttle_quiet_epp: CPUEPP::Power,
|
||||
throttle_balanced_epp: CPUEPP::BalancePower,
|
||||
throttle_performance_epp: CPUEPP::Performance,
|
||||
ppt_pl1_spl: Default::default(),
|
||||
ppt_pl2_sppt: Default::default(),
|
||||
ppt_fppt: Default::default(),
|
||||
ppt_apu_sppt: Default::default(),
|
||||
ppt_platform_sppt: Default::default(),
|
||||
nv_dynamic_boost: Default::default(),
|
||||
nv_temp_target: Default::default(),
|
||||
platform_profile_linked_epp: true,
|
||||
platform_profile_on_battery: PlatformProfile::Quiet,
|
||||
change_platform_profile_on_battery: true,
|
||||
platform_profile_on_ac: PlatformProfile::Performance,
|
||||
change_platform_profile_on_ac: true,
|
||||
profile_quiet_epp: CPUEPP::Power,
|
||||
profile_balanced_epp: CPUEPP::BalancePower,
|
||||
profile_performance_epp: CPUEPP::Performance,
|
||||
ac_profile_tunings: HashMap::default(),
|
||||
dc_profile_tunings: HashMap::default(),
|
||||
armoury_settings: HashMap::default(),
|
||||
last_power_plugged: Default::default()
|
||||
}
|
||||
}
|
||||
@@ -99,8 +92,8 @@ impl StdConfig for Config {
|
||||
Config {
|
||||
charge_control_end_threshold: 100,
|
||||
disable_nvidia_powerd_on_battery: true,
|
||||
throttle_policy_on_battery: ThrottlePolicy::Quiet,
|
||||
throttle_policy_on_ac: ThrottlePolicy::Performance,
|
||||
platform_profile_on_battery: PlatformProfile::Quiet,
|
||||
platform_profile_on_ac: PlatformProfile::Performance,
|
||||
ac_command: String::new(),
|
||||
bat_command: String::new(),
|
||||
..Default::default()
|
||||
@@ -116,58 +109,68 @@ impl StdConfig for Config {
|
||||
}
|
||||
}
|
||||
|
||||
impl StdConfigLoad1<Config507> for Config {}
|
||||
impl StdConfigLoad1<Config601> for Config {}
|
||||
|
||||
#[derive(Deserialize, Serialize)]
|
||||
pub struct Config507 {
|
||||
// The current charge limit applied
|
||||
pub struct Config601 {
|
||||
pub charge_control_end_threshold: u8,
|
||||
#[serde(skip)]
|
||||
pub base_charge_control_end_threshold: u8,
|
||||
pub panel_od: bool,
|
||||
pub boot_sound: bool,
|
||||
pub mini_led_mode: bool,
|
||||
pub disable_nvidia_powerd_on_battery: bool,
|
||||
pub ac_command: String,
|
||||
pub bat_command: String,
|
||||
pub platform_policy_linked_epp: bool,
|
||||
pub platform_policy_on_battery: ThrottlePolicy,
|
||||
pub platform_policy_on_ac: ThrottlePolicy,
|
||||
//
|
||||
pub platform_profile_linked_epp: bool,
|
||||
pub platform_profile_on_battery: PlatformProfile,
|
||||
pub change_platform_profile_on_battery: bool,
|
||||
pub platform_profile_on_ac: PlatformProfile,
|
||||
pub change_platform_profile_on_ac: bool,
|
||||
pub profile_quiet_epp: CPUEPP,
|
||||
pub profile_balanced_epp: CPUEPP,
|
||||
pub profile_performance_epp: CPUEPP,
|
||||
#[serde(skip_serializing_if = "Option::is_none", default)]
|
||||
pub ppt_pl1_spl: Option<u8>,
|
||||
#[serde(skip_serializing_if = "Option::is_none", default)]
|
||||
pub ppt_pl2_sppt: Option<u8>,
|
||||
#[serde(skip_serializing_if = "Option::is_none", default)]
|
||||
pub ppt_pl3_fppt: Option<u8>,
|
||||
#[serde(skip_serializing_if = "Option::is_none", default)]
|
||||
pub ppt_fppt: Option<u8>,
|
||||
#[serde(skip_serializing_if = "Option::is_none", default)]
|
||||
pub ppt_apu_sppt: Option<u8>,
|
||||
#[serde(skip_serializing_if = "Option::is_none", default)]
|
||||
pub ppt_platform_sppt: Option<u8>,
|
||||
#[serde(skip_serializing_if = "Option::is_none", default)]
|
||||
pub nv_dynamic_boost: Option<u8>,
|
||||
pub nv_temp_target: Option<u8>
|
||||
#[serde(skip_serializing_if = "Option::is_none", default)]
|
||||
pub nv_temp_target: Option<u8>,
|
||||
#[serde(skip)]
|
||||
pub last_power_plugged: u8
|
||||
}
|
||||
|
||||
impl From<Config507> for Config {
|
||||
fn from(c: Config507) -> Self {
|
||||
impl From<Config601> for Config {
|
||||
fn from(c: Config601) -> Self {
|
||||
Self {
|
||||
// Restore the base charge limit
|
||||
charge_control_end_threshold: c.charge_control_end_threshold,
|
||||
base_charge_control_end_threshold: c.charge_control_end_threshold,
|
||||
panel_od: c.panel_od,
|
||||
boot_sound: false,
|
||||
disable_nvidia_powerd_on_battery: c.disable_nvidia_powerd_on_battery,
|
||||
ac_command: c.ac_command,
|
||||
bat_command: c.bat_command,
|
||||
mini_led_mode: c.mini_led_mode,
|
||||
throttle_policy_linked_epp: true,
|
||||
throttle_policy_on_battery: c.platform_policy_on_battery,
|
||||
change_throttle_policy_on_battery: true,
|
||||
throttle_policy_on_ac: c.platform_policy_on_ac,
|
||||
change_throttle_policy_on_ac: true,
|
||||
throttle_quiet_epp: CPUEPP::Power,
|
||||
throttle_balanced_epp: CPUEPP::BalancePower,
|
||||
throttle_performance_epp: CPUEPP::Performance,
|
||||
ppt_pl1_spl: c.ppt_pl1_spl,
|
||||
ppt_pl2_sppt: c.ppt_pl2_sppt,
|
||||
ppt_fppt: c.ppt_fppt,
|
||||
ppt_apu_sppt: c.ppt_apu_sppt,
|
||||
ppt_platform_sppt: c.ppt_platform_sppt,
|
||||
nv_dynamic_boost: c.nv_dynamic_boost,
|
||||
nv_temp_target: c.nv_temp_target,
|
||||
last_power_plugged: 0
|
||||
platform_profile_linked_epp: c.platform_profile_linked_epp,
|
||||
platform_profile_on_battery: c.platform_profile_on_battery,
|
||||
change_platform_profile_on_battery: c.change_platform_profile_on_battery,
|
||||
platform_profile_on_ac: c.platform_profile_on_ac,
|
||||
change_platform_profile_on_ac: c.change_platform_profile_on_ac,
|
||||
profile_quiet_epp: c.profile_quiet_epp,
|
||||
profile_balanced_epp: c.profile_balanced_epp,
|
||||
profile_performance_epp: c.profile_performance_epp,
|
||||
last_power_plugged: c.last_power_plugged,
|
||||
ac_profile_tunings: HashMap::default(),
|
||||
dc_profile_tunings: HashMap::default(),
|
||||
armoury_settings: HashMap::default()
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
+36
-31
@@ -4,7 +4,7 @@ use std::sync::Arc;
|
||||
use config_traits::{StdConfig, StdConfigLoad};
|
||||
use futures_lite::StreamExt;
|
||||
use log::{debug, error, info, warn};
|
||||
use rog_platform::platform::{RogPlatform, ThrottlePolicy};
|
||||
use rog_platform::platform::{PlatformProfile, RogPlatform};
|
||||
use rog_profiles::error::ProfileError;
|
||||
use rog_profiles::fan_curve_set::CurveData;
|
||||
use rog_profiles::{find_fan_curve_node, FanCurvePU, FanCurveProfiles};
|
||||
@@ -23,7 +23,7 @@ pub const FAN_CURVE_ZBUS_PATH: &str = "/xyz/ljones";
|
||||
pub struct FanCurveConfig {
|
||||
pub profiles: FanCurveProfiles,
|
||||
#[serde(skip)]
|
||||
pub current: u8
|
||||
pub current: PlatformProfile
|
||||
}
|
||||
|
||||
impl StdConfig for FanCurveConfig {
|
||||
@@ -54,7 +54,7 @@ pub struct CtrlFanCurveZbus {
|
||||
impl CtrlFanCurveZbus {
|
||||
pub fn new() -> Result<Self, RogError> {
|
||||
let platform = RogPlatform::new()?;
|
||||
if platform.has_throttle_thermal_policy() {
|
||||
if platform.has_platform_profile() {
|
||||
info!("Device has profile control available");
|
||||
find_fan_curve_node()?;
|
||||
info!("Device has fan curves available");
|
||||
@@ -65,16 +65,16 @@ impl CtrlFanCurveZbus {
|
||||
if config.profiles.balanced.is_empty() || !config.file_path().exists() {
|
||||
info!("Fetching default fan curves");
|
||||
|
||||
let current = platform.get_throttle_thermal_policy()?;
|
||||
let current = platform.get_platform_profile()?;
|
||||
for this in [
|
||||
ThrottlePolicy::Balanced,
|
||||
ThrottlePolicy::Performance,
|
||||
ThrottlePolicy::Quiet
|
||||
PlatformProfile::Balanced,
|
||||
PlatformProfile::Performance,
|
||||
PlatformProfile::Quiet
|
||||
] {
|
||||
// For each profile we need to switch to it before we
|
||||
// can read the existing values from hardware. The ACPI method used
|
||||
// for this is what limits us.
|
||||
platform.set_throttle_thermal_policy(this.into())?;
|
||||
platform.set_platform_profile(this.into())?;
|
||||
let mut dev = find_fan_curve_node()?;
|
||||
fan_curves.set_active_curve_to_defaults(this, &mut dev)?;
|
||||
|
||||
@@ -83,7 +83,7 @@ impl CtrlFanCurveZbus {
|
||||
info!("{}", String::from(curve));
|
||||
}
|
||||
}
|
||||
platform.set_throttle_thermal_policy(current)?;
|
||||
platform.set_platform_profile(current.as_str())?;
|
||||
config.profiles = fan_curves;
|
||||
config.write();
|
||||
} else {
|
||||
@@ -107,7 +107,7 @@ impl CtrlFanCurveZbus {
|
||||
/// fan curve if in the same profile mode
|
||||
async fn set_fan_curves_enabled(
|
||||
&mut self,
|
||||
profile: ThrottlePolicy,
|
||||
profile: PlatformProfile,
|
||||
enabled: bool
|
||||
) -> zbus::fdo::Result<()> {
|
||||
self.config
|
||||
@@ -128,7 +128,7 @@ impl CtrlFanCurveZbus {
|
||||
/// activate a fan curve if in the same profile mode
|
||||
async fn set_profile_fan_curve_enabled(
|
||||
&mut self,
|
||||
profile: ThrottlePolicy,
|
||||
profile: PlatformProfile,
|
||||
fan: FanCurvePU,
|
||||
enabled: bool
|
||||
) -> zbus::fdo::Result<()> {
|
||||
@@ -149,7 +149,7 @@ impl CtrlFanCurveZbus {
|
||||
/// Get the fan-curve data for the currently active ThrottlePolicy
|
||||
async fn fan_curve_data(
|
||||
&mut self,
|
||||
profile: ThrottlePolicy
|
||||
profile: PlatformProfile
|
||||
) -> zbus::fdo::Result<Vec<CurveData>> {
|
||||
let curve = self
|
||||
.config
|
||||
@@ -165,7 +165,7 @@ impl CtrlFanCurveZbus {
|
||||
/// Will also activate the fan curve if the user is in the same mode.
|
||||
async fn set_fan_curve(
|
||||
&mut self,
|
||||
profile: ThrottlePolicy,
|
||||
profile: PlatformProfile,
|
||||
curve: CurveData
|
||||
) -> zbus::fdo::Result<()> {
|
||||
self.config
|
||||
@@ -173,7 +173,7 @@ impl CtrlFanCurveZbus {
|
||||
.await
|
||||
.profiles
|
||||
.save_fan_curve(curve, profile)?;
|
||||
let active: ThrottlePolicy = self.platform.get_throttle_thermal_policy()?.into();
|
||||
let active: PlatformProfile = self.platform.get_platform_profile()?.into();
|
||||
if active == profile {
|
||||
self.config
|
||||
.lock()
|
||||
@@ -190,15 +190,15 @@ impl CtrlFanCurveZbus {
|
||||
///
|
||||
/// Each platform_profile has a different default and the default can be
|
||||
/// read only for the currently active profile.
|
||||
async fn set_curves_to_defaults(&mut self, profile: ThrottlePolicy) -> zbus::fdo::Result<()> {
|
||||
let active = self.platform.get_throttle_thermal_policy()?;
|
||||
self.platform.set_throttle_thermal_policy(profile.into())?;
|
||||
async fn set_curves_to_defaults(&mut self, profile: PlatformProfile) -> zbus::fdo::Result<()> {
|
||||
let active = self.platform.get_platform_profile()?;
|
||||
self.platform.set_platform_profile(profile.into())?;
|
||||
self.config
|
||||
.lock()
|
||||
.await
|
||||
.profiles
|
||||
.set_active_curve_to_defaults(profile, &mut find_fan_curve_node()?)?;
|
||||
self.platform.set_throttle_thermal_policy(active)?;
|
||||
self.platform.set_platform_profile(active.as_str())?;
|
||||
self.config.lock().await.write();
|
||||
Ok(())
|
||||
}
|
||||
@@ -208,16 +208,16 @@ impl CtrlFanCurveZbus {
|
||||
///
|
||||
/// Each platform_profile has a different default and the defualt can be
|
||||
/// read only for the currently active profile.
|
||||
async fn reset_profile_curves(&self, profile: ThrottlePolicy) -> zbus::fdo::Result<()> {
|
||||
let active = self.platform.get_throttle_thermal_policy()?;
|
||||
async fn reset_profile_curves(&self, profile: PlatformProfile) -> zbus::fdo::Result<()> {
|
||||
let active = self.platform.get_platform_profile()?;
|
||||
|
||||
self.platform.set_throttle_thermal_policy(profile.into())?;
|
||||
self.platform.set_platform_profile(profile.into())?;
|
||||
self.config
|
||||
.lock()
|
||||
.await
|
||||
.profiles
|
||||
.set_active_curve_to_defaults(active.into(), &mut find_fan_curve_node()?)?;
|
||||
self.platform.set_throttle_thermal_policy(active)?;
|
||||
.set_active_curve_to_defaults((&active).into(), &mut find_fan_curve_node()?)?;
|
||||
self.platform.set_platform_profile(active.as_str())?;
|
||||
|
||||
self.config.lock().await.write();
|
||||
Ok(())
|
||||
@@ -236,26 +236,31 @@ impl CtrlTask for CtrlFanCurveZbus {
|
||||
}
|
||||
|
||||
async fn create_tasks(&self, _signal_ctxt: SignalEmitter<'static>) -> Result<(), RogError> {
|
||||
let watch_throttle_thermal_policy = self.platform.monitor_throttle_thermal_policy()?;
|
||||
let watch_platform_profile = self.platform.monitor_platform_profile()?;
|
||||
let platform = self.platform.clone();
|
||||
let config = self.config.clone();
|
||||
let fan_curves = self.config.clone();
|
||||
|
||||
tokio::spawn(async move {
|
||||
let mut buffer = [0; 32];
|
||||
if let Ok(mut stream) = watch_throttle_thermal_policy.into_event_stream(&mut buffer) {
|
||||
if let Ok(mut stream) = watch_platform_profile.into_event_stream(&mut buffer) {
|
||||
while (stream.next().await).is_some() {
|
||||
debug!("watch_throttle_thermal_policy changed");
|
||||
if let Ok(profile) = platform.get_throttle_thermal_policy().map_err(|e| {
|
||||
error!("get_throttle_thermal_policy error: {e}");
|
||||
}) {
|
||||
debug!("watch_platform_profile changed");
|
||||
if let Ok(profile) =
|
||||
platform
|
||||
.get_platform_profile()
|
||||
.map(|p| p.into())
|
||||
.map_err(|e| {
|
||||
error!("get_platform_profile error: {e}");
|
||||
})
|
||||
{
|
||||
if profile != config.lock().await.current {
|
||||
fan_curves
|
||||
.lock()
|
||||
.await
|
||||
.profiles
|
||||
.write_profile_curve_to_platform(
|
||||
profile.into(),
|
||||
profile,
|
||||
&mut find_fan_curve_node().unwrap()
|
||||
)
|
||||
.map_err(|e| warn!("write_profile_curve_to_platform, {}", e))
|
||||
@@ -274,7 +279,7 @@ impl CtrlTask for CtrlFanCurveZbus {
|
||||
impl crate::Reloadable for CtrlFanCurveZbus {
|
||||
/// Fetch the active profile and use that to set all related components up
|
||||
async fn reload(&mut self) -> Result<(), RogError> {
|
||||
let active = self.platform.get_throttle_thermal_policy()?.into();
|
||||
let active = self.platform.get_platform_profile()?.into();
|
||||
let mut config = self.config.lock().await;
|
||||
if let Ok(mut device) = find_fan_curve_node() {
|
||||
config
|
||||
|
||||
+241
-481
File diff suppressed because it is too large
Load Diff
+18
-1
@@ -12,6 +12,9 @@ use asusd::ctrl_platform::CtrlPlatform;
|
||||
use asusd::{print_board_info, start_tasks, CtrlTask, DBUS_NAME};
|
||||
use config_traits::{StdConfig, StdConfigLoad1};
|
||||
use log::{error, info};
|
||||
use rog_platform::asus_armoury::FirmwareAttributes;
|
||||
use rog_platform::platform::RogPlatform;
|
||||
use rog_platform::power::AsusPower;
|
||||
use zbus::fdo::ObjectManager;
|
||||
|
||||
#[tokio::main]
|
||||
@@ -65,7 +68,17 @@ async fn start_daemon() -> Result<(), Box<dyn Error>> {
|
||||
let config = Arc::new(Mutex::new(config));
|
||||
|
||||
// supported.add_to_server(&mut connection).await;
|
||||
start_attributes_zbus(&server).await?;
|
||||
let platform = RogPlatform::new()?; // TODO: maybe needs async mutex?
|
||||
let power = AsusPower::new()?; // TODO: maybe needs async mutex?
|
||||
let attributes = FirmwareAttributes::new();
|
||||
start_attributes_zbus(
|
||||
&server,
|
||||
platform.clone(),
|
||||
power.clone(),
|
||||
attributes.clone(),
|
||||
config.clone()
|
||||
)
|
||||
.await?;
|
||||
|
||||
match CtrlFanCurveZbus::new() {
|
||||
Ok(ctrl) => {
|
||||
@@ -78,6 +91,9 @@ async fn start_daemon() -> Result<(), Box<dyn Error>> {
|
||||
}
|
||||
|
||||
match CtrlPlatform::new(
|
||||
platform,
|
||||
power,
|
||||
attributes,
|
||||
config.clone(),
|
||||
&cfg_path,
|
||||
CtrlPlatform::signal_context(&server)?
|
||||
@@ -96,6 +112,7 @@ async fn start_daemon() -> Result<(), Box<dyn Error>> {
|
||||
// Request dbus name after finishing initalizing all functions
|
||||
server.request_name(DBUS_NAME).await?;
|
||||
|
||||
info!("Startup success, begining dbus server loop");
|
||||
loop {
|
||||
// This is just a blocker to idle and ensure the reator reacts
|
||||
server.executor().tick().await;
|
||||
|
||||
@@ -203,7 +203,7 @@ macro_rules! std_config_load {
|
||||
/// new one created
|
||||
pub trait $trait_name<$($generic),*>
|
||||
where
|
||||
Self: $crate::StdConfig +std::fmt::Debug + DeserializeOwned + Serialize,
|
||||
Self: $crate::StdConfig + DeserializeOwned + Serialize,
|
||||
$($generic: DeserializeOwned + Into<Self>),*
|
||||
{
|
||||
fn load(mut self) -> Self {
|
||||
|
||||
+2
-1
@@ -6,7 +6,7 @@ After=nvidia-powerd.service systemd-udevd.service
|
||||
|
||||
[Service]
|
||||
Environment=IS_SERVICE=1
|
||||
Environment=RUST_LOG="info"
|
||||
Environment=RUST_LOG="debug"
|
||||
# required to prevent init issues with hid_asus and MCU
|
||||
ExecStartPre=/bin/sleep 1
|
||||
ExecStart=/usr/bin/asusd
|
||||
@@ -16,3 +16,4 @@ Type=dbus
|
||||
BusName=xyz.ljones.Asusd
|
||||
SELinuxContext=system_u:system_r:unconfined_t:s0
|
||||
#SELinuxContext=system_u:object_r:modules_object_t:s0
|
||||
TimeoutSec=10
|
||||
|
||||
@@ -35,6 +35,15 @@
|
||||
advanced_type: None,
|
||||
power_zones: [Keyboard],
|
||||
),
|
||||
(
|
||||
device_name: "FA617NS",
|
||||
product_id: "",
|
||||
layout_name: "fa617ns",
|
||||
basic_modes: [Static, Breathe, Pulse],
|
||||
basic_zones: [],
|
||||
advanced_type: None,
|
||||
power_zones: [Keyboard],
|
||||
),
|
||||
(
|
||||
device_name: "FX505",
|
||||
product_id: "",
|
||||
@@ -80,6 +89,15 @@
|
||||
advanced_type: None,
|
||||
power_zones: [Keyboard],
|
||||
),
|
||||
(
|
||||
device_name: "FX617X",
|
||||
product_id: "",
|
||||
layout_name: "fa506i",
|
||||
basic_modes: [Static, Breathe, Pulse],
|
||||
basic_zones: [],
|
||||
advanced_type: None,
|
||||
power_zones: [Keyboard],
|
||||
),
|
||||
(
|
||||
device_name: "FX705D",
|
||||
product_id: "",
|
||||
@@ -139,7 +157,7 @@
|
||||
product_id: "",
|
||||
layout_name: "g513i",
|
||||
basic_modes: [Static, Breathe, RainbowCycle, RainbowWave, Pulse],
|
||||
basic_zones: [],
|
||||
basic_zones: [Key1, Key2, Key3, Key4],
|
||||
advanced_type: Zoned([ZonedKbLeft, ZonedKbLeftMid, ZonedKbRightMid, ZonedKbRight, LightbarRight, LightbarRightCorner, LightbarRightBottom, LightbarLeftBottom, LightbarLeftCorner, LightbarLeft]),
|
||||
power_zones: [Keyboard, Lightbar],
|
||||
),
|
||||
@@ -665,15 +683,6 @@
|
||||
advanced_type: Zoned([SingleZone]),
|
||||
power_zones: [Keyboard],
|
||||
),
|
||||
(
|
||||
device_name: "GA605W",
|
||||
product_id: "",
|
||||
layout_name: "ga401q",
|
||||
basic_modes: [Static, Breathe, RainbowCycle, RainbowWave, Pulse],
|
||||
basic_zones: [],
|
||||
advanced_type: Zoned([SingleZone]),
|
||||
power_zones: [Keyboard],
|
||||
),
|
||||
(
|
||||
device_name: "GV301Q",
|
||||
product_id: "",
|
||||
|
||||
@@ -5,7 +5,6 @@ use slint_build::CompilerConfiguration;
|
||||
|
||||
fn main() {
|
||||
// write_locales();
|
||||
|
||||
let root = env!("CARGO_MANIFEST_DIR");
|
||||
let mut main = PathBuf::from_str(root).unwrap();
|
||||
main.push("ui/main_window.slint");
|
||||
@@ -14,13 +13,12 @@ fn main() {
|
||||
include.push("ui");
|
||||
|
||||
slint_build::print_rustc_flags().unwrap();
|
||||
// slint_build::compile("ui/main_window.slint").unwrap();
|
||||
slint_build::compile_with_config(
|
||||
main,
|
||||
CompilerConfiguration::new()
|
||||
// .embed_resources(EmbedResourcesKind::EmbedFiles)
|
||||
.with_include_paths(vec![include])
|
||||
.with_style("fluent-dark".into())
|
||||
.with_style("fluent".into())
|
||||
)
|
||||
.unwrap();
|
||||
}
|
||||
|
||||
@@ -1,7 +1,6 @@
|
||||
[Desktop Entry]
|
||||
Version=1.0
|
||||
Type=Application
|
||||
|
||||
Name=ROG Control Center
|
||||
Comment=Make your ASUS ROG Laptop go Brrrrr!
|
||||
Categories=Settings
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
use std::env::args;
|
||||
use std::env::{self, args};
|
||||
use std::path::{Path, PathBuf};
|
||||
use std::process::exit;
|
||||
use std::sync::{Arc, Mutex};
|
||||
@@ -32,6 +32,12 @@ async fn main() -> Result<()> {
|
||||
.format_timestamp(None)
|
||||
.init();
|
||||
|
||||
// If we're running under gamescope we have to set WAYLAND_DISPLAY for winit to
|
||||
// use
|
||||
if let Ok(gamescope) = env::var("GAMESCOPE_WAYLAND_DISPLAY") {
|
||||
env::set_var("WAYLAND_DISPLAY", gamescope);
|
||||
}
|
||||
|
||||
// Try to open a proxy and check for app state first
|
||||
{
|
||||
let user_con = zbus::blocking::Connection::session()?;
|
||||
@@ -49,7 +55,12 @@ async fn main() -> Result<()> {
|
||||
let self_version = env!("CARGO_PKG_VERSION");
|
||||
let zbus_con = zbus::blocking::Connection::system()?;
|
||||
let platform_proxy = rog_dbus::zbus_platform::PlatformProxyBlocking::new(&zbus_con)?;
|
||||
let asusd_version = platform_proxy.version().unwrap();
|
||||
let asusd_version = platform_proxy
|
||||
.version()
|
||||
.map_err(|e| {
|
||||
println!("Could not get asusd version: {e:?}\nIs asusd.service running?");
|
||||
})
|
||||
.unwrap();
|
||||
if asusd_version != self_version {
|
||||
println!("Version mismatch: asusctl = {self_version}, asusd = {asusd_version}");
|
||||
return Ok(());
|
||||
@@ -79,7 +90,7 @@ async fn main() -> Result<()> {
|
||||
let board_name = dmi.board_name;
|
||||
let prod_family = dmi.product_family;
|
||||
info!("Running on {board_name}, product: {prod_family}");
|
||||
let is_rog_ally = prod_family == "RC71L";
|
||||
let is_rog_ally = prod_family == "RC71L" || prod_family == "RC72L";
|
||||
|
||||
let args: Vec<String> = args().skip(1).collect();
|
||||
|
||||
@@ -115,7 +126,9 @@ async fn main() -> Result<()> {
|
||||
config.enable_tray_icon = false;
|
||||
config.run_in_background = false;
|
||||
config.startup_in_background = false;
|
||||
config.start_fullscreen = true;
|
||||
}
|
||||
config.write();
|
||||
|
||||
let enable_tray_icon = config.enable_tray_icon;
|
||||
let startup_in_background = config.startup_in_background;
|
||||
@@ -131,8 +144,8 @@ async fn main() -> Result<()> {
|
||||
// i_slint_backend_selector::with_platform(|_| Ok(())).unwrap();
|
||||
|
||||
if !startup_in_background {
|
||||
if let Ok(mut lock) = app_state.lock() {
|
||||
*lock = AppState::MainWindowShouldOpen;
|
||||
if let Ok(mut app_state) = app_state.lock() {
|
||||
*app_state = AppState::MainWindowShouldOpen;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -149,15 +162,15 @@ async fn main() -> Result<()> {
|
||||
let mut state = AppState::StartingUp;
|
||||
loop {
|
||||
// save as a var, don't hold the lock the entire time or deadlocks happen
|
||||
if let Ok(lock) = app_state.lock() {
|
||||
state = *lock;
|
||||
if let Ok(app_state) = app_state.lock() {
|
||||
state = *app_state;
|
||||
}
|
||||
|
||||
// This sleep is required to give the event loop time to react
|
||||
sleep(Duration::from_millis(300));
|
||||
if state == AppState::MainWindowShouldOpen {
|
||||
if let Ok(mut lock) = app_state.lock() {
|
||||
*lock = AppState::MainWindowOpen;
|
||||
if let Ok(mut app_state) = app_state.lock() {
|
||||
*app_state = AppState::MainWindowOpen;
|
||||
}
|
||||
|
||||
let config_copy = config.clone();
|
||||
@@ -169,20 +182,39 @@ async fn main() -> Result<()> {
|
||||
if let Some(ui) = ui.as_mut() {
|
||||
ui.window().show().unwrap();
|
||||
ui.window().on_close_requested(move || {
|
||||
if let Ok(mut lock) = app_state_copy.lock() {
|
||||
*lock = AppState::MainWindowClosed;
|
||||
if let Ok(mut app_state) = app_state_copy.lock() {
|
||||
*app_state = AppState::MainWindowClosed;
|
||||
}
|
||||
slint::CloseRequestResponse::HideWindow
|
||||
});
|
||||
} else {
|
||||
let config_copy_2 = config_copy.clone();
|
||||
let newui = setup_window(config_copy);
|
||||
newui.window().show().unwrap();
|
||||
newui.window().on_close_requested(move || {
|
||||
if let Ok(mut lock) = app_state_copy.lock() {
|
||||
*lock = AppState::MainWindowClosed;
|
||||
if let Ok(mut app_state) = app_state_copy.lock() {
|
||||
*app_state = AppState::MainWindowClosed;
|
||||
}
|
||||
slint::CloseRequestResponse::HideWindow
|
||||
});
|
||||
|
||||
let ui_copy = newui.as_weak();
|
||||
newui
|
||||
.window()
|
||||
.set_rendering_notifier(move |s, _| {
|
||||
if let slint::RenderingState::RenderingSetup = s {
|
||||
let config = config_copy_2.clone();
|
||||
ui_copy
|
||||
.upgrade_in_event_loop(move |w| {
|
||||
let fullscreen =
|
||||
config.lock().is_ok_and(|c| c.start_fullscreen);
|
||||
if fullscreen && !w.window().is_fullscreen() {
|
||||
w.window().set_fullscreen(fullscreen);
|
||||
}
|
||||
})
|
||||
.ok();
|
||||
}
|
||||
})
|
||||
.ok();
|
||||
ui.replace(newui);
|
||||
}
|
||||
});
|
||||
@@ -192,8 +224,8 @@ async fn main() -> Result<()> {
|
||||
slint::quit_event_loop().unwrap();
|
||||
exit(0);
|
||||
} else if state != AppState::MainWindowOpen {
|
||||
if let Ok(lock) = config.lock() {
|
||||
if !lock.run_in_background {
|
||||
if let Ok(config) = config.lock() {
|
||||
if !config.run_in_background {
|
||||
slint::quit_event_loop().unwrap();
|
||||
exit(0);
|
||||
}
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -127,7 +127,6 @@ async fn set_tray_icon_and_tip(
|
||||
};
|
||||
|
||||
tray.update(|tray: &mut AsusTray| {
|
||||
dbg!(power);
|
||||
tray.current_icon = icon;
|
||||
tray.current_title = format!(
|
||||
"ROG: gpu mode = {mode:?}, gpu power =
|
||||
@@ -160,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"));
|
||||
@@ -207,7 +208,15 @@ pub fn init_tray(_supported_properties: Vec<Properties>, config: Arc<Mutex<Confi
|
||||
}
|
||||
}
|
||||
}
|
||||
Err(e) => warn!("Couldn't get mode form supergfxd: {e:?}")
|
||||
Err(e) => match e {
|
||||
zbus::Error::MethodError(_, _, message) => {
|
||||
warn!(
|
||||
"Couldn't get mode from supergfxd: {message:?}, the supergfxd service \
|
||||
may not be running or installed"
|
||||
)
|
||||
}
|
||||
_ => warn!("Couldn't get mode from supergfxd: {e:?}")
|
||||
}
|
||||
}
|
||||
|
||||
info!("Started ROGTray");
|
||||
|
||||
@@ -1,24 +1,24 @@
|
||||
use rog_platform::platform::ThrottlePolicy;
|
||||
use rog_platform::platform::PlatformProfile;
|
||||
use rog_profiles::FanCurvePU;
|
||||
|
||||
use crate::{FanType, Profile};
|
||||
|
||||
impl From<Profile> for ThrottlePolicy {
|
||||
impl From<Profile> for PlatformProfile {
|
||||
fn from(value: Profile) -> Self {
|
||||
match value {
|
||||
Profile::Balanced => ThrottlePolicy::Balanced,
|
||||
Profile::Performance => ThrottlePolicy::Performance,
|
||||
Profile::Quiet => ThrottlePolicy::Quiet
|
||||
Profile::Balanced => PlatformProfile::Balanced,
|
||||
Profile::Performance => PlatformProfile::Performance,
|
||||
Profile::Quiet => PlatformProfile::Quiet
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
impl From<ThrottlePolicy> for Profile {
|
||||
fn from(value: ThrottlePolicy) -> Self {
|
||||
impl From<PlatformProfile> for Profile {
|
||||
fn from(value: PlatformProfile) -> Self {
|
||||
match value {
|
||||
ThrottlePolicy::Balanced => Profile::Balanced,
|
||||
ThrottlePolicy::Performance => Profile::Performance,
|
||||
ThrottlePolicy::Quiet => Profile::Quiet
|
||||
PlatformProfile::Balanced => Profile::Balanced,
|
||||
PlatformProfile::Performance => Profile::Performance,
|
||||
PlatformProfile::Quiet => Profile::Quiet
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -6,8 +6,9 @@ pub mod setup_system;
|
||||
use std::sync::{Arc, Mutex};
|
||||
|
||||
use config_traits::StdConfig;
|
||||
use log::warn;
|
||||
use rog_dbus::list_iface_blocking;
|
||||
use slint::{ComponentHandle, PhysicalSize, SharedString, Weak};
|
||||
use slint::{ComponentHandle, SharedString, Weak};
|
||||
|
||||
use crate::config::Config;
|
||||
use crate::ui::setup_anime::setup_anime_page;
|
||||
@@ -26,7 +27,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();
|
||||
@@ -82,16 +83,11 @@ pub fn show_toast(
|
||||
}
|
||||
|
||||
pub fn setup_window(config: Arc<Mutex<Config>>) -> MainWindow {
|
||||
slint::set_xdg_app_id("rog-control-center")
|
||||
.map_err(|e| warn!("Couldn't set application ID: {e:?}"))
|
||||
.ok();
|
||||
let ui = MainWindow::new().unwrap();
|
||||
if let Ok(lock) = config.try_lock() {
|
||||
let fullscreen = lock.start_fullscreen;
|
||||
let width = lock.fullscreen_width;
|
||||
let height = lock.fullscreen_height;
|
||||
if fullscreen {
|
||||
ui.window().set_fullscreen(fullscreen);
|
||||
ui.window().set_size(PhysicalSize { width, height });
|
||||
}
|
||||
};
|
||||
ui.window().show().unwrap();
|
||||
|
||||
let available = list_iface_blocking().unwrap_or_default();
|
||||
ui.set_sidebar_items_avilable(
|
||||
@@ -125,6 +121,7 @@ pub fn setup_window(config: Arc<Mutex<Config>>) -> MainWindow {
|
||||
if available.contains(&"xyz.ljones.FanCurves".to_string()) {
|
||||
setup_fan_curve_page(&ui, config);
|
||||
}
|
||||
|
||||
ui
|
||||
}
|
||||
|
||||
|
||||
@@ -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();
|
||||
|
||||
@@ -2,7 +2,7 @@ use std::sync::{Arc, Mutex};
|
||||
|
||||
use log::{error, info};
|
||||
use rog_dbus::zbus_fan_curves::FanCurvesProxy;
|
||||
use rog_platform::platform::ThrottlePolicy;
|
||||
use rog_platform::platform::PlatformProfile;
|
||||
use rog_profiles::fan_curve_set::CurveData;
|
||||
use slint::{ComponentHandle, Model, Weak};
|
||||
|
||||
@@ -109,21 +109,21 @@ pub fn setup_fan_curve_page(ui: &MainWindow, _config: Arc<Mutex<Config>>) {
|
||||
let handle_copy = handle.clone();
|
||||
// Do initial setup
|
||||
let Ok(balanced) = fans
|
||||
.fan_curve_data(ThrottlePolicy::Balanced)
|
||||
.fan_curve_data(PlatformProfile::Balanced)
|
||||
.await
|
||||
.map_err(|e| error!("{e:}"))
|
||||
else {
|
||||
return;
|
||||
};
|
||||
let Ok(perf) = fans
|
||||
.fan_curve_data(ThrottlePolicy::Performance)
|
||||
.fan_curve_data(PlatformProfile::Performance)
|
||||
.await
|
||||
.map_err(|e| error!("{e:}"))
|
||||
else {
|
||||
return;
|
||||
};
|
||||
let Ok(quiet) = fans
|
||||
.fan_curve_data(ThrottlePolicy::Quiet)
|
||||
.fan_curve_data(PlatformProfile::Quiet)
|
||||
.await
|
||||
.map_err(|e| error!("{e:}"))
|
||||
else {
|
||||
@@ -144,21 +144,21 @@ pub fn setup_fan_curve_page(ui: &MainWindow, _config: Arc<Mutex<Config>>) {
|
||||
return;
|
||||
}
|
||||
let Ok(balanced) = fans
|
||||
.fan_curve_data(ThrottlePolicy::Balanced)
|
||||
.fan_curve_data(PlatformProfile::Balanced)
|
||||
.await
|
||||
.map_err(|e| error!("{e:}"))
|
||||
else {
|
||||
return;
|
||||
};
|
||||
let Ok(perf) = fans
|
||||
.fan_curve_data(ThrottlePolicy::Performance)
|
||||
.fan_curve_data(PlatformProfile::Performance)
|
||||
.await
|
||||
.map_err(|e| error!("{e:}"))
|
||||
else {
|
||||
return;
|
||||
};
|
||||
let Ok(quiet) = fans
|
||||
.fan_curve_data(ThrottlePolicy::Quiet)
|
||||
.fan_curve_data(PlatformProfile::Quiet)
|
||||
.await
|
||||
.map_err(|e| error!("{e:}"))
|
||||
else {
|
||||
|
||||
@@ -1,39 +1,40 @@
|
||||
use std::sync::{Arc, Mutex};
|
||||
|
||||
use concat_idents::concat_idents;
|
||||
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,
|
||||
max: 0,
|
||||
val: -1.0
|
||||
current: -1.0
|
||||
};
|
||||
|
||||
pub fn setup_system_page(ui: &MainWindow, _config: Arc<Mutex<Config>>) {
|
||||
let conn = zbus::blocking::Connection::system().unwrap();
|
||||
let platform = PlatformProxyBlocking::new(&conn).unwrap();
|
||||
let platform = PlatformProxyBlocking::builder(&conn).build().unwrap();
|
||||
// let armoury_attrs =
|
||||
// find_iface::<AsusArmouryProxyBlocking>("xyz.ljones.AsusArmoury").unwrap();
|
||||
|
||||
// Null everything before the setup step
|
||||
ui.global::<SystemPageData>()
|
||||
.set_charge_control_end_threshold(-1.0);
|
||||
ui.global::<SystemPageData>()
|
||||
.set_throttle_thermal_policy(-1);
|
||||
ui.global::<SystemPageData>().set_platform_profile(-1);
|
||||
ui.global::<SystemPageData>().set_panel_overdrive(-1);
|
||||
ui.global::<SystemPageData>().set_boot_sound(-1);
|
||||
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);
|
||||
@@ -92,13 +93,13 @@ macro_rules! init_minmax_property {
|
||||
tokio::spawn(async move {
|
||||
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;
|
||||
let current = 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 });
|
||||
.setter(AttrMinMax { min, max, current });
|
||||
});
|
||||
})
|
||||
.ok();
|
||||
@@ -130,6 +131,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
|
||||
@@ -141,7 +159,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
|
||||
@@ -157,27 +174,62 @@ macro_rules! setup_external {
|
||||
}
|
||||
|
||||
// For handling external value changes
|
||||
macro_rules! setup_minmax_external {
|
||||
($property:ident, $handle:expr, $attr:expr) => {
|
||||
macro_rules! setup_value_watch {
|
||||
($property:ident, $handle:expr, $proxy:expr, $value_type:ident $($conv: tt)*) => {
|
||||
let handle_copy = $handle.as_weak();
|
||||
let proxy_copy = $attr.clone();
|
||||
let proxy_copy = $proxy.clone();
|
||||
tokio::spawn(async move {
|
||||
let mut x = proxy_copy.receive_current_value_changed().await;
|
||||
let mut x = concat_idents!(recv = receive_, $value_type, _value_changed {
|
||||
proxy_copy.recv().await
|
||||
});
|
||||
use zbus::export::futures_util::StreamExt;
|
||||
while let Some(e) = x.next().await {
|
||||
if let Ok(out) = e.get().await {
|
||||
concat_idents!(getter = get_, $property {
|
||||
handle_copy
|
||||
.upgrade_in_event_loop(move |handle| {
|
||||
let mut tmp: AttrMinMax =
|
||||
handle.global::<SystemPageData>().getter();
|
||||
tmp.$value_type = out $($conv)*;
|
||||
concat_idents!(setter = set_, $property {
|
||||
handle.global::<SystemPageData>().setter(tmp);
|
||||
});
|
||||
})
|
||||
.ok();
|
||||
});
|
||||
}
|
||||
}
|
||||
});
|
||||
};
|
||||
}
|
||||
|
||||
macro_rules! setup_minmax_external {
|
||||
($property:ident, $handle:expr, $attr:expr, $platform:expr) => {
|
||||
setup_value_watch!($property, $handle, $attr, current as f32);
|
||||
setup_value_watch!($property, $handle, $attr, min);
|
||||
setup_value_watch!($property, $handle, $attr, max);
|
||||
|
||||
let handle_copy = $handle.as_weak();
|
||||
let proxy_copy = $attr.clone();
|
||||
let platform_proxy_copy = $platform.clone();
|
||||
tokio::spawn(async move {
|
||||
let mut x = platform_proxy_copy.receive_platform_profile_changed().await;
|
||||
use zbus::export::futures_util::StreamExt;
|
||||
while let Some(e) = x.next().await {
|
||||
if let Ok(_) = e.get().await {
|
||||
debug!("receive_platform_profile_changed, getting new {}", stringify!(attr));
|
||||
let min = proxy_copy.min_value().await.unwrap();
|
||||
let max = proxy_copy.max_value().await.unwrap();
|
||||
let current = proxy_copy.current_value().await.unwrap() as f32;
|
||||
handle_copy
|
||||
.upgrade_in_event_loop(move |handle| {
|
||||
let mut tmp: AttrMinMax =
|
||||
handle.global::<SystemPageData>().getter();
|
||||
tmp.val = out as f32;
|
||||
concat_idents!(setter = set_, $property {
|
||||
handle.global::<SystemPageData>().setter(tmp);
|
||||
handle
|
||||
.global::<SystemPageData>()
|
||||
.setter(AttrMinMax { min, max, current });
|
||||
});
|
||||
})
|
||||
.ok();
|
||||
});
|
||||
}
|
||||
}
|
||||
});
|
||||
@@ -207,10 +259,7 @@ pub fn setup_system_page_callbacks(ui: &MainWindow, _states: Arc<Mutex<Config>>)
|
||||
tokio::spawn(async move {
|
||||
// Create the connections/proxies here to prevent future delays in process
|
||||
let conn = zbus::Connection::system().await.unwrap();
|
||||
let platform = PlatformProxy::new(&conn).await.unwrap();
|
||||
let armoury_attrs = find_iface_async::<AsusArmouryProxy>("xyz.ljones.AsusArmoury")
|
||||
.await
|
||||
.unwrap();
|
||||
let platform = PlatformProxy::builder(&conn).build().await.unwrap();
|
||||
|
||||
set_ui_props_async!(
|
||||
handle,
|
||||
@@ -218,30 +267,134 @@ 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_policy_linked_epp);
|
||||
set_ui_props_async!(handle, platform, SystemPageData, throttle_balanced_epp);
|
||||
set_ui_props_async!(handle, platform, SystemPageData, throttle_performance_epp);
|
||||
set_ui_props_async!(handle, platform, SystemPageData, throttle_quiet_epp);
|
||||
set_ui_props_async!(handle, platform, SystemPageData, throttle_policy_on_battery);
|
||||
set_ui_props_async!(handle, platform, SystemPageData, platform_profile);
|
||||
set_ui_props_async!(
|
||||
handle,
|
||||
platform,
|
||||
SystemPageData,
|
||||
change_throttle_policy_on_battery
|
||||
platform_profile_linked_epp
|
||||
);
|
||||
set_ui_props_async!(handle, platform, SystemPageData, throttle_policy_on_ac);
|
||||
set_ui_props_async!(handle, platform, SystemPageData, profile_balanced_epp);
|
||||
set_ui_props_async!(handle, platform, SystemPageData, profile_performance_epp);
|
||||
set_ui_props_async!(handle, platform, SystemPageData, profile_quiet_epp);
|
||||
set_ui_props_async!(
|
||||
handle,
|
||||
platform,
|
||||
SystemPageData,
|
||||
change_throttle_policy_on_ac
|
||||
platform_profile_on_battery
|
||||
);
|
||||
set_ui_props_async!(
|
||||
handle,
|
||||
platform,
|
||||
SystemPageData,
|
||||
change_platform_profile_on_battery
|
||||
);
|
||||
set_ui_props_async!(handle, platform, SystemPageData, platform_profile_on_ac);
|
||||
set_ui_props_async!(
|
||||
handle,
|
||||
platform,
|
||||
SystemPageData,
|
||||
change_platform_profile_on_ac
|
||||
);
|
||||
|
||||
set_ui_props_async!(handle, platform, SystemPageData, enable_ppt_group);
|
||||
|
||||
let platform_copy = platform.clone();
|
||||
handle
|
||||
.upgrade_in_event_loop(move |handle| {
|
||||
set_ui_callbacks!(handle,
|
||||
SystemPageData(as bool),
|
||||
platform_copy.enable_ppt_group(as bool),
|
||||
"Applied PPT group settings {}",
|
||||
"Setting PPT group settings failed"
|
||||
);
|
||||
|
||||
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.platform_profile(.into()),
|
||||
"Throttle policy set to {}",
|
||||
"Setting Throttle policy failed"
|
||||
);
|
||||
set_ui_callbacks!(handle,
|
||||
SystemPageData(as i32),
|
||||
platform_copy.profile_balanced_epp(.into()),
|
||||
"Throttle policy EPP set to {}",
|
||||
"Setting Throttle policy EPP failed"
|
||||
);
|
||||
set_ui_callbacks!(handle,
|
||||
SystemPageData(as i32),
|
||||
platform_copy.profile_performance_epp(.into()),
|
||||
"Throttle policy EPP set to {}",
|
||||
"Setting Throttle policy EPP failed"
|
||||
);
|
||||
set_ui_callbacks!(handle,
|
||||
SystemPageData(as i32),
|
||||
platform_copy.profile_quiet_epp(.into()),
|
||||
"Throttle policy EPP set to {}",
|
||||
"Setting Throttle policy EPP failed"
|
||||
);
|
||||
set_ui_callbacks!(
|
||||
handle,
|
||||
SystemPageData(),
|
||||
platform_copy.platform_profile_linked_epp(),
|
||||
"Throttle policy linked to EPP: {}",
|
||||
"Setting Throttle policy linked to EPP failed"
|
||||
);
|
||||
set_ui_callbacks!(handle,
|
||||
SystemPageData(as i32),
|
||||
platform_copy.platform_profile_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_platform_profile_on_ac(.into()),
|
||||
"Throttle policy on AC enabled: {}",
|
||||
"Setting Throttle policy on AC failed"
|
||||
);
|
||||
set_ui_callbacks!(handle,
|
||||
SystemPageData(as i32),
|
||||
platform_copy.platform_profile_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_platform_profile_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;
|
||||
handle
|
||||
.upgrade_in_event_loop(|ui| {
|
||||
ui.global::<SystemPageData>().set_asus_armoury_loaded(true)
|
||||
})
|
||||
.ok();
|
||||
} else {
|
||||
error!(
|
||||
"The kernel module asus-armoury is required, if you do not have this you will \
|
||||
need to either build or install a kernel which includes the patchwork. This \
|
||||
driver is in process of being upstreamed"
|
||||
);
|
||||
return;
|
||||
}
|
||||
|
||||
for attr in armoury_attrs {
|
||||
if let Ok(value) = attr.current_value().await {
|
||||
let name = attr.name().await.unwrap();
|
||||
let platform = platform.clone();
|
||||
handle
|
||||
.upgrade_in_event_loop(move |handle| match name {
|
||||
FirmwareAttribute::ApuMem => {}
|
||||
@@ -250,37 +403,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::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);
|
||||
}
|
||||
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);
|
||||
FirmwareAttribute::PptPl3Fppt => {
|
||||
init_minmax_property!(ppt_pl3_fppt, handle, attr);
|
||||
setup_callback!(ppt_pl3_fppt, handle, attr, i32);
|
||||
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_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_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 => {}
|
||||
@@ -304,7 +470,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 => {}
|
||||
|
||||
@@ -146,5 +146,5 @@ where
|
||||
return Ok(ctrl);
|
||||
}
|
||||
|
||||
Err("No Aura interface".into())
|
||||
Err("No interface".into())
|
||||
}
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
msgid ""
|
||||
msgstr ""
|
||||
"Project-Id-Version: PACKAGE VERSION\n"
|
||||
"POT-Creation-Date: 2025-01-12 04:36+0000\n"
|
||||
"POT-Creation-Date: 2025-02-06 20:42+0000\n"
|
||||
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
|
||||
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
|
||||
"Language-Team: LANGUAGE <LL@li.org>\n"
|
||||
@@ -47,122 +47,203 @@ msgctxt "SystemPageData"
|
||||
msgid "Power"
|
||||
msgstr ""
|
||||
|
||||
#: rog-control-center/ui/pages/system.slint:122
|
||||
#: rog-control-center/ui/pages/system.slint:142
|
||||
msgctxt "PageSystem"
|
||||
msgid "Power settings"
|
||||
msgstr ""
|
||||
|
||||
#: rog-control-center/ui/pages/system.slint:127
|
||||
#: rog-control-center/ui/pages/system.slint:147
|
||||
msgctxt "PageSystem"
|
||||
msgid "Charge limit"
|
||||
msgstr ""
|
||||
|
||||
#: rog-control-center/ui/pages/system.slint:139
|
||||
#: rog-control-center/ui/pages/system.slint:161
|
||||
msgctxt "PageSystem"
|
||||
msgid "Throttle Policy"
|
||||
msgid "Platform Profile"
|
||||
msgstr ""
|
||||
|
||||
#: rog-control-center/ui/pages/system.slint:149
|
||||
#: rog-control-center/ui/pages/system.slint:171
|
||||
msgctxt "PageSystem"
|
||||
msgid "Advanced"
|
||||
msgstr ""
|
||||
|
||||
#: rog-control-center/ui/pages/system.slint:167
|
||||
#: rog-control-center/ui/pages/system.slint:189
|
||||
msgctxt "PageSystem"
|
||||
msgid "Armoury settings"
|
||||
msgstr ""
|
||||
|
||||
#: rog-control-center/ui/pages/system.slint:175
|
||||
#: rog-control-center/ui/pages/system.slint:199
|
||||
msgctxt "no_asus_armoury_driver_1"
|
||||
msgid "The asus-armoury driver is not loaded"
|
||||
msgstr ""
|
||||
|
||||
#: rog-control-center/ui/pages/system.slint:205
|
||||
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:216
|
||||
msgctxt "PageSystem"
|
||||
msgid "Panel Overdrive"
|
||||
msgstr ""
|
||||
|
||||
#: rog-control-center/ui/pages/system.slint:183
|
||||
#: rog-control-center/ui/pages/system.slint:224
|
||||
msgctxt "PageSystem"
|
||||
msgid "MiniLED Mode"
|
||||
msgstr ""
|
||||
|
||||
#: rog-control-center/ui/pages/system.slint:191
|
||||
#: rog-control-center/ui/pages/system.slint:232
|
||||
msgctxt "PageSystem"
|
||||
msgid "POST boot sound"
|
||||
msgstr ""
|
||||
|
||||
#: rog-control-center/ui/pages/system.slint:200
|
||||
#: rog-control-center/ui/pages/system.slint:248
|
||||
msgctxt "ppt_warning"
|
||||
msgid "The following settings are not applied until the toggle is enabled."
|
||||
msgstr ""
|
||||
|
||||
#: rog-control-center/ui/pages/system.slint:253
|
||||
msgctxt "ppt_group_enabled"
|
||||
msgid "Enable Tuning"
|
||||
msgstr ""
|
||||
|
||||
#: rog-control-center/ui/pages/system.slint:262 rog-control-center/ui/pages/system.slint:263
|
||||
msgctxt "ppt_pl1_spl"
|
||||
msgid "PL1, sustained power limit"
|
||||
msgid "CPU Sustained Power Limit"
|
||||
msgstr ""
|
||||
|
||||
#: rog-control-center/ui/pages/system.slint:211
|
||||
#: rog-control-center/ui/pages/system.slint:264
|
||||
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:280 rog-control-center/ui/pages/system.slint:281
|
||||
msgctxt "ppt_pl2_sppt"
|
||||
msgid "PL2, turbo power limit"
|
||||
msgid "CPU Turbo Power Limit"
|
||||
msgstr ""
|
||||
|
||||
#: rog-control-center/ui/pages/system.slint:222
|
||||
#: rog-control-center/ui/pages/system.slint:282
|
||||
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:298 rog-control-center/ui/pages/system.slint:299
|
||||
msgctxt "ppt_pl3_fppt"
|
||||
msgid "CPU Fast Burst Power Limit"
|
||||
msgstr ""
|
||||
|
||||
#: rog-control-center/ui/pages/system.slint:300
|
||||
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:315 rog-control-center/ui/pages/system.slint:316
|
||||
msgctxt "ppt_fppt"
|
||||
msgid "FPPT, Fast Power Limit"
|
||||
msgid "Fast Package Power Limit"
|
||||
msgstr ""
|
||||
|
||||
#: rog-control-center/ui/pages/system.slint:233
|
||||
#: rog-control-center/ui/pages/system.slint:317
|
||||
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:333 rog-control-center/ui/pages/system.slint:334
|
||||
msgctxt "ppt_apu_sppt"
|
||||
msgid "SPPT, APU slow power limit"
|
||||
msgid "APU Sustained Power Limit"
|
||||
msgstr ""
|
||||
|
||||
#: rog-control-center/ui/pages/system.slint:244
|
||||
#: rog-control-center/ui/pages/system.slint:335
|
||||
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:351 rog-control-center/ui/pages/system.slint:352
|
||||
msgctxt "ppt_platform_sppt"
|
||||
msgid "Slow package power tracking limit"
|
||||
msgid "Platform Sustained Power Limit"
|
||||
msgstr ""
|
||||
|
||||
#: rog-control-center/ui/pages/system.slint:255
|
||||
#: rog-control-center/ui/pages/system.slint:353
|
||||
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:369 rog-control-center/ui/pages/system.slint:370
|
||||
msgctxt "nv_dynamic_boost"
|
||||
msgid "dGPU boost overclock"
|
||||
msgid "GPU Power Boost"
|
||||
msgstr ""
|
||||
|
||||
#: rog-control-center/ui/pages/system.slint:266
|
||||
#: rog-control-center/ui/pages/system.slint:371
|
||||
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:387 rog-control-center/ui/pages/system.slint:388
|
||||
msgctxt "nv_temp_target"
|
||||
msgid "dGPU temperature max"
|
||||
msgid "GPU Temperature Limit"
|
||||
msgstr ""
|
||||
|
||||
#: rog-control-center/ui/pages/system.slint:313
|
||||
#: rog-control-center/ui/pages/system.slint:389
|
||||
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:441
|
||||
msgctxt "PageSystem"
|
||||
msgid "Energy Performance Preference linked to Throttle Policy"
|
||||
msgstr ""
|
||||
|
||||
#: rog-control-center/ui/pages/system.slint:317
|
||||
#: rog-control-center/ui/pages/system.slint:445
|
||||
msgctxt "PageSystem"
|
||||
msgid "Change EPP based on Throttle Policy"
|
||||
msgstr ""
|
||||
|
||||
#: rog-control-center/ui/pages/system.slint:325
|
||||
#: rog-control-center/ui/pages/system.slint:453
|
||||
msgctxt "PageSystem"
|
||||
msgid "EPP for Balanced Policy"
|
||||
msgstr ""
|
||||
|
||||
#: rog-control-center/ui/pages/system.slint:335
|
||||
#: rog-control-center/ui/pages/system.slint:463
|
||||
msgctxt "PageSystem"
|
||||
msgid "EPP for Performance Policy"
|
||||
msgstr ""
|
||||
|
||||
#: rog-control-center/ui/pages/system.slint:345
|
||||
#: rog-control-center/ui/pages/system.slint:473
|
||||
msgctxt "PageSystem"
|
||||
msgid "EPP for Quiet Policy"
|
||||
msgstr ""
|
||||
|
||||
#: rog-control-center/ui/pages/system.slint:363
|
||||
#: rog-control-center/ui/pages/system.slint:491
|
||||
msgctxt "PageSystem"
|
||||
msgid "Throttle Policy for power state"
|
||||
msgstr ""
|
||||
|
||||
#: rog-control-center/ui/pages/system.slint:369
|
||||
#: rog-control-center/ui/pages/system.slint:497
|
||||
msgctxt "PageSystem"
|
||||
msgid "Throttle Policy on Battery"
|
||||
msgstr ""
|
||||
|
||||
#: rog-control-center/ui/pages/system.slint:379 rog-control-center/ui/pages/system.slint:400
|
||||
#: rog-control-center/ui/pages/system.slint:507 rog-control-center/ui/pages/system.slint:528
|
||||
msgctxt "PageSystem"
|
||||
msgid "Enabled"
|
||||
msgstr ""
|
||||
|
||||
#: rog-control-center/ui/pages/system.slint:390
|
||||
#: rog-control-center/ui/pages/system.slint:518
|
||||
msgctxt "PageSystem"
|
||||
msgid "Throttle Policy on AC"
|
||||
msgstr ""
|
||||
@@ -647,42 +728,47 @@ msgctxt "AuraPowerGroupOld"
|
||||
msgid "Sleep"
|
||||
msgstr ""
|
||||
|
||||
#: rog-control-center/ui/main_window.slint:51
|
||||
#: rog-control-center/ui/widgets/common.slint:136
|
||||
msgctxt "confirm_reset"
|
||||
msgid "Are you sure you want to reset this?"
|
||||
msgstr ""
|
||||
|
||||
#: rog-control-center/ui/main_window.slint:55
|
||||
msgctxt "MainWindow"
|
||||
msgid "ROG"
|
||||
msgstr ""
|
||||
|
||||
#: rog-control-center/ui/main_window.slint:53
|
||||
#: rog-control-center/ui/main_window.slint:57
|
||||
msgctxt "Menu1"
|
||||
msgid "System Control"
|
||||
msgstr ""
|
||||
|
||||
#: rog-control-center/ui/main_window.slint:54
|
||||
#: rog-control-center/ui/main_window.slint:58
|
||||
msgctxt "Menu2"
|
||||
msgid "Keyboard Aura"
|
||||
msgstr ""
|
||||
|
||||
#: rog-control-center/ui/main_window.slint:55
|
||||
#: rog-control-center/ui/main_window.slint:59
|
||||
msgctxt "Menu3"
|
||||
msgid "AniMe Matrix"
|
||||
msgstr ""
|
||||
|
||||
#: rog-control-center/ui/main_window.slint:56
|
||||
#: rog-control-center/ui/main_window.slint:60
|
||||
msgctxt "Menu4"
|
||||
msgid "Fan Curves"
|
||||
msgstr ""
|
||||
|
||||
#: rog-control-center/ui/main_window.slint:57
|
||||
#: rog-control-center/ui/main_window.slint:61
|
||||
msgctxt "Menu5"
|
||||
msgid "App Settings"
|
||||
msgstr ""
|
||||
|
||||
#: rog-control-center/ui/main_window.slint:58
|
||||
#: rog-control-center/ui/main_window.slint:62
|
||||
msgctxt "Menu6"
|
||||
msgid "About"
|
||||
msgstr ""
|
||||
|
||||
#: rog-control-center/ui/main_window.slint:70
|
||||
#: rog-control-center/ui/main_window.slint:74
|
||||
msgctxt "MainWindow"
|
||||
msgid "Quit App"
|
||||
msgstr ""
|
||||
|
||||
@@ -19,10 +19,14 @@ export { AppSize, AttrMinMax, SystemPageData, AnimePageData, AppSettingsPageData
|
||||
|
||||
export component MainWindow inherits Window {
|
||||
title: "ROG Control";
|
||||
default-font-family: "DejaVu Sans";
|
||||
always-on-top: true;
|
||||
default-font-family: "Noto Sans";
|
||||
default-font-size: 14px;
|
||||
default-font-weight: 400;
|
||||
icon: @image-url("../data/rog-control-center.png");
|
||||
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 +35,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 +113,7 @@ export component MainWindow inherits Window {
|
||||
}
|
||||
}
|
||||
|
||||
if fade-cover: Rectangle {
|
||||
if fade_cover: Rectangle {
|
||||
x: 0px;
|
||||
y: 0px;
|
||||
width: root.width;
|
||||
@@ -121,10 +125,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 +160,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 +169,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);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,23 +1,23 @@
|
||||
import { SystemSlider, SystemDropdown, SystemToggle, SystemToggleInt } from "../widgets/common.slint";
|
||||
import { Palette, HorizontalBox , VerticalBox, ScrollView, Slider, Button, Switch, ComboBox, GroupBox} from "std-widgets.slint";
|
||||
import { Palette, HorizontalBox , VerticalBox, ScrollView, Slider, Button, Switch, ComboBox, GroupBox, StandardButton} from "std-widgets.slint";
|
||||
|
||||
export struct AttrMinMax {
|
||||
min: int,
|
||||
max: int,
|
||||
val: float,
|
||||
current: float,
|
||||
}
|
||||
|
||||
export struct AttrPossible {
|
||||
range: [int],
|
||||
val: int,
|
||||
current: int,
|
||||
}
|
||||
|
||||
export global SystemPageData {
|
||||
in-out property <float> charge_control_end_threshold: 30;
|
||||
callback cb_charge_control_end_threshold(/* charge limit */ int);
|
||||
in-out property <int> throttle_thermal_policy: 0;
|
||||
in-out property <[string]> throttle_policy_choices: [@tr("Balanced"), @tr("Performance"), @tr("Quiet")];
|
||||
callback cb_throttle_thermal_policy(int);
|
||||
in-out property <int> platform_profile: 0;
|
||||
in-out property <[string]> platform_profile_choices: [@tr("Balanced"), @tr("Performance"), @tr("Quiet")];
|
||||
callback cb_platform_profile(int);
|
||||
in-out property <[string]> energy_performance_choices: [
|
||||
@tr("Default"),
|
||||
@tr("Performance"),
|
||||
@@ -25,23 +25,23 @@ export global SystemPageData {
|
||||
@tr("BalancePower"),
|
||||
@tr("Power")
|
||||
];
|
||||
in-out property <int> throttle_balanced_epp: 0;
|
||||
callback cb_throttle_balanced_epp(int);
|
||||
in-out property <int> throttle_performance_epp: 0;
|
||||
callback cb_throttle_performance_epp(int);
|
||||
in-out property <int> throttle_quiet_epp: 0;
|
||||
callback cb_throttle_quiet_epp(int);
|
||||
in-out property <int> profile_balanced_epp: 0;
|
||||
callback cb_profile_balanced_epp(int);
|
||||
in-out property <int> profile_performance_epp: 0;
|
||||
callback cb_profile_performance_epp(int);
|
||||
in-out property <int> profile_quiet_epp: 0;
|
||||
callback cb_profile_quiet_epp(int);
|
||||
// if the EPP should change with throttle
|
||||
in-out property <bool> throttle_policy_linked_epp: true;
|
||||
callback cb_throttle_policy_linked_epp(bool);
|
||||
in-out property <int> throttle_policy_on_ac: 0;
|
||||
callback cb_throttle_policy_on_ac(int);
|
||||
in-out property <bool> change_throttle_policy_on_ac: true;
|
||||
callback cb_change_throttle_policy_on_ac(bool);
|
||||
in-out property <int> throttle_policy_on_battery: 0;
|
||||
callback cb_throttle_policy_on_battery(int);
|
||||
in-out property <bool> change_throttle_policy_on_battery: true;
|
||||
callback cb_change_throttle_policy_on_battery(bool);
|
||||
in-out property <bool> platform_profile_linked_epp: true;
|
||||
callback cb_platform_profile_linked_epp(bool);
|
||||
in-out property <int> platform_profile_on_ac: 0;
|
||||
callback cb_platform_profile_on_ac(int);
|
||||
in-out property <bool> change_platform_profile_on_ac: true;
|
||||
callback cb_change_platform_profile_on_ac(bool);
|
||||
in-out property <int> platform_profile_on_battery: 0;
|
||||
callback cb_platform_profile_on_battery(int);
|
||||
in-out property <bool> change_platform_profile_on_battery: true;
|
||||
callback cb_change_platform_profile_on_battery(bool);
|
||||
//
|
||||
in-out property <int> panel_overdrive;
|
||||
callback cb_panel_overdrive(int);
|
||||
@@ -49,55 +49,74 @@ export global SystemPageData {
|
||||
callback cb_boot_sound(int);
|
||||
in-out property <int> mini_led_mode;
|
||||
callback cb_mini_led_mode(int);
|
||||
in-out property <bool> asus_armoury_loaded: false;
|
||||
|
||||
in-out property <AttrMinMax> ppt_pl1_spl: {
|
||||
min: 0,
|
||||
max: 100,
|
||||
val: 20,
|
||||
current: 20,
|
||||
};
|
||||
callback cb_ppt_pl1_spl(int);
|
||||
callback cb_default_ppt_pl1_spl();
|
||||
|
||||
in-out property <AttrMinMax> ppt_pl2_sppt: {
|
||||
min: 0,
|
||||
max: 100,
|
||||
val: 20,
|
||||
current: 20,
|
||||
};
|
||||
callback cb_ppt_pl2_sppt(int);
|
||||
callback cb_default_ppt_pl2_sppt();
|
||||
|
||||
in-out property <AttrMinMax> ppt_pl3_fppt: {
|
||||
min: 0,
|
||||
max: 100,
|
||||
current: 20,
|
||||
};
|
||||
callback cb_ppt_pl3_fppt(int);
|
||||
callback cb_default_ppt_pl3_fppt();
|
||||
|
||||
in-out property <AttrMinMax> ppt_fppt: {
|
||||
min: 0,
|
||||
max: 100,
|
||||
val: 20,
|
||||
current: 20,
|
||||
};
|
||||
callback cb_ppt_fppt(int);
|
||||
callback cb_default_ppt_fppt();
|
||||
|
||||
in-out property <AttrMinMax> ppt_apu_sppt: {
|
||||
min: 0,
|
||||
max: 100,
|
||||
val: 20,
|
||||
current: 20,
|
||||
};
|
||||
callback cb_ppt_apu_sppt(int);
|
||||
callback cb_default_ppt_apu_sppt();
|
||||
|
||||
in-out property <AttrMinMax> ppt_platform_sppt: {
|
||||
min: 0,
|
||||
max: 100,
|
||||
val: 20,
|
||||
current: 20,
|
||||
};
|
||||
callback cb_ppt_platform_sppt(int);
|
||||
callback cb_default_ppt_platform_sppt();
|
||||
|
||||
in-out property <AttrMinMax> nv_dynamic_boost: {
|
||||
min: 0,
|
||||
max: 30,
|
||||
val: 5,
|
||||
current: 5,
|
||||
};
|
||||
callback cb_nv_dynamic_boost(int);
|
||||
callback cb_default_nv_dynamic_boost();
|
||||
|
||||
in-out property <AttrMinMax> nv_temp_target: {
|
||||
min: 0,
|
||||
max: 80,
|
||||
val: 75,
|
||||
current: 75,
|
||||
};
|
||||
callback cb_nv_temp_target(int);
|
||||
callback cb_default_nv_temp_target();
|
||||
|
||||
in-out property <bool> enable_ppt_group;
|
||||
callback cb_enable_ppt_group(bool);
|
||||
}
|
||||
|
||||
export component PageSystem inherits Rectangle {
|
||||
@@ -109,6 +128,7 @@ export component PageSystem inherits Rectangle {
|
||||
VerticalLayout {
|
||||
padding: 10px;
|
||||
spacing: 10px;
|
||||
alignment: LayoutAlignment.start;
|
||||
Rectangle {
|
||||
background: Palette.alternate-background;
|
||||
border-color: Palette.accent-background;
|
||||
@@ -127,21 +147,23 @@ 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))
|
||||
}
|
||||
}
|
||||
|
||||
if SystemPageData.throttle_thermal_policy != -1: HorizontalLayout {
|
||||
if SystemPageData.platform_profile != -1: HorizontalLayout {
|
||||
spacing: 10px;
|
||||
SystemDropdown {
|
||||
text: @tr("Throttle Policy");
|
||||
current_index <=> SystemPageData.throttle_thermal_policy;
|
||||
current_value: SystemPageData.throttle_policy_choices[SystemPageData.throttle_thermal_policy];
|
||||
model <=> SystemPageData.throttle_policy_choices;
|
||||
text: @tr("Platform Profile");
|
||||
current_index <=> SystemPageData.platform_profile;
|
||||
current_value: SystemPageData.platform_profile_choices[SystemPageData.platform_profile];
|
||||
model <=> SystemPageData.platform_profile_choices;
|
||||
selected => {
|
||||
SystemPageData.cb_throttle_thermal_policy(SystemPageData.throttle_thermal_policy)
|
||||
SystemPageData.cb_platform_profile(SystemPageData.platform_profile)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -168,6 +190,25 @@ export component PageSystem inherits Rectangle {
|
||||
}
|
||||
}
|
||||
|
||||
if !SystemPageData.asus_armoury_loaded: Rectangle {
|
||||
border-width: 3px;
|
||||
border-color: red;
|
||||
max-height: 30px;
|
||||
VerticalBox {
|
||||
Text {
|
||||
text: @tr("no_asus_armoury_driver_1" => "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;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
HorizontalBox {
|
||||
padding: 0px;
|
||||
spacing: 10px;
|
||||
@@ -196,79 +237,166 @@ export component PageSystem inherits Rectangle {
|
||||
}
|
||||
}
|
||||
|
||||
if SystemPageData.ppt_pl1_spl.val != -1: SystemSlider {
|
||||
text: @tr("ppt_pl1_spl" => "PL1, sustained power limit");
|
||||
minimum: SystemPageData.ppt_pl1_spl.min;
|
||||
maximum: SystemPageData.ppt_pl1_spl.max;
|
||||
value: SystemPageData.ppt_pl1_spl.val;
|
||||
released => {
|
||||
SystemPageData.ppt_pl1_spl.val = self.value;
|
||||
SystemPageData.cb_ppt_pl1_spl(Math.round(self.value))
|
||||
if SystemPageData.ppt_pl1_spl.current != -1 || SystemPageData.ppt_pl2_sppt.current != -1 || SystemPageData.nv_dynamic_boost.current != -1: HorizontalLayout {
|
||||
padding-right: 10px;
|
||||
padding-left: 10px;
|
||||
alignment: LayoutAlignment.space-between;
|
||||
Rectangle {
|
||||
height: 32px;
|
||||
Text {
|
||||
font-size: 16px;
|
||||
text: @tr("ppt_warning" => "The following settings are not applied until the toggle is enabled.");
|
||||
}
|
||||
}
|
||||
|
||||
Switch {
|
||||
text: @tr("ppt_group_enabled" => "Enable Tuning");
|
||||
checked <=> SystemPageData.enable_ppt_group;
|
||||
toggled => {
|
||||
SystemPageData.cb_enable_ppt_group(SystemPageData.enable_ppt_group)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if SystemPageData.ppt_pl2_sppt.val != -1: SystemSlider {
|
||||
text: @tr("ppt_pl2_sppt" => "PL2, turbo power limit");
|
||||
if SystemPageData.ppt_pl1_spl.current != -1: SystemSlider {
|
||||
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.current;
|
||||
enabled <=> SystemPageData.enable_ppt_group;
|
||||
has_reset: true;
|
||||
cb_do_reset => {
|
||||
SystemPageData.cb_default_ppt_pl1_spl();
|
||||
}
|
||||
released => {
|
||||
SystemPageData.ppt_pl1_spl.current = self.value;
|
||||
SystemPageData.cb_ppt_pl1_spl(Math.round(self.value));
|
||||
}
|
||||
}
|
||||
|
||||
if SystemPageData.ppt_pl2_sppt.current != -1: SystemSlider {
|
||||
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;
|
||||
value: SystemPageData.ppt_pl2_sppt.current;
|
||||
enabled <=> SystemPageData.enable_ppt_group;
|
||||
has_reset: true;
|
||||
cb_do_reset => {
|
||||
SystemPageData.cb_default_ppt_pl2_sppt();
|
||||
}
|
||||
released => {
|
||||
SystemPageData.ppt_pl2_sppt.val = self.value;
|
||||
SystemPageData.ppt_pl2_sppt.current = self.value;
|
||||
SystemPageData.cb_ppt_pl2_sppt(Math.round(self.value))
|
||||
}
|
||||
}
|
||||
|
||||
if SystemPageData.ppt_fppt.val != -1: SystemSlider {
|
||||
text: @tr("ppt_fppt" => "FPPT, Fast Power Limit");
|
||||
if SystemPageData.ppt_pl3_fppt.current != -1: SystemSlider {
|
||||
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.current;
|
||||
enabled <=> SystemPageData.enable_ppt_group;
|
||||
has_reset: true;
|
||||
cb_do_reset => {
|
||||
SystemPageData.cb_default_ppt_pl3_fppt();
|
||||
}
|
||||
released => {
|
||||
SystemPageData.ppt_pl3_fppt.current = self.value;
|
||||
SystemPageData.cb_ppt_pl3_fppt(Math.round(self.value))
|
||||
}
|
||||
}
|
||||
if SystemPageData.ppt_fppt.current != -1: SystemSlider {
|
||||
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;
|
||||
value: SystemPageData.ppt_fppt.current;
|
||||
enabled <=> SystemPageData.enable_ppt_group;
|
||||
has_reset: true;
|
||||
cb_do_reset => {
|
||||
SystemPageData.cb_default_ppt_fppt();
|
||||
}
|
||||
released => {
|
||||
SystemPageData.ppt_fppt.val = self.value;
|
||||
SystemPageData.ppt_fppt.current = self.value;
|
||||
SystemPageData.cb_ppt_fppt(Math.round(self.value))
|
||||
}
|
||||
}
|
||||
|
||||
if SystemPageData.ppt_apu_sppt.val != -1: SystemSlider {
|
||||
text: @tr("ppt_apu_sppt" => "SPPT, APU slow power limit");
|
||||
if SystemPageData.ppt_apu_sppt.current != -1: SystemSlider {
|
||||
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;
|
||||
value: SystemPageData.ppt_apu_sppt.current;
|
||||
enabled <=> SystemPageData.enable_ppt_group;
|
||||
has_reset: true;
|
||||
cb_do_reset => {
|
||||
SystemPageData.cb_default_ppt_apu_sppt();
|
||||
}
|
||||
released => {
|
||||
SystemPageData.ppt_apu_sppt.val = self.value;
|
||||
SystemPageData.ppt_apu_sppt.current = self.value;
|
||||
SystemPageData.cb_ppt_apu_sppt(Math.round(self.value))
|
||||
}
|
||||
}
|
||||
|
||||
if SystemPageData.ppt_platform_sppt.val != -1: SystemSlider {
|
||||
text: @tr("ppt_platform_sppt" => "Slow package power tracking limit");
|
||||
if SystemPageData.ppt_platform_sppt.current != -1: SystemSlider {
|
||||
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;
|
||||
value: SystemPageData.ppt_platform_sppt.current;
|
||||
enabled <=> SystemPageData.enable_ppt_group;
|
||||
has_reset: true;
|
||||
cb_do_reset => {
|
||||
SystemPageData.cb_default_ppt_platform_sppt();
|
||||
}
|
||||
released => {
|
||||
SystemPageData.ppt_platform_sppt.val = self.value;
|
||||
SystemPageData.ppt_platform_sppt.current = self.value;
|
||||
SystemPageData.cb_ppt_platform_sppt(Math.round(self.value))
|
||||
}
|
||||
}
|
||||
|
||||
if SystemPageData.nv_dynamic_boost.val != -1: SystemSlider {
|
||||
text: @tr("nv_dynamic_boost" => "dGPU boost overclock");
|
||||
if SystemPageData.nv_dynamic_boost.current != -1: SystemSlider {
|
||||
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;
|
||||
value: SystemPageData.nv_dynamic_boost.current;
|
||||
enabled <=> SystemPageData.enable_ppt_group;
|
||||
has_reset: true;
|
||||
cb_do_reset => {
|
||||
SystemPageData.cb_default_nv_dynamic_boost();
|
||||
}
|
||||
released => {
|
||||
SystemPageData.nv_dynamic_boost.val = self.value;
|
||||
SystemPageData.nv_dynamic_boost.current = self.value;
|
||||
SystemPageData.cb_nv_dynamic_boost(Math.round(self.value))
|
||||
}
|
||||
}
|
||||
|
||||
if SystemPageData.nv_temp_target.val != -1: SystemSlider {
|
||||
text: @tr("nv_temp_target" => "dGPU temperature max");
|
||||
if SystemPageData.nv_temp_target.current != -1: SystemSlider {
|
||||
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;
|
||||
value: SystemPageData.nv_temp_target.current;
|
||||
enabled <=> SystemPageData.enable_ppt_group;
|
||||
has_reset: true;
|
||||
cb_do_reset => {
|
||||
SystemPageData.cb_default_nv_temp_target();
|
||||
}
|
||||
released => {
|
||||
SystemPageData.nv_temp_target.val = self.value;
|
||||
SystemPageData.nv_temp_target.current = self.value;
|
||||
SystemPageData.cb_nv_temp_target(Math.round(self.value))
|
||||
}
|
||||
}
|
||||
@@ -315,39 +443,39 @@ export component PageSystem inherits Rectangle {
|
||||
|
||||
SystemToggle {
|
||||
text: @tr("Change EPP based on Throttle Policy");
|
||||
checked <=> SystemPageData.throttle_policy_linked_epp;
|
||||
checked <=> SystemPageData.platform_profile_linked_epp;
|
||||
toggled => {
|
||||
SystemPageData.cb_throttle_policy_linked_epp(SystemPageData.throttle_policy_linked_epp)
|
||||
SystemPageData.cb_platform_profile_linked_epp(SystemPageData.platform_profile_linked_epp)
|
||||
}
|
||||
}
|
||||
|
||||
SystemDropdown {
|
||||
text: @tr("EPP for Balanced Policy");
|
||||
current_index <=> SystemPageData.throttle_balanced_epp;
|
||||
current_value: SystemPageData.energy_performance_choices[SystemPageData.throttle_balanced_epp];
|
||||
current_index <=> SystemPageData.profile_balanced_epp;
|
||||
current_value: SystemPageData.energy_performance_choices[SystemPageData.profile_balanced_epp];
|
||||
model <=> SystemPageData.energy_performance_choices;
|
||||
selected => {
|
||||
SystemPageData.cb_throttle_balanced_epp(SystemPageData.throttle_balanced_epp)
|
||||
SystemPageData.cb_profile_balanced_epp(SystemPageData.profile_balanced_epp)
|
||||
}
|
||||
}
|
||||
|
||||
SystemDropdown {
|
||||
text: @tr("EPP for Performance Policy");
|
||||
current_index <=> SystemPageData.throttle_performance_epp;
|
||||
current_value: SystemPageData.energy_performance_choices[SystemPageData.throttle_performance_epp];
|
||||
current_index <=> SystemPageData.profile_performance_epp;
|
||||
current_value: SystemPageData.energy_performance_choices[SystemPageData.profile_performance_epp];
|
||||
model <=> SystemPageData.energy_performance_choices;
|
||||
selected => {
|
||||
SystemPageData.cb_throttle_performance_epp(SystemPageData.throttle_performance_epp)
|
||||
SystemPageData.cb_profile_performance_epp(SystemPageData.profile_performance_epp)
|
||||
}
|
||||
}
|
||||
|
||||
SystemDropdown {
|
||||
text: @tr("EPP for Quiet Policy");
|
||||
current_index <=> SystemPageData.throttle_quiet_epp;
|
||||
current_value: SystemPageData.energy_performance_choices[SystemPageData.throttle_quiet_epp];
|
||||
current_index <=> SystemPageData.profile_quiet_epp;
|
||||
current_value: SystemPageData.energy_performance_choices[SystemPageData.profile_quiet_epp];
|
||||
model <=> SystemPageData.energy_performance_choices;
|
||||
selected => {
|
||||
SystemPageData.cb_throttle_quiet_epp(SystemPageData.throttle_quiet_epp)
|
||||
SystemPageData.cb_profile_quiet_epp(SystemPageData.profile_quiet_epp)
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -367,19 +495,19 @@ export component PageSystem inherits Rectangle {
|
||||
spacing: 10px;
|
||||
SystemDropdown {
|
||||
text: @tr("Throttle Policy on Battery");
|
||||
current_index <=> SystemPageData.throttle_policy_on_battery;
|
||||
current_value: SystemPageData.throttle_policy_choices[SystemPageData.throttle_policy_on_battery];
|
||||
model <=> SystemPageData.throttle_policy_choices;
|
||||
current_index <=> SystemPageData.platform_profile_on_battery;
|
||||
current_value: SystemPageData.platform_profile_choices[SystemPageData.platform_profile_on_battery];
|
||||
model <=> SystemPageData.platform_profile_choices;
|
||||
selected => {
|
||||
SystemPageData.cb_throttle_policy_on_battery(SystemPageData.throttle_policy_on_battery)
|
||||
SystemPageData.cb_platform_profile_on_battery(SystemPageData.platform_profile_on_battery)
|
||||
}
|
||||
}
|
||||
|
||||
SystemToggle {
|
||||
text: @tr("Enabled");
|
||||
checked <=> SystemPageData.change_throttle_policy_on_battery;
|
||||
checked <=> SystemPageData.change_platform_profile_on_battery;
|
||||
toggled => {
|
||||
SystemPageData.cb_change_throttle_policy_on_battery(SystemPageData.change_throttle_policy_on_battery);
|
||||
SystemPageData.cb_change_platform_profile_on_battery(SystemPageData.change_platform_profile_on_battery);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -388,19 +516,19 @@ export component PageSystem inherits Rectangle {
|
||||
spacing: 10px;
|
||||
SystemDropdown {
|
||||
text: @tr("Throttle Policy on AC");
|
||||
current_index <=> SystemPageData.throttle_policy_on_ac;
|
||||
current_value: SystemPageData.throttle_policy_choices[SystemPageData.throttle_policy_on_ac];
|
||||
model <=> SystemPageData.throttle_policy_choices;
|
||||
current_index <=> SystemPageData.platform_profile_on_ac;
|
||||
current_value: SystemPageData.platform_profile_choices[SystemPageData.platform_profile_on_ac];
|
||||
model <=> SystemPageData.platform_profile_choices;
|
||||
selected => {
|
||||
SystemPageData.cb_throttle_policy_on_ac(SystemPageData.throttle_policy_on_ac)
|
||||
SystemPageData.cb_platform_profile_on_ac(SystemPageData.platform_profile_on_ac)
|
||||
}
|
||||
}
|
||||
|
||||
SystemToggle {
|
||||
text: @tr("Enabled");
|
||||
checked <=> SystemPageData.change_throttle_policy_on_ac;
|
||||
checked <=> SystemPageData.change_platform_profile_on_ac;
|
||||
toggled => {
|
||||
SystemPageData.cb_change_throttle_policy_on_ac(SystemPageData.change_throttle_policy_on_ac);
|
||||
SystemPageData.cb_change_platform_profile_on_ac(SystemPageData.change_platform_profile_on_ac);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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,48 @@ export component RogItem inherits Rectangle {
|
||||
}
|
||||
|
||||
export component SystemSlider inherits RogItem {
|
||||
in property <string> title;
|
||||
in property <string> text;
|
||||
in-out property <bool> enabled;
|
||||
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;
|
||||
enabled <=> root.enabled;
|
||||
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)}";
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -51,6 +59,7 @@ export component SystemSlider inherits RogItem {
|
||||
// alignment: LayoutAlignment.end;
|
||||
padding-right: 20px;
|
||||
slider := Slider {
|
||||
enabled <=> root.enabled;
|
||||
maximum: root.maximum;
|
||||
minimum: root.minimum;
|
||||
value <=> root.value;
|
||||
@@ -59,6 +68,97 @@ 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;
|
||||
enabled <=> root.enabled;
|
||||
clicked => {
|
||||
reset_popup.show();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -114,7 +214,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())
|
||||
}
|
||||
|
||||
@@ -20,7 +20,7 @@
|
||||
//!
|
||||
//! …consequently `zbus-xmlgen` did not generate code for the above interfaces.
|
||||
|
||||
use rog_platform::platform::ThrottlePolicy;
|
||||
use rog_platform::platform::PlatformProfile;
|
||||
use rog_profiles::fan_curve_set::CurveData;
|
||||
use rog_profiles::FanCurvePU;
|
||||
use zbus::proxy;
|
||||
@@ -32,30 +32,30 @@ use zbus::proxy;
|
||||
)]
|
||||
pub trait FanCurves {
|
||||
/// Get the fan-curve data for the currently active PlatformProfile
|
||||
fn fan_curve_data(&self, profile: ThrottlePolicy) -> zbus::Result<Vec<CurveData>>;
|
||||
fn fan_curve_data(&self, profile: PlatformProfile) -> zbus::Result<Vec<CurveData>>;
|
||||
|
||||
/// Reset the stored (self) and device curve to the defaults of the
|
||||
/// platform.
|
||||
///
|
||||
/// Each platform_profile has a different default and the defualt can be
|
||||
/// read only for the currently active profile.
|
||||
fn reset_profile_curves(&self, profile: ThrottlePolicy) -> zbus::Result<()>;
|
||||
fn reset_profile_curves(&self, profile: PlatformProfile) -> zbus::Result<()>;
|
||||
|
||||
/// SetActiveCurveToDefaults method
|
||||
fn set_curves_to_defaults(&self, profile: ThrottlePolicy) -> zbus::Result<()>;
|
||||
fn set_curves_to_defaults(&self, profile: PlatformProfile) -> zbus::Result<()>;
|
||||
|
||||
/// Set the fan curve for the specified profile, or the profile the user is
|
||||
/// currently in if profile == None. Will also activate the fan curve.
|
||||
fn set_fan_curve(&self, profile: ThrottlePolicy, curve: CurveData) -> zbus::Result<()>;
|
||||
fn set_fan_curve(&self, profile: PlatformProfile, curve: CurveData) -> zbus::Result<()>;
|
||||
|
||||
/// Set a profile fan curve enabled status. Will also activate a fan curve.
|
||||
fn set_fan_curves_enabled(&self, profile: ThrottlePolicy, enabled: bool) -> zbus::Result<()>;
|
||||
fn set_fan_curves_enabled(&self, profile: PlatformProfile, enabled: bool) -> zbus::Result<()>;
|
||||
|
||||
/// Set a single fan curve for a profile to enabled status. Will also
|
||||
/// activate a fan curve.
|
||||
async fn set_profile_fan_curve_enabled(
|
||||
&self,
|
||||
profile: ThrottlePolicy,
|
||||
profile: PlatformProfile,
|
||||
fan: FanCurvePU,
|
||||
enabled: bool
|
||||
) -> zbus::Result<()>;
|
||||
|
||||
@@ -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::{PlatformProfile, Properties};
|
||||
use zbus::proxy;
|
||||
|
||||
#[proxy(
|
||||
@@ -34,7 +34,7 @@ pub trait Platform {
|
||||
fn version(&self) -> zbus::Result<String>;
|
||||
|
||||
/// NextThrottleThermalPolicy method
|
||||
fn next_throttle_thermal_policy(&self) -> zbus::Result<()>;
|
||||
fn next_platform_profile(&self) -> zbus::Result<()>;
|
||||
|
||||
/// SupportedProperties method
|
||||
fn supported_properties(&self) -> zbus::Result<Vec<Properties>>;
|
||||
@@ -48,131 +48,68 @@ 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>;
|
||||
fn profile_balanced_epp(&self) -> zbus::Result<CPUEPP>;
|
||||
#[zbus(property)]
|
||||
fn set_throttle_balanced_epp(&self, epp: CPUEPP) -> zbus::Result<()>;
|
||||
fn set_profile_balanced_epp(&self, epp: CPUEPP) -> zbus::Result<()>;
|
||||
|
||||
/// ThrottlePerformanceEpp property
|
||||
#[zbus(property)]
|
||||
fn throttle_performance_epp(&self) -> zbus::Result<CPUEPP>;
|
||||
fn profile_performance_epp(&self) -> zbus::Result<CPUEPP>;
|
||||
#[zbus(property)]
|
||||
fn set_throttle_performance_epp(&self, epp: CPUEPP) -> zbus::Result<()>;
|
||||
fn set_profile_performance_epp(&self, epp: CPUEPP) -> zbus::Result<()>;
|
||||
|
||||
/// ThrottlePolicyLinkedEpp property
|
||||
#[zbus(property)]
|
||||
fn throttle_policy_linked_epp(&self) -> zbus::Result<bool>;
|
||||
fn platform_profile_linked_epp(&self) -> zbus::Result<bool>;
|
||||
#[zbus(property)]
|
||||
fn set_throttle_policy_linked_epp(&self, value: bool) -> zbus::Result<()>;
|
||||
fn set_platform_profile_linked_epp(&self, value: bool) -> zbus::Result<()>;
|
||||
|
||||
/// ThrottlePolicyOnAc property
|
||||
#[zbus(property)]
|
||||
fn throttle_policy_on_ac(&self) -> zbus::Result<ThrottlePolicy>;
|
||||
fn platform_profile_on_ac(&self) -> zbus::Result<PlatformProfile>;
|
||||
#[zbus(property)]
|
||||
fn set_throttle_policy_on_ac(&self, throttle_policy: ThrottlePolicy) -> zbus::Result<()>;
|
||||
fn set_platform_profile_on_ac(&self, platform_profile: PlatformProfile) -> zbus::Result<()>;
|
||||
|
||||
/// ChangeThrottlePolicyOnAc property
|
||||
#[zbus(property)]
|
||||
fn change_throttle_policy_on_ac(&self) -> zbus::Result<bool>;
|
||||
fn change_platform_profile_on_ac(&self) -> zbus::Result<bool>;
|
||||
#[zbus(property)]
|
||||
fn set_change_throttle_policy_on_ac(&self, change: bool) -> zbus::Result<()>;
|
||||
fn set_change_platform_profile_on_ac(&self, change: bool) -> zbus::Result<()>;
|
||||
|
||||
/// ThrottlePolicyOnBattery property
|
||||
#[zbus(property)]
|
||||
fn throttle_policy_on_battery(&self) -> zbus::Result<ThrottlePolicy>;
|
||||
fn platform_profile_on_battery(&self) -> zbus::Result<PlatformProfile>;
|
||||
#[zbus(property)]
|
||||
fn set_throttle_policy_on_battery(&self, throttle_policy: ThrottlePolicy) -> zbus::Result<()>;
|
||||
fn set_platform_profile_on_battery(
|
||||
&self,
|
||||
platform_profile: PlatformProfile
|
||||
) -> zbus::Result<()>;
|
||||
|
||||
/// ChangeThrottlePolicyOnAc property
|
||||
#[zbus(property)]
|
||||
fn change_throttle_policy_on_battery(&self) -> zbus::Result<bool>;
|
||||
fn change_platform_profile_on_battery(&self) -> zbus::Result<bool>;
|
||||
#[zbus(property)]
|
||||
fn set_change_throttle_policy_on_battery(&self, change: bool) -> zbus::Result<()>;
|
||||
fn set_change_platform_profile_on_battery(&self, change: bool) -> zbus::Result<()>;
|
||||
|
||||
/// ThrottleQuietEpp property
|
||||
#[zbus(property)]
|
||||
fn throttle_quiet_epp(&self) -> zbus::Result<CPUEPP>;
|
||||
fn profile_quiet_epp(&self) -> zbus::Result<CPUEPP>;
|
||||
#[zbus(property)]
|
||||
fn set_throttle_quiet_epp(&self, epp: CPUEPP) -> zbus::Result<()>;
|
||||
fn set_profile_quiet_epp(&self, epp: CPUEPP) -> zbus::Result<()>;
|
||||
|
||||
/// ThrottlePolicy property
|
||||
#[zbus(property)]
|
||||
fn throttle_thermal_policy(&self) -> zbus::Result<ThrottlePolicy>;
|
||||
fn platform_profile(&self) -> zbus::Result<PlatformProfile>;
|
||||
#[zbus(property)]
|
||||
fn set_throttle_thermal_policy(&self, throttle_policy: ThrottlePolicy) -> zbus::Result<()>;
|
||||
fn set_platform_profile(&self, platform_profile: PlatformProfile) -> zbus::Result<()>;
|
||||
|
||||
/// Set if the PPT tuning group for the current profile is enabled
|
||||
#[zbus(property)]
|
||||
fn enable_ppt_group(&self) -> zbus::Result<bool>;
|
||||
|
||||
/// Set if the PPT tuning group for the current profile is enabled
|
||||
#[zbus(property)]
|
||||
fn set_enable_ppt_group(&self, enable: bool) -> zbus::Result<()>;
|
||||
}
|
||||
|
||||
@@ -2,6 +2,7 @@ use std::fs::{read_dir, File, OpenOptions};
|
||||
use std::io::{Read, Write};
|
||||
use std::path::{Path, PathBuf};
|
||||
|
||||
use log::debug;
|
||||
use serde::{Deserialize, Serialize};
|
||||
use zbus::zvariant::{OwnedValue, Type, Value};
|
||||
|
||||
@@ -75,12 +76,21 @@ impl Attribute {
|
||||
}
|
||||
}
|
||||
|
||||
pub fn base_path_exists(&self) -> bool {
|
||||
let exists = self.base_path.exists();
|
||||
debug!(
|
||||
"Attribute path {:?} exits? {exists}",
|
||||
self.base_path.as_os_str()
|
||||
);
|
||||
exists
|
||||
}
|
||||
|
||||
/// 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 +104,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 +171,28 @@ impl Attribute {
|
||||
default_value, possible_values, min_value, max_value, scalar_increment
|
||||
)
|
||||
}
|
||||
|
||||
pub fn get_watcher(&self, attr: &str) -> Result<inotify::Inotify, PlatformError> {
|
||||
let path = self.base_path.join(attr);
|
||||
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>
|
||||
}
|
||||
@@ -230,7 +264,20 @@ define_attribute_getters!(
|
||||
|
||||
/// CamelCase names of the properties. Intended for use with DBUS
|
||||
#[repr(u8)]
|
||||
#[derive(Clone, Copy, Serialize, Deserialize, Type, Value, OwnedValue, PartialEq, PartialOrd)]
|
||||
#[derive(
|
||||
Clone,
|
||||
Copy,
|
||||
Serialize,
|
||||
Deserialize,
|
||||
Type,
|
||||
Value,
|
||||
OwnedValue,
|
||||
PartialEq,
|
||||
Eq,
|
||||
PartialOrd,
|
||||
Ord,
|
||||
Hash,
|
||||
)]
|
||||
#[zvariant(signature = "s")]
|
||||
pub enum FirmwareAttribute {
|
||||
ApuMem = 0,
|
||||
@@ -238,25 +285,49 @@ pub enum FirmwareAttribute {
|
||||
CoresEfficiency = 2,
|
||||
PptPl1Spl = 3,
|
||||
PptPl2Sppt = 4,
|
||||
PptApuSppt = 5,
|
||||
PptPlatformSppt = 6,
|
||||
PptFppt = 7,
|
||||
NvDynamicBoost = 8,
|
||||
NvTempTarget = 9,
|
||||
DgpuBaseTgp = 10,
|
||||
DgpuTgp = 11,
|
||||
ChargeMode = 12,
|
||||
BootSound = 13,
|
||||
McuPowersave = 14,
|
||||
PanelOverdrive = 15,
|
||||
PanelHdMode = 16,
|
||||
EgpuConnected = 17,
|
||||
EgpuEnable = 18,
|
||||
DgpuDisable = 19,
|
||||
GpuMuxMode = 20,
|
||||
MiniLedMode = 21,
|
||||
PendingReboot = 22,
|
||||
None = 23
|
||||
PptPl3Fppt = 5,
|
||||
PptFppt = 6,
|
||||
PptApuSppt = 7,
|
||||
PptPlatformSppt = 8,
|
||||
NvDynamicBoost = 9,
|
||||
NvTempTarget = 10,
|
||||
DgpuBaseTgp = 11,
|
||||
DgpuTgp = 12,
|
||||
ChargeMode = 13,
|
||||
BootSound = 14,
|
||||
McuPowersave = 15,
|
||||
PanelOverdrive = 16,
|
||||
PanelHdMode = 17,
|
||||
EgpuConnected = 18,
|
||||
EgpuEnable = 19,
|
||||
DgpuDisable = 20,
|
||||
GpuMuxMode = 21,
|
||||
MiniLedMode = 22,
|
||||
PendingReboot = 23,
|
||||
None = 24
|
||||
}
|
||||
|
||||
impl FirmwareAttribute {
|
||||
pub fn is_ppt(&self) -> bool {
|
||||
matches!(
|
||||
self,
|
||||
FirmwareAttribute::PptPl1Spl
|
||||
| FirmwareAttribute::PptPl2Sppt
|
||||
| FirmwareAttribute::PptPl3Fppt
|
||||
| FirmwareAttribute::PptFppt
|
||||
| FirmwareAttribute::PptApuSppt
|
||||
| FirmwareAttribute::PptPlatformSppt
|
||||
)
|
||||
}
|
||||
|
||||
pub fn is_dgpu(&self) -> bool {
|
||||
matches!(
|
||||
self,
|
||||
FirmwareAttribute::NvDynamicBoost
|
||||
| FirmwareAttribute::NvTempTarget
|
||||
| FirmwareAttribute::DgpuTgp
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
impl From<&str> for FirmwareAttribute {
|
||||
@@ -267,12 +338,13 @@ impl From<&str> for FirmwareAttribute {
|
||||
"cores_efficiency" => Self::CoresEfficiency,
|
||||
"ppt_pl1_spl" => Self::PptPl1Spl,
|
||||
"ppt_pl2_sppt" => Self::PptPl2Sppt,
|
||||
"ppt_pl3_fppt" => Self::PptPl3Fppt,
|
||||
"ppt_fppt" => Self::PptFppt,
|
||||
"ppt_apu_sppt" => Self::PptApuSppt,
|
||||
"ppt_platform_sppt" => Self::PptPlatformSppt,
|
||||
"ppt_fppt" => Self::PptFppt,
|
||||
"nv_dynamic_boost" => Self::NvDynamicBoost,
|
||||
"nv_temp_target" => Self::NvTempTarget,
|
||||
"dgpu_base_tgp" => Self::DgpuBaseTgp,
|
||||
"nv_base_tgp" => Self::DgpuBaseTgp,
|
||||
"dgpu_tgp" => Self::DgpuTgp,
|
||||
"charge_mode" => Self::ChargeMode,
|
||||
"boot_sound" => Self::BootSound,
|
||||
@@ -298,9 +370,10 @@ impl From<FirmwareAttribute> for &str {
|
||||
FirmwareAttribute::CoresEfficiency => "cores_efficiency",
|
||||
FirmwareAttribute::PptPl1Spl => "ppt_pl1_spl",
|
||||
FirmwareAttribute::PptPl2Sppt => "ppt_pl2_sppt",
|
||||
FirmwareAttribute::PptPl3Fppt => "ppt_pl3_fppt",
|
||||
FirmwareAttribute::PptFppt => "ppt_fppt",
|
||||
FirmwareAttribute::PptApuSppt => "ppt_apu_sppt",
|
||||
FirmwareAttribute::PptPlatformSppt => "ppt_platform_sppt",
|
||||
FirmwareAttribute::PptFppt => "ppt_fppt",
|
||||
FirmwareAttribute::NvDynamicBoost => "nv_dynamic_boost",
|
||||
FirmwareAttribute::NvTempTarget => "nv_temp_target",
|
||||
FirmwareAttribute::DgpuBaseTgp => "dgpu_base_tgp",
|
||||
@@ -399,6 +472,6 @@ mod tests {
|
||||
if let AttrValue::Integer(val) = &mut val {
|
||||
*val = 0;
|
||||
}
|
||||
attr.set_current_value(val).unwrap();
|
||||
attr.set_current_value(&val).unwrap();
|
||||
}
|
||||
}
|
||||
@@ -5,7 +5,7 @@ use serde::{Deserialize, Serialize};
|
||||
use zbus::zvariant::{OwnedValue, Type, Value};
|
||||
|
||||
use crate::error::{PlatformError, Result};
|
||||
use crate::platform::ThrottlePolicy;
|
||||
use crate::platform::PlatformProfile;
|
||||
use crate::{read_attr_string, to_device};
|
||||
|
||||
const ATTR_AVAILABLE_GOVERNORS: &str = "cpufreq/scaling_available_governors";
|
||||
@@ -201,12 +201,12 @@ pub enum CPUEPP {
|
||||
Power = 4
|
||||
}
|
||||
|
||||
impl From<ThrottlePolicy> for CPUEPP {
|
||||
fn from(value: ThrottlePolicy) -> Self {
|
||||
impl From<PlatformProfile> for CPUEPP {
|
||||
fn from(value: PlatformProfile) -> Self {
|
||||
match value {
|
||||
ThrottlePolicy::Balanced => CPUEPP::BalancePerformance,
|
||||
ThrottlePolicy::Performance => CPUEPP::Performance,
|
||||
ThrottlePolicy::Quiet => CPUEPP::Power
|
||||
PlatformProfile::Balanced => CPUEPP::BalancePerformance,
|
||||
PlatformProfile::Performance => CPUEPP::Performance,
|
||||
PlatformProfile::Quiet => CPUEPP::Power
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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;
|
||||
|
||||
+46
-106
@@ -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, to_device};
|
||||
|
||||
/// The "platform" device provides access to things like:
|
||||
/// - `dgpu_disable`
|
||||
@@ -24,86 +24,12 @@ 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
|
||||
"throttle_thermal_policy",
|
||||
path
|
||||
);
|
||||
|
||||
attr_string!(
|
||||
/// The acpi platform_profile support
|
||||
"platform_profile",
|
||||
pp_path
|
||||
);
|
||||
|
||||
attr_u8!(
|
||||
/// Package Power Target total of CPU: PL1 on Intel, SPL on AMD.
|
||||
/// Shown on Intel+Nvidia or AMD+Nvidia based systems:
|
||||
/// * min=5, max=250
|
||||
"ppt_pl1_spl",
|
||||
path
|
||||
);
|
||||
|
||||
attr_u8!(
|
||||
/// Slow Package Power Tracking Limit of CPU: PL2 on Intel, SPPT,
|
||||
/// on AMD. Shown on Intel+Nvidia or AMD+Nvidia based systems:
|
||||
/// * min=5, max=250
|
||||
"ppt_pl2_sppt",
|
||||
path
|
||||
);
|
||||
|
||||
attr_u8!(
|
||||
/// Fast Package Power Tracking Limit of CPU. AMD+Nvidia only:
|
||||
/// * min=5, max=250
|
||||
"ppt_fppt",
|
||||
path
|
||||
);
|
||||
|
||||
attr_u8!(
|
||||
/// APU SPPT limit. Shown on full AMD systems only:
|
||||
/// * min=5, max=130
|
||||
"ppt_apu_sppt",
|
||||
path
|
||||
);
|
||||
|
||||
attr_u8!(
|
||||
/// Platform SPPT limit. Shown on full AMD systems only:
|
||||
/// * min=5, max=130
|
||||
"ppt_platform_sppt",
|
||||
path
|
||||
);
|
||||
|
||||
attr_u8!(
|
||||
/// Dynamic boost limit of the Nvidia dGPU:
|
||||
/// * min=5, max=25
|
||||
"nv_dynamic_boost",
|
||||
path
|
||||
);
|
||||
|
||||
attr_u8!(
|
||||
/// Target temperature limit of the Nvidia dGPU:
|
||||
/// * min=75, max=87
|
||||
"nv_temp_target",
|
||||
path
|
||||
);
|
||||
|
||||
attr_bool!(
|
||||
/// Control the POST animation "FWOOoosh" sound
|
||||
"boot_sound",
|
||||
path
|
||||
);
|
||||
|
||||
pub fn new() -> Result<Self> {
|
||||
let mut enumerator = udev::Enumerator::new().map_err(|err| {
|
||||
warn!("{}", err);
|
||||
@@ -255,21 +181,20 @@ impl Display for GpuMode {
|
||||
PartialEq,
|
||||
Eq,
|
||||
PartialOrd,
|
||||
Ord,
|
||||
Hash,
|
||||
Clone,
|
||||
Copy,
|
||||
)]
|
||||
#[zvariant(signature = "u")]
|
||||
/// `throttle_thermal_policy` in asus_wmi
|
||||
pub enum ThrottlePolicy {
|
||||
/// `platform_profile` in asus_wmi
|
||||
pub enum PlatformProfile {
|
||||
#[default]
|
||||
Balanced = 0,
|
||||
Performance = 1,
|
||||
Quiet = 2
|
||||
}
|
||||
|
||||
impl ThrottlePolicy {
|
||||
impl PlatformProfile {
|
||||
pub const fn next(self) -> Self {
|
||||
match self {
|
||||
Self::Balanced => Self::Performance,
|
||||
@@ -287,7 +212,7 @@ impl ThrottlePolicy {
|
||||
}
|
||||
}
|
||||
|
||||
impl From<u8> for ThrottlePolicy {
|
||||
impl From<u8> for PlatformProfile {
|
||||
fn from(num: u8) -> Self {
|
||||
match num {
|
||||
0 => Self::Balanced,
|
||||
@@ -301,52 +226,74 @@ impl From<u8> for ThrottlePolicy {
|
||||
}
|
||||
}
|
||||
|
||||
impl From<i32> for ThrottlePolicy {
|
||||
impl From<i32> for PlatformProfile {
|
||||
fn from(num: i32) -> Self {
|
||||
(num as u8).into()
|
||||
}
|
||||
}
|
||||
|
||||
impl From<ThrottlePolicy> for u8 {
|
||||
fn from(p: ThrottlePolicy) -> Self {
|
||||
impl From<PlatformProfile> for u8 {
|
||||
fn from(p: PlatformProfile) -> Self {
|
||||
match p {
|
||||
ThrottlePolicy::Balanced => 0,
|
||||
ThrottlePolicy::Performance => 1,
|
||||
ThrottlePolicy::Quiet => 2
|
||||
PlatformProfile::Balanced => 0,
|
||||
PlatformProfile::Performance => 1,
|
||||
PlatformProfile::Quiet => 2
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
impl From<ThrottlePolicy> for i32 {
|
||||
fn from(p: ThrottlePolicy) -> Self {
|
||||
impl From<PlatformProfile> for i32 {
|
||||
fn from(p: PlatformProfile) -> Self {
|
||||
<u8>::from(p) as i32
|
||||
}
|
||||
}
|
||||
|
||||
impl From<ThrottlePolicy> for &str {
|
||||
fn from(profile: ThrottlePolicy) -> &'static str {
|
||||
impl From<PlatformProfile> for &str {
|
||||
fn from(profile: PlatformProfile) -> &'static str {
|
||||
match profile {
|
||||
ThrottlePolicy::Balanced => "balanced",
|
||||
ThrottlePolicy::Performance => "performance",
|
||||
ThrottlePolicy::Quiet => "quiet"
|
||||
PlatformProfile::Balanced => "balanced",
|
||||
PlatformProfile::Performance => "performance",
|
||||
PlatformProfile::Quiet => "quiet"
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
impl std::str::FromStr for ThrottlePolicy {
|
||||
impl From<String> for PlatformProfile {
|
||||
fn from(profile: String) -> Self {
|
||||
Self::from(&profile)
|
||||
}
|
||||
}
|
||||
|
||||
impl From<&String> for PlatformProfile {
|
||||
fn from(profile: &String) -> Self {
|
||||
match profile.to_ascii_lowercase().trim() {
|
||||
"balanced" => PlatformProfile::Balanced,
|
||||
"performance" => PlatformProfile::Performance,
|
||||
"quiet" => PlatformProfile::Quiet,
|
||||
"low-power" => PlatformProfile::Quiet,
|
||||
_ => {
|
||||
warn!("{profile} is unknown, using ThrottlePolicy::Balanced");
|
||||
PlatformProfile::Balanced
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
impl std::str::FromStr for PlatformProfile {
|
||||
type Err = PlatformError;
|
||||
|
||||
fn from_str(profile: &str) -> Result<Self> {
|
||||
match profile.to_ascii_lowercase().trim() {
|
||||
"balanced" => Ok(ThrottlePolicy::Balanced),
|
||||
"performance" => Ok(ThrottlePolicy::Performance),
|
||||
"quiet" => Ok(ThrottlePolicy::Quiet),
|
||||
"balanced" => Ok(PlatformProfile::Balanced),
|
||||
"performance" => Ok(PlatformProfile::Performance),
|
||||
"quiet" => Ok(PlatformProfile::Quiet),
|
||||
"low-power" => Ok(PlatformProfile::Quiet),
|
||||
_ => Err(PlatformError::NotSupported)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
impl Display for ThrottlePolicy {
|
||||
impl Display for PlatformProfile {
|
||||
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
|
||||
write!(f, "{:?}", self)
|
||||
}
|
||||
@@ -364,12 +311,5 @@ pub enum Properties {
|
||||
PanelOd,
|
||||
MiniLedMode,
|
||||
EgpuEnable,
|
||||
ThrottlePolicy,
|
||||
PptPl1Spl,
|
||||
PptPl2Sppt,
|
||||
PptFppt,
|
||||
PptApuSppt,
|
||||
PptPlatformSppt,
|
||||
NvDynamicBoost,
|
||||
NvTempTarget
|
||||
ThrottlePolicy
|
||||
}
|
||||
|
||||
+30
-30
@@ -4,7 +4,7 @@ pub mod fan_curve_set;
|
||||
use error::ProfileError;
|
||||
use fan_curve_set::CurveData;
|
||||
use log::debug;
|
||||
use rog_platform::platform::ThrottlePolicy;
|
||||
use rog_platform::platform::PlatformProfile;
|
||||
use serde::{Deserialize, Serialize};
|
||||
pub use udev::Device;
|
||||
#[cfg(feature = "dbus")]
|
||||
@@ -125,7 +125,7 @@ impl FanCurveProfiles {
|
||||
|
||||
pub fn read_from_dev_profile(
|
||||
&mut self,
|
||||
profile: ThrottlePolicy,
|
||||
profile: PlatformProfile,
|
||||
device: &Device
|
||||
) -> Result<(), ProfileError> {
|
||||
let fans = Self::supported_fans()?;
|
||||
@@ -143,9 +143,9 @@ impl FanCurveProfiles {
|
||||
}
|
||||
|
||||
match profile {
|
||||
ThrottlePolicy::Balanced => self.balanced = curves,
|
||||
ThrottlePolicy::Performance => self.performance = curves,
|
||||
ThrottlePolicy::Quiet => self.quiet = curves
|
||||
PlatformProfile::Balanced => self.balanced = curves,
|
||||
PlatformProfile::Performance => self.performance = curves,
|
||||
PlatformProfile::Quiet => self.quiet = curves
|
||||
}
|
||||
Ok(())
|
||||
}
|
||||
@@ -157,7 +157,7 @@ impl FanCurveProfiles {
|
||||
/// read only for the currently active profile.
|
||||
pub fn set_active_curve_to_defaults(
|
||||
&mut self,
|
||||
profile: ThrottlePolicy,
|
||||
profile: PlatformProfile,
|
||||
device: &mut Device
|
||||
) -> Result<(), ProfileError> {
|
||||
let fans = Self::supported_fans()?;
|
||||
@@ -175,13 +175,13 @@ impl FanCurveProfiles {
|
||||
/// in the enabled list it will become active.
|
||||
pub fn write_profile_curve_to_platform(
|
||||
&mut self,
|
||||
profile: ThrottlePolicy,
|
||||
profile: PlatformProfile,
|
||||
device: &mut Device
|
||||
) -> Result<(), ProfileError> {
|
||||
let fans = match profile {
|
||||
ThrottlePolicy::Balanced => &mut self.balanced,
|
||||
ThrottlePolicy::Performance => &mut self.performance,
|
||||
ThrottlePolicy::Quiet => &mut self.quiet
|
||||
PlatformProfile::Balanced => &mut self.balanced,
|
||||
PlatformProfile::Performance => &mut self.performance,
|
||||
PlatformProfile::Quiet => &mut self.quiet
|
||||
};
|
||||
for fan in fans.iter().filter(|f| !f.enabled) {
|
||||
debug!("write_profile_curve_to_platform: writing profile:{profile}, {fan:?}");
|
||||
@@ -196,19 +196,19 @@ impl FanCurveProfiles {
|
||||
Ok(())
|
||||
}
|
||||
|
||||
pub fn set_profile_curves_enabled(&mut self, profile: ThrottlePolicy, enabled: bool) {
|
||||
pub fn set_profile_curves_enabled(&mut self, profile: PlatformProfile, enabled: bool) {
|
||||
match profile {
|
||||
ThrottlePolicy::Balanced => {
|
||||
PlatformProfile::Balanced => {
|
||||
for curve in self.balanced.iter_mut() {
|
||||
curve.enabled = enabled;
|
||||
}
|
||||
}
|
||||
ThrottlePolicy::Performance => {
|
||||
PlatformProfile::Performance => {
|
||||
for curve in self.performance.iter_mut() {
|
||||
curve.enabled = enabled;
|
||||
}
|
||||
}
|
||||
ThrottlePolicy::Quiet => {
|
||||
PlatformProfile::Quiet => {
|
||||
for curve in self.quiet.iter_mut() {
|
||||
curve.enabled = enabled;
|
||||
}
|
||||
@@ -218,12 +218,12 @@ impl FanCurveProfiles {
|
||||
|
||||
pub fn set_profile_fan_curve_enabled(
|
||||
&mut self,
|
||||
profile: ThrottlePolicy,
|
||||
profile: PlatformProfile,
|
||||
fan: FanCurvePU,
|
||||
enabled: bool
|
||||
) {
|
||||
match profile {
|
||||
ThrottlePolicy::Balanced => {
|
||||
PlatformProfile::Balanced => {
|
||||
for curve in self.balanced.iter_mut() {
|
||||
if curve.fan == fan {
|
||||
curve.enabled = enabled;
|
||||
@@ -231,7 +231,7 @@ impl FanCurveProfiles {
|
||||
}
|
||||
}
|
||||
}
|
||||
ThrottlePolicy::Performance => {
|
||||
PlatformProfile::Performance => {
|
||||
for curve in self.performance.iter_mut() {
|
||||
if curve.fan == fan {
|
||||
curve.enabled = enabled;
|
||||
@@ -239,7 +239,7 @@ impl FanCurveProfiles {
|
||||
}
|
||||
}
|
||||
}
|
||||
ThrottlePolicy::Quiet => {
|
||||
PlatformProfile::Quiet => {
|
||||
for curve in self.quiet.iter_mut() {
|
||||
if curve.fan == fan {
|
||||
curve.enabled = enabled;
|
||||
@@ -250,31 +250,31 @@ impl FanCurveProfiles {
|
||||
}
|
||||
}
|
||||
|
||||
pub fn get_fan_curves_for(&self, name: ThrottlePolicy) -> &[CurveData] {
|
||||
pub fn get_fan_curves_for(&self, name: PlatformProfile) -> &[CurveData] {
|
||||
match name {
|
||||
ThrottlePolicy::Balanced => &self.balanced,
|
||||
ThrottlePolicy::Performance => &self.performance,
|
||||
ThrottlePolicy::Quiet => &self.quiet
|
||||
PlatformProfile::Balanced => &self.balanced,
|
||||
PlatformProfile::Performance => &self.performance,
|
||||
PlatformProfile::Quiet => &self.quiet
|
||||
}
|
||||
}
|
||||
|
||||
pub fn get_fan_curve_for(&self, name: &ThrottlePolicy, pu: FanCurvePU) -> Option<&CurveData> {
|
||||
pub fn get_fan_curve_for(&self, name: &PlatformProfile, pu: FanCurvePU) -> Option<&CurveData> {
|
||||
match name {
|
||||
ThrottlePolicy::Balanced => {
|
||||
PlatformProfile::Balanced => {
|
||||
for this_curve in self.balanced.iter() {
|
||||
if this_curve.fan == pu {
|
||||
return Some(this_curve);
|
||||
}
|
||||
}
|
||||
}
|
||||
ThrottlePolicy::Performance => {
|
||||
PlatformProfile::Performance => {
|
||||
for this_curve in self.performance.iter() {
|
||||
if this_curve.fan == pu {
|
||||
return Some(this_curve);
|
||||
}
|
||||
}
|
||||
}
|
||||
ThrottlePolicy::Quiet => {
|
||||
PlatformProfile::Quiet => {
|
||||
for this_curve in self.quiet.iter() {
|
||||
if this_curve.fan == pu {
|
||||
return Some(this_curve);
|
||||
@@ -288,10 +288,10 @@ impl FanCurveProfiles {
|
||||
pub fn save_fan_curve(
|
||||
&mut self,
|
||||
curve: CurveData,
|
||||
profile: ThrottlePolicy
|
||||
profile: PlatformProfile
|
||||
) -> Result<(), ProfileError> {
|
||||
match profile {
|
||||
ThrottlePolicy::Balanced => {
|
||||
PlatformProfile::Balanced => {
|
||||
for this_curve in self.balanced.iter_mut() {
|
||||
if this_curve.fan == curve.fan {
|
||||
*this_curve = curve;
|
||||
@@ -299,7 +299,7 @@ impl FanCurveProfiles {
|
||||
}
|
||||
}
|
||||
}
|
||||
ThrottlePolicy::Performance => {
|
||||
PlatformProfile::Performance => {
|
||||
for this_curve in self.performance.iter_mut() {
|
||||
if this_curve.fan == curve.fan {
|
||||
*this_curve = curve;
|
||||
@@ -307,7 +307,7 @@ impl FanCurveProfiles {
|
||||
}
|
||||
}
|
||||
}
|
||||
ThrottlePolicy::Quiet => {
|
||||
PlatformProfile::Quiet => {
|
||||
for this_curve in self.quiet.iter_mut() {
|
||||
if this_curve.fan == curve.fan {
|
||||
*this_curve = curve;
|
||||
|
||||
Reference in New Issue
Block a user