mirror of
https://gitlab.com/asus-linux/asusctl.git
synced 2026-02-06 00:15:04 +01:00
Compare commits
7 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| e90375828d | |||
| 75b4d67072 | |||
| 9aa332de3b | |||
| 5efd7fc6a7 | |||
| 0aafe24a02 | |||
| dda6d343d9 | |||
| 6f39307080 |
@@ -6,6 +6,18 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
|||||||
|
|
||||||
## [Unreleased]
|
## [Unreleased]
|
||||||
|
|
||||||
|
## [v5.0.2]
|
||||||
|
### Changed
|
||||||
|
- Fan-curves: nuke a few async deadlocks
|
||||||
|
- Anime: force power/wakeup disabled to prevent idiotic random wakes
|
||||||
|
|
||||||
|
## [v5.0.1]
|
||||||
|
### Changed
|
||||||
|
- Fix setting next fan profile
|
||||||
|
- Fix the assud.service
|
||||||
|
- Fix dbus signature of some power setting types for some keyboards
|
||||||
|
|
||||||
|
## [v5.0.0]
|
||||||
### Added
|
### Added
|
||||||
- Gnome 45 plugin
|
- Gnome 45 plugin
|
||||||
- Support for G513RW LED modes
|
- Support for G513RW LED modes
|
||||||
|
|||||||
Generated
+14
-13
@@ -199,7 +199,7 @@ checksum = "96d30a06541fbafbc7f82ed10c06164cfbd2c401138f6addd8404629c4b16711"
|
|||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "asusctl"
|
name = "asusctl"
|
||||||
version = "5.0.0"
|
version = "5.0.2"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"asusd",
|
"asusd",
|
||||||
"cargo-husky",
|
"cargo-husky",
|
||||||
@@ -218,7 +218,7 @@ dependencies = [
|
|||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "asusd"
|
name = "asusd"
|
||||||
version = "5.0.0"
|
version = "5.0.2"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"async-trait",
|
"async-trait",
|
||||||
"cargo-husky",
|
"cargo-husky",
|
||||||
@@ -237,12 +237,13 @@ dependencies = [
|
|||||||
"serde_derive",
|
"serde_derive",
|
||||||
"systemd-zbus",
|
"systemd-zbus",
|
||||||
"tokio",
|
"tokio",
|
||||||
|
"udev",
|
||||||
"zbus",
|
"zbus",
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "asusd-user"
|
name = "asusd-user"
|
||||||
version = "5.0.0"
|
version = "5.0.2"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"cargo-husky",
|
"cargo-husky",
|
||||||
"config-traits",
|
"config-traits",
|
||||||
@@ -845,7 +846,7 @@ dependencies = [
|
|||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "config-traits"
|
name = "config-traits"
|
||||||
version = "5.0.0"
|
version = "5.0.2"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"cargo-husky",
|
"cargo-husky",
|
||||||
"log",
|
"log",
|
||||||
@@ -898,7 +899,7 @@ dependencies = [
|
|||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "cpuctl"
|
name = "cpuctl"
|
||||||
version = "5.0.0"
|
version = "5.0.2"
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "cpufeatures"
|
name = "cpufeatures"
|
||||||
@@ -1025,7 +1026,7 @@ dependencies = [
|
|||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "dmi_id"
|
name = "dmi_id"
|
||||||
version = "5.0.0"
|
version = "5.0.2"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"log",
|
"log",
|
||||||
"udev",
|
"udev",
|
||||||
@@ -2845,7 +2846,7 @@ checksum = "c08c74e62047bb2de4ff487b251e4a92e24f48745648451635cec7d591162d9f"
|
|||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "rog-control-center"
|
name = "rog-control-center"
|
||||||
version = "5.0.0"
|
version = "5.0.2"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"asusd",
|
"asusd",
|
||||||
"cargo-husky",
|
"cargo-husky",
|
||||||
@@ -2878,7 +2879,7 @@ dependencies = [
|
|||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "rog_anime"
|
name = "rog_anime"
|
||||||
version = "5.0.0"
|
version = "5.0.2"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"cargo-husky",
|
"cargo-husky",
|
||||||
"dmi_id",
|
"dmi_id",
|
||||||
@@ -2895,7 +2896,7 @@ dependencies = [
|
|||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "rog_aura"
|
name = "rog_aura"
|
||||||
version = "5.0.0"
|
version = "5.0.2"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"cargo-husky",
|
"cargo-husky",
|
||||||
"dmi_id",
|
"dmi_id",
|
||||||
@@ -2909,7 +2910,7 @@ dependencies = [
|
|||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "rog_dbus"
|
name = "rog_dbus"
|
||||||
version = "5.0.0"
|
version = "5.0.2"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"asusd",
|
"asusd",
|
||||||
"cargo-husky",
|
"cargo-husky",
|
||||||
@@ -2922,7 +2923,7 @@ dependencies = [
|
|||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "rog_platform"
|
name = "rog_platform"
|
||||||
version = "5.0.0"
|
version = "5.0.2"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"cargo-husky",
|
"cargo-husky",
|
||||||
"concat-idents",
|
"concat-idents",
|
||||||
@@ -2939,7 +2940,7 @@ dependencies = [
|
|||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "rog_profiles"
|
name = "rog_profiles"
|
||||||
version = "5.0.0"
|
version = "5.0.2"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"cargo-husky",
|
"cargo-husky",
|
||||||
"log",
|
"log",
|
||||||
@@ -2953,7 +2954,7 @@ dependencies = [
|
|||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "rog_simulators"
|
name = "rog_simulators"
|
||||||
version = "5.0.0"
|
version = "5.0.2"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"glam",
|
"glam",
|
||||||
"log",
|
"log",
|
||||||
|
|||||||
+2
-2
@@ -4,11 +4,11 @@ default-members = ["asusctl", "asusd", "asusd-user", "cpuctl", "rog-control-cent
|
|||||||
resolver = "2"
|
resolver = "2"
|
||||||
|
|
||||||
[workspace.package]
|
[workspace.package]
|
||||||
version = "5.0.0"
|
version = "5.0.2"
|
||||||
|
|
||||||
[workspace.dependencies]
|
[workspace.dependencies]
|
||||||
async-trait = "^0.1"
|
async-trait = "^0.1"
|
||||||
tokio = { version = "^1.23.0", features = ["macros", "sync", "rt-multi-thread"]}
|
tokio = { version = "^1.23.0", default-features = false, features = ["macros", "sync"]}
|
||||||
concat-idents = "^1.1"
|
concat-idents = "^1.1"
|
||||||
dirs = "^4.0"
|
dirs = "^4.0"
|
||||||
smol = "^1.3"
|
smol = "^1.3"
|
||||||
|
|||||||
@@ -21,6 +21,7 @@ rog_platform = { path = "../rog-platform" }
|
|||||||
rog_profiles = { path = "../rog-profiles" }
|
rog_profiles = { path = "../rog-profiles" }
|
||||||
dmi_id = { path = "../dmi-id" }
|
dmi_id = { path = "../dmi-id" }
|
||||||
futures-lite = "*"
|
futures-lite = "*"
|
||||||
|
udev.workspace = true
|
||||||
|
|
||||||
async-trait.workspace = true
|
async-trait.workspace = true
|
||||||
tokio.workspace = true
|
tokio.workspace = true
|
||||||
|
|||||||
@@ -73,6 +73,20 @@ impl CtrlAnime {
|
|||||||
return Err(RogError::Anime(AnimeError::NoDevice));
|
return Err(RogError::Anime(AnimeError::NoDevice));
|
||||||
};
|
};
|
||||||
|
|
||||||
|
// TODO: something better to set wakeups disabled
|
||||||
|
if matches!(node, Node::Usb(_)) {
|
||||||
|
if let Ok(mut enumerator) = udev::Enumerator::new() {
|
||||||
|
enumerator.match_subsystem("usb").ok();
|
||||||
|
enumerator.match_attribute("idProduct", "193b").ok();
|
||||||
|
|
||||||
|
if let Ok(mut enumer) = enumerator.scan_devices() {
|
||||||
|
if let Some(mut dev) = enumer.next() {
|
||||||
|
dev.set_attribute_value("power/wakeup", "disabled").ok();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
let mut anime_type = get_anime_type()?;
|
let mut anime_type = get_anime_type()?;
|
||||||
if let AnimeType::Unknown = anime_type {
|
if let AnimeType::Unknown = anime_type {
|
||||||
if let Some(model) = config.model_override {
|
if let Some(model) = config.model_override {
|
||||||
|
|||||||
@@ -277,6 +277,15 @@ impl crate::CtrlTask for CtrlAnimeZbus {
|
|||||||
async move {
|
async move {
|
||||||
let lock = inner.lock().await;
|
let lock = inner.lock().await;
|
||||||
if lock.config.display_enabled {
|
if lock.config.display_enabled {
|
||||||
|
lock.node
|
||||||
|
.write_bytes(&pkt_set_enable_powersave_anim(
|
||||||
|
!(sleeping && lock.config.off_when_suspended),
|
||||||
|
))
|
||||||
|
.map_err(|err| {
|
||||||
|
warn!("create_sys_event_tasks::off_when_suspended {}", err);
|
||||||
|
})
|
||||||
|
.ok();
|
||||||
|
|
||||||
lock.thread_exit.store(true, Ordering::Release); // ensure clean slate
|
lock.thread_exit.store(true, Ordering::Release); // ensure clean slate
|
||||||
lock.node
|
lock.node
|
||||||
.write_bytes(&pkt_set_enable_display(
|
.write_bytes(&pkt_set_enable_display(
|
||||||
@@ -316,8 +325,16 @@ impl crate::CtrlTask for CtrlAnimeZbus {
|
|||||||
async move {
|
async move {
|
||||||
let lock = inner.lock().await;
|
let lock = inner.lock().await;
|
||||||
if lock.config.off_when_lid_closed {
|
if lock.config.off_when_lid_closed {
|
||||||
|
if lock.config.builtin_anims_enabled {
|
||||||
|
lock.node
|
||||||
|
.write_bytes(&pkt_set_enable_powersave_anim(!lid_closed))
|
||||||
|
.map_err(|err| {
|
||||||
|
warn!("create_sys_event_tasks::off_when_suspended {}", err);
|
||||||
|
})
|
||||||
|
.ok();
|
||||||
|
}
|
||||||
lock.node
|
lock.node
|
||||||
.write_bytes(&pkt_set_enable_display(lid_closed))
|
.write_bytes(&pkt_set_enable_display(!lid_closed))
|
||||||
.map_err(|err| {
|
.map_err(|err| {
|
||||||
warn!("create_sys_event_tasks::off_when_lid_closed {}", err);
|
warn!("create_sys_event_tasks::off_when_lid_closed {}", err);
|
||||||
})
|
})
|
||||||
@@ -331,6 +348,14 @@ impl crate::CtrlTask for CtrlAnimeZbus {
|
|||||||
async move {
|
async move {
|
||||||
let lock = inner.lock().await;
|
let lock = inner.lock().await;
|
||||||
if lock.config.off_when_unplugged {
|
if lock.config.off_when_unplugged {
|
||||||
|
if lock.config.builtin_anims_enabled {
|
||||||
|
lock.node
|
||||||
|
.write_bytes(&pkt_set_enable_powersave_anim(power_plugged))
|
||||||
|
.map_err(|err| {
|
||||||
|
warn!("create_sys_event_tasks::off_when_suspended {}", err);
|
||||||
|
})
|
||||||
|
.ok();
|
||||||
|
}
|
||||||
lock.node
|
lock.node
|
||||||
.write_bytes(&pkt_set_enable_display(power_plugged))
|
.write_bytes(&pkt_set_enable_display(power_plugged))
|
||||||
.map_err(|err| {
|
.map_err(|err| {
|
||||||
|
|||||||
+50
-32
@@ -109,19 +109,18 @@ impl CtrlFanCurveZbus {
|
|||||||
}
|
}
|
||||||
|
|
||||||
pub async fn update_profiles_from_config(&self) {
|
pub async fn update_profiles_from_config(&self) {
|
||||||
let mut fan_curves = self.fan_curves.lock().await;
|
self.fan_curves.lock().await.balanced = self.config.lock().await.balanced.clone();
|
||||||
let config = self.config.lock().await;
|
self.fan_curves.lock().await.performance = self.config.lock().await.performance.clone();
|
||||||
fan_curves.balanced = config.balanced.clone();
|
self.fan_curves.lock().await.quiet = self.config.lock().await.quiet.clone();
|
||||||
fan_curves.performance = config.performance.clone();
|
|
||||||
fan_curves.quiet = config.quiet.clone();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// Because this locks both config and fan_curves, it means nothing else can
|
||||||
|
/// hold a lock across this function call. Stupid choice to do this and
|
||||||
|
/// needs to be fixed.
|
||||||
pub async fn update_config_from_profiles(&self) {
|
pub async fn update_config_from_profiles(&self) {
|
||||||
let fan_curves = self.fan_curves.lock().await;
|
self.config.lock().await.balanced = self.fan_curves.lock().await.balanced.clone();
|
||||||
let mut config = self.config.lock().await;
|
self.config.lock().await.performance = self.fan_curves.lock().await.performance.clone();
|
||||||
config.balanced = fan_curves.balanced.clone();
|
self.config.lock().await.quiet = self.fan_curves.lock().await.quiet.clone();
|
||||||
config.performance = fan_curves.performance.clone();
|
|
||||||
config.quiet = fan_curves.quiet.clone();
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -134,10 +133,14 @@ impl CtrlFanCurveZbus {
|
|||||||
profile: PlatformPolicy,
|
profile: PlatformPolicy,
|
||||||
enabled: bool,
|
enabled: bool,
|
||||||
) -> zbus::fdo::Result<()> {
|
) -> zbus::fdo::Result<()> {
|
||||||
let mut fan_curves = self.fan_curves.lock().await;
|
self.fan_curves
|
||||||
fan_curves.set_profile_curves_enabled(profile, enabled);
|
.lock()
|
||||||
fan_curves.write_profile_curve_to_platform(profile, &mut find_fan_curve_node()?)?;
|
.await
|
||||||
|
.set_profile_curves_enabled(profile, enabled);
|
||||||
|
self.fan_curves
|
||||||
|
.lock()
|
||||||
|
.await
|
||||||
|
.write_profile_curve_to_platform(profile, &mut find_fan_curve_node()?)?;
|
||||||
self.update_config_from_profiles().await;
|
self.update_config_from_profiles().await;
|
||||||
self.config.lock().await.write();
|
self.config.lock().await.write();
|
||||||
Ok(())
|
Ok(())
|
||||||
@@ -151,10 +154,14 @@ impl CtrlFanCurveZbus {
|
|||||||
fan: FanCurvePU,
|
fan: FanCurvePU,
|
||||||
enabled: bool,
|
enabled: bool,
|
||||||
) -> zbus::fdo::Result<()> {
|
) -> zbus::fdo::Result<()> {
|
||||||
let mut fan_curves = self.fan_curves.lock().await;
|
self.fan_curves
|
||||||
fan_curves.set_profile_fan_curve_enabled(profile, fan, enabled);
|
.lock()
|
||||||
fan_curves.write_profile_curve_to_platform(profile, &mut find_fan_curve_node()?)?;
|
.await
|
||||||
|
.set_profile_fan_curve_enabled(profile, fan, enabled);
|
||||||
|
self.fan_curves
|
||||||
|
.lock()
|
||||||
|
.await
|
||||||
|
.write_profile_curve_to_platform(profile, &mut find_fan_curve_node()?)?;
|
||||||
self.update_config_from_profiles().await;
|
self.update_config_from_profiles().await;
|
||||||
self.config.lock().await.write();
|
self.config.lock().await.write();
|
||||||
Ok(())
|
Ok(())
|
||||||
@@ -165,9 +172,13 @@ impl CtrlFanCurveZbus {
|
|||||||
&mut self,
|
&mut self,
|
||||||
profile: PlatformPolicy,
|
profile: PlatformPolicy,
|
||||||
) -> zbus::fdo::Result<Vec<CurveData>> {
|
) -> zbus::fdo::Result<Vec<CurveData>> {
|
||||||
let fan_curves = self.fan_curves.lock().await;
|
let curve = self
|
||||||
let curve = fan_curves.get_fan_curves_for(profile);
|
.fan_curves
|
||||||
Ok(curve.to_vec())
|
.lock()
|
||||||
|
.await
|
||||||
|
.get_fan_curves_for(profile)
|
||||||
|
.to_vec();
|
||||||
|
Ok(curve)
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Set the fan curve for the specified profile.
|
/// Set the fan curve for the specified profile.
|
||||||
@@ -177,13 +188,16 @@ impl CtrlFanCurveZbus {
|
|||||||
profile: PlatformPolicy,
|
profile: PlatformPolicy,
|
||||||
curve: CurveData,
|
curve: CurveData,
|
||||||
) -> zbus::fdo::Result<()> {
|
) -> zbus::fdo::Result<()> {
|
||||||
let mut fan_curves = self.fan_curves.lock().await;
|
self.fan_curves
|
||||||
fan_curves.save_fan_curve(curve, profile)?;
|
.lock()
|
||||||
fan_curves.write_profile_curve_to_platform(profile, &mut find_fan_curve_node()?)?;
|
.await
|
||||||
|
.save_fan_curve(curve, profile)?;
|
||||||
|
self.fan_curves
|
||||||
|
.lock()
|
||||||
|
.await
|
||||||
|
.write_profile_curve_to_platform(profile, &mut find_fan_curve_node()?)?;
|
||||||
self.update_config_from_profiles().await;
|
self.update_config_from_profiles().await;
|
||||||
self.config.lock().await.write();
|
self.config.lock().await.write();
|
||||||
|
|
||||||
Ok(())
|
Ok(())
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -193,10 +207,11 @@ impl CtrlFanCurveZbus {
|
|||||||
/// Each platform_profile has a different default and the defualt can be
|
/// Each platform_profile has a different default and the defualt can be
|
||||||
/// read only for the currently active profile.
|
/// read only for the currently active profile.
|
||||||
async fn set_active_curve_to_defaults(&mut self) -> zbus::fdo::Result<()> {
|
async fn set_active_curve_to_defaults(&mut self) -> zbus::fdo::Result<()> {
|
||||||
let mut fan_curves = self.fan_curves.lock().await;
|
|
||||||
let active = self.platform.get_throttle_thermal_policy()?;
|
let active = self.platform.get_throttle_thermal_policy()?;
|
||||||
fan_curves.set_active_curve_to_defaults(active.into(), &mut find_fan_curve_node()?)?;
|
self.fan_curves
|
||||||
|
.lock()
|
||||||
|
.await
|
||||||
|
.set_active_curve_to_defaults(active.into(), &mut find_fan_curve_node()?)?;
|
||||||
self.update_config_from_profiles().await;
|
self.update_config_from_profiles().await;
|
||||||
self.config.lock().await.write();
|
self.config.lock().await.write();
|
||||||
Ok(())
|
Ok(())
|
||||||
@@ -208,15 +223,18 @@ impl CtrlFanCurveZbus {
|
|||||||
/// Each platform_profile has a different default and the defualt can be
|
/// Each platform_profile has a different default and the defualt can be
|
||||||
/// read only for the currently active profile.
|
/// read only for the currently active profile.
|
||||||
async fn reset_profile_curves(&self, profile: PlatformPolicy) -> zbus::fdo::Result<()> {
|
async fn reset_profile_curves(&self, profile: PlatformPolicy) -> zbus::fdo::Result<()> {
|
||||||
let mut fan_curves = self.fan_curves.lock().await;
|
|
||||||
|
|
||||||
let active = self
|
let active = self
|
||||||
.platform
|
.platform
|
||||||
.get_throttle_thermal_policy()
|
.get_throttle_thermal_policy()
|
||||||
.unwrap_or(PlatformPolicy::Balanced.into());
|
.unwrap_or(PlatformPolicy::Balanced.into());
|
||||||
|
|
||||||
self.platform.set_throttle_thermal_policy(profile.into())?;
|
self.platform.set_throttle_thermal_policy(profile.into())?;
|
||||||
fan_curves.set_active_curve_to_defaults(active.into(), &mut find_fan_curve_node()?)?;
|
{
|
||||||
|
self.fan_curves
|
||||||
|
.lock()
|
||||||
|
.await
|
||||||
|
.set_active_curve_to_defaults(active.into(), &mut find_fan_curve_node()?)?;
|
||||||
|
}
|
||||||
self.platform.set_throttle_thermal_policy(active)?;
|
self.platform.set_throttle_thermal_policy(active)?;
|
||||||
|
|
||||||
self.update_config_from_profiles().await;
|
self.update_config_from_profiles().await;
|
||||||
|
|||||||
+23
-16
@@ -4,7 +4,7 @@ use std::sync::Arc;
|
|||||||
use async_trait::async_trait;
|
use async_trait::async_trait;
|
||||||
use config_traits::StdConfig;
|
use config_traits::StdConfig;
|
||||||
use log::{debug, error, info, warn};
|
use log::{debug, error, info, warn};
|
||||||
use rog_platform::cpu::CPUControl;
|
use rog_platform::cpu::{CPUControl, CPUGovernor};
|
||||||
use rog_platform::platform::{GpuMode, PlatformPolicy, Properties, RogPlatform};
|
use rog_platform::platform::{GpuMode, PlatformPolicy, Properties, RogPlatform};
|
||||||
use rog_platform::power::AsusPower;
|
use rog_platform::power::AsusPower;
|
||||||
use zbus::export::futures_util::lock::Mutex;
|
use zbus::export::futures_util::lock::Mutex;
|
||||||
@@ -180,6 +180,23 @@ impl CtrlPlatform {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
fn check_and_set_epp(&self, profile: PlatformPolicy) {
|
||||||
|
info!("PlatformPolicy setting EPP");
|
||||||
|
if let Some(cpu) = self.cpu_control.as_ref() {
|
||||||
|
if let Ok(epp) = cpu.get_available_epp() {
|
||||||
|
debug!("Available EPP: {epp:?}");
|
||||||
|
if epp.contains(&profile.into()) {
|
||||||
|
debug!("Setting {profile:?}");
|
||||||
|
cpu.set_epp(profile.into()).ok();
|
||||||
|
} else if let Ok(gov) = cpu.get_governor() {
|
||||||
|
if gov != CPUGovernor::Powersave {
|
||||||
|
warn!("powersave governor is not is use, you should use it.");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
async fn update_policy_ac_or_bat(&self, power_plugged: bool) {
|
async fn update_policy_ac_or_bat(&self, power_plugged: bool) {
|
||||||
let profile = if power_plugged {
|
let profile = if power_plugged {
|
||||||
self.config.lock().await.platform_policy_on_ac
|
self.config.lock().await.platform_policy_on_ac
|
||||||
@@ -189,9 +206,7 @@ impl CtrlPlatform {
|
|||||||
self.platform
|
self.platform
|
||||||
.set_throttle_thermal_policy(profile.into())
|
.set_throttle_thermal_policy(profile.into())
|
||||||
.ok();
|
.ok();
|
||||||
if let Some(cpu) = self.cpu_control.as_ref() {
|
self.check_and_set_epp(profile);
|
||||||
cpu.set_epp(profile.into()).ok();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -322,12 +337,10 @@ impl CtrlPlatform {
|
|||||||
let policy: PlatformPolicy =
|
let policy: PlatformPolicy =
|
||||||
platform_get_value!(self, throttle_thermal_policy, "throttle_thermal_policy")
|
platform_get_value!(self, throttle_thermal_policy, "throttle_thermal_policy")
|
||||||
.map(|n| n.into())?;
|
.map(|n| n.into())?;
|
||||||
|
let policy = PlatformPolicy::next(&policy);
|
||||||
|
|
||||||
if self.platform.has_throttle_thermal_policy() {
|
if self.platform.has_throttle_thermal_policy() {
|
||||||
if let Some(cpu) = self.cpu_control.as_ref() {
|
self.check_and_set_epp(policy);
|
||||||
info!("PlatformPolicy setting EPP");
|
|
||||||
cpu.set_epp(policy.into())?
|
|
||||||
}
|
|
||||||
self.platform
|
self.platform
|
||||||
.set_throttle_thermal_policy(policy.into())
|
.set_throttle_thermal_policy(policy.into())
|
||||||
.map_err(|err| {
|
.map_err(|err| {
|
||||||
@@ -353,10 +366,7 @@ impl CtrlPlatform {
|
|||||||
async fn set_throttle_thermal_policy(&mut self, policy: PlatformPolicy) -> Result<(), FdoErr> {
|
async fn set_throttle_thermal_policy(&mut self, policy: PlatformPolicy) -> Result<(), FdoErr> {
|
||||||
// TODO: watch for external changes
|
// TODO: watch for external changes
|
||||||
if self.platform.has_throttle_thermal_policy() {
|
if self.platform.has_throttle_thermal_policy() {
|
||||||
if let Some(cpu) = self.cpu_control.as_ref() {
|
self.check_and_set_epp(policy);
|
||||||
info!("PlatformPolicy setting EPP");
|
|
||||||
cpu.set_epp(policy.into())?
|
|
||||||
}
|
|
||||||
self.config.lock().await.platform_policy_to_restore = policy;
|
self.config.lock().await.platform_policy_to_restore = policy;
|
||||||
self.platform
|
self.platform
|
||||||
.set_throttle_thermal_policy(policy.into())
|
.set_throttle_thermal_policy(policy.into())
|
||||||
@@ -687,10 +697,7 @@ impl CtrlTask for CtrlPlatform {
|
|||||||
error!("Platform: get_throttle_thermal_policy error: {e}");
|
error!("Platform: get_throttle_thermal_policy error: {e}");
|
||||||
})
|
})
|
||||||
{
|
{
|
||||||
if let Some(cpu) = ctrl.cpu_control.as_ref() {
|
ctrl.check_and_set_epp(profile);
|
||||||
info!("PlatformPolicy setting EPP");
|
|
||||||
cpu.set_epp(profile.into()).ok();
|
|
||||||
}
|
|
||||||
ctrl.config.lock().await.platform_policy_to_restore = profile;
|
ctrl.config.lock().await.platform_policy_to_restore = profile;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
+1
-1
@@ -2,7 +2,7 @@
|
|||||||
Description=ASUS Notebook Control
|
Description=ASUS Notebook Control
|
||||||
StartLimitInterval=500
|
StartLimitInterval=500
|
||||||
StartLimitBurst=5
|
StartLimitBurst=5
|
||||||
After=nvidia-powerd.service,systemd-udevd.service
|
After=nvidia-powerd.service systemd-udevd.service
|
||||||
|
|
||||||
[Service]
|
[Service]
|
||||||
Environment=IS_SERVICE=1
|
Environment=IS_SERVICE=1
|
||||||
|
|||||||
+2
-2
@@ -137,7 +137,7 @@ pub struct AuraPowerDev {
|
|||||||
#[cfg_attr(
|
#[cfg_attr(
|
||||||
feature = "dbus",
|
feature = "dbus",
|
||||||
derive(Type, Value, OwnedValue),
|
derive(Type, Value, OwnedValue),
|
||||||
zvariant(signature = "s")
|
zvariant(signature = "y")
|
||||||
)]
|
)]
|
||||||
#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, Serialize, Deserialize)]
|
#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, Serialize, Deserialize)]
|
||||||
#[repr(u32)]
|
#[repr(u32)]
|
||||||
@@ -172,7 +172,7 @@ impl AuraDevTuf {
|
|||||||
#[cfg_attr(
|
#[cfg_attr(
|
||||||
feature = "dbus",
|
feature = "dbus",
|
||||||
derive(Type, Value, OwnedValue),
|
derive(Type, Value, OwnedValue),
|
||||||
zvariant(signature = "s")
|
zvariant(signature = "y")
|
||||||
)]
|
)]
|
||||||
#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, Serialize, Deserialize)]
|
#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, Serialize, Deserialize)]
|
||||||
#[repr(u32)]
|
#[repr(u32)]
|
||||||
|
|||||||
@@ -4,6 +4,7 @@ use std::io::Write;
|
|||||||
use std::path::PathBuf;
|
use std::path::PathBuf;
|
||||||
|
|
||||||
use log::{info, warn};
|
use log::{info, warn};
|
||||||
|
use udev::Device;
|
||||||
|
|
||||||
use crate::error::{PlatformError, Result};
|
use crate::error::{PlatformError, Result};
|
||||||
|
|
||||||
@@ -88,4 +89,10 @@ impl HidRaw {
|
|||||||
file.write_all(message)
|
file.write_all(message)
|
||||||
.map_err(|e| PlatformError::IoPath(path.to_string_lossy().to_string(), e))
|
.map_err(|e| PlatformError::IoPath(path.to_string_lossy().to_string(), e))
|
||||||
}
|
}
|
||||||
|
|
||||||
|
pub fn set_wakeup_disabled(&self) -> Result<()> {
|
||||||
|
let path = unsafe { &*(self.path.get()) };
|
||||||
|
let mut dev = Device::from_syspath(path)?;
|
||||||
|
Ok(dev.set_attribute_value("power/wakeup", "disabled")?)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -278,7 +278,7 @@ pub enum PlatformPolicy {
|
|||||||
impl PlatformPolicy {
|
impl PlatformPolicy {
|
||||||
pub const fn next(&self) -> Self {
|
pub const fn next(&self) -> Self {
|
||||||
match self {
|
match self {
|
||||||
Self::Balanced => Self::Balanced,
|
Self::Balanced => Self::Performance,
|
||||||
Self::Performance => Self::Quiet,
|
Self::Performance => Self::Quiet,
|
||||||
Self::Quiet => Self::Balanced,
|
Self::Quiet => Self::Balanced,
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user