forked from NG-SD-Plugins/PowerTools
Try resetting clocks as well as forcing them to min/max range
This commit is contained in:
parent
a44314397a
commit
40b46337b4
5 changed files with 24 additions and 6 deletions
4
backend/Cargo.lock
generated
4
backend/Cargo.lock
generated
|
@ -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"
|
||||
|
|
|
@ -1,11 +1,11 @@
|
|||
[package]
|
||||
name = "powertools"
|
||||
version = "1.4.0-beta3"
|
||||
version = "1.5.0-ng1"
|
||||
edition = "2021"
|
||||
authors = ["NGnius (Graham) <ngniusness@gmail.com>"]
|
||||
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"] }
|
||||
|
|
|
@ -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())
|
||||
|
|
|
@ -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<SettingError>> {
|
||||
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(())
|
||||
|
|
|
@ -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",
|
||||
|
|
Loading…
Reference in a new issue