Compare commits

..

7 commits
main ... dev

45 changed files with 1354 additions and 218 deletions

2
.github/FUNDING.yml vendored
View file

@ -1,2 +0,0 @@
github: NGnius
liberapay: NGnius

26
.github/ISSUE_TEMPLATE/bug-report.md vendored Normal file
View file

@ -0,0 +1,26 @@
---
name: Bug Report
about: Create a report to help us improve
title: ''
labels: bug
assignees: ''
---
**Expected Behaviour**
A clear and concise description of what you expected to happen.
**Actual Behaviour**
A clear and concise description of what actually happened.
**To Reproduce**
Steps to reproduce the behavior:
1. Go to '...'
2. Click on '....'
3. Scroll down to '....'
4. See error
**Screenshots, etc.**
If applicable, add screenshots to help explain your problem.
Please include the log (located at `/tmp/powertools.log`) if possible.
Note: the log is deleted when the device is restarted.

View file

@ -1,72 +0,0 @@
name: "Bug Report"
description: "Report an issue with PowerTools"
labels: "bug"
body:
- type: textarea
id: expected-behaviour
attributes:
label: Expected Behaviour
description: A clear and concise description of what you expected to happen.
validations:
required: true
- type: textarea
id: actual-behaviour
attributes:
label: Actual Behaviour
description: A clear and concise description of what actually happened.
validations:
required: true
- type: textarea
id: reproduction
attributes:
label: Steps To Reproduce
description: Steps to reproduce the behaviour.
placeholder: |
1. Go to '...'
2. Click on '....'
3. Scroll down to '.....'
4. See error......
validations:
required: true
- type: textarea
id: extras
attributes:
label: Anything else?
description: |
Screenshots? Logs? limits_overrides.ron? limits_cache.ron? Anything that will give more context about the problem!
If applicable, add screenshots to help explain your problem.
Please include the log (located at `/tmp/powertools.log`) if possible.
Note: the log is deleted when the device is restarted.
Tip: You can attach files by clicking this area to highlight it and then dragging them in.
validations:
required: false
- type: input
id: version
attributes:
label: Version
description: What version of PowerTools are you using? This is the version beside `Native` near the bottom of the plugin's UI.
validations:
required: true
- type: input
id: platform
attributes:
label: Platform
description: What driver is PowerTools using?
value: SteamDeck
validations:
required: true
- type: dropdown
id: operating-system
attributes:
label: OS
description: On which operating system are you running PowerTools?
options:
- _
- SteamOS 3 (Stable)
- SteamOS 3 (Preview/Beta)
- SteamOS 3 (Main)
- HoloISO
- Not listed
validations:
required: true

View file

@ -1,5 +0,0 @@
blank_issues_enabled: false
contact_links:
- name: NGnius
url: https://git.ngni.us/sys/website/wiki#contact-information
about: Repository owner

View file

@ -0,0 +1,17 @@
---
name: Feature Request
about: Suggest a tool to add
title: ''
labels: enhancement
assignees: ''
---
**Describe what you'd like to be able to do**
A clear and concise description of what you want. E.g. I'd like to be able to select how many CPU cores are enabled.
**Describe alternatives you've considered**
A clear and concise description of any alternatives you've considered. E.g. Enabling and disabling CPU cores with another computer connected over SSH.
**Additional context**
Description of how can this be done. E.g. This can be accomplished with `echo {0 or 1} > /sys/devices/system/cpu/cpu{cpu_number}/online`.

View file

@ -1,32 +0,0 @@
name: Feature Request
description: Suggest functionality to add
labels: "enhancement"
body:
- type: textarea
id: feature-description
attributes:
label: Describe what you'd like to be able to do
description: A clear and concise description of what you want.
placeholder: I'd like to be able to ...
validations:
required: true
- type: textarea
id: alternatives
attributes:
label: Describe alternatives you've considered
description: A clear and concise description of any alternatives you've considered.
placeholder: This can also be done by ... but ...
validations:
required: true
- type: textarea
id: extras
attributes:
label: Anything else?
description: |
Description of how this can be achieved, or other additional context.
If this is related to the UI, consider adding a picture.
Tip: You can attach files by clicking this area to highlight it and then dragging them in.
placeholder: This can be accomplished by doing ...
validations:
required: false

View file

@ -1,23 +0,0 @@
name: "Question"
description: "Ask for more information about PowerTools"
labels: "question"
body:
- type: textarea
id: question-elaboration
attributes:
label: Question
description: |
A clear and concise description of what you'd like to know.
Please check the wiki and closed issues to avoid waiting for an answer when you didn't need to.
validations:
required: true
- type: textarea
id: extras
attributes:
label: Extra Info
description: |
Additional context or information which may be helpful when answering your question.
Tip: You can attach files by clicking this area to highlight it and then dragging them in.
validations:
required: false

View file

@ -1,13 +0,0 @@
## Description
A short description of what the PR changes.
If this is a minor change and the commit message(s) explains it well, feel free to delete this section.
## Motivation
Why did you write this PR and/or why should it be accepted.
## Fixes
Please indicate issues that this fixes or addresses here.
If this is a bugfix with no pre-existing issue, please describe the bug here instead.

83
backend/Cargo.lock generated
View file

@ -201,7 +201,7 @@ version = "0.66.1"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "f2b84e06fc203107bfbad243f4aba2af864eb7db3b1cf46ea0a023b0b433d2a7" checksum = "f2b84e06fc203107bfbad243f4aba2af864eb7db3b1cf46ea0a023b0b433d2a7"
dependencies = [ dependencies = [
"bitflags", "bitflags 2.4.1",
"cexpr", "cexpr",
"clang-sys", "clang-sys",
"lazy_static", "lazy_static",
@ -218,6 +218,18 @@ dependencies = [
"which", "which",
] ]
[[package]]
name = "bit_field"
version = "0.10.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "dc827186963e592360843fb5ba4b973e145841266c1357f7180c43526f2e5b61"
[[package]]
name = "bitflags"
version = "1.3.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "bef38d45163c2f1dde094a7dfd33ccf595c92905c8f8f4fdc18d06fb1037718a"
[[package]] [[package]]
name = "bitflags" name = "bitflags"
version = "2.4.1" version = "2.4.1"
@ -891,22 +903,22 @@ dependencies = [
] ]
[[package]] [[package]]
name = "libryzenadj-alt" name = "libryzenadj"
version = "0.14.0" version = "0.13.0"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "f0a8cc66a7f77b864c2ef014dd9f9a3b03305d9e7f130202ca4addde9bc71f8b" checksum = "c5bccdf07c3234c06c435648a53d8cb369f76d20e03bb8d2f8c24fb2330efc32"
dependencies = [ dependencies = [
"errno", "errno",
"libryzenadj-sys-alt", "libryzenadj-sys",
"num_enum", "num_enum",
"thiserror", "thiserror",
] ]
[[package]] [[package]]
name = "libryzenadj-sys-alt" name = "libryzenadj-sys"
version = "0.14.0" version = "0.13.0"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "cb9de62ac92216770e51b5fa0628c22246a23c948e006f4ee65f6b96f6e0dd35" checksum = "b1de3621be974e892e12d4a07a6a2e32b6a05950759b062d94f5b54f78fabc3a"
dependencies = [ dependencies = [
"bindgen", "bindgen",
"cmake", "cmake",
@ -915,7 +927,7 @@ dependencies = [
[[package]] [[package]]
name = "limits_core" name = "limits_core"
version = "3.0.0" version = "3.0.1"
dependencies = [ dependencies = [
"serde", "serde",
] ]
@ -1162,6 +1174,13 @@ dependencies = [
"universal-hash", "universal-hash",
] ]
[[package]]
name = "powerbox"
version = "0.1.0"
dependencies = [
"sysfuss 0.4.0",
]
[[package]] [[package]]
name = "powerfmt" name = "powerfmt"
version = "0.2.0" version = "0.2.0"
@ -1170,23 +1189,24 @@ checksum = "439ee305def115ba05938db6eb1644ff94165c5ab5e9420d1c1bcedbba909391"
[[package]] [[package]]
name = "powertools" name = "powertools"
version = "2.0.3" version = "2.0.3-alpha1"
dependencies = [ dependencies = [
"async-trait", "async-trait",
"chrono", "chrono",
"clap", "clap",
"community_settings_core", "community_settings_core",
"libc", "libc",
"libryzenadj-alt", "libryzenadj",
"limits_core", "limits_core",
"log", "log",
"procbox",
"regex", "regex",
"ron", "ron",
"serde", "serde",
"serde_json", "serde_json",
"simplelog", "simplelog",
"smokepatio", "smokepatio",
"sysfuss", "sysfuss 0.3.0",
"tokio", "tokio",
"ureq", "ureq",
"usdpl-back", "usdpl-back",
@ -1227,6 +1247,15 @@ dependencies = [
"unicode-ident", "unicode-ident",
] ]
[[package]]
name = "procbox"
version = "0.1.0"
dependencies = [
"powerbox",
"sysfuss 0.4.0",
"x86",
]
[[package]] [[package]]
name = "quote" name = "quote"
version = "1.0.33" version = "1.0.33"
@ -1266,6 +1295,15 @@ dependencies = [
"getrandom", "getrandom",
] ]
[[package]]
name = "raw-cpuid"
version = "10.7.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "6c297679cb867470fa8c9f67dbba74a78d78e3e98d7cf2b08d6d71540f797332"
dependencies = [
"bitflags 1.3.2",
]
[[package]] [[package]]
name = "regex" name = "regex"
version = "1.10.2" version = "1.10.2"
@ -1316,7 +1354,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "b91f7eff05f748767f183df4320a63d6936e9c6107d97c9e6bdd9784f4289c94" checksum = "b91f7eff05f748767f183df4320a63d6936e9c6107d97c9e6bdd9784f4289c94"
dependencies = [ dependencies = [
"base64 0.21.5", "base64 0.21.5",
"bitflags", "bitflags 2.4.1",
"serde", "serde",
"serde_derive", "serde_derive",
] ]
@ -1339,7 +1377,7 @@ version = "0.38.28"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "72e572a5e8ca657d7366229cdde4bd14c4eb5499a9573d4d366fe1b599daa316" checksum = "72e572a5e8ca657d7366229cdde4bd14c4eb5499a9573d4d366fe1b599daa316"
dependencies = [ dependencies = [
"bitflags", "bitflags 2.4.1",
"errno", "errno",
"libc", "libc",
"linux-raw-sys", "linux-raw-sys",
@ -1482,8 +1520,6 @@ dependencies = [
[[package]] [[package]]
name = "smokepatio" name = "smokepatio"
version = "0.2.0" version = "0.2.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "3416e8c907d171c4334df3933873c32bff97ca5ad7ae0ee93e6268e04e2041ef"
dependencies = [ dependencies = [
"embedded-io", "embedded-io",
"log", "log",
@ -1544,6 +1580,10 @@ version = "0.3.0"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "f33bae529511a671b5f2ed4cc46ae0b2ccdf8c03ccf7eebe95a5a886ff7914dc" checksum = "f33bae529511a671b5f2ed4cc46ae0b2ccdf8c03ccf7eebe95a5a886ff7914dc"
[[package]]
name = "sysfuss"
version = "0.4.0"
[[package]] [[package]]
name = "termcolor" name = "termcolor"
version = "1.1.3" version = "1.1.3"
@ -2168,6 +2208,17 @@ dependencies = [
"memchr", "memchr",
] ]
[[package]]
name = "x86"
version = "0.52.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "2781db97787217ad2a2845c396a5efe286f87467a5810836db6d74926e94a385"
dependencies = [
"bit_field",
"bitflags 1.3.2",
"raw-cpuid",
]
[[package]] [[package]]
name = "zeroize" name = "zeroize"
version = "1.3.0" version = "1.3.0"

View file

@ -1,6 +1,6 @@
[package] [package]
name = "powertools" name = "powertools"
version = "2.0.3" version = "2.0.3-alpha1"
edition = "2021" edition = "2021"
authors = ["NGnius (Graham) <ngniusness@gmail.com>"] authors = ["NGnius (Graham) <ngniusness@gmail.com>"]
description = "Backend (superuser) functionality for PowerTools" description = "Backend (superuser) functionality for PowerTools"
@ -17,6 +17,7 @@ serde = { version = "1.0", features = ["derive"] }
serde_json = "1.0" serde_json = "1.0"
ron = "0.8" ron = "0.8"
sysfuss = { version = "0.3", features = ["derive"] }#,path = "../../sysfs-nav"} sysfuss = { version = "0.3", features = ["derive"] }#,path = "../../sysfs-nav"}
procbox = { version = "0.1", path = "../../powerbox/crates/procbox" }
# async # async
tokio = { version = "*", features = ["time"] } tokio = { version = "*", features = ["time"] }
@ -31,7 +32,7 @@ limits_core = { version = "3", path = "./limits_core" }
regex = "1" regex = "1"
# steam deck libs # steam deck libs
smokepatio = { version = "0.2", default-features = false } smokepatio = { version = "0.2", default-features = false, path = "../../smokepatio" }
libc = "0.2" libc = "0.2"
# online settings # online settings
@ -40,7 +41,7 @@ chrono = { version = "0.4", features = [ "serde" ] }
# hardware enablement # hardware enablement
#libryzenadj = { version = "0.14", path = "../../libryzenadj-rs-14" } #libryzenadj = { version = "0.14", path = "../../libryzenadj-rs-14" }
libryzenadj-alt = { version = "0.14" } libryzenadj = { version = "0.13" }
# ureq's tls feature does not like musl targets # ureq's tls feature does not like musl targets
ureq = { version = "2", features = ["json", "gzip", "brotli", "charset", "tls"], default-features = false, optional = true } ureq = { version = "2", features = ["json", "gzip", "brotli", "charset", "tls"], default-features = false, optional = true }

View file

@ -4,7 +4,7 @@ version = 3
[[package]] [[package]]
name = "limits_core" name = "limits_core"
version = "3.0.0" version = "3.0.1"
dependencies = [ dependencies = [
"serde", "serde",
] ]

View file

@ -1,6 +1,6 @@
[package] [package]
name = "limits_core" name = "limits_core"
version = "3.0.0" version = "3.0.1"
edition = "2021" edition = "2021"
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html # See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html

View file

@ -9,6 +9,8 @@ pub enum CpuLimitType {
SteamDeck, SteamDeck,
#[serde(rename = "GabeBoySP", alias = "SteamDeckOLED")] #[serde(rename = "GabeBoySP", alias = "SteamDeckOLED")]
SteamDeckOLED, SteamDeckOLED,
ROGAlly,
MSIClaw,
Generic, Generic,
GenericAMD, GenericAMD,
Unknown, Unknown,

View file

@ -8,6 +8,8 @@ pub enum GpuLimitType {
SteamDeck, SteamDeck,
#[serde(rename = "GabeBoySP", alias = "SteamDeckOLED")] #[serde(rename = "GabeBoySP", alias = "SteamDeckOLED")]
SteamDeckOLED, SteamDeckOLED,
ROGAlly,
MSIClaw,
Generic, Generic,
GenericAMD, GenericAMD,
Unknown, Unknown,
@ -83,8 +85,7 @@ impl GenericGpuLimit {
experiments: false, experiments: false,
quirks: vec![ quirks: vec![
"pp_dpm_fclk-reversed".to_owned(), "pp_dpm_fclk-reversed".to_owned(),
"pp_dpm_fclk-not-updated-on-LCD".to_owned(), "pp_dpm_fclk-static".to_owned(),
//"pp_dpm_fclk-static".to_owned(),
].into_iter().collect(), ].into_iter().collect(),
} }
} }
@ -94,6 +95,8 @@ impl GenericGpuLimit {
let mut sd = Self::default_steam_deck(); let mut sd = Self::default_steam_deck();
sd.memory_clock_step = Some(200); sd.memory_clock_step = Some(200);
sd.extras.quirks.insert("clock-autodetect".to_owned()); sd.extras.quirks.insert("clock-autodetect".to_owned());
sd.extras.quirks.remove("pp_dpm_fclk-static");
//sd.extras.quirks.remove("pp_dpm_fclk-reversed");
sd sd
} }

View file

@ -32,6 +32,55 @@ dependencies = [
"libc", "libc",
] ]
[[package]]
name = "anstream"
version = "0.6.15"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "64e15c1ab1f89faffbf04a634d5e1962e9074f2741eef6d97f3c4e322426d526"
dependencies = [
"anstyle",
"anstyle-parse",
"anstyle-query",
"anstyle-wincon",
"colorchoice",
"is_terminal_polyfill",
"utf8parse",
]
[[package]]
name = "anstyle"
version = "1.0.8"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "1bec1de6f59aedf83baf9ff929c98f2ad654b97c9510f4e70cf6f661d49fd5b1"
[[package]]
name = "anstyle-parse"
version = "0.2.5"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "eb47de1e80c2b463c735db5b217a0ddc39d612e7ac9e2e96a5aed1f57616c1cb"
dependencies = [
"utf8parse",
]
[[package]]
name = "anstyle-query"
version = "1.1.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "6d36fc52c7f6c869915e99412912f22093507da8d9e942ceaf66fe4b7c14422a"
dependencies = [
"windows-sys 0.52.0",
]
[[package]]
name = "anstyle-wincon"
version = "3.0.4"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "5bf74e1b6e971609db8ca7a9ce79fd5768ab6ae46441c572e46cf596f59e57f8"
dependencies = [
"anstyle",
"windows-sys 0.52.0",
]
[[package]] [[package]]
name = "autocfg" name = "autocfg"
version = "1.1.0" version = "1.1.0"
@ -71,6 +120,15 @@ version = "1.3.2"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "bef38d45163c2f1dde094a7dfd33ccf595c92905c8f8f4fdc18d06fb1037718a" checksum = "bef38d45163c2f1dde094a7dfd33ccf595c92905c8f8f4fdc18d06fb1037718a"
[[package]]
name = "bitflags"
version = "2.6.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "b048fb63fd8b5923fc5aa7b340d8e156aec7ec02f0c78fa8a6ddc2613f6f71de"
dependencies = [
"serde",
]
[[package]] [[package]]
name = "block-buffer" name = "block-buffer"
version = "0.10.4" version = "0.10.4"
@ -125,6 +183,51 @@ dependencies = [
"winapi", "winapi",
] ]
[[package]]
name = "clap"
version = "4.4.18"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "1e578d6ec4194633722ccf9544794b71b1385c3c027efe0c55db226fc880865c"
dependencies = [
"clap_builder",
"clap_derive",
]
[[package]]
name = "clap_builder"
version = "4.4.18"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "4df4df40ec50c46000231c914968278b1eb05098cf8f1b3a518a95030e71d1c7"
dependencies = [
"anstream",
"anstyle",
"clap_lex",
]
[[package]]
name = "clap_derive"
version = "4.4.7"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "cf9804afaaf59a91e75b022a30fb7229a7901f60c755489cc61c9b423b836442"
dependencies = [
"heck",
"proc-macro2",
"quote",
"syn",
]
[[package]]
name = "clap_lex"
version = "0.6.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "702fc72eb24e5a1e48ce58027a675bc24edd52096d5397d4aea7c6dd9eca0bd1"
[[package]]
name = "colorchoice"
version = "1.0.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "d3fd119d74b830634cea2a0f58bbd0d54540518a14397557951e79340abc28c0"
[[package]] [[package]]
name = "core-foundation-sys" name = "core-foundation-sys"
version = "0.8.4" version = "0.8.4"
@ -285,7 +388,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "f3e372db8e5c0d213e0cd0b9be18be2aca3d44cf2fe30a9d46a65581cd454584" checksum = "f3e372db8e5c0d213e0cd0b9be18be2aca3d44cf2fe30a9d46a65581cd454584"
dependencies = [ dependencies = [
"base64 0.13.1", "base64 0.13.1",
"bitflags", "bitflags 1.3.2",
"bytes", "bytes",
"headers-core", "headers-core",
"http", "http",
@ -303,6 +406,12 @@ dependencies = [
"http", "http",
] ]
[[package]]
name = "heck"
version = "0.4.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "95505c38b4572b2d910cecb0281560f54b440a19336cbbcb27bf6ce6adc6f5a8"
[[package]] [[package]]
name = "hermit-abi" name = "hermit-abi"
version = "0.3.1" version = "0.3.1"
@ -410,6 +519,12 @@ dependencies = [
"hashbrown", "hashbrown",
] ]
[[package]]
name = "is_terminal_polyfill"
version = "1.70.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "7943c866cc5cd64cbc25b2e01621d07fa8eb2a1a23160ee81ce38704e97b8ecf"
[[package]] [[package]]
name = "itoa" name = "itoa"
version = "1.0.8" version = "1.0.8"
@ -433,17 +548,19 @@ checksum = "b4668fb0ea861c1df094127ac5f1da3409a82116a4ba74fca2e58ef927159bb3"
[[package]] [[package]]
name = "limits_core" name = "limits_core"
version = "3.0.0" version = "3.0.1"
dependencies = [ dependencies = [
"serde", "serde",
] ]
[[package]] [[package]]
name = "limits_srv" name = "limits_srv"
version = "3.0.0" version = "3.1.0"
dependencies = [ dependencies = [
"chrono", "chrono",
"clap",
"limits_core", "limits_core",
"ron",
"serde", "serde",
"serde_json", "serde_json",
"tokio", "tokio",
@ -495,7 +612,7 @@ checksum = "927a765cd3fc26206e66b296465fa9d3e5ab003e651c1b3c060e7956d96b19d2"
dependencies = [ dependencies = [
"libc", "libc",
"wasi 0.11.0+wasi-snapshot-preview1", "wasi 0.11.0+wasi-snapshot-preview1",
"windows-sys", "windows-sys 0.48.0",
] ]
[[package]] [[package]]
@ -642,6 +759,18 @@ dependencies = [
"getrandom", "getrandom",
] ]
[[package]]
name = "ron"
version = "0.8.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "b91f7eff05f748767f183df4320a63d6936e9c6107d97c9e6bdd9784f4289c94"
dependencies = [
"base64 0.21.2",
"bitflags 2.6.0",
"serde",
"serde_derive",
]
[[package]] [[package]]
name = "rustc-demangle" name = "rustc-demangle"
version = "0.1.23" version = "0.1.23"
@ -820,7 +949,7 @@ dependencies = [
"pin-project-lite", "pin-project-lite",
"socket2", "socket2",
"tokio-macros", "tokio-macros",
"windows-sys", "windows-sys 0.48.0",
] ]
[[package]] [[package]]
@ -976,6 +1105,12 @@ version = "0.7.6"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "09cc8ee72d2a9becf2f2febe0205bbed8fc6615b7cb429ad062dc7b7ddd036a9" checksum = "09cc8ee72d2a9becf2f2febe0205bbed8fc6615b7cb429ad062dc7b7ddd036a9"
[[package]]
name = "utf8parse"
version = "0.2.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "06abde3611657adf66d383f00b093d7faecc7fa57071cce2578660c9f1010821"
[[package]] [[package]]
name = "version_check" name = "version_check"
version = "0.9.4" version = "0.9.4"
@ -1116,7 +1251,7 @@ version = "0.48.0"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "e686886bc078bc1b0b600cac0147aadb815089b6e4da64016cbd754b6342700f" checksum = "e686886bc078bc1b0b600cac0147aadb815089b6e4da64016cbd754b6342700f"
dependencies = [ dependencies = [
"windows-targets", "windows-targets 0.48.1",
] ]
[[package]] [[package]]
@ -1125,7 +1260,16 @@ version = "0.48.0"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "677d2418bec65e3338edb076e806bc1ec15693c5d0104683f2efe857f61056a9" checksum = "677d2418bec65e3338edb076e806bc1ec15693c5d0104683f2efe857f61056a9"
dependencies = [ dependencies = [
"windows-targets", "windows-targets 0.48.1",
]
[[package]]
name = "windows-sys"
version = "0.52.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "282be5f36a8ce781fad8c8ae18fa3f9beff57ec1b52cb3de0789201425d9a33d"
dependencies = [
"windows-targets 0.52.6",
] ]
[[package]] [[package]]
@ -1134,13 +1278,29 @@ version = "0.48.1"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "05d4b17490f70499f20b9e791dcf6a299785ce8af4d709018206dc5b4953e95f" checksum = "05d4b17490f70499f20b9e791dcf6a299785ce8af4d709018206dc5b4953e95f"
dependencies = [ dependencies = [
"windows_aarch64_gnullvm", "windows_aarch64_gnullvm 0.48.0",
"windows_aarch64_msvc", "windows_aarch64_msvc 0.48.0",
"windows_i686_gnu", "windows_i686_gnu 0.48.0",
"windows_i686_msvc", "windows_i686_msvc 0.48.0",
"windows_x86_64_gnu", "windows_x86_64_gnu 0.48.0",
"windows_x86_64_gnullvm", "windows_x86_64_gnullvm 0.48.0",
"windows_x86_64_msvc", "windows_x86_64_msvc 0.48.0",
]
[[package]]
name = "windows-targets"
version = "0.52.6"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "9b724f72796e036ab90c1021d4780d4d3d648aca59e491e6b98e725b84e99973"
dependencies = [
"windows_aarch64_gnullvm 0.52.6",
"windows_aarch64_msvc 0.52.6",
"windows_i686_gnu 0.52.6",
"windows_i686_gnullvm",
"windows_i686_msvc 0.52.6",
"windows_x86_64_gnu 0.52.6",
"windows_x86_64_gnullvm 0.52.6",
"windows_x86_64_msvc 0.52.6",
] ]
[[package]] [[package]]
@ -1149,38 +1309,86 @@ version = "0.48.0"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "91ae572e1b79dba883e0d315474df7305d12f569b400fcf90581b06062f7e1bc" checksum = "91ae572e1b79dba883e0d315474df7305d12f569b400fcf90581b06062f7e1bc"
[[package]]
name = "windows_aarch64_gnullvm"
version = "0.52.6"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "32a4622180e7a0ec044bb555404c800bc9fd9ec262ec147edd5989ccd0c02cd3"
[[package]] [[package]]
name = "windows_aarch64_msvc" name = "windows_aarch64_msvc"
version = "0.48.0" version = "0.48.0"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "b2ef27e0d7bdfcfc7b868b317c1d32c641a6fe4629c171b8928c7b08d98d7cf3" checksum = "b2ef27e0d7bdfcfc7b868b317c1d32c641a6fe4629c171b8928c7b08d98d7cf3"
[[package]]
name = "windows_aarch64_msvc"
version = "0.52.6"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "09ec2a7bb152e2252b53fa7803150007879548bc709c039df7627cabbd05d469"
[[package]] [[package]]
name = "windows_i686_gnu" name = "windows_i686_gnu"
version = "0.48.0" version = "0.48.0"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "622a1962a7db830d6fd0a69683c80a18fda201879f0f447f065a3b7467daa241" checksum = "622a1962a7db830d6fd0a69683c80a18fda201879f0f447f065a3b7467daa241"
[[package]]
name = "windows_i686_gnu"
version = "0.52.6"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "8e9b5ad5ab802e97eb8e295ac6720e509ee4c243f69d781394014ebfe8bbfa0b"
[[package]]
name = "windows_i686_gnullvm"
version = "0.52.6"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "0eee52d38c090b3caa76c563b86c3a4bd71ef1a819287c19d586d7334ae8ed66"
[[package]] [[package]]
name = "windows_i686_msvc" name = "windows_i686_msvc"
version = "0.48.0" version = "0.48.0"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "4542c6e364ce21bf45d69fdd2a8e455fa38d316158cfd43b3ac1c5b1b19f8e00" checksum = "4542c6e364ce21bf45d69fdd2a8e455fa38d316158cfd43b3ac1c5b1b19f8e00"
[[package]]
name = "windows_i686_msvc"
version = "0.52.6"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "240948bc05c5e7c6dabba28bf89d89ffce3e303022809e73deaefe4f6ec56c66"
[[package]] [[package]]
name = "windows_x86_64_gnu" name = "windows_x86_64_gnu"
version = "0.48.0" version = "0.48.0"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "ca2b8a661f7628cbd23440e50b05d705db3686f894fc9580820623656af974b1" checksum = "ca2b8a661f7628cbd23440e50b05d705db3686f894fc9580820623656af974b1"
[[package]]
name = "windows_x86_64_gnu"
version = "0.52.6"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "147a5c80aabfbf0c7d901cb5895d1de30ef2907eb21fbbab29ca94c5b08b1a78"
[[package]] [[package]]
name = "windows_x86_64_gnullvm" name = "windows_x86_64_gnullvm"
version = "0.48.0" version = "0.48.0"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "7896dbc1f41e08872e9d5e8f8baa8fdd2677f29468c4e156210174edc7f7b953" checksum = "7896dbc1f41e08872e9d5e8f8baa8fdd2677f29468c4e156210174edc7f7b953"
[[package]]
name = "windows_x86_64_gnullvm"
version = "0.52.6"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "24d5b23dc417412679681396f2b49f3de8c1473deb516bd34410872eff51ed0d"
[[package]] [[package]]
name = "windows_x86_64_msvc" name = "windows_x86_64_msvc"
version = "0.48.0" version = "0.48.0"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "1a515f5799fe4961cb532f983ce2b23082366b898e52ffbce459c86f67c8378a" checksum = "1a515f5799fe4961cb532f983ce2b23082366b898e52ffbce459c86f67c8378a"
[[package]]
name = "windows_x86_64_msvc"
version = "0.52.6"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "589f6da84c646204747d1270a2a5661ea66ed1cced2631d546fdfb155959f9ec"

View file

@ -1,6 +1,6 @@
[package] [package]
name = "limits_srv" name = "limits_srv"
version = "3.0.0" version = "3.1.0"
edition = "2021" edition = "2021"
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html # See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
@ -10,5 +10,7 @@ limits_core = { version = "3.0.0", path = "../limits_core" }
chrono = { version = "0.4" } chrono = { version = "0.4" }
serde = { version = "1.0", features = ["derive"] } serde = { version = "1.0", features = ["derive"] }
serde_json = "1.0" serde_json = "1.0"
ron = "0.8"
warp = { version = "0.3" } warp = { version = "0.3" }
tokio = { version = "1.22", features = ["macros", "rt", "rt-multi-thread"] } tokio = { version = "1.22", features = ["macros", "rt", "rt-multi-thread"] }
clap = { version = "4", features = ["derive", "std", "color"], default-features = false }

View file

@ -603,7 +603,7 @@
"experiments": false, "experiments": false,
"quirks": [ "quirks": [
"pp_dpm_fclk-reversed", "pp_dpm_fclk-reversed",
"pp_dpm_fclk-not-updated-on-LCD" "pp_dpm_fclk-static"
] ]
} }
} }
@ -867,9 +867,8 @@
"extras": { "extras": {
"experiments": false, "experiments": false,
"quirks": [ "quirks": [
"pp_dpm_fclk-reversed", "clock-autodetect",
"pp_dpm_fclk-not-updated-on-LCD", "pp_dpm_fclk-reversed"
"clock-autodetect"
] ]
} }
} }

View file

@ -0,0 +1,19 @@
use clap::Parser;
#[derive(Parser, Debug, Clone)]
#[command(author, version, about, long_about = None)]
pub struct Cli {
/// Path to folder containing pt_limits.json and pt_limits_v2.json
#[arg(short, long, default_value = "./")]
pub limits: std::path::PathBuf,
/// Server port
#[arg(short, long, default_value_t = 8080)]
pub port: u16,
}
impl Cli {
pub fn get() -> Self {
Self::parse()
}
}

View file

@ -1,3 +1,5 @@
mod cli;
use std::sync::atomic::{Ordering, AtomicU64, AtomicI64}; use std::sync::atomic::{Ordering, AtomicU64, AtomicI64};
use std::sync::{RwLock, Arc}; use std::sync::{RwLock, Arc};
@ -73,26 +75,35 @@ pub async fn recovery(reject: warp::Rejection) -> Result<impl warp::Reply, warp:
#[tokio::main] #[tokio::main]
async fn main() { async fn main() {
START_TIME.store(chrono::Utc::now().timestamp(), Ordering::Relaxed); START_TIME.store(chrono::Utc::now().timestamp(), Ordering::Relaxed);
let file = std::fs::File::open("./pt_limits.json").expect("Failed to read limits file"); let args = cli::Cli::get();
let file = std::fs::File::open(args.limits.join("pt_limits.json")).expect("Failed to read limits file");
let limits: limits_core::json::Base = serde_json::from_reader(file).expect("Failed to parse limits file"); let limits: limits_core::json::Base = serde_json::from_reader(file).expect("Failed to parse limits file");
assert!(limits.refresh.is_some(), "`refresh` cannot be null, since it will brick future refreshes"); assert!(limits.refresh.is_some(), "`refresh` cannot be null, since it will brick future refreshes");
let file = std::fs::File::open("./pt_limits_v2.json").expect("Failed to read limits file"); let file = std::fs::File::open(args.limits.join("pt_limits_v2.json")).expect("Failed to read limits_v2 file");
let limits_v2: limits_core::json_v2::Base = serde_json::from_reader(file).expect("Failed to parse limits file"); let limits_v2: limits_core::json_v2::Base = serde_json::from_reader(file).expect("Failed to parse limits file");
assert!(limits_v2.refresh.is_some(), "`refresh` cannot be null, since it will brick future refreshes"); assert!(limits_v2.refresh.is_some(), "`refresh` cannot be null, since it will brick future refreshes");
warp::serve(routes(Arc::new(RwLock::new(limits)), Arc::new(RwLock::new(limits_v2)))) warp::serve(routes(Arc::new(RwLock::new(limits)), Arc::new(RwLock::new(limits_v2))))
.run(([0, 0, 0, 0], 8080)) .run(([0, 0, 0, 0], args.port))
.await; .await;
} }
#[cfg(test)] #[cfg(test)]
mod test { mod test {
fn ron_pretty_config() -> ron::ser::PrettyConfig {
ron::ser::PrettyConfig::default()
.struct_names(true)
.compact_arrays(true)
}
#[test] #[test]
fn generate_default_pt_limits() { fn generate_default_pt_limits() {
let limits = limits_core::json::Base::default(); let limits = limits_core::json::Base::default();
let output_file = std::fs::File::create("./pt_limits.json").unwrap(); let output_file = std::fs::File::create("./pt_limits.json").unwrap();
serde_json::to_writer_pretty(output_file, &limits).unwrap(); serde_json::to_writer_pretty(output_file, &limits).unwrap();
let output_file = std::fs::File::create("./pt_limits.ron").unwrap();
ron::ser::to_writer_pretty(output_file, &limits, ron_pretty_config()).unwrap();
} }
#[test] #[test]
@ -100,5 +111,7 @@ mod test {
let limits = limits_core::json_v2::Base::default(); let limits = limits_core::json_v2::Base::default();
let output_file = std::fs::File::create("./pt_limits_v2.json").unwrap(); let output_file = std::fs::File::create("./pt_limits_v2.json").unwrap();
serde_json::to_writer_pretty(output_file, &limits).unwrap(); serde_json::to_writer_pretty(output_file, &limits).unwrap();
let output_file = std::fs::File::create("./pt_limits_v2.ron").unwrap();
ron::ser::to_writer_pretty(output_file, &limits, ron_pretty_config()).unwrap();
} }
} }

View file

@ -12,6 +12,10 @@ pub enum DriverJson {
Generic, Generic,
#[serde(rename = "generic-amd")] #[serde(rename = "generic-amd")]
GenericAMD, GenericAMD,
#[serde(rename = "rog-ally")]
ROGAlly,
#[serde(rename = "msi-claw")]
MSIClaw,
#[serde(rename = "unknown")] #[serde(rename = "unknown")]
Unknown, Unknown,
#[default] #[default]

View file

@ -138,6 +138,20 @@ pub fn auto_detect0(
) )
.variant(super::super::steam_deck::Model::OLED), .variant(super::super::steam_deck::Model::OLED),
), ),
CpuLimitType::ROGAlly => Box::new(
crate::settings::rog_ally::Cpus::from_json_and_limits(
settings.cpus.clone(),
settings.version,
relevant_limits.cpu.limits,
)
),
CpuLimitType::MSIClaw => Box::new(
crate::settings::msi_claw::Cpus::from_json_and_limits(
settings.cpus.clone(),
settings.version,
relevant_limits.cpu.limits,
)
),
CpuLimitType::Generic => Box::new(crate::settings::generic::Cpus::< CpuLimitType::Generic => Box::new(crate::settings::generic::Cpus::<
crate::settings::generic::Cpu, crate::settings::generic::Cpu,
>::from_json_and_limits( >::from_json_and_limits(
@ -185,6 +199,20 @@ pub fn auto_detect0(
) )
.variant(super::super::steam_deck::Model::OLED), .variant(super::super::steam_deck::Model::OLED),
), ),
GpuLimitType::ROGAlly => Box::new(
crate::settings::rog_ally::Gpu::from_json_and_limits(
settings.gpu.clone(),
settings.version,
relevant_limits.gpu.limits,
)
),
GpuLimitType::MSIClaw => Box::new(
crate::settings::msi_claw::Gpu::from_json_and_limits(
settings.gpu.clone(),
settings.version,
relevant_limits.gpu.limits,
)
),
GpuLimitType::Generic => { GpuLimitType::Generic => {
Box::new(crate::settings::generic::Gpu::from_json_and_limits( Box::new(crate::settings::generic::Gpu::from_json_and_limits(
settings.gpu.clone(), settings.gpu.clone(),
@ -270,6 +298,12 @@ pub fn auto_detect0(
crate::settings::steam_deck::Cpus::from_limits(relevant_limits.cpu.limits) crate::settings::steam_deck::Cpus::from_limits(relevant_limits.cpu.limits)
.variant(super::super::steam_deck::Model::OLED), .variant(super::super::steam_deck::Model::OLED),
), ),
CpuLimitType::ROGAlly => Box::new(
crate::settings::rog_ally::Cpus::from_limits(relevant_limits.cpu.limits)
),
CpuLimitType::MSIClaw => Box::new(
crate::settings::msi_claw::Cpus::from_limits(relevant_limits.cpu.limits)
),
CpuLimitType::Generic => Box::new(crate::settings::generic::Cpus::< CpuLimitType::Generic => Box::new(crate::settings::generic::Cpus::<
crate::settings::generic::Cpu, crate::settings::generic::Cpu,
>::from_limits( >::from_limits(
@ -294,6 +328,12 @@ pub fn auto_detect0(
crate::settings::steam_deck::Gpu::from_limits(relevant_limits.gpu.limits) crate::settings::steam_deck::Gpu::from_limits(relevant_limits.gpu.limits)
.variant(super::super::steam_deck::Model::OLED), .variant(super::super::steam_deck::Model::OLED),
), ),
GpuLimitType::ROGAlly => Box::new(
crate::settings::rog_ally::Gpu::from_limits(relevant_limits.gpu.limits)
),
GpuLimitType::MSIClaw => Box::new(
crate::settings::msi_claw::Gpu::from_limits(relevant_limits.gpu.limits)
),
GpuLimitType::Generic => Box::new(crate::settings::generic::Gpu::from_limits( GpuLimitType::Generic => Box::new(crate::settings::generic::Gpu::from_limits(
relevant_limits.gpu.limits, relevant_limits.gpu.limits,
)), )),

View file

@ -272,11 +272,11 @@ impl TCpu for Cpu {
}); });
} }
fn get_clock_limits(&self) -> Option<&MinMax<u64>> { fn get_clock_limits(&self) -> Option<MinMax<u64>> {
log::debug!( log::debug!(
"dev_mode_Cpu::get_clock_limits(self) -> {:?}", "dev_mode_Cpu::get_clock_limits(self) -> {:?}",
self.clock_limits.as_ref() self.clock_limits.as_ref()
); );
self.clock_limits.as_ref() self.clock_limits.clone()
} }
} }

View file

@ -188,12 +188,12 @@ impl TGpu for Gpu {
}); });
} }
fn get_clock_limits(&self) -> Option<&MinMax<u64>> { fn get_clock_limits(&self) -> Option<MinMax<u64>> {
log::debug!( log::debug!(
"dev_mode_Gpu::get_clock_limits(self) -> {:?}", "dev_mode_Gpu::get_clock_limits(self) -> {:?}",
self.clock_limits.as_ref() self.clock_limits.as_ref()
); );
self.clock_limits.as_ref() self.clock_limits.clone()
} }
fn memory_clock(&mut self, speed: Option<u64>) { fn memory_clock(&mut self, speed: Option<u64>) {

View file

@ -37,7 +37,9 @@ pub fn maybe_do_button() {
match super::auto_detect_provider() { match super::auto_detect_provider() {
DriverJson::SteamDeck | DriverJson::SteamDeckOLED => { DriverJson::SteamDeck | DriverJson::SteamDeckOLED => {
crate::settings::steam_deck::flash_led(); crate::settings::steam_deck::flash_led();
} },
DriverJson::ROGAlly => log::info!("Roggle boggle smoggle flollop"),
DriverJson::MSIClaw => log::warn!("My condolences"),
DriverJson::Generic | DriverJson::GenericAMD => { DriverJson::Generic | DriverJson::GenericAMD => {
log::warn!("You need to come up with something fun on generic") log::warn!("You need to come up with something fun on generic")
} }

View file

@ -441,8 +441,8 @@ impl TCpu for Cpu {
} }
} }
fn get_clock_limits(&self) -> Option<&MinMax<u64>> { fn get_clock_limits(&self) -> Option<MinMax<u64>> {
self.clock_limits.as_ref() self.clock_limits.clone()
} }
} }

View file

@ -303,8 +303,8 @@ impl TGpu for Gpu {
} }
} }
fn get_clock_limits(&self) -> Option<&MinMax<u64>> { fn get_clock_limits(&self) -> Option<MinMax<u64>> {
self.clock_limits.as_ref() self.clock_limits.clone()
} }
fn memory_clock(&mut self, _speed: Option<u64>) {} fn memory_clock(&mut self, _speed: Option<u64>) {}

View file

@ -149,7 +149,7 @@ impl TCpu for Cpu {
// TODO: support this // TODO: support this
} }
fn get_clock_limits(&self) -> Option<&MinMax<u64>> { fn get_clock_limits(&self) -> Option<MinMax<u64>> {
self.generic.get_clock_limits() self.generic.get_clock_limits()
} }
} }

View file

@ -1,4 +1,4 @@
use libryzenadj_alt::RyzenAdj; use libryzenadj::RyzenAdj;
use std::sync::Mutex; use std::sync::Mutex;
use crate::persist::GpuJson; use crate::persist::GpuJson;
@ -22,9 +22,9 @@ fn msg_or_err<D: std::fmt::Display, E: std::fmt::Display>(
fn log_capabilities(ryzenadj: &RyzenAdj) { fn log_capabilities(ryzenadj: &RyzenAdj) {
log::info!( log::info!(
"RyzenAdj v{}.{}.{}", "RyzenAdj v{}.{}.{}",
libryzenadj_alt::libryzenadj_sys::RYZENADJ_REVISION_VER, libryzenadj::libryzenadj_sys::RYZENADJ_REVISION_VER,
libryzenadj_alt::libryzenadj_sys::RYZENADJ_MAJOR_VER, libryzenadj::libryzenadj_sys::RYZENADJ_MAJOR_VER,
libryzenadj_alt::libryzenadj_sys::RYZENADJ_MINIOR_VER libryzenadj::libryzenadj_sys::RYZENADJ_MINIOR_VER
); );
#[cfg(feature = "experimental")] #[cfg(feature = "experimental")]
if let Some(x) = ryzenadj.get_init_table_err() { if let Some(x) = ryzenadj.get_init_table_err() {
@ -368,7 +368,7 @@ impl TGpu for Gpu {
self.generic.clock_limits(limits) self.generic.clock_limits(limits)
} }
fn get_clock_limits(&self) -> Option<&MinMax<u64>> { fn get_clock_limits(&self) -> Option<MinMax<u64>> {
self.generic.get_clock_limits() self.generic.get_clock_limits()
} }

View file

@ -11,6 +11,8 @@ pub mod generic;
pub mod generic_amd; pub mod generic_amd;
pub mod steam_deck; pub mod steam_deck;
pub mod unknown; pub mod unknown;
pub mod rog_ally;
pub mod msi_claw;
pub use detect::{ pub use detect::{
auto_detect0, auto_detect_provider, get_dev_messages, auto_detect0, auto_detect_provider, get_dev_messages,

View file

@ -0,0 +1,155 @@
use crate::persist::CpuJson;
use crate::settings::generic::{Cpu as GenericCpu, Cpus as GenericCpus, FromGenericCpuInfo};
use crate::settings::MinMax;
use crate::settings::{OnResume, OnSet, SettingError};
use crate::settings::{ProviderBuilder, TCpu, TCpus};
#[derive(Debug)]
pub struct Cpus {
generic: GenericCpus<Cpu>,
}
impl ProviderBuilder<Vec<CpuJson>, limits_core::json_v2::GenericCpusLimit> for Cpus {
fn from_limits(limits: limits_core::json_v2::GenericCpusLimit) -> Self {
Self {
generic: GenericCpus::from_limits(limits),
}
}
fn from_json_and_limits(
other: Vec<CpuJson>,
version: u64,
limits: limits_core::json_v2::GenericCpusLimit,
) -> Self {
Self {
generic: GenericCpus::from_json_and_limits(other, version, limits),
}
}
}
impl OnResume for Cpus {
fn on_resume(&self) -> Result<(), Vec<SettingError>> {
self.generic.on_resume()
// TODO
}
}
impl OnSet for Cpus {
fn on_set(&mut self) -> Result<(), Vec<SettingError>> {
self.generic.on_set()
// TODO
}
}
impl crate::settings::OnPowerEvent for Cpus {}
impl crate::settings::OnLoad for Cpus {
fn on_load(&mut self) -> Result<(), Vec<SettingError>> {
Ok(())
}
}
impl crate::settings::OnUnload for Cpus {
fn on_unload(&mut self) -> Result<(), Vec<SettingError>> {
Ok(())
}
}
impl TCpus for Cpus {
fn limits(&self) -> crate::api::CpusLimits {
self.generic.limits()
}
fn json(&self) -> Vec<crate::persist::CpuJson> {
self.generic.json() // TODO
}
fn cpus(&mut self) -> Vec<&mut dyn TCpu> {
self.generic.cpus() // TODO
}
fn len(&self) -> usize {
self.generic.len() // TODO
}
fn smt(&mut self) -> &'_ mut bool {
self.generic.smt()
}
fn provider(&self) -> crate::persist::DriverJson {
crate::persist::DriverJson::GenericAMD
}
}
#[derive(Debug)]
pub struct Cpu {
generic: GenericCpu,
}
impl FromGenericCpuInfo for Cpu {
fn from_limits(cpu_index: usize, limits: limits_core::json_v2::GenericCpuLimit) -> Self {
let gen = GenericCpu::from_limits(cpu_index, limits.clone());
Self { generic: gen }
}
fn from_json_and_limits(
other: CpuJson,
version: u64,
cpu_index: usize,
limits: limits_core::json_v2::GenericCpuLimit,
) -> Self {
let gen = GenericCpu::from_json_and_limits(other, version, cpu_index, limits);
Self { generic: gen }
}
}
impl AsRef<GenericCpu> for Cpu {
fn as_ref(&self) -> &GenericCpu {
&self.generic
}
}
impl AsMut<GenericCpu> for Cpu {
fn as_mut(&mut self) -> &mut GenericCpu {
&mut self.generic
}
}
impl OnResume for Cpu {
fn on_resume(&self) -> Result<(), Vec<SettingError>> {
self.generic.on_resume()
// TODO
}
}
impl OnSet for Cpu {
fn on_set(&mut self) -> Result<(), Vec<SettingError>> {
self.generic.on_set()
// TODO
}
}
impl crate::settings::OnPowerEvent for Cpu {}
impl TCpu for Cpu {
fn online(&mut self) -> &mut bool {
self.generic.online()
}
fn governor(&mut self, governor: String) {
self.generic.governor(governor)
}
fn get_governor(&self) -> &'_ str {
self.generic.get_governor()
}
fn clock_limits(&mut self, _limits: Option<MinMax<u64>>) {
//self.generic.clock_limits(limits)
// TODO: support this
}
fn get_clock_limits(&self) -> Option<MinMax<u64>> {
self.generic.get_clock_limits()
}
}

View file

@ -0,0 +1,287 @@
use limits_core::json_v2::GenericGpuLimit;
//use sysfuss::{capability::attributes, BasicEntityPath, SysEntity};
//use procbox::gpu::IntelGpu; // TODO
use crate::api::RangeLimit;
use crate::persist::{GpuJson, MinMaxJson};
use crate::settings::{min_max_from_json, MinMax};
use crate::settings::{OnResume, OnSet, SettingError};
use crate::settings::{ProviderBuilder, TGpu};
//#[derive(Clone)]
pub struct Gpu {
//gpu_impl: IntelGpu,
settings: GpuJson,
limits: GenericGpuLimit,
}
impl Gpu {
/*fn find_badgpu(root: Option<impl AsRef<std::path::Path>>) -> IntelGpu {
let root = crate::settings::util::root_or_default_sysfs(root);
let ent_path = match root.class(
"drm",
attributes(
crate::settings::util::CARD_NEEDS
.into_iter()
.map(|s| s.to_string()),
),
) {
Ok(iter) => {
let card = iter
.filter(|ent| if let Ok(name) = ent.name() { name.starts_with("card")} else { false })
//.filter(|ent| super::util::card_also_has(ent, CARD_EXTENSIONS))
.next()
.unwrap_or_else(|| {
log::error!("Failed to find ROG Ally gpu drm in sysfs (no results), using naive fallback");
BasicEntityPath::new(root.as_ref().join("sys/class/drm/card1"))
});
log::info!(
"Found ROG Ally gpu drm in sysfs: {}",
card.as_ref().display()
);
card
}
Err(e) => {
log::error!(
"Failed to find ROG Ally gpu drm in sysfs ({}), using naive fallback",
e
);
BasicEntityPath::new(root.as_ref().join("sys/class/drm/card1"))
}
};
IntelGpu::new(ent_path)
}*/
}
impl core::fmt::Debug for Gpu {
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
f.debug_struct("msi_claw::Gpu")
.field("limits", &self.limits)
//.field("settings", &self.settings)
//.field("gpu_impl", &self.gpu_impl)
.finish_non_exhaustive()
}
}
impl ProviderBuilder<GpuJson, GenericGpuLimit> for Gpu {
fn from_json_and_limits(persistent: GpuJson, _version: u64, limits: GenericGpuLimit) -> Self {
Self {
//gpu_impl: Self::find_badgpu(persistent.root.clone()),
settings: persistent,
limits,
}
}
fn from_limits(limits: GenericGpuLimit) -> Self {
Self {
//gpu_impl: Self::find_badgpu(None::<&'static str>),
settings: GpuJson::default(),
limits,
}
}
}
impl Into<GpuJson> for Gpu {
#[inline]
fn into(self) -> GpuJson {
self.settings
}
}
impl OnSet for Gpu {
fn on_set(&mut self) -> Result<(), Vec<SettingError>> {
// TODO
Ok(())
}
}
impl OnResume for Gpu {
fn on_resume(&self) -> Result<(), Vec<SettingError>> {
// TODO
Ok(())
}
}
impl crate::settings::OnPowerEvent for Gpu {}
impl crate::settings::OnLoad for Gpu {
fn on_load(&mut self) -> Result<(), Vec<SettingError>> {
Ok(())
}
}
impl crate::settings::OnUnload for Gpu {
fn on_unload(&mut self) -> Result<(), Vec<SettingError>> {
Ok(())
}
}
impl TGpu for Gpu {
fn limits(&self) -> crate::api::GpuLimits {
crate::api::GpuLimits {
fast_ppt_limits: self
.limits
.fast_ppt
.clone()
.map(|x| RangeLimit::new(x.min.unwrap_or(0), x.max.unwrap_or(15)))
.map(|mut x| {
if let Some(ppt_divisor) = self.limits.ppt_divisor {
x.min /= ppt_divisor;
x.max /= ppt_divisor;
x
} else {
x
}
}),
fast_ppt_default: {
let def = self
.limits
.fast_ppt_default
.or_else(|| self.limits.fast_ppt.and_then(|x| x.max))
.unwrap_or(15);
if let Some(ppt_divisor) = self.limits.ppt_divisor {
def / ppt_divisor
} else {
def
}
},
slow_ppt_limits: self
.limits
.slow_ppt
.clone()
.map(|x| RangeLimit::new(x.min.unwrap_or(0), x.max.unwrap_or(15)))
.map(|mut x| {
if let Some(ppt_divisor) = self.limits.ppt_divisor {
x.min /= ppt_divisor;
x.max /= ppt_divisor;
x
} else {
x
}
}),
slow_ppt_default: {
let def = self
.limits
.slow_ppt_default
.or_else(|| self.limits.slow_ppt.and_then(|x| x.max))
.unwrap_or(15);
if let Some(ppt_divisor) = self.limits.ppt_divisor {
def / ppt_divisor
} else {
def
}
},
ppt_step: self.limits.ppt_step.unwrap_or(1),
tdp_limits: self
.limits
.tdp
.clone()
.map(|x| RangeLimit::new(x.min.unwrap_or(0), x.max.unwrap_or(15_000_000))),
tdp_boost_limits: self
.limits
.tdp_boost
.clone()
.map(|x| RangeLimit::new(x.min.unwrap_or(0), x.max.unwrap_or(15_000_000))),
tdp_step: self.limits.tdp_step.unwrap_or(42),
clock_min_limits: self
.limits
.clock_min
.clone()
.map(|x| RangeLimit::new(x.min.unwrap_or(0), x.max.unwrap_or(3_000))),
clock_max_limits: self
.limits
.clock_max
.clone()
.map(|x| RangeLimit::new(x.min.unwrap_or(0), x.max.unwrap_or(3_000))),
clock_step: self.limits.clock_step.unwrap_or(100),
memory_control: None,
memory_step: 100,
}
}
fn json(&self) -> crate::persist::GpuJson {
self.settings.clone()
}
fn ppt(&mut self, fast: Option<u64>, slow: Option<u64>) {
if let Some(fast_lims) = &self.limits.fast_ppt {
self.settings.fast_ppt = fast
.map(|x| {
if let Some(ppt_divisor) = self.limits.ppt_divisor {
x * ppt_divisor
} else {
x
}
})
.map(|x| {
x.clamp(
fast_lims.min.unwrap_or(0),
fast_lims.max.unwrap_or(u64::MAX),
)
});
}
if let Some(slow_lims) = &self.limits.slow_ppt {
self.settings.slow_ppt = slow
.map(|x| {
if let Some(ppt_divisor) = self.limits.ppt_divisor {
x * ppt_divisor
} else {
x
}
})
.map(|x| {
x.clamp(
slow_lims.min.unwrap_or(0),
slow_lims.max.unwrap_or(u64::MAX),
)
});
}
}
fn get_ppt(&self) -> (Option<u64>, Option<u64>) {
(
self.settings.fast_ppt.map(|x| {
if let Some(ppt_divisor) = self.limits.ppt_divisor {
x / ppt_divisor
} else {
x
}
}),
self.settings.slow_ppt.map(|x| {
if let Some(ppt_divisor) = self.limits.ppt_divisor {
x / ppt_divisor
} else {
x
}
}),
)
}
fn clock_limits(&mut self, limits: Option<MinMax<u64>>) {
if let Some(clock_min) = &self.limits.clock_min {
if let Some(clock_max) = &self.limits.clock_max {
self.settings.clock_limits = limits.map(|x| {
MinMaxJson {
min: x.min.clamp(clock_min.min, clock_min.max),
max: x.max.clamp(clock_max.max, clock_max.max)
}
});
}
}
}
fn get_clock_limits(&self) -> Option<MinMax<u64>> {
self.settings.clock_limits.clone().map(|mmj| min_max_from_json(mmj, 1))
}
fn memory_clock(&mut self, _speed: Option<u64>) {}
fn get_memory_clock(&self) -> Option<u64> {
None
}
fn provider(&self) -> crate::persist::DriverJson {
crate::persist::DriverJson::Generic
}
}

View file

@ -0,0 +1,6 @@
mod cpu;
mod gpu;
mod util;
pub use cpu::Cpus;
pub use gpu::Gpu;

View file

View file

@ -0,0 +1,155 @@
use crate::persist::CpuJson;
use crate::settings::generic::{Cpu as GenericCpu, Cpus as GenericCpus, FromGenericCpuInfo};
use crate::settings::MinMax;
use crate::settings::{OnResume, OnSet, SettingError};
use crate::settings::{ProviderBuilder, TCpu, TCpus};
#[derive(Debug)]
pub struct Cpus {
generic: GenericCpus<Cpu>,
}
impl ProviderBuilder<Vec<CpuJson>, limits_core::json_v2::GenericCpusLimit> for Cpus {
fn from_limits(limits: limits_core::json_v2::GenericCpusLimit) -> Self {
Self {
generic: GenericCpus::from_limits(limits),
}
}
fn from_json_and_limits(
other: Vec<CpuJson>,
version: u64,
limits: limits_core::json_v2::GenericCpusLimit,
) -> Self {
Self {
generic: GenericCpus::from_json_and_limits(other, version, limits),
}
}
}
impl OnResume for Cpus {
fn on_resume(&self) -> Result<(), Vec<SettingError>> {
self.generic.on_resume()
// TODO
}
}
impl OnSet for Cpus {
fn on_set(&mut self) -> Result<(), Vec<SettingError>> {
self.generic.on_set()
// TODO
}
}
impl crate::settings::OnPowerEvent for Cpus {}
impl crate::settings::OnLoad for Cpus {
fn on_load(&mut self) -> Result<(), Vec<SettingError>> {
Ok(())
}
}
impl crate::settings::OnUnload for Cpus {
fn on_unload(&mut self) -> Result<(), Vec<SettingError>> {
Ok(())
}
}
impl TCpus for Cpus {
fn limits(&self) -> crate::api::CpusLimits {
self.generic.limits()
}
fn json(&self) -> Vec<crate::persist::CpuJson> {
self.generic.json() // TODO
}
fn cpus(&mut self) -> Vec<&mut dyn TCpu> {
self.generic.cpus() // TODO
}
fn len(&self) -> usize {
self.generic.len() // TODO
}
fn smt(&mut self) -> &'_ mut bool {
self.generic.smt()
}
fn provider(&self) -> crate::persist::DriverJson {
crate::persist::DriverJson::GenericAMD
}
}
#[derive(Debug)]
pub struct Cpu {
generic: GenericCpu,
}
impl FromGenericCpuInfo for Cpu {
fn from_limits(cpu_index: usize, limits: limits_core::json_v2::GenericCpuLimit) -> Self {
let gen = GenericCpu::from_limits(cpu_index, limits.clone());
Self { generic: gen }
}
fn from_json_and_limits(
other: CpuJson,
version: u64,
cpu_index: usize,
limits: limits_core::json_v2::GenericCpuLimit,
) -> Self {
let gen = GenericCpu::from_json_and_limits(other, version, cpu_index, limits);
Self { generic: gen }
}
}
impl AsRef<GenericCpu> for Cpu {
fn as_ref(&self) -> &GenericCpu {
&self.generic
}
}
impl AsMut<GenericCpu> for Cpu {
fn as_mut(&mut self) -> &mut GenericCpu {
&mut self.generic
}
}
impl OnResume for Cpu {
fn on_resume(&self) -> Result<(), Vec<SettingError>> {
self.generic.on_resume()
// TODO
}
}
impl OnSet for Cpu {
fn on_set(&mut self) -> Result<(), Vec<SettingError>> {
self.generic.on_set()
// TODO
}
}
impl crate::settings::OnPowerEvent for Cpu {}
impl TCpu for Cpu {
fn online(&mut self) -> &mut bool {
self.generic.online()
}
fn governor(&mut self, governor: String) {
self.generic.governor(governor)
}
fn get_governor(&self) -> &'_ str {
self.generic.get_governor()
}
fn clock_limits(&mut self, _limits: Option<MinMax<u64>>) {
//self.generic.clock_limits(limits)
// TODO: support this
}
fn get_clock_limits(&self) -> Option<MinMax<u64>> {
self.generic.get_clock_limits()
}
}

View file

@ -0,0 +1,286 @@
use limits_core::json_v2::GenericGpuLimit;
use sysfuss::{capability::attributes, BasicEntityPath, SysEntity};
use procbox::combo::AmdGpu;
use crate::api::RangeLimit;
use crate::persist::{GpuJson, MinMaxJson};
use crate::settings::{min_max_from_json, MinMax};
use crate::settings::{OnResume, OnSet, SettingError};
use crate::settings::{ProviderBuilder, TGpu};
//#[derive(Clone)]
pub struct Gpu {
gpu_impl: AmdGpu,
settings: GpuJson,
limits: GenericGpuLimit,
}
impl Gpu {
fn find_amdgpu(root: Option<impl AsRef<std::path::Path>>) -> AmdGpu {
let root = crate::settings::util::root_or_default_sysfs(root);
let ent_path = match root.class(
"drm",
attributes(
crate::settings::util::CARD_NEEDS
.into_iter()
.map(|s| s.to_string()),
),
) {
Ok(iter) => {
let card = iter
.filter(|ent| if let Ok(name) = ent.name() { name.starts_with("card")} else { false })
//.filter(|ent| super::util::card_also_has(ent, CARD_EXTENSIONS))
.next()
.unwrap_or_else(|| {
log::error!("Failed to find ROG Ally gpu drm in sysfs (no results), using naive fallback");
BasicEntityPath::new(root.as_ref().join("sys/class/drm/card1"))
});
log::info!(
"Found ROG Ally gpu drm in sysfs: {}",
card.as_ref().display()
);
card
}
Err(e) => {
log::error!(
"Failed to find ROG Ally gpu drm in sysfs ({}), using naive fallback",
e
);
BasicEntityPath::new(root.as_ref().join("sys/class/drm/card1"))
}
};
AmdGpu::new(ent_path)
}
}
impl core::fmt::Debug for Gpu {
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
f.debug_struct("rog_ally::Gpu")
.field("limits", &self.limits)
//.field("gpu_impl", &self.gpu_impl)
.finish_non_exhaustive()
}
}
impl ProviderBuilder<GpuJson, GenericGpuLimit> for Gpu {
fn from_json_and_limits(persistent: GpuJson, _version: u64, limits: GenericGpuLimit) -> Self {
Self {
gpu_impl: Self::find_amdgpu(persistent.root.clone()),
settings: persistent,
limits,
}
}
fn from_limits(limits: GenericGpuLimit) -> Self {
Self {
gpu_impl: Self::find_amdgpu(None::<&'static str>),
settings: GpuJson::default(),
limits,
}
}
}
impl Into<GpuJson> for Gpu {
#[inline]
fn into(self) -> GpuJson {
self.settings
}
}
impl OnSet for Gpu {
fn on_set(&mut self) -> Result<(), Vec<SettingError>> {
// TODO
Ok(())
}
}
impl OnResume for Gpu {
fn on_resume(&self) -> Result<(), Vec<SettingError>> {
// TODO
Ok(())
}
}
impl crate::settings::OnPowerEvent for Gpu {}
impl crate::settings::OnLoad for Gpu {
fn on_load(&mut self) -> Result<(), Vec<SettingError>> {
Ok(())
}
}
impl crate::settings::OnUnload for Gpu {
fn on_unload(&mut self) -> Result<(), Vec<SettingError>> {
Ok(())
}
}
impl TGpu for Gpu {
fn limits(&self) -> crate::api::GpuLimits {
crate::api::GpuLimits {
fast_ppt_limits: self
.limits
.fast_ppt
.clone()
.map(|x| RangeLimit::new(x.min.unwrap_or(0), x.max.unwrap_or(15)))
.map(|mut x| {
if let Some(ppt_divisor) = self.limits.ppt_divisor {
x.min /= ppt_divisor;
x.max /= ppt_divisor;
x
} else {
x
}
}),
fast_ppt_default: {
let def = self
.limits
.fast_ppt_default
.or_else(|| self.limits.fast_ppt.and_then(|x| x.max))
.unwrap_or(15);
if let Some(ppt_divisor) = self.limits.ppt_divisor {
def / ppt_divisor
} else {
def
}
},
slow_ppt_limits: self
.limits
.slow_ppt
.clone()
.map(|x| RangeLimit::new(x.min.unwrap_or(0), x.max.unwrap_or(15)))
.map(|mut x| {
if let Some(ppt_divisor) = self.limits.ppt_divisor {
x.min /= ppt_divisor;
x.max /= ppt_divisor;
x
} else {
x
}
}),
slow_ppt_default: {
let def = self
.limits
.slow_ppt_default
.or_else(|| self.limits.slow_ppt.and_then(|x| x.max))
.unwrap_or(15);
if let Some(ppt_divisor) = self.limits.ppt_divisor {
def / ppt_divisor
} else {
def
}
},
ppt_step: self.limits.ppt_step.unwrap_or(1),
tdp_limits: self
.limits
.tdp
.clone()
.map(|x| RangeLimit::new(x.min.unwrap_or(0), x.max.unwrap_or(15_000_000))),
tdp_boost_limits: self
.limits
.tdp_boost
.clone()
.map(|x| RangeLimit::new(x.min.unwrap_or(0), x.max.unwrap_or(15_000_000))),
tdp_step: self.limits.tdp_step.unwrap_or(42),
clock_min_limits: self
.limits
.clock_min
.clone()
.map(|x| RangeLimit::new(x.min.unwrap_or(0), x.max.unwrap_or(3_000))),
clock_max_limits: self
.limits
.clock_max
.clone()
.map(|x| RangeLimit::new(x.min.unwrap_or(0), x.max.unwrap_or(3_000))),
clock_step: self.limits.clock_step.unwrap_or(100),
memory_control: None,
memory_step: 100,
}
}
fn json(&self) -> crate::persist::GpuJson {
self.settings.clone()
}
fn ppt(&mut self, fast: Option<u64>, slow: Option<u64>) {
if let Some(fast_lims) = &self.limits.fast_ppt {
self.settings.fast_ppt = fast
.map(|x| {
if let Some(ppt_divisor) = self.limits.ppt_divisor {
x * ppt_divisor
} else {
x
}
})
.map(|x| {
x.clamp(
fast_lims.min.unwrap_or(0),
fast_lims.max.unwrap_or(u64::MAX),
)
});
}
if let Some(slow_lims) = &self.limits.slow_ppt {
self.settings.slow_ppt = slow
.map(|x| {
if let Some(ppt_divisor) = self.limits.ppt_divisor {
x * ppt_divisor
} else {
x
}
})
.map(|x| {
x.clamp(
slow_lims.min.unwrap_or(0),
slow_lims.max.unwrap_or(u64::MAX),
)
});
}
}
fn get_ppt(&self) -> (Option<u64>, Option<u64>) {
(
self.settings.fast_ppt.map(|x| {
if let Some(ppt_divisor) = self.limits.ppt_divisor {
x / ppt_divisor
} else {
x
}
}),
self.settings.slow_ppt.map(|x| {
if let Some(ppt_divisor) = self.limits.ppt_divisor {
x / ppt_divisor
} else {
x
}
}),
)
}
fn clock_limits(&mut self, limits: Option<MinMax<u64>>) {
if let Some(clock_min) = &self.limits.clock_min {
if let Some(clock_max) = &self.limits.clock_max {
self.settings.clock_limits = limits.map(|x| {
MinMaxJson {
min: x.min.clamp(clock_min.min, clock_min.max),
max: x.max.clamp(clock_max.max, clock_max.max)
}
});
}
}
}
fn get_clock_limits(&self) -> Option<MinMax<u64>> {
self.settings.clock_limits.clone().map(|mmj| min_max_from_json(mmj, 1))
}
fn memory_clock(&mut self, _speed: Option<u64>) {}
fn get_memory_clock(&self) -> Option<u64> {
None
}
fn provider(&self) -> crate::persist::DriverJson {
crate::persist::DriverJson::Generic
}
}

View file

@ -0,0 +1,6 @@
mod cpu;
mod gpu;
mod util;
pub use cpu::Cpus;
pub use gpu::Gpu;

View file

View file

@ -723,8 +723,8 @@ impl TCpu for Cpu {
self.clock_limits = limits; self.clock_limits = limits;
} }
fn get_clock_limits(&self) -> Option<&MinMax<u64>> { fn get_clock_limits(&self) -> Option<MinMax<u64>> {
self.clock_limits.as_ref() self.clock_limits.clone()
} }
} }

View file

@ -717,8 +717,8 @@ impl TGpu for Gpu {
self.clock_limits = limits; self.clock_limits = limits;
} }
fn get_clock_limits(&self) -> Option<&MinMax<u64>> { fn get_clock_limits(&self) -> Option<MinMax<u64>> {
self.clock_limits.as_ref() self.clock_limits.clone()
} }
fn memory_clock(&mut self, speed: Option<u64>) { fn memory_clock(&mut self, speed: Option<u64>) {

View file

@ -65,7 +65,7 @@ pub trait TGpu: OnSet + OnResume + OnPowerEvent + OnLoad + OnUnload + Debug + Se
fn clock_limits(&mut self, limits: Option<MinMax<u64>>); fn clock_limits(&mut self, limits: Option<MinMax<u64>>);
fn get_clock_limits(&self) -> Option<&MinMax<u64>>; fn get_clock_limits(&self) -> Option<MinMax<u64>>;
fn memory_clock(&mut self, speed: Option<u64>); fn memory_clock(&mut self, speed: Option<u64>);
@ -101,7 +101,7 @@ pub trait TCpu: Debug + Send {
fn clock_limits(&mut self, limits: Option<MinMax<u64>>); fn clock_limits(&mut self, limits: Option<MinMax<u64>>);
fn get_clock_limits(&self) -> Option<&MinMax<u64>>; fn get_clock_limits(&self) -> Option<MinMax<u64>>;
} }
pub trait TGeneral: OnSet + OnResume + OnPowerEvent + OnLoad + OnUnload + Debug + Send { pub trait TGeneral: OnSet + OnResume + OnPowerEvent + OnLoad + OnUnload + Debug + Send {

View file

@ -356,7 +356,7 @@ impl TCpu for Cpu {
fn clock_limits(&mut self, _limits: Option<MinMax<u64>>) {} fn clock_limits(&mut self, _limits: Option<MinMax<u64>>) {}
fn get_clock_limits(&self) -> Option<&MinMax<u64>> { fn get_clock_limits(&self) -> Option<MinMax<u64>> {
None None
} }
} }

View file

@ -98,7 +98,7 @@ impl TGpu for Gpu {
fn clock_limits(&mut self, _limits: Option<MinMax<u64>>) {} fn clock_limits(&mut self, _limits: Option<MinMax<u64>>) {}
fn get_clock_limits(&self) -> Option<&MinMax<u64>> { fn get_clock_limits(&self) -> Option<MinMax<u64>> {
None None
} }

View file

@ -59,7 +59,6 @@ mod test {
online: status, online: status,
clock_limits: None, clock_limits: None,
governor: "schedutil".to_owned(), governor: "schedutil".to_owned(),
root: Some("/".to_owned()),
} }
} }
} }

View file

@ -1,6 +1,6 @@
{ {
"name": "PowerTools", "name": "PowerTools",
"version": "2.0.3", "version": "2.0.3-alpha1",
"description": "Power tweaks for power users", "description": "Power tweaks for power users",
"scripts": { "scripts": {
"build": "shx rm -rf dist && rollup -c", "build": "shx rm -rf dist && rollup -c",

View file

@ -1,7 +1,7 @@
{ {
"name": "PowerTools", "name": "PowerTools",
"author": "NGnius", "author": "NGnius",
"flags": ["root", "global-dfl"], "flags": ["root", "_debug", "global-dfl"],
"publish": { "publish": {
"discord_id": "106537989684887552", "discord_id": "106537989684887552",
"description": "Power tweaks for power users", "description": "Power tweaks for power users",