From 40b46337b45612cc8dd6afc6e63f631aa9384441 Mon Sep 17 00:00:00 2001 From: "NGnius (Graham)" Date: Mon, 4 Sep 2023 17:46:19 -0400 Subject: [PATCH] Try resetting clocks as well as forcing them to min/max range --- backend/Cargo.lock | 4 +++- backend/Cargo.toml | 6 +++--- backend/limits_core/src/json/base.rs | 2 +- backend/src/settings/steam_deck/cpu.rs | 16 ++++++++++++++++ package.json | 2 +- 5 files changed, 24 insertions(+), 6 deletions(-) diff --git a/backend/Cargo.lock b/backend/Cargo.lock index b36860c..4da9134 100644 --- a/backend/Cargo.lock +++ b/backend/Cargo.lock @@ -1052,7 +1052,7 @@ dependencies = [ [[package]] name = "powertools" -version = "1.4.0-beta3" +version = "1.5.0-ng1" dependencies = [ "async-trait", "libryzenadj", @@ -1321,6 +1321,8 @@ dependencies = [ [[package]] name = "sysfuss" version = "0.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4fa4dd5879b3fd41aff63991a59970cdfeced6f0d5920c5da0937279904d9f45" [[package]] name = "termcolor" diff --git a/backend/Cargo.toml b/backend/Cargo.toml index c12933c..2f48805 100644 --- a/backend/Cargo.toml +++ b/backend/Cargo.toml @@ -1,11 +1,11 @@ [package] name = "powertools" -version = "1.4.0-beta3" +version = "1.5.0-ng1" edition = "2021" authors = ["NGnius (Graham) "] description = "Backend (superuser) functionality for PowerTools" license = "GPL-3.0-only" -repository = "https://github.com/NGnius/PowerTools" +repository = "https://git.ngni.us/NG-SD-Plugins/PowerTools" keywords = ["utility", "power-management", "root", "decky"] readme = "../README.md" @@ -15,7 +15,7 @@ readme = "../README.md" usdpl-back = { version = "0.10.1", features = ["blocking"] }#, path = "../../usdpl-rs/usdpl-back"} serde = { version = "1.0", features = ["derive"] } serde_json = "1.0" -sysfuss = { version = "0.2", path = "../../sysfs-nav", features = ["derive"] } +sysfuss = { version = "0.2", features = ["derive"] }#,path = "../../sysfs-nav"} # async tokio = { version = "*", features = ["time"] } diff --git a/backend/limits_core/src/json/base.rs b/backend/limits_core/src/json/base.rs index cbb77fc..803d8bd 100644 --- a/backend/limits_core/src/json/base.rs +++ b/backend/limits_core/src/json/base.rs @@ -175,7 +175,7 @@ impl Default for Base { id: 1, title: "Welcome".to_owned(), body: "Thanks for installing PowerTools! For more information, please check the wiki. For bugs and requests, please create an issue on GitHub.".to_owned(), - url: Some("https://github.com/NGnius/PowerTools/wiki".to_owned()), + url: Some("https://git.ngni.us/NG-SD-Plugins/PowerTools/wiki".to_owned()), } ], refresh: Some("http://limits.ngni.us:45000/powertools/v1".to_owned()) diff --git a/backend/src/settings/steam_deck/cpu.rs b/backend/src/settings/steam_deck/cpu.rs index a6e4d10..4bea66c 100644 --- a/backend/src/settings/steam_deck/cpu.rs +++ b/backend/src/settings/steam_deck/cpu.rs @@ -307,6 +307,18 @@ impl Cpu { }) } + fn reset_clock_limits(&self) -> Result<(), SettingError> { + self.sysfs.set(CPU_CLOCK_LIMITS_ATTRIBUTE.to_owned(), "r\n").map_err(|e| { + SettingError { + msg: format!( + "Failed to write `r` to `{}`: {}", + CPU_CLOCK_LIMITS_ATTRIBUTE, e + ), + setting: crate::settings::SettingVariant::Cpu, + } + }) + } + fn set_clock_limits(&mut self) -> Result<(), Vec> { let mut errors = Vec::new(); if let Some(clock_limits) = &self.clock_limits { @@ -390,6 +402,10 @@ impl Cpu { .unwrap_or_else(|e| errors.push(e)); self.set_confirm().unwrap_or_else(|e| errors.push(e)); + + self.reset_clock_limits().unwrap_or_else(|e| errors.push(e)); + self.set_confirm().unwrap_or_else(|e| errors.push(e)); + POWER_DPM_FORCE_PERFORMANCE_LEVEL_MGMT.set_cpu(false, self.index); if errors.is_empty() { Ok(()) diff --git a/package.json b/package.json index 02e97a5..11a3af9 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "PowerTools", - "version": "1.4.0-beta3", + "version": "1.5.0-ng1", "description": "Power tweaks for power users", "scripts": { "build": "shx rm -rf dist && rollup -c",