Compare commits

...

23 Commits
5.0.6 ... 5.0.8

Author SHA1 Message Date
Luke D. Jones
bb7b3a81fb Bump version 2024-02-24 21:50:52 +13:00
Luke D. Jones
19607d71c3 Prep 5.0.8 release 2024-02-24 17:09:24 +13:00
Luke D. Jones
96f281d789 Remove the use of bytes in zbus signatures 2024-02-23 21:50:53 +13:00
Luke D. Jones
7613eded95 Sane defaults for asusd config 2024-02-23 14:40:00 +13:00
Luke D. Jones
50eccd2b1d Formatting and fixes 2024-02-23 12:36:16 +13:00
Luke Jones
ba54007102 Merge branch 'bugfix/persistent-theme' into 'main'
Reintroduce persistent dark/light mode

See merge request asus-linux/asusctl!180
2024-02-19 19:44:59 +00:00
Filip Binkiewicz
a028f5375f Reintroduce persistent dark/light mode 2024-02-19 19:27:56 +00:00
Luke Jones
9ec02cd727 Merge branch 'dearner-main-patch-22870' into 'main'
Added G814JZ to aura_support.ron (uses G814JI keymap)

See merge request asus-linux/asusctl!179
2024-02-14 01:40:26 +00:00
Chris Dearner
4b46ece09a Added G814JZ to aura_support.ron (uses G814JI keymap) 2024-02-05 12:49:49 +00:00
Luke D. Jones
086bbd0908 Fix the broken pipe error 2024-02-02 23:26:41 +13:00
Luke D. Jones
c94eaa473e Update TS bindings 2024-01-24 22:37:10 +13:00
Luke D. Jones
b1b809834b Reload and apply settings if config file externally changed 2024-01-24 12:19:34 +13:00
Luke D. Jones
84183288ec Fix inotify watch failing thanks to vim idiocy 2024-01-23 22:44:20 +13:00
Luke D. Jones
86cbef83b6 Reload asusd.ron if changed 2024-01-22 21:54:19 +13:00
Luke D. Jones
006fb632c4 Doc and feature fixes 2024-01-22 19:33:40 +13:00
Luke D. Jones
e3636ed8ce Update smithay-client-toolkit 2024-01-22 12:06:42 +13:00
Luke D. Jones
cfd207f251 Remove async-trait crate and set min rustc 1.75 2024-01-15 18:22:41 +13:00
Luke D. Jones
d4c68546e7 Added ability to change what EPP is linked with each throttle profile 2024-01-15 18:00:27 +13:00
Luke D. Jones
6f4a7e16dc Fixes to RCC 2024-01-05 14:21:31 +13:00
Luke D. Jones
f64253d633 Various bugfixes 2024-01-05 13:53:57 +13:00
Luke D. Jones
124c17aadc Add default issue template 2024-01-04 14:30:11 +13:00
Luke D. Jones
ab40f9fcbf Add FX705D led support 2024-01-04 09:23:37 +13:00
Luke D. Jones
5cdfa5a8d4 Fix to suspend process in anime thread to let custom anims run on wake 2023-12-27 11:24:39 +13:00
37 changed files with 1055 additions and 507 deletions

View File

@@ -0,0 +1,24 @@
## Issue description
(Summarize the bug encountered)
## Steps to reproduce
(How can the issue be reproduced)
## What is the current bug behavior?
(What actually happens)
## What is the expected correct behavior?
(What you should see instead)
## Relevant logs and/or screenshots
(run `journalctl -b -u supergfxd > ~/supergfxd.log` and attach `~/supergfxd.log`)
(Paste any relevant logs - use code blocks (```) to format console output, logs, and code, as
it's very hard to read otherwise.)
/label ~bug ~reproducable ~needs-investigation

View File

@@ -6,6 +6,27 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
## [Unreleased]
## [v5.0.8]
### Changed
- Reintroduce persisting dark/light mode in config file
- Added ability to change what EPP is linked with each throttle profile
- Don't change EPP or thermal profile if the battery/ac state hasn't actually changed on resume
- Re-implement the `asusctl -s` command (not fully)
- Add more docs to some parts of code, and dbus interfaces
- Reload asusd.ron if changed. Does not notify any dbus listeners (yet)
- Fix the broken pipe error
- Remove the use of bytes in zbus signatures (another cause of broken pipe)
### Added
- Support for G614J LED modes
## [v5.0.7]
### Changed
- Fix to suspend process in anime thread to let custom anims run on wake.
- Fix to reload the fan curves correctly on boot.
- Add new config option `platform_policy_linked_epp` to set if energy_performance_preference should be paired with platform_profile/throttle_thermal_policy
- Small fixes to rog-control-center
## [v5.0.6]
- Revert egui update due to a lot of issues arising from window closing.

315
Cargo.lock generated
View File

@@ -104,9 +104,9 @@ checksum = "f26201604c87b1e01bd3d98f8d5d9a8fcbb815e8cedb41ffccbeb4bf593a35fe"
[[package]]
name = "ahash"
version = "0.8.6"
version = "0.8.7"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "91429305e9f0a25f6205c5b8e0d2db09e0708a7a6df0f42212bb56c32c8ac97a"
checksum = "77c3a9648d43b9cd48db467b3f87fdd6e146bcc88ab0180006cef2179fe11d01"
dependencies = [
"cfg-if",
"once_cell",
@@ -164,9 +164,9 @@ dependencies = [
[[package]]
name = "anyhow"
version = "1.0.76"
version = "1.0.79"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "59d2a3357dde987206219e78ecfbbb6e8dad06cbb65292758d3270e6254f7355"
checksum = "080e9890a082662b09c1ad45f567faeeb47f22b5fb23895fbe1e651e718e25ca"
[[package]]
name = "arboard"
@@ -199,7 +199,7 @@ checksum = "96d30a06541fbafbc7f82ed10c06164cfbd2c401138f6addd8404629c4b16711"
[[package]]
name = "asusctl"
version = "5.0.6"
version = "5.0.8"
dependencies = [
"asusd",
"cargo-husky",
@@ -213,20 +213,21 @@ dependencies = [
"rog_platform",
"rog_profiles",
"tinybmp",
"tokio",
"toml 0.5.11",
]
[[package]]
name = "asusd"
version = "5.0.6"
version = "5.0.8"
dependencies = [
"async-trait",
"cargo-husky",
"concat-idents",
"config-traits",
"dmi_id",
"env_logger",
"futures-lite 2.1.0",
"futures-lite 1.13.0",
"inotify",
"log",
"logind-zbus",
"rog_anime",
@@ -243,7 +244,7 @@ dependencies = [
[[package]]
name = "asusd-user"
version = "5.0.6"
version = "5.0.8"
dependencies = [
"cargo-husky",
"config-traits",
@@ -289,7 +290,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "1ca33f4bc4ed1babef42cad36cc1f51fa88be00420404e5b1e80ab1b18f7678c"
dependencies = [
"concurrent-queue",
"event-listener 4.0.1",
"event-listener 4.0.3",
"event-listener-strategy",
"futures-core",
"pin-project-lite",
@@ -301,11 +302,11 @@ version = "1.8.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "17ae5ebefcc48e7452b4987947920dac9450be1110cadf34d1b8c116bdbaf97c"
dependencies = [
"async-lock 3.2.0",
"async-lock 3.3.0",
"async-task",
"concurrent-queue",
"fastrand 2.0.1",
"futures-lite 2.1.0",
"futures-lite 2.2.0",
"slab",
]
@@ -343,18 +344,18 @@ dependencies = [
[[package]]
name = "async-io"
version = "2.2.2"
version = "2.3.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "6afaa937395a620e33dc6a742c593c01aced20aa376ffb0f628121198578ccc7"
checksum = "fb41eb19024a91746eba0773aa5e16036045bbf45733766661099e182ea6a744"
dependencies = [
"async-lock 3.2.0",
"async-lock 3.3.0",
"cfg-if",
"concurrent-queue",
"futures-io",
"futures-lite 2.1.0",
"futures-lite 2.2.0",
"parking",
"polling 3.3.1",
"rustix 0.38.28",
"polling 3.3.2",
"rustix 0.38.30",
"slab",
"tracing",
"windows-sys 0.52.0",
@@ -371,11 +372,11 @@ dependencies = [
[[package]]
name = "async-lock"
version = "3.2.0"
version = "3.3.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "7125e42787d53db9dd54261812ef17e937c95a51e4d291373b670342fa44310c"
checksum = "d034b430882f8381900d3fe6f0aaa3ad94f2cb4ac519b429692a1bc2dda4ae7b"
dependencies = [
"event-listener 4.0.1",
"event-listener 4.0.3",
"event-listener-strategy",
"pin-project-lite",
]
@@ -404,7 +405,7 @@ dependencies = [
"cfg-if",
"event-listener 3.1.0",
"futures-lite 1.13.0",
"rustix 0.38.28",
"rustix 0.38.30",
"windows-sys 0.48.0",
]
@@ -416,7 +417,7 @@ checksum = "5fd55a5ba1179988837d24ab4c7cc8ed6efdeff578ede0416b4225a5fca35bd0"
dependencies = [
"proc-macro2",
"quote",
"syn 2.0.43",
"syn 2.0.48",
]
[[package]]
@@ -425,13 +426,13 @@ version = "0.2.5"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "9e47d90f65a225c4527103a8d747001fc56e375203592b25ad103e1ca13124c5"
dependencies = [
"async-io 2.2.2",
"async-io 2.3.0",
"async-lock 2.8.0",
"atomic-waker",
"cfg-if",
"futures-core",
"futures-io",
"rustix 0.38.28",
"rustix 0.38.30",
"signal-hook-registry",
"slab",
"windows-sys 0.48.0",
@@ -439,19 +440,19 @@ dependencies = [
[[package]]
name = "async-task"
version = "4.6.0"
version = "4.7.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "e1d90cd0b264dfdd8eb5bad0a2c217c1f88fa96a8573f40e7b12de23fb468f46"
checksum = "fbb36e985947064623dbd357f727af08ffd077f93d696782f3c56365fa2e2799"
[[package]]
name = "async-trait"
version = "0.1.75"
version = "0.1.77"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "fdf6721fb0140e4f897002dd086c06f6c27775df19cfe1fccb21181a48fd2c98"
checksum = "c980ee35e870bd1a4d2c8294d4c04d0499e67bca1e4b5cefcc693c2fa00caea9"
dependencies = [
"proc-macro2",
"quote",
"syn 2.0.43",
"syn 2.0.48",
]
[[package]]
@@ -546,17 +547,17 @@ dependencies = [
[[package]]
name = "base64"
version = "0.21.5"
version = "0.21.7"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "35636a1494ede3b646cc98f74f8e62c773a38a659ebc777a2cf26b9b74171df9"
checksum = "9d297deb1925b89f2ccc13d7635fa0714f12c87adce1c75356b39ca9b7178567"
[[package]]
name = "bindgen"
version = "0.69.1"
version = "0.69.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "9ffcebc3849946a7170a05992aac39da343a90676ab392c51a4280981d6379c2"
checksum = "a4c69fae65a523209d34240b60abe0c42d33d1045d445c0839d8a4894a736e2d"
dependencies = [
"bitflags 2.4.1",
"bitflags 2.4.2",
"cexpr",
"clang-sys",
"lazy_static",
@@ -567,7 +568,7 @@ dependencies = [
"regex",
"rustc-hash",
"shlex",
"syn 2.0.43",
"syn 2.0.48",
]
[[package]]
@@ -578,9 +579,9 @@ checksum = "bef38d45163c2f1dde094a7dfd33ccf595c92905c8f8f4fdc18d06fb1037718a"
[[package]]
name = "bitflags"
version = "2.4.1"
version = "2.4.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "327762f6e5a765692301e5bb513e0d9fef63be86bbc14528052b1cd3e6f03e07"
checksum = "ed570934406eb16438a4e976b1b4500774099c13b8cb96eec99f620f05090ddf"
dependencies = [
"serde",
]
@@ -626,11 +627,11 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "6a37913e8dc4ddcc604f0c6d3bf2887c995153af3611de9e23c352b44c1b9118"
dependencies = [
"async-channel 2.1.1",
"async-lock 3.2.0",
"async-lock 3.3.0",
"async-task",
"fastrand 2.0.1",
"futures-io",
"futures-lite 2.1.0",
"futures-lite 2.2.0",
"piper",
"tracing",
]
@@ -658,7 +659,7 @@ checksum = "965ab7eb5f8f97d2a083c799f3a1b994fc397b2fe2da5d1da1626ce15a39f2b1"
dependencies = [
"proc-macro2",
"quote",
"syn 2.0.43",
"syn 2.0.48",
]
[[package]]
@@ -745,9 +746,9 @@ dependencies = [
[[package]]
name = "cfg-expr"
version = "0.15.5"
version = "0.15.6"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "03915af431787e6ffdcc74c645077518c6b6e01f80b761e0fbbfa288536311b3"
checksum = "6100bc57b6209840798d95cb2775684849d332f7bd788db2a8c8caf7ef82a41a"
dependencies = [
"smallvec",
"target-lexicon",
@@ -790,9 +791,9 @@ dependencies = [
[[package]]
name = "clang-sys"
version = "1.6.1"
version = "1.7.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "c688fc74432808e3eb684cae8830a86be1d66a2bd58e1f248ed0960a590baf6f"
checksum = "67523a3b4be3ce1989d607a828d036249522dd9c1c8de7f4dd2dae43a37369d1"
dependencies = [
"glob",
"libc",
@@ -832,7 +833,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "f76990911f2267d837d9d0ad060aa63aaad170af40904b29461734c339030d4d"
dependencies = [
"quote",
"syn 2.0.43",
"syn 2.0.48",
]
[[package]]
@@ -846,7 +847,7 @@ dependencies = [
[[package]]
name = "config-traits"
version = "5.0.6"
version = "5.0.8"
dependencies = [
"cargo-husky",
"log",
@@ -899,13 +900,13 @@ dependencies = [
[[package]]
name = "cpuctl"
version = "5.0.6"
version = "5.0.8"
[[package]]
name = "cpufeatures"
version = "0.2.11"
version = "0.2.12"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "ce420fe07aecd3e67c5f910618fe65e94158f6dcc0adf44e00d69ce2bdfe0fd0"
checksum = "53fe5e26ff1b7aef8bca9c6080520cfb8d9333c7568e1829cef191a9723e5504"
dependencies = [
"libc",
]
@@ -921,12 +922,9 @@ dependencies = [
[[package]]
name = "crossbeam-utils"
version = "0.8.18"
version = "0.8.19"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "c3a430a770ebd84726f584a90ee7f020d28db52c6d02138900f22341f866d39c"
dependencies = [
"cfg-if",
]
checksum = "248e3bacc7dc6baa3b21e405ee045c3047101a49145e7e9eca583ab4c2ca5345"
[[package]]
name = "crypto-common"
@@ -940,9 +938,9 @@ dependencies = [
[[package]]
name = "deranged"
version = "0.3.10"
version = "0.3.11"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "8eb30d70a07a3b04884d2677f06bec33509dc67ca60d92949e5535352d3191dc"
checksum = "b42b6fa04a440b495c8b04d0e71b707c585f83cb9cb28cf8cd0d976c315e31b4"
dependencies = [
"powerfmt",
]
@@ -1026,7 +1024,7 @@ dependencies = [
[[package]]
name = "dmi_id"
version = "5.0.6"
version = "5.0.8"
dependencies = [
"log",
"udev",
@@ -1165,14 +1163,14 @@ checksum = "f95e2801cd355d4a1a3e3953ce6ee5ae9603a5c833455343a8bfe3f44d418246"
dependencies = [
"proc-macro2",
"quote",
"syn 2.0.43",
"syn 2.0.48",
]
[[package]]
name = "env_logger"
version = "0.10.1"
version = "0.10.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "95b3f3e67048839cb0d0781f445682a35113da7121f7c949db0e2be96a4fbece"
checksum = "4cd405aab171cb85d6735e5c8d9db038c17d3ca007a4d2c25f337935c3d90580"
dependencies = [
"humantime",
"is-terminal",
@@ -1242,9 +1240,9 @@ dependencies = [
[[package]]
name = "event-listener"
version = "4.0.1"
version = "4.0.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "84f2cdcf274580f2d63697192d744727b3198894b1bf02923643bf59e2c26712"
checksum = "67b215c49b2b248c855fb73579eb1f4f26c38ffdc12973e20e07b91d78d5646e"
dependencies = [
"concurrent-queue",
"parking",
@@ -1257,7 +1255,7 @@ version = "0.4.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "958e4d70b6d5e81971bebec42271ec641e7ff4e170a6fa605f2b8a8b65cb97d3"
dependencies = [
"event-listener 4.0.1",
"event-listener 4.0.3",
"pin-project-lite",
]
@@ -1278,9 +1276,9 @@ checksum = "25cbce373ec4653f1a01a31e8a5e5ec0c622dc27ff9c4e6606eefef5cbbed4a5"
[[package]]
name = "fdeflate"
version = "0.3.2"
version = "0.3.4"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "7caf4086251adeba90011a7ff9bd1f6d7f7595be0871867daa4dbb0fcf2ca932"
checksum = "4f9bfee30e4dedf0ab8b422f03af778d9612b63f502710fc500a334ebe2de645"
dependencies = [
"simd-adler32",
]
@@ -1387,9 +1385,9 @@ dependencies = [
[[package]]
name = "futures-lite"
version = "2.1.0"
version = "2.2.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "aeee267a1883f7ebef3700f262d2d54de95dfaf38189015a74fdc4e0c7ad8143"
checksum = "445ba825b27408685aaecefd65178908c36c6e96aaf6d8599419d46e624192ba"
dependencies = [
"fastrand 2.0.1",
"futures-core",
@@ -1406,7 +1404,7 @@ checksum = "87750cf4b7a4c0625b1529e4c543c2182106e4dedc60a2a6455e00d212c489ac"
dependencies = [
"proc-macro2",
"quote",
"syn 2.0.43",
"syn 2.0.48",
]
[[package]]
@@ -1519,9 +1517,9 @@ dependencies = [
[[package]]
name = "getrandom"
version = "0.2.11"
version = "0.2.12"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "fe9006bed769170c11f845cf00c7c1e9092aeb3f268e007c3e760ac68008070f"
checksum = "190092ea657667030ac6a35e305e62fc4dd69fd98ac98631e5d3a2b1575a12b5"
dependencies = [
"cfg-if",
"libc",
@@ -1826,9 +1824,9 @@ checksum = "95505c38b4572b2d910cecb0281560f54b440a19336cbbcb27bf6ce6adc6f5a8"
[[package]]
name = "hermit-abi"
version = "0.3.3"
version = "0.3.4"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "d77f7ec81a6d05a3abb01ab6eb7590f6083d08449fe5a1c8b1e620283546ccb7"
checksum = "5d3d0e0f38255e7fa3cf31335b3a56f05febd18025f4db5ef7a0cfb4f8da651f"
[[package]]
name = "hex"
@@ -1853,16 +1851,16 @@ checksum = "9a3a5bfb195931eeb336b2a7b4d761daec841b97f947d34394601737a7bba5e4"
[[package]]
name = "iana-time-zone"
version = "0.1.58"
version = "0.1.59"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "8326b86b6cff230b97d0d312a6c40a60726df3332e721f72a1b035f451663b20"
checksum = "b6a67363e2aa4443928ce15e57ebae94fd8949958fd1223c4cfc0cd473ad7539"
dependencies = [
"android_system_properties",
"core-foundation-sys",
"iana-time-zone-haiku",
"js-sys",
"wasm-bindgen",
"windows-core",
"windows-core 0.52.0",
]
[[package]]
@@ -1941,13 +1939,13 @@ dependencies = [
[[package]]
name = "is-terminal"
version = "0.4.9"
version = "0.4.10"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "cb0889898416213fab133e1d33a0e5858a48177452750691bde3666d0fdbaf8b"
checksum = "0bad00257d07be169d870ab665980b06cdb366d792ad690bf2e76876dc503455"
dependencies = [
"hermit-abi",
"rustix 0.38.28",
"windows-sys 0.48.0",
"rustix 0.38.30",
"windows-sys 0.52.0",
]
[[package]]
@@ -2049,9 +2047,9 @@ dependencies = [
[[package]]
name = "libc"
version = "0.2.151"
version = "0.2.152"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "302d7ab3130588088d277783b1e2d2e10c9e9e4a16dd9050e6ec93fb3e7048f4"
checksum = "13e3bf6590cbc649f4d1a3eefc9d5d6eb746f5200ffb04e5e142700b8faa56e7"
[[package]]
name = "libloading"
@@ -2069,7 +2067,7 @@ version = "0.0.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "85c833ca1e66078851dba29046874e38f08b2c883700aa29a03ddd3b23814ee8"
dependencies = [
"bitflags 2.4.1",
"bitflags 2.4.2",
"libc",
"redox_syscall 0.4.1",
]
@@ -2080,7 +2078,7 @@ version = "0.0.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "3af92c55d7d839293953fcd0fda5ecfe93297cfde6ffbdec13b41d99c0ba6607"
dependencies = [
"bitflags 2.4.1",
"bitflags 2.4.2",
"libc",
"redox_syscall 0.4.1",
]
@@ -2115,9 +2113,9 @@ checksum = "ef53942eb7bf7ff43a617b3e2c1c4a5ecf5944a7c1bc12d7ee39bbb15e5c1519"
[[package]]
name = "linux-raw-sys"
version = "0.4.12"
version = "0.4.13"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "c4cd1a83af159aa67994778be9070f0ae1bd732942279cabb14f86f986a21456"
checksum = "01cda141df6706de531b6c46c3a33ecca755538219bd484262fa09410c13539c"
[[package]]
name = "lock_api"
@@ -2169,9 +2167,9 @@ dependencies = [
[[package]]
name = "memchr"
version = "2.6.4"
version = "2.7.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "f665ee40bc4a3c5590afb1e9677db74a508659dfd71e126420da8274909a0167"
checksum = "523dc4f511e55ab87b694dc30d0f820d60906ef06413f93d4d7a1385599cc149"
[[package]]
name = "memmap2"
@@ -2405,7 +2403,7 @@ dependencies = [
"proc-macro-crate",
"proc-macro2",
"quote",
"syn 2.0.43",
"syn 2.0.48",
]
[[package]]
@@ -2610,15 +2608,15 @@ checksum = "5de5067af0cd27add969cdb4ef2eecc955f59235f3b7a75a3c6ac9562cfb6b81"
[[package]]
name = "pkg-config"
version = "0.3.28"
version = "0.3.29"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "69d3587f8a9e599cc7ec2c00e331f71c4e69a5f9a4b8a6efd5b07466b9736f9a"
checksum = "2900ede94e305130c13ddd391e0ab7cbaeb783945ae07a279c268cb05109c6cb"
[[package]]
name = "png"
version = "0.17.10"
version = "0.17.11"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "dd75bf2d8dd3702b9707cdbc56a5b9ef42cec752eb8b3bafc01234558442aa64"
checksum = "1f6c3c3e617595665b8ea2ff95a86066be38fb121ff920a9c0eb282abcd1da5a"
dependencies = [
"bitflags 1.3.2",
"crc32fast",
@@ -2655,14 +2653,14 @@ dependencies = [
[[package]]
name = "polling"
version = "3.3.1"
version = "3.3.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "cf63fa624ab313c11656b4cda960bfc46c410187ad493c41f6ba2d8c1e991c9e"
checksum = "545c980a3880efd47b2e262f6a4bb6daad6555cf3367aa9c4e52895f69537a41"
dependencies = [
"cfg-if",
"concurrent-queue",
"pin-project-lite",
"rustix 0.38.28",
"rustix 0.38.30",
"tracing",
"windows-sys 0.52.0",
]
@@ -2715,9 +2713,9 @@ dependencies = [
[[package]]
name = "proc-macro2"
version = "1.0.71"
version = "1.0.78"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "75cb1540fadbd5b8fbccc4dddad2734eba435053f725621c070711a14bb5f4b8"
checksum = "e2422ad645d89c99f8f3e6b88a9fdeca7fabeac836b1002371c4367c8f984aae"
dependencies = [
"unicode-ident",
]
@@ -2733,9 +2731,9 @@ dependencies = [
[[package]]
name = "quote"
version = "1.0.33"
version = "1.0.35"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "5267fca4496028628a95160fc423a33e8b2e6af8a5302579e322e4b520293cae"
checksum = "291ec9ab5efd934aaf503a6466c5d5251535d108ee747472c3977cc5acc868ef"
dependencies = [
"proc-macro2",
]
@@ -2807,9 +2805,9 @@ dependencies = [
[[package]]
name = "regex"
version = "1.10.2"
version = "1.10.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "380b951a9c5e80ddfd6136919eef32310721aa4aacd4889a8d39124b026ab343"
checksum = "b62dbe01f0b06f9d8dc7d49e05a0785f153b00b2c227856282f671e0318c9b15"
dependencies = [
"aho-corasick",
"memchr",
@@ -2819,9 +2817,9 @@ dependencies = [
[[package]]
name = "regex-automata"
version = "0.4.3"
version = "0.4.4"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "5f804c7828047e88b2d32e2d7fe5a105da8ee3264f01902f796c8e067dc2483f"
checksum = "3b7fa1134405e2ec9353fd416b17f8dacd46c473d7d3fd1cf202706a14eb792a"
dependencies = [
"aho-corasick",
"memchr",
@@ -2836,7 +2834,7 @@ checksum = "c08c74e62047bb2de4ff487b251e4a92e24f48745648451635cec7d591162d9f"
[[package]]
name = "rog-control-center"
version = "5.0.6"
version = "5.0.8"
dependencies = [
"asusd",
"cargo-husky",
@@ -2869,7 +2867,7 @@ dependencies = [
[[package]]
name = "rog_anime"
version = "5.0.6"
version = "5.0.8"
dependencies = [
"cargo-husky",
"dmi_id",
@@ -2886,7 +2884,7 @@ dependencies = [
[[package]]
name = "rog_aura"
version = "5.0.6"
version = "5.0.8"
dependencies = [
"cargo-husky",
"dmi_id",
@@ -2900,7 +2898,7 @@ dependencies = [
[[package]]
name = "rog_dbus"
version = "5.0.6"
version = "5.0.8"
dependencies = [
"asusd",
"cargo-husky",
@@ -2913,7 +2911,7 @@ dependencies = [
[[package]]
name = "rog_platform"
version = "5.0.6"
version = "5.0.8"
dependencies = [
"cargo-husky",
"concat-idents",
@@ -2930,7 +2928,7 @@ dependencies = [
[[package]]
name = "rog_profiles"
version = "5.0.6"
version = "5.0.8"
dependencies = [
"cargo-husky",
"log",
@@ -2944,7 +2942,7 @@ dependencies = [
[[package]]
name = "rog_simulators"
version = "5.0.6"
version = "5.0.8"
dependencies = [
"glam",
"log",
@@ -2960,7 +2958,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "b91f7eff05f748767f183df4320a63d6936e9c6107d97c9e6bdd9784f4289c94"
dependencies = [
"base64",
"bitflags 2.4.1",
"bitflags 2.4.2",
"serde",
"serde_derive",
]
@@ -3012,14 +3010,14 @@ dependencies = [
[[package]]
name = "rustix"
version = "0.38.28"
version = "0.38.30"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "72e572a5e8ca657d7366229cdde4bd14c4eb5499a9573d4d366fe1b599daa316"
checksum = "322394588aaf33c24007e8bb3238ee3e4c5c09c084ab32bc73890b99ff326bca"
dependencies = [
"bitflags 2.4.1",
"bitflags 2.4.2",
"errno",
"libc",
"linux-raw-sys 0.4.12",
"linux-raw-sys 0.4.13",
"windows-sys 0.52.0",
]
@@ -3088,35 +3086,35 @@ dependencies = [
[[package]]
name = "semver"
version = "1.0.20"
version = "1.0.21"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "836fa6a3e1e547f9a2c4040802ec865b5d85f4014efe00555d7090a3dcaa1090"
checksum = "b97ed7a9823b74f99c7742f5336af7be5ecd3eeafcb1507d1fa93347b1d589b0"
[[package]]
name = "serde"
version = "1.0.193"
version = "1.0.195"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "25dd9975e68d0cb5aa1120c288333fc98731bd1dd12f561e468ea4728c042b89"
checksum = "63261df402c67811e9ac6def069e4786148c4563f4b50fd4bf30aa370d626b02"
dependencies = [
"serde_derive",
]
[[package]]
name = "serde_derive"
version = "1.0.193"
version = "1.0.195"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "43576ca501357b9b071ac53cdc7da8ef0cbd9493d8df094cd821777ea6e894d3"
checksum = "46fe8f8603d81ba86327b23a2e9cdf49e1255fb94a4c5f297f6ee0547178ea2c"
dependencies = [
"proc-macro2",
"quote",
"syn 2.0.43",
"syn 2.0.48",
]
[[package]]
name = "serde_json"
version = "1.0.108"
version = "1.0.111"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "3d1c7e3eac408d115102c4c24ad393e0821bb3a5df4d506a80f85f7a742a526b"
checksum = "176e46fa42316f18edd598015a5166857fc835ec732f5215eac6b7bdbf0a84f4"
dependencies = [
"itoa",
"ryu",
@@ -3125,13 +3123,13 @@ dependencies = [
[[package]]
name = "serde_repr"
version = "0.1.17"
version = "0.1.18"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "3081f5ffbb02284dda55132aa26daecedd7372a42417bbbab6f14ab7d6bb9145"
checksum = "0b2e6b945e9d3df726b65d6ee24060aff8e3533d431f677a9695db04eff9dfdb"
dependencies = [
"proc-macro2",
"quote",
"syn 2.0.43",
"syn 2.0.48",
]
[[package]]
@@ -3195,9 +3193,9 @@ dependencies = [
[[package]]
name = "smallvec"
version = "1.11.2"
version = "1.13.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "4dccd0940a2dcdf68d092b8cbab7dc0ad8fa938bf95787e1b916b0e3d0e8e970"
checksum = "e6ecd384b10a64542d77071bd64bd7b231f4ed5940fba55e98c3de13824cf3d7"
[[package]]
name = "smithay-client-toolkit"
@@ -3286,7 +3284,7 @@ checksum = "6637bab7722d379c8b41ba849228d680cc12d0a45ba1fa2b48f2a30577a06731"
[[package]]
name = "supergfxctl"
version = "5.1.2"
source = "git+https://gitlab.com/asus-linux/supergfxctl.git#af23df7596712bb9433a3be917febadeb3f1f419"
source = "git+https://gitlab.com/asus-linux/supergfxctl.git#a54163c4ced0f58dbbc134392d8a2118ee6c5c64"
dependencies = [
"log",
"logind-zbus",
@@ -3311,9 +3309,9 @@ dependencies = [
[[package]]
name = "syn"
version = "2.0.43"
version = "2.0.48"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "ee659fb5f3d355364e1f3e5bc10fb82068efbf824a1e9d1c9504244a6469ad53"
checksum = "0f3531638e407dfc0814761abb7c00a5b54992b849452a0646b7f65c9f770f3f"
dependencies = [
"proc-macro2",
"quote",
@@ -3345,9 +3343,9 @@ dependencies = [
[[package]]
name = "target-lexicon"
version = "0.12.12"
version = "0.12.13"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "14c39fd04924ca3a864207c66fc2cd7d22d7c016007f9ce846cbb9326331930a"
checksum = "69758bda2e78f098e4ccb393021a0963bb3442eac05f135c30f61b7370bbafae"
[[package]]
name = "tauri-winrt-notification"
@@ -3361,44 +3359,44 @@ dependencies = [
[[package]]
name = "tempfile"
version = "3.8.1"
version = "3.9.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "7ef1adac450ad7f4b3c28589471ade84f25f731a7a0fe30d71dfa9f60fd808e5"
checksum = "01ce4141aa927a6d1bd34a041795abd0db1cccba5d5f24b009f694bdf3a1f3fa"
dependencies = [
"cfg-if",
"fastrand 2.0.1",
"redox_syscall 0.4.1",
"rustix 0.38.28",
"windows-sys 0.48.0",
"rustix 0.38.30",
"windows-sys 0.52.0",
]
[[package]]
name = "termcolor"
version = "1.4.0"
version = "1.4.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "ff1bc3d3f05aff0403e8ac0d92ced918ec05b666a43f83297ccef5bea8a3d449"
checksum = "06794f8f6c5c898b3275aebefa6b8a1cb24cd2c6c79397ab15774837a0bc5755"
dependencies = [
"winapi-util",
]
[[package]]
name = "thiserror"
version = "1.0.52"
version = "1.0.56"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "83a48fd946b02c0a526b2e9481c8e2a17755e47039164a86c4070446e3a4614d"
checksum = "d54378c645627613241d077a3a79db965db602882668f9136ac42af9ecb730ad"
dependencies = [
"thiserror-impl",
]
[[package]]
name = "thiserror-impl"
version = "1.0.52"
version = "1.0.56"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "e7fbe9b594d6568a6a1443250a7e67d80b74e1e96f6d1715e1e21cc1888291d3"
checksum = "fa0faa943b50f3db30a20aa7e265dbc66076993efed8463e8de414e5d06d3471"
dependencies = [
"proc-macro2",
"quote",
"syn 2.0.43",
"syn 2.0.48",
]
[[package]]
@@ -3492,7 +3490,7 @@ checksum = "5b8a1e28f2deaa14e508979454cb3a223b10b938b45af148bc0986de36f1923b"
dependencies = [
"proc-macro2",
"quote",
"syn 2.0.43",
"syn 2.0.48",
]
[[package]]
@@ -3568,7 +3566,7 @@ checksum = "34704c8d6ebcbc939824180af020566b01a7c01f80641264eba0999f6c2b6be7"
dependencies = [
"proc-macro2",
"quote",
"syn 2.0.43",
"syn 2.0.48",
]
[[package]]
@@ -3658,9 +3656,9 @@ dependencies = [
[[package]]
name = "unicode-bidi"
version = "0.3.14"
version = "0.3.15"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "6f2528f27a9eb2b21e69c95319b30bd0efd85d09c379741b0f78ea1d86be2416"
checksum = "08f95100a766bf4f8f28f90d77e0a5461bbdb219042e7679bebe79004fed8d75"
[[package]]
name = "unicode-ident"
@@ -3985,7 +3983,7 @@ version = "0.51.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "ca229916c5ee38c2f2bc1e9d8f04df975b4bd93f9955dc69fabb5d91270045c9"
dependencies = [
"windows-core",
"windows-core 0.51.1",
"windows-targets 0.48.5",
]
@@ -3998,6 +3996,15 @@ dependencies = [
"windows-targets 0.48.5",
]
[[package]]
name = "windows-core"
version = "0.52.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "33ab640c8d7e35bf8ba19b884ba838ceb4fba93a4e8c65a9059d08afcfc683d9"
dependencies = [
"windows-targets 0.52.0",
]
[[package]]
name = "windows-implement"
version = "0.44.0"
@@ -4255,9 +4262,9 @@ dependencies = [
[[package]]
name = "winnow"
version = "0.5.30"
version = "0.5.34"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "9b5c3db89721d50d0e2a673f5043fc4722f76dcc352d7b1ab8b8288bed4ed2c5"
checksum = "b7cf47b659b318dccbd69cc4797a39ae128f533dce7902a1096044d1967b9c16"
dependencies = [
"memchr",
]
@@ -4400,7 +4407,7 @@ checksum = "9ce1b18ccd8e73a9321186f97e46f9f04b778851177567b1975109d26a08d2a6"
dependencies = [
"proc-macro2",
"quote",
"syn 2.0.43",
"syn 2.0.48",
]
[[package]]

View File

@@ -4,10 +4,10 @@ default-members = ["asusctl", "asusd", "asusd-user", "cpuctl", "rog-control-cent
resolver = "2"
[workspace.package]
version = "5.0.6"
version = "5.0.8"
rust-version = "1.75"
[workspace.dependencies]
async-trait = "^0.1"
tokio = { version = "^1.23.0", default-features = false, features = ["macros", "sync"]}
concat-idents = "^1.1"
dirs = "^4.0"

View File

@@ -72,7 +72,7 @@ A gui is now in the repo - ROG Control Center. At this time it is still a WIP, b
# BUILDING
Requirements are rust >= 1.57 installed from rustup.io if the distro provided version is too old, and `make`.
Requirements are rust >= 1.75 installed from rustup.io if the distro provided version is too old, and `make`.
**Ubuntu (unsuported):**

View File

@@ -22,5 +22,6 @@ gif.workspace = true
tinybmp.workspace = true
glam.workspace = true
rog_dbus = { path = "../rog-dbus" }
tokio = { version = "^1.23.0", default-features = false, features = ["macros", "sync", "rt", "time"]}
cargo-husky.workspace = true

View File

@@ -1,5 +1,5 @@
use gumdrop::Options;
use rog_platform::platform::PlatformPolicy;
use rog_platform::platform::ThrottlePolicy;
use crate::anime_cli::AnimeCommand;
use crate::aura_cli::{LedBrightness, LedPowerCommand1, LedPowerCommand2, SetAuraBuiltin};
@@ -60,7 +60,7 @@ pub struct ProfileCommand {
pub profile_get: bool,
#[options(meta = "", help = "set the active profile")]
pub profile_set: Option<PlatformPolicy>,
pub profile_set: Option<ThrottlePolicy>,
}
#[derive(Options)]

View File

@@ -1,5 +1,5 @@
use gumdrop::Options;
use rog_platform::platform::PlatformPolicy;
use rog_platform::platform::ThrottlePolicy;
use rog_profiles::fan_curve_set::CurveData;
use rog_profiles::FanCurvePU;
@@ -18,7 +18,7 @@ pub struct FanCurveCommand {
meta = "",
help = "profile to modify fan-curve for. Shows data if no options provided"
)]
pub mod_profile: Option<PlatformPolicy>,
pub mod_profile: Option<ThrottlePolicy>,
#[options(
meta = "",

View File

@@ -18,7 +18,7 @@ use rog_aura::usb::{AuraDevRog1, AuraDevTuf, AuraPowerDev};
use rog_aura::{self, AuraEffect};
use rog_dbus::RogDbusClientBlocking;
use rog_platform::error::PlatformError;
use rog_platform::platform::{GpuMode, PlatformPolicy, Properties};
use rog_platform::platform::{GpuMode, Properties, ThrottlePolicy};
use rog_profiles::error::ProfileError;
use crate::aura_cli::{AuraPowerStates, LedBrightness};
@@ -180,10 +180,23 @@ fn do_parsed(
dbus.proxies().aura().set_brightness(brightness.prev())?;
}
// TODO:
// if parsed.show_supported {
// println!("Supported laptop functions:\n\n{}", supported);
// }
if parsed.show_supported {
println!("Supported Core Functions:\n{:#?}", supported_interfaces);
println!(
"Supported Platform Properties:\n{:#?}",
supported_properties
);
if supported_interfaces.contains(&"Aura".to_owned()) {
let bright = dbus.proxies().aura().supported_brightness()?;
let modes = dbus.proxies().aura().supported_basic_modes()?;
let zones = dbus.proxies().aura().supported_basic_zones()?;
let power = dbus.proxies().aura().supported_power_zones()?;
println!("Supported Keyboard Brightness:\n{:#?}", bright);
println!("Supported Aura Modes:\n{:#?}", modes);
println!("Supported Aura Zones:\n{:#?}", zones);
println!("Supported Aura Power Zones:\n{:#?}", power);
}
}
if let Some(chg_limit) = parsed.chg_limit {
dbus.proxies()
@@ -662,7 +675,7 @@ fn handle_throttle_profile(
supported: &[Properties],
cmd: &ProfileCommand,
) -> Result<(), Box<dyn std::error::Error>> {
if !supported.contains(&Properties::PlatformPolicy) {
if !supported.contains(&Properties::ThrottlePolicy) {
println!("Profiles not supported by either this kernel or by the laptop.");
return Err(ProfileError::NotSupported.into());
}
@@ -691,7 +704,7 @@ fn handle_throttle_profile(
}
if cmd.list {
let res = PlatformPolicy::list();
let res = ThrottlePolicy::list();
for p in &res {
println!("{:?}", p);
}

View File

@@ -22,8 +22,8 @@ rog_profiles = { path = "../rog-profiles" }
dmi_id = { path = "../dmi-id" }
futures-lite = "*"
udev.workspace = true
inotify.workspace = true
async-trait.workspace = true
tokio.workspace = true
# cli and logging

View File

@@ -1,31 +1,78 @@
use config_traits::{StdConfig, StdConfigLoad2};
use rog_platform::platform::PlatformPolicy;
use config_traits::{StdConfig, StdConfigLoad3};
use rog_platform::cpu::CPUEPP;
use rog_platform::platform::ThrottlePolicy;
use serde_derive::{Deserialize, Serialize};
const CONFIG_FILE: &str = "asusd.ron";
#[derive(Deserialize, Serialize, Default, Debug)]
#[derive(Deserialize, Serialize, Debug, PartialEq, PartialOrd)]
pub struct Config {
/// Save charge limit for restoring on boot
/// Save charge limit for restoring on boot/resume
pub charge_control_end_threshold: u8,
pub panel_od: bool,
pub mini_led_mode: bool,
pub disable_nvidia_powerd_on_battery: bool,
/// An optional command/script to run when power is changed to AC
pub ac_command: String,
/// An optional command/script to run when power is changed to battery
pub bat_command: String,
/// Restored on boot as well as when power is plugged
#[serde(skip)]
pub platform_policy_to_restore: PlatformPolicy,
pub platform_policy_on_battery: PlatformPolicy,
pub platform_policy_on_ac: PlatformPolicy,
//
/// Set true if energy_performance_preference should be set if the
/// throttle/platform profile is changed
pub throttle_policy_linked_epp: bool,
/// Which throttle/profile to use on battery power
pub throttle_policy_on_battery: ThrottlePolicy,
/// Which throttle/profile to use on AC power
pub throttle_policy_on_ac: ThrottlePolicy,
/// The energy_performance_preference for this throttle/platform profile
pub throttle_quiet_epp: CPUEPP,
/// The energy_performance_preference for this throttle/platform profile
pub throttle_balanced_epp: CPUEPP,
/// The energy_performance_preference for this throttle/platform profile
pub throttle_performance_epp: CPUEPP,
/// Defaults to `None` if not supported
pub ppt_pl1_spl: Option<u8>,
/// Defaults to `None` if not supported
pub ppt_pl2_sppt: Option<u8>,
/// Defaults to `None` if not supported
pub ppt_fppt: Option<u8>,
/// Defaults to `None` if not supported
pub ppt_apu_sppt: Option<u8>,
/// Defaults to `None` if not supported
pub ppt_platform_sppt: Option<u8>,
/// Defaults to `None` if not supported
pub nv_dynamic_boost: Option<u8>,
/// Defaults to `None` if not supported
pub nv_temp_target: Option<u8>,
/// Temporary state for AC/Batt
#[serde(skip)]
pub last_power_plugged: u8,
}
impl Default for Config {
fn default() -> Self {
Self {
charge_control_end_threshold: 100,
panel_od: false,
mini_led_mode: false,
disable_nvidia_powerd_on_battery: true,
ac_command: Default::default(),
bat_command: Default::default(),
throttle_policy_linked_epp: true,
throttle_policy_on_battery: ThrottlePolicy::Quiet,
throttle_policy_on_ac: ThrottlePolicy::Performance,
throttle_quiet_epp: CPUEPP::Power,
throttle_balanced_epp: CPUEPP::BalancePower,
throttle_performance_epp: CPUEPP::Performance,
ppt_pl1_spl: Default::default(),
ppt_pl2_sppt: Default::default(),
ppt_fppt: Default::default(),
ppt_apu_sppt: Default::default(),
ppt_platform_sppt: Default::default(),
nv_dynamic_boost: Default::default(),
nv_temp_target: Default::default(),
last_power_plugged: Default::default(),
}
}
}
impl StdConfig for Config {
@@ -33,8 +80,8 @@ impl StdConfig for Config {
Config {
charge_control_end_threshold: 100,
disable_nvidia_powerd_on_battery: true,
platform_policy_on_battery: PlatformPolicy::Quiet,
platform_policy_on_ac: PlatformPolicy::Performance,
throttle_policy_on_battery: ThrottlePolicy::Quiet,
throttle_policy_on_ac: ThrottlePolicy::Performance,
ac_command: String::new(),
bat_command: String::new(),
..Default::default()
@@ -50,9 +97,109 @@ impl StdConfig for Config {
}
}
impl StdConfigLoad2<Config462, Config472> for Config {}
impl StdConfigLoad3<Config472, Config506, Config507> for Config {}
#[derive(Deserialize, Serialize, Default, Debug)]
#[derive(Deserialize, Serialize)]
pub struct Config507 {
/// Save charge limit for restoring on boot
pub charge_control_end_threshold: u8,
pub panel_od: bool,
pub mini_led_mode: bool,
pub disable_nvidia_powerd_on_battery: bool,
pub ac_command: String,
pub bat_command: String,
pub platform_policy_linked_epp: bool,
pub platform_policy_on_battery: ThrottlePolicy,
pub platform_policy_on_ac: ThrottlePolicy,
//
pub ppt_pl1_spl: Option<u8>,
pub ppt_pl2_sppt: Option<u8>,
pub ppt_fppt: Option<u8>,
pub ppt_apu_sppt: Option<u8>,
pub ppt_platform_sppt: Option<u8>,
pub nv_dynamic_boost: Option<u8>,
pub nv_temp_target: Option<u8>,
}
impl From<Config507> for Config {
fn from(c: Config507) -> Self {
Self {
charge_control_end_threshold: c.charge_control_end_threshold,
panel_od: c.panel_od,
disable_nvidia_powerd_on_battery: c.disable_nvidia_powerd_on_battery,
ac_command: c.ac_command,
bat_command: c.bat_command,
mini_led_mode: c.mini_led_mode,
throttle_policy_linked_epp: true,
throttle_policy_on_battery: c.platform_policy_on_battery,
throttle_policy_on_ac: c.platform_policy_on_ac,
throttle_quiet_epp: CPUEPP::Power,
throttle_balanced_epp: CPUEPP::BalancePower,
throttle_performance_epp: CPUEPP::Performance,
ppt_pl1_spl: c.ppt_pl1_spl,
ppt_pl2_sppt: c.ppt_pl2_sppt,
ppt_fppt: c.ppt_fppt,
ppt_apu_sppt: c.ppt_apu_sppt,
ppt_platform_sppt: c.ppt_platform_sppt,
nv_dynamic_boost: c.nv_dynamic_boost,
nv_temp_target: c.nv_temp_target,
last_power_plugged: 0,
}
}
}
#[derive(Deserialize, Serialize)]
pub struct Config506 {
/// Save charge limit for restoring on boot
pub charge_control_end_threshold: u8,
pub panel_od: bool,
pub mini_led_mode: bool,
pub disable_nvidia_powerd_on_battery: bool,
pub ac_command: String,
pub bat_command: String,
/// Restored on boot as well as when power is plugged
#[serde(skip)]
pub platform_policy_to_restore: ThrottlePolicy,
pub platform_policy_on_battery: ThrottlePolicy,
pub platform_policy_on_ac: ThrottlePolicy,
//
pub ppt_pl1_spl: Option<u8>,
pub ppt_pl2_sppt: Option<u8>,
pub ppt_fppt: Option<u8>,
pub ppt_apu_sppt: Option<u8>,
pub ppt_platform_sppt: Option<u8>,
pub nv_dynamic_boost: Option<u8>,
pub nv_temp_target: Option<u8>,
}
impl From<Config506> for Config {
fn from(c: Config506) -> Self {
Self {
charge_control_end_threshold: c.charge_control_end_threshold,
panel_od: c.panel_od,
disable_nvidia_powerd_on_battery: c.disable_nvidia_powerd_on_battery,
ac_command: c.ac_command,
bat_command: c.bat_command,
mini_led_mode: c.mini_led_mode,
throttle_policy_linked_epp: true,
throttle_policy_on_battery: c.platform_policy_on_battery,
throttle_policy_on_ac: c.platform_policy_on_ac,
throttle_quiet_epp: CPUEPP::Power,
throttle_balanced_epp: CPUEPP::BalancePower,
throttle_performance_epp: CPUEPP::Performance,
ppt_pl1_spl: c.ppt_pl1_spl,
ppt_pl2_sppt: c.ppt_pl2_sppt,
ppt_fppt: c.ppt_fppt,
ppt_apu_sppt: c.ppt_apu_sppt,
ppt_platform_sppt: c.ppt_platform_sppt,
nv_dynamic_boost: c.nv_dynamic_boost,
nv_temp_target: c.nv_temp_target,
last_power_plugged: 0,
}
}
}
#[derive(Deserialize, Serialize)]
pub struct Config472 {
/// Save charge limit for restoring on boot
pub bat_charge_limit: u8,
@@ -75,26 +222,3 @@ impl From<Config472> for Config {
}
}
}
#[derive(Deserialize, Serialize)]
pub struct Config462 {
/// Save charge limit for restoring on boot
pub bat_charge_limit: u8,
pub panel_od: bool,
pub disable_nvidia_powerd_on_battery: bool,
pub ac_command: String,
pub bat_command: String,
}
impl From<Config462> for Config {
fn from(c: Config462) -> Self {
Self {
charge_control_end_threshold: c.bat_charge_limit,
panel_od: c.panel_od,
disable_nvidia_powerd_on_battery: true,
ac_command: String::new(),
bat_command: String::new(),
..Default::default()
}
}
}

View File

@@ -1,7 +1,6 @@
use std::sync::atomic::Ordering;
use std::sync::Arc;
use async_trait::async_trait;
use config_traits::StdConfig;
use log::warn;
use logind_zbus::manager::ManagerProxy;
@@ -35,7 +34,6 @@ async fn get_logind_manager<'a>() -> ManagerProxy<'a> {
pub struct CtrlAnimeZbus(pub Arc<Mutex<CtrlAnime>>);
/// The struct with the main dbus methods requires this trait
#[async_trait]
impl crate::ZbusRun for CtrlAnimeZbus {
async fn add_to_server(self, server: &mut Connection) {
Self::add_to_server_helper(self, ANIME_ZBUS_PATH, server).await;
@@ -259,7 +257,6 @@ impl CtrlAnimeZbus {
}
}
#[async_trait]
impl crate::CtrlTask for CtrlAnimeZbus {
fn zbus_path() -> &'static str {
ANIME_ZBUS_PATH
@@ -277,16 +274,8 @@ impl crate::CtrlTask for CtrlAnimeZbus {
async move {
let lock = inner.lock().await;
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.node
.write_bytes(&pkt_set_enable_display(
!(sleeping && lock.config.off_when_suspended),
@@ -296,7 +285,21 @@ impl crate::CtrlTask for CtrlAnimeZbus {
})
.ok();
if !sleeping && !lock.config.builtin_anims_enabled {
if lock.config.builtin_anims_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();
} else if !sleeping && !lock.config.builtin_anims_enabled {
// Run custom wake animation
lock.node
.write_bytes(&pkt_set_enable_powersave_anim(false))
.ok(); // ensure builtins are disabled
CtrlAnime::run_thread(inner.clone(), lock.cache.wake.clone(), true)
.await;
}
@@ -379,7 +382,6 @@ impl crate::CtrlTask for CtrlAnimeZbus {
}
}
#[async_trait]
impl crate::Reloadable for CtrlAnimeZbus {
async fn reload(&mut self) -> Result<(), RogError> {
if let Some(lock) = self.0.try_lock() {

View File

@@ -1,7 +1,6 @@
use std::collections::BTreeMap;
use std::sync::Arc;
use async_trait::async_trait;
use config_traits::StdConfig;
use log::{debug, error, info, warn};
use rog_aura::advanced::UsbPackets;
@@ -33,7 +32,6 @@ impl CtrlAuraZbus {
}
}
#[async_trait]
impl crate::ZbusRun for CtrlAuraZbus {
async fn add_to_server(self, server: &mut Connection) {
Self::add_to_server_helper(self, AURA_ZBUS_PATH, server).await;
@@ -205,7 +203,6 @@ impl CtrlAuraZbus {
}
}
#[async_trait]
impl CtrlTask for CtrlAuraZbus {
fn zbus_path() -> &'static str {
AURA_ZBUS_PATH
@@ -278,7 +275,6 @@ impl CtrlTask for CtrlAuraZbus {
}
}
#[async_trait]
impl crate::Reloadable for CtrlAuraZbus {
async fn reload(&mut self) -> Result<(), RogError> {
let mut ctrl = self.0.lock().await;

View File

@@ -1,11 +1,10 @@
use std::path::PathBuf;
use std::sync::Arc;
use async_trait::async_trait;
use config_traits::{StdConfig, StdConfigLoad};
use futures_lite::StreamExt;
use log::{debug, error, info, warn};
use rog_platform::platform::{PlatformPolicy, RogPlatform};
use rog_platform::platform::{RogPlatform, ThrottlePolicy};
use rog_profiles::error::ProfileError;
use rog_profiles::fan_curve_set::CurveData;
use rog_profiles::{find_fan_curve_node, FanCurvePU, FanCurveProfiles};
@@ -70,19 +69,19 @@ impl CtrlFanCurveZbus {
info!("{MOD_NAME}: Fetching default fan curves");
for this in [
PlatformPolicy::Balanced,
PlatformPolicy::Performance,
PlatformPolicy::Quiet,
ThrottlePolicy::Balanced,
ThrottlePolicy::Performance,
ThrottlePolicy::Quiet,
] {
// For each profile we need to switch to it before we
// can read the existing values from hardware. The ACPI method used
// for this is what limits us.
let next = PlatformPolicy::get_next_profile(this);
let next = ThrottlePolicy::next(this);
platform.set_throttle_thermal_policy(next.into())?;
let active = platform
.get_throttle_thermal_policy()
.map_or(PlatformPolicy::Balanced, |t| t.into());
.map_or(ThrottlePolicy::Balanced, |t| t.into());
info!("{MOD_NAME}: {active:?}:");
for curve in fan_curves.get_fan_curves_for(active) {
@@ -130,7 +129,7 @@ impl CtrlFanCurveZbus {
/// fan curve if in the same profile mode
async fn set_fan_curves_enabled(
&mut self,
profile: PlatformPolicy,
profile: ThrottlePolicy,
enabled: bool,
) -> zbus::fdo::Result<()> {
self.fan_curves
@@ -150,7 +149,7 @@ impl CtrlFanCurveZbus {
/// activate a fan curve if in the same profile mode
async fn set_profile_fan_curve_enabled(
&mut self,
profile: PlatformPolicy,
profile: ThrottlePolicy,
fan: FanCurvePU,
enabled: bool,
) -> zbus::fdo::Result<()> {
@@ -167,10 +166,10 @@ impl CtrlFanCurveZbus {
Ok(())
}
/// Get the fan-curve data for the currently active PlatformPolicy
/// Get the fan-curve data for the currently active ThrottlePolicy
async fn fan_curve_data(
&mut self,
profile: PlatformPolicy,
profile: ThrottlePolicy,
) -> zbus::fdo::Result<Vec<CurveData>> {
let curve = self
.fan_curves
@@ -185,7 +184,7 @@ impl CtrlFanCurveZbus {
/// Will also activate the fan curve if the user is in the same mode.
async fn set_fan_curve(
&mut self,
profile: PlatformPolicy,
profile: ThrottlePolicy,
curve: CurveData,
) -> zbus::fdo::Result<()> {
self.fan_curves
@@ -222,11 +221,8 @@ impl CtrlFanCurveZbus {
///
/// Each platform_profile has a different default and the defualt can be
/// read only for the currently active profile.
async fn reset_profile_curves(&self, profile: PlatformPolicy) -> zbus::fdo::Result<()> {
let active = self
.platform
.get_throttle_thermal_policy()
.unwrap_or(PlatformPolicy::Balanced.into());
async fn reset_profile_curves(&self, profile: ThrottlePolicy) -> zbus::fdo::Result<()> {
let active = self.platform.get_throttle_thermal_policy()?;
self.platform.set_throttle_thermal_policy(profile.into())?;
self.fan_curves
@@ -241,14 +237,12 @@ impl CtrlFanCurveZbus {
}
}
#[async_trait]
impl crate::ZbusRun for CtrlFanCurveZbus {
async fn add_to_server(self, server: &mut Connection) {
Self::add_to_server_helper(self, FAN_CURVE_ZBUS_PATH, server).await;
}
}
#[async_trait]
impl CtrlTask for CtrlFanCurveZbus {
fn zbus_path() -> &'static str {
FAN_CURVE_ZBUS_PATH
@@ -284,7 +278,6 @@ impl CtrlTask for CtrlFanCurveZbus {
}
}
}
dbg!("STREAM ENDED");
}
});
@@ -292,20 +285,21 @@ impl CtrlTask for CtrlFanCurveZbus {
}
}
#[async_trait]
impl crate::Reloadable for CtrlFanCurveZbus {
/// Fetch the active profile and use that to set all related components up
async fn reload(&mut self) -> Result<(), RogError> {
// let active = self.platform.get_throttle_thermal_policy()?.into();
// if let Ok(mut device) = find_fan_curve_node() {
// // There is a possibility that the curve was default zeroed, so this call
// // initialises the data from system read and we need to save it
// // after
// self.fan_curves
// .lock()
// .await
// .write_profile_curve_to_platform(active, &mut device)?;
// }
let active = self.platform.get_throttle_thermal_policy()?.into();
if let Ok(mut device) = find_fan_curve_node() {
// There is a possibility that the curve was default zeroed, so this call
// initialises the data from system read and we need to save it
// after
loop {
if let Ok(mut curves) = self.fan_curves.try_lock() {
curves.write_profile_curve_to_platform(active, &mut device)?;
break;
}
}
}
Ok(())
}
}

View File

@@ -1,11 +1,11 @@
use std::path::Path;
use std::process::Command;
use std::sync::Arc;
use async_trait::async_trait;
use config_traits::StdConfig;
use log::{debug, error, info, warn};
use rog_platform::cpu::{CPUControl, CPUGovernor};
use rog_platform::platform::{GpuMode, PlatformPolicy, Properties, RogPlatform};
use rog_platform::cpu::{CPUControl, CPUGovernor, CPUEPP};
use rog_platform::platform::{GpuMode, Properties, RogPlatform, ThrottlePolicy};
use rog_platform::power::AsusPower;
use zbus::export::futures_util::lock::Mutex;
use zbus::fdo::Error as FdoErr;
@@ -16,9 +16,10 @@ use crate::ctrl_anime::trait_impls::{CtrlAnimeZbus, ANIME_ZBUS_NAME, ANIME_ZBUS_
use crate::ctrl_aura::trait_impls::{CtrlAuraZbus, AURA_ZBUS_NAME, AURA_ZBUS_PATH};
use crate::ctrl_fancurves::{CtrlFanCurveZbus, FAN_CURVE_ZBUS_NAME, FAN_CURVE_ZBUS_PATH};
use crate::error::RogError;
use crate::{task_watch_item, task_watch_item_notify, CtrlTask};
use crate::{task_watch_item, task_watch_item_notify, CtrlTask, ReloadAndNotify};
const ZBUS_PATH: &str = "/org/asuslinux/Platform";
const PLATFORM_ZBUS_NAME: &str = "Platform";
const PLATFORM_ZBUS_PATH: &str = "/org/asuslinux/Platform";
macro_rules! platform_get_value {
($self:ident, $property:tt, $prop_name:literal) => {
@@ -115,7 +116,11 @@ pub struct CtrlPlatform {
}
impl CtrlPlatform {
pub fn new(config: Arc<Mutex<Config>>) -> Result<Self, RogError> {
pub fn new(
config: Arc<Mutex<Config>>,
config_path: &Path,
signal_context: SignalContext<'static>,
) -> Result<Self, RogError> {
let platform = RogPlatform::new()?;
let power = AsusPower::new()?;
@@ -124,14 +129,70 @@ impl CtrlPlatform {
info!("Standard graphics switching will still work.");
}
Ok(CtrlPlatform {
let config1 = config.clone();
let config_path = config_path.to_owned();
let ret_self = CtrlPlatform {
power,
platform,
config,
cpu_control: CPUControl::new()
.map_err(|e| error!("Couldn't get CPU control sysfs: {e}"))
.ok(),
})
};
let mut inotify_self = ret_self.clone();
tokio::spawn(async move {
use zbus::export::futures_util::StreamExt;
info!("Starting inotify watch for asusd config file");
let mut buffer = [0; 32];
loop {
// vi and vim do stupid shit causing the file watch to be removed
let inotify = inotify::Inotify::init().unwrap();
inotify
.watches()
.add(
&config_path,
inotify::WatchMask::MODIFY
| inotify::WatchMask::CLOSE_WRITE
| inotify::WatchMask::ATTRIB
| inotify::WatchMask::CREATE,
)
.map_err(|e| {
if e.kind() == std::io::ErrorKind::NotFound {
error!("Not found: {:?}", config_path);
} else {
error!("Could not set asusd config inotify: {:?}", config_path);
}
e
})
.ok();
let mut events = inotify.into_event_stream(&mut buffer).unwrap();
while let Some(ev) = events.next().await {
if let Ok(ev) = ev {
if ev.mask == inotify::EventMask::IGNORED {
warn!(
"Something modified asusd.ron vi/vim style. Now need to reload \
inotify watch"
);
break;
}
}
let res = config1.lock().await.read_new();
if let Some(new_cfg) = res {
inotify_self
.reload_and_notify(&signal_context, new_cfg)
.await
.unwrap();
}
}
}
});
Ok(ret_self)
}
fn set_gfx_mode(&self, mode: GpuMode) -> Result<(), RogError> {
@@ -180,14 +241,18 @@ impl CtrlPlatform {
}
}
fn check_and_set_epp(&self, profile: PlatformPolicy) {
info!("PlatformPolicy setting EPP");
fn check_and_set_epp(&self, enegy_pref: CPUEPP, change_epp: bool) {
if !change_epp {
info!("ThrottlePolicy unlinked from EPP");
return;
}
info!("ThrottlePolicy 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();
if epp.contains(&enegy_pref) {
debug!("Setting {enegy_pref:?}");
cpu.set_epp(enegy_pref).ok();
} else if let Ok(gov) = cpu.get_governor() {
if gov != CPUGovernor::Powersave {
warn!("powersave governor is not is use, you should use it.");
@@ -197,16 +262,26 @@ impl CtrlPlatform {
}
}
async fn update_policy_ac_or_bat(&self, power_plugged: bool) {
let profile = if power_plugged {
self.config.lock().await.platform_policy_on_ac
async fn get_config_epp_for_throttle(&self, throttle: ThrottlePolicy) -> CPUEPP {
match throttle {
ThrottlePolicy::Balanced => self.config.lock().await.throttle_balanced_epp,
ThrottlePolicy::Performance => self.config.lock().await.throttle_performance_epp,
ThrottlePolicy::Quiet => self.config.lock().await.throttle_quiet_epp,
}
}
async fn update_policy_ac_or_bat(&self, power_plugged: bool, change_epp: bool) {
let throttle = if power_plugged {
self.config.lock().await.throttle_policy_on_ac
} else {
self.config.lock().await.platform_policy_on_battery
self.config.lock().await.throttle_policy_on_battery
};
debug!("Setting {throttle:?} before EPP");
let epp = self.get_config_epp_for_throttle(throttle).await;
self.platform
.set_throttle_thermal_policy(profile.into())
.set_throttle_thermal_policy(throttle.into())
.ok();
self.check_and_set_epp(profile);
self.check_and_set_epp(epp, change_epp);
}
}
@@ -248,7 +323,7 @@ impl CtrlPlatform {
platform_name!(panel_od, Properties::PanelOd);
platform_name!(mini_led_mode, Properties::MiniLedMode);
platform_name!(egpu_enable, Properties::EgpuEnable);
platform_name!(throttle_thermal_policy, Properties::PlatformPolicy);
platform_name!(throttle_thermal_policy, Properties::ThrottlePolicy);
platform_name!(ppt_pl1_spl, Properties::PptPl1Spl);
platform_name!(ppt_pl2_sppt, Properties::PptPl2Sppt);
@@ -287,6 +362,13 @@ impl CtrlPlatform {
{
interfaces.push(FAN_CURVE_ZBUS_NAME.to_owned());
}
if server
.interface::<_, CtrlPlatform>(PLATFORM_ZBUS_PATH)
.await
.is_ok()
{
interfaces.push(PLATFORM_ZBUS_NAME.to_owned());
}
interfaces
}
@@ -334,20 +416,21 @@ impl CtrlPlatform {
&mut self,
#[zbus(signal_context)] ctxt: SignalContext<'_>,
) -> Result<(), FdoErr> {
let policy: PlatformPolicy =
let policy: ThrottlePolicy =
platform_get_value!(self, throttle_thermal_policy, "throttle_thermal_policy")
.map(|n| n.into())?;
let policy = PlatformPolicy::next(&policy);
let policy = ThrottlePolicy::next(policy);
if self.platform.has_throttle_thermal_policy() {
self.check_and_set_epp(policy);
let change_epp = self.config.lock().await.throttle_policy_linked_epp;
let epp = self.get_config_epp_for_throttle(policy).await;
self.check_and_set_epp(epp, change_epp);
self.platform
.set_throttle_thermal_policy(policy.into())
.map_err(|err| {
warn!("RogPlatform: throttle_thermal_policy {}", err);
FdoErr::Failed(format!("RogPlatform: throttle_thermal_policy: {err}"))
})?;
self.config.lock().await.platform_policy_to_restore = policy;
Ok(self.throttle_thermal_policy_changed(&ctxt).await?)
} else {
Err(FdoErr::NotSupported(
@@ -357,17 +440,18 @@ impl CtrlPlatform {
}
#[dbus_interface(property)]
fn throttle_thermal_policy(&self) -> Result<PlatformPolicy, FdoErr> {
fn throttle_thermal_policy(&self) -> Result<ThrottlePolicy, FdoErr> {
platform_get_value!(self, throttle_thermal_policy, "throttle_thermal_policy")
.map(|n| n.into())
}
#[dbus_interface(property)]
async fn set_throttle_thermal_policy(&mut self, policy: PlatformPolicy) -> Result<(), FdoErr> {
async fn set_throttle_thermal_policy(&mut self, policy: ThrottlePolicy) -> Result<(), FdoErr> {
// TODO: watch for external changes
if self.platform.has_throttle_thermal_policy() {
self.check_and_set_epp(policy);
self.config.lock().await.platform_policy_to_restore = policy;
let change_epp = self.config.lock().await.throttle_policy_linked_epp;
let epp = self.get_config_epp_for_throttle(policy).await;
self.check_and_set_epp(epp, change_epp);
self.platform
.set_throttle_thermal_policy(policy.into())
.map_err(|err| {
@@ -381,6 +465,91 @@ impl CtrlPlatform {
}
}
#[dbus_interface(property)]
async fn throttle_policy_linked_epp(&self) -> Result<bool, FdoErr> {
Ok(self.config.lock().await.throttle_policy_linked_epp)
}
#[dbus_interface(property)]
async fn set_throttle_policy_linked_epp(&self, linked: bool) -> Result<(), zbus::Error> {
self.config.lock().await.throttle_policy_linked_epp = linked;
Ok(())
}
#[dbus_interface(property)]
async fn throttle_policy_on_battery(&self) -> Result<ThrottlePolicy, FdoErr> {
Ok(self.config.lock().await.throttle_policy_on_battery)
}
#[dbus_interface(property)]
async fn set_throttle_policy_on_battery(
&mut self,
policy: ThrottlePolicy,
) -> Result<(), FdoErr> {
self.config.lock().await.throttle_policy_on_battery = policy;
self.set_throttle_thermal_policy(policy).await?;
Ok(())
}
#[dbus_interface(property)]
async fn throttle_policy_on_ac(&self) -> Result<ThrottlePolicy, FdoErr> {
Ok(self.config.lock().await.throttle_policy_on_ac)
}
#[dbus_interface(property)]
async fn set_throttle_policy_on_ac(&mut self, policy: ThrottlePolicy) -> Result<(), FdoErr> {
self.config.lock().await.throttle_policy_on_ac = policy;
self.set_throttle_thermal_policy(policy).await?;
Ok(())
}
/// The energy_performance_preference for the quiet throttle/platform
/// profile
#[dbus_interface(property)]
async fn throttle_quiet_epp(&self) -> Result<CPUEPP, FdoErr> {
Ok(self.config.lock().await.throttle_quiet_epp)
}
#[dbus_interface(property)]
async fn set_throttle_quiet_epp(&mut self, epp: CPUEPP) -> Result<(), FdoErr> {
let change_pp = self.config.lock().await.throttle_policy_linked_epp;
self.config.lock().await.throttle_quiet_epp = epp;
self.check_and_set_epp(epp, change_pp);
Ok(())
}
/// The energy_performance_preference for the balanced throttle/platform
/// profile
#[dbus_interface(property)]
async fn throttle_balanced_epp(&self) -> Result<CPUEPP, FdoErr> {
Ok(self.config.lock().await.throttle_balanced_epp)
}
#[dbus_interface(property)]
async fn set_throttle_balanced_epp(&mut self, epp: CPUEPP) -> Result<(), FdoErr> {
let change_pp = self.config.lock().await.throttle_policy_linked_epp;
self.config.lock().await.throttle_balanced_epp = epp;
self.check_and_set_epp(epp, change_pp);
Ok(())
}
/// The energy_performance_preference for the performance throttle/platform
/// profile
#[dbus_interface(property)]
async fn throttle_performance_epp(&self) -> Result<CPUEPP, FdoErr> {
Ok(self.config.lock().await.throttle_performance_epp)
}
#[dbus_interface(property)]
async fn set_throttle_performance_epp(&mut self, epp: CPUEPP) -> Result<(), FdoErr> {
let change_pp = self.config.lock().await.throttle_policy_linked_epp;
self.config.lock().await.throttle_performance_epp = epp;
self.check_and_set_epp(epp, change_pp);
Ok(())
}
/// ***********************************************************************
#[dbus_interface(property)]
fn post_animation_sound(&self) -> Result<bool, FdoErr> {
platform_get_value!(self, post_animation_sound, "post_animation_sound")
@@ -434,7 +603,10 @@ impl CtrlPlatform {
platform_get_value!(self, egpu_enable, "egpu_enable")
}
/// ************************************************************************
/// ***********************************************************************
/// Set the Package Power Target total of CPU: PL1 on Intel, SPL on AMD.
/// Shown on Intel+Nvidia or AMD+Nvidia based systems:
/// * min=5, max=250
#[dbus_interface(property)]
async fn ppt_pl1_spl(&self) -> Result<u8, FdoErr> {
platform_get_value_if_some!(self, ppt_pl1_spl, "ppt_pl1_spl", 5)
@@ -445,6 +617,9 @@ impl CtrlPlatform {
platform_set_with_min_max!(self, ppt_pl1_spl, "ppt_pl1_spl", value, 5, 250)
}
/// Set the Slow Package Power Tracking Limit of CPU: PL2 on Intel, SPPT,
/// on AMD. Shown on Intel+Nvidia or AMD+Nvidia based systems:
/// * min=5, max=250
#[dbus_interface(property)]
async fn ppt_pl2_sppt(&self) -> Result<u8, FdoErr> {
platform_get_value_if_some!(self, ppt_pl2_sppt, "ppt_pl2_sppt", 5)
@@ -455,6 +630,8 @@ impl CtrlPlatform {
platform_set_with_min_max!(self, ppt_pl2_sppt, "ppt_pl2_sppt", value, 5, 250)
}
/// Set the Fast Package Power Tracking Limit of CPU. AMD+Nvidia only:
/// * min=5, max=250
#[dbus_interface(property)]
async fn ppt_fppt(&self) -> Result<u8, FdoErr> {
platform_get_value_if_some!(self, ppt_fppt, "ppt_fppt", 5)
@@ -465,6 +642,8 @@ impl CtrlPlatform {
platform_set_with_min_max!(self, ppt_fppt, "ppt_fppt", value, 5, 250)
}
/// Set the APU SPPT limit. Shown on full AMD systems only:
/// * min=5, max=130
#[dbus_interface(property)]
async fn ppt_apu_sppt(&self) -> Result<u8, FdoErr> {
platform_get_value_if_some!(self, ppt_apu_sppt, "ppt_apu_sppt", 5)
@@ -475,6 +654,8 @@ impl CtrlPlatform {
platform_set_with_min_max!(self, ppt_apu_sppt, "ppt_apu_sppt", value, 5, 130)
}
/// Set the platform SPPT limit. Shown on full AMD systems only:
/// * min=5, max=130
#[dbus_interface(property)]
async fn ppt_platform_sppt(&self) -> Result<u8, FdoErr> {
platform_get_value_if_some!(self, ppt_platform_sppt, "ppt_platform_sppt", 5)
@@ -485,6 +666,8 @@ impl CtrlPlatform {
platform_set_with_min_max!(self, ppt_platform_sppt, "ppt_platform_sppt", value, 5, 130)
}
/// Set the dynamic boost limit of the Nvidia dGPU:
/// * min=5, max=25
#[dbus_interface(property)]
async fn nv_dynamic_boost(&self) -> Result<u8, FdoErr> {
platform_get_value_if_some!(self, nv_dynamic_boost, "nv_dynamic_boost", 5)
@@ -495,6 +678,8 @@ impl CtrlPlatform {
platform_set_with_min_max!(self, nv_dynamic_boost, "nv_dynamic_boost", value, 5, 25)
}
/// Set the target temperature limit of the Nvidia dGPU:
/// * min=75, max=87
#[dbus_interface(property)]
async fn nv_temp_target(&self) -> Result<u8, FdoErr> {
platform_get_value_if_some!(self, nv_temp_target, "nv_temp_target", 5)
@@ -506,14 +691,75 @@ impl CtrlPlatform {
}
}
#[async_trait]
impl crate::ZbusRun for CtrlPlatform {
async fn add_to_server(self, server: &mut Connection) {
Self::add_to_server_helper(self, ZBUS_PATH, server).await;
Self::add_to_server_helper(self, PLATFORM_ZBUS_PATH, server).await;
}
}
impl ReloadAndNotify for CtrlPlatform {
type Data = Config;
async fn reload_and_notify(
&mut self,
signal_context: &SignalContext<'static>,
data: Self::Data,
) -> Result<(), RogError> {
let mut config = self.config.lock().await;
if *config != data {
info!("asusd.ron updated externally, reloading and updating internal copy");
if self.power.has_charge_control_end_threshold() {
self.power
.set_charge_control_end_threshold(data.charge_control_end_threshold)?;
self.charge_control_end_threshold_changed(signal_context)
.await?;
}
if self.platform.has_panel_od() && config.panel_od != data.panel_od {
self.platform.set_panel_od(data.panel_od)?;
self.panel_od_changed(signal_context).await?;
}
if self.platform.has_mini_led_mode() && config.mini_led_mode != data.mini_led_mode {
self.platform.set_mini_led_mode(data.mini_led_mode)?;
self.mini_led_mode_changed(signal_context).await?;
}
if self.platform.has_throttle_thermal_policy()
&& config.throttle_policy_linked_epp != data.throttle_policy_linked_epp
{
// TODO: extra stuff
}
macro_rules! ppt_reload_and_notify {
($property:tt, $prop_name:literal) => {
concat_idents::concat_idents!(has = has_, $property {
if self.platform.has() && config.$property != data.$property {
concat_idents::concat_idents!(set = set_, $property {
self.platform
.set_ppt_pl1_spl(data.$property.unwrap_or_default())?;});
concat_idents::concat_idents!(changed = $property, _changed {
self.ppt_pl1_spl_changed(signal_context).await?;});
}
})
}
}
ppt_reload_and_notify!(ppt_pl1_spl, "ppt_pl1_spl");
ppt_reload_and_notify!(ppt_pl2_sppt, "ppt_pl2_sppt");
ppt_reload_and_notify!(ppt_fppt, "ppt_fppt");
ppt_reload_and_notify!(ppt_apu_sppt, "ppt_apu_sppt");
ppt_reload_and_notify!(ppt_platform_sppt, "ppt_platform_sppt");
ppt_reload_and_notify!(nv_dynamic_boost, "nv_dynamic_boost");
ppt_reload_and_notify!(nv_temp_target, "nv_temp_target");
*config = data;
}
Ok(())
}
}
#[async_trait]
impl crate::Reloadable for CtrlPlatform {
async fn reload(&mut self) -> Result<(), RogError> {
if self.platform.has_panel_od() {
@@ -533,8 +779,11 @@ impl crate::Reloadable for CtrlPlatform {
}
if let Ok(power_plugged) = self.power.get_online() {
self.config.lock().await.last_power_plugged = power_plugged;
if self.platform.has_throttle_thermal_policy() {
self.update_policy_ac_or_bat(power_plugged > 0).await;
let change_epp = self.config.lock().await.throttle_policy_linked_epp;
self.update_policy_ac_or_bat(power_plugged > 0, change_epp)
.await;
}
self.run_ac_or_bat_cmd(power_plugged > 0).await;
}
@@ -574,10 +823,9 @@ impl CtrlPlatform {
task_watch_item_notify!(nv_temp_target platform);
}
#[async_trait]
impl CtrlTask for CtrlPlatform {
fn zbus_path() -> &'static str {
ZBUS_PATH
PLATFORM_ZBUS_PATH
}
async fn create_tasks(&self, signal_ctxt: SignalContext<'static>) -> Result<(), RogError> {
@@ -613,11 +861,18 @@ impl CtrlTask for CtrlPlatform {
.ok();
}
if let Ok(power_plugged) = platform1.power.get_online() {
if !sleeping && platform1.platform.has_throttle_thermal_policy() {
platform1.update_policy_ac_or_bat(power_plugged > 0).await;
}
if !sleeping {
platform1.run_ac_or_bat_cmd(power_plugged > 0).await;
if platform1.config.lock().await.last_power_plugged != power_plugged {
if !sleeping && platform1.platform.has_throttle_thermal_policy() {
let change_epp =
platform1.config.lock().await.throttle_policy_linked_epp;
platform1
.update_policy_ac_or_bat(power_plugged > 0, change_epp)
.await;
}
if !sleeping {
platform1.run_ac_or_bat_cmd(power_plugged > 0).await;
}
platform1.config.lock().await.last_power_plugged = power_plugged;
}
}
}
@@ -648,7 +903,10 @@ impl CtrlTask for CtrlPlatform {
// power change
async move {
if platform3.platform.has_throttle_thermal_policy() {
platform3.update_policy_ac_or_bat(power_plugged).await;
let change_epp = platform3.config.lock().await.throttle_policy_linked_epp;
platform3
.update_policy_ac_or_bat(power_plugged, change_epp)
.await;
}
platform3.run_ac_or_bat_cmd(power_plugged).await;
}
@@ -692,13 +950,14 @@ impl CtrlTask for CtrlPlatform {
if let Ok(profile) = ctrl
.platform
.get_throttle_thermal_policy()
.map(PlatformPolicy::from)
.map(ThrottlePolicy::from)
.map_err(|e| {
error!("Platform: get_throttle_thermal_policy error: {e}");
})
{
ctrl.check_and_set_epp(profile);
ctrl.config.lock().await.platform_policy_to_restore = profile;
let change_epp = ctrl.config.lock().await.throttle_policy_linked_epp;
let epp = ctrl.get_config_epp_for_throttle(profile).await;
ctrl.check_and_set_epp(epp, change_epp);
}
}
}

View File

@@ -15,7 +15,7 @@ use asusd::ctrl_aura::trait_impls::CtrlAuraZbus;
use asusd::ctrl_fancurves::CtrlFanCurveZbus;
use asusd::ctrl_platform::CtrlPlatform;
use asusd::{print_board_info, CtrlTask, Reloadable, ZbusRun, DBUS_NAME};
use config_traits::{StdConfig, StdConfigLoad2};
use config_traits::{StdConfig, StdConfigLoad2, StdConfigLoad3};
use log::{error, info, warn};
use rog_aura::aura_detection::LaptopLedData;
use tokio::time::sleep;
@@ -64,11 +64,16 @@ async fn start_daemon() -> Result<(), Box<dyn Error>> {
let mut connection = Connection::system().await?;
let config = Config::new().load();
let cfg_path = config.file_path();
let config = Arc::new(Mutex::new(config));
// supported.add_to_server(&mut connection).await;
match CtrlPlatform::new(config.clone()) {
match CtrlPlatform::new(
config.clone(),
&cfg_path,
CtrlPlatform::signal_context(&connection)?,
) {
Ok(ctrl) => {
let sig_ctx = CtrlPlatform::signal_context(&connection)?;
start_tasks(ctrl, &mut connection, sig_ctx).await?;

View File

@@ -15,7 +15,6 @@ pub mod error;
use std::future::Future;
use std::time::Duration;
use async_trait::async_trait;
use dmi_id::DMIID;
use futures_lite::stream::StreamExt;
use log::{debug, info, warn};
@@ -130,34 +129,44 @@ pub fn print_board_info() {
info!("Board name: {}", dmi.board_name);
}
#[async_trait]
pub trait Reloadable {
async fn reload(&mut self) -> Result<(), RogError>;
fn reload(&mut self) -> impl std::future::Future<Output = Result<(), RogError>> + Send;
}
#[async_trait]
pub trait ZbusRun {
async fn add_to_server(self, server: &mut Connection);
pub trait ReloadAndNotify {
type Data: Send;
async fn add_to_server_helper(
fn reload_and_notify(
&mut self,
signal_context: &SignalContext<'static>,
data: Self::Data,
) -> impl std::future::Future<Output = Result<(), RogError>> + Send;
}
pub trait ZbusRun {
fn add_to_server(self, server: &mut Connection)
-> impl std::future::Future<Output = ()> + Send;
fn add_to_server_helper(
iface: impl zbus::Interface,
path: &str,
server: &mut Connection,
) {
server
.object_server()
.at(&ObjectPath::from_str_unchecked(path), iface)
.await
.map_err(|err| {
warn!("{}: add_to_server {}", path, err);
err
})
.ok();
) -> impl std::future::Future<Output = ()> + Send {
async move {
server
.object_server()
.at(&ObjectPath::from_str_unchecked(path), iface)
.await
.map_err(|err| {
warn!("{}: add_to_server {}", path, err);
err
})
.ok();
}
}
}
/// Set up a task to run on the async executor
#[async_trait]
pub trait CtrlTask {
fn zbus_path() -> &'static str;
@@ -168,7 +177,10 @@ pub trait CtrlTask {
/// Implement to set up various tasks that may be required, using the
/// `Executor`. No blocking loops are allowed, or they must be run on a
/// separate thread.
async fn create_tasks(&self, signal: SignalContext<'static>) -> Result<(), RogError>;
fn create_tasks(
&self,
signal: SignalContext<'static>,
) -> impl std::future::Future<Output = Result<(), RogError>> + Send;
// /// Create a timed repeating task
// async fn repeating_task(&self, millis: u64, mut task: impl FnMut() + Send +
@@ -186,7 +198,7 @@ pub trait CtrlTask {
///
/// The closures can potentially block, so execution time should be the
/// minimal possible such as save a variable.
async fn create_sys_event_tasks<
fn create_sys_event_tasks<
Fut1,
Fut2,
Fut3,
@@ -201,7 +213,8 @@ pub trait CtrlTask {
mut on_prepare_for_shutdown: F2,
mut on_lid_change: F3,
mut on_external_power_change: F4,
) where
) -> impl std::future::Future<Output = ()> + Send
where
F1: FnMut(bool) -> Fut1,
F2: FnMut(bool) -> Fut2,
F3: FnMut(bool) -> Fut3,
@@ -211,70 +224,72 @@ pub trait CtrlTask {
Fut3: Future<Output = ()> + Send,
Fut4: Future<Output = ()> + Send,
{
let connection = Connection::system()
.await
.expect("Controller could not create dbus connection");
async {
let connection = Connection::system()
.await
.expect("Controller could not create dbus connection");
let manager = ManagerProxy::builder(&connection)
.cache_properties(CacheProperties::No)
.build()
.await
.expect("Controller could not create ManagerProxy");
let manager = ManagerProxy::builder(&connection)
.cache_properties(CacheProperties::No)
.build()
.await
.expect("Controller could not create ManagerProxy");
let manager1 = manager.clone();
tokio::spawn(async move {
if let Ok(mut notif) = manager1.receive_prepare_for_shutdown().await {
while let Some(event) = notif.next().await {
// blocks thread :|
if let Ok(args) = event.args() {
debug!("Doing on_prepare_for_shutdown({})", args.start);
on_prepare_for_shutdown(args.start).await;
let manager1 = manager.clone();
tokio::spawn(async move {
if let Ok(mut notif) = manager1.receive_prepare_for_shutdown().await {
while let Some(event) = notif.next().await {
// blocks thread :|
if let Ok(args) = event.args() {
debug!("Doing on_prepare_for_shutdown({})", args.start);
on_prepare_for_shutdown(args.start).await;
}
}
}
}
});
});
let manager2 = manager.clone();
tokio::spawn(async move {
if let Ok(mut notif) = manager2.receive_prepare_for_sleep().await {
while let Some(event) = notif.next().await {
// blocks thread :|
if let Ok(args) = event.args() {
debug!("Doing on_prepare_for_sleep({})", args.start);
on_prepare_for_sleep(args.start).await;
let manager2 = manager.clone();
tokio::spawn(async move {
if let Ok(mut notif) = manager2.receive_prepare_for_sleep().await {
while let Some(event) = notif.next().await {
// blocks thread :|
if let Ok(args) = event.args() {
debug!("Doing on_prepare_for_sleep({})", args.start);
on_prepare_for_sleep(args.start).await;
}
}
}
}
});
});
let manager3 = manager.clone();
tokio::spawn(async move {
let mut last_power = manager3.on_external_power().await.unwrap_or_default();
let manager3 = manager.clone();
tokio::spawn(async move {
let mut last_power = manager3.on_external_power().await.unwrap_or_default();
loop {
if let Ok(next) = manager3.on_external_power().await {
if next != last_power {
last_power = next;
on_external_power_change(next).await;
loop {
if let Ok(next) = manager3.on_external_power().await {
if next != last_power {
last_power = next;
on_external_power_change(next).await;
}
}
sleep(Duration::from_secs(2)).await;
}
sleep(Duration::from_secs(2)).await;
}
});
});
tokio::spawn(async move {
let mut last_lid = manager.lid_closed().await.unwrap_or_default();
// need to loop on these as they don't emit signals
loop {
if let Ok(next) = manager.lid_closed().await {
if next != last_lid {
last_lid = next;
on_lid_change(next).await;
tokio::spawn(async move {
let mut last_lid = manager.lid_closed().await.unwrap_or_default();
// need to loop on these as they don't emit signals
loop {
if let Ok(next) = manager.lid_closed().await {
if next != last_lid {
last_lid = next;
on_lid_change(next).await;
}
}
sleep(Duration::from_secs(2)).await;
}
sleep(Duration::from_secs(2)).await;
}
});
});
}
}
}

View File

@@ -19,7 +19,7 @@
<arg name="enabled" type="b" direction="in"/>
</method>
<!--
Get the fan-curve data for the currently active PlatformPolicy
Get the fan-curve data for the currently active ThrottlePolicy
-->
<method name="FanCurveData">
<arg name="profile" type="s" direction="in"/>

View File

@@ -28,7 +28,7 @@ export enum GpuMode {
}
/** `throttle_thermal_policy` in asus_wmi */
export enum PlatformPolicy {
export enum ThrottlePolicy {
Balanced = "Balanced",
Performance = "Performance",
Quiet = "Quiet",
@@ -43,7 +43,7 @@ export enum Properties {
PanelOd = "PanelOd",
MiniLedMode = "MiniLedMode",
EgpuEnable = "EgpuEnable",
PlatformPolicy = "PlatformPolicy",
ThrottlePolicy = "ThrottlePolicy",
PptPl1Spl = "PptPl1Spl",
PptPl2Sppt = "PptPl2Sppt",
PptFppt = "PptFppt",

View File

@@ -109,6 +109,20 @@ where
}
}
/// Open and parse the config file to self from ron format
fn read_new(&self) -> Option<Self> {
if let Ok(data) = fs::read_to_string(self.file_path()) {
if data.is_empty() {
warn!("File is empty {:?}", self.file_path());
} else if let Ok(data) = ron::from_str(&data) {
return Some(data);
} else {
warn!("Could not deserialise {:?}", self.file_path());
}
}
None
}
/// Write the config file data to pretty ron format
fn write(&self) {
let mut file = match File::create(self.file_path()) {

View File

@@ -71,6 +71,14 @@
advanced_type: None,
power_zones: [Keyboard],
),
(
board_name: "FX705D",
layout_name: "fx505d",
basic_modes: [Static, Breathe, Strobe, Pulse],
basic_zones: [],
advanced_type: None,
power_zones: [Keyboard],
),
(
board_name: "G512",
layout_name: "g512",
@@ -231,6 +239,14 @@
advanced_type: PerKey,
power_zones: [Keyboard],
),
(
board_name: "G614J",
layout_name: "g634j-per-key",
basic_modes: [Static, Breathe, Pulse, Strobe, Rainbow],
basic_zones: [],
advanced_type: None,
power_zones: [Keyboard, Lightbar],
),
(
board_name: "G634J",
layout_name: "g634j-per-key",
@@ -399,6 +415,14 @@
advanced_type: PerKey,
power_zones: [Keyboard, Lightbar],
),
(
board_name: "G814JZ",
layout_name: "g814ji-per-key",
basic_modes: [Static, Breathe, Strobe, Rainbow, Star, Rain, Highlight, Laser, Ripple, Pulse, Comet, Flash],
basic_zones: [],
advanced_type: PerKey,
power_zones: [Keyboard, Lightbar],
),
(
board_name: "G834JZ",
layout_name: "g814ji-per-key",
@@ -703,4 +727,4 @@
advanced_type: None,
power_zones: [Keyboard],
),
])
])

View File

@@ -10,10 +10,9 @@ pub mod effects;
pub mod advanced;
/// Convert the `RgbAddress` to `&str` labels
pub mod advanced_to_str;
pub mod error;
pub use advanced_to_str::*;
/// Helper for detecting what is available
pub mod aura_detection;
pub mod error;
/// Helpers for consructing keyboard layouts for UI use and effects
pub mod layouts;
pub mod usb;

View File

@@ -137,7 +137,7 @@ pub struct AuraPowerDev {
#[cfg_attr(
feature = "dbus",
derive(Type, Value, OwnedValue),
zvariant(signature = "y")
zvariant(signature = "u")
)]
#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, Serialize, Deserialize)]
#[repr(u32)]
@@ -172,7 +172,7 @@ impl AuraDevTuf {
#[cfg_attr(
feature = "dbus",
derive(Type, Value, OwnedValue),
zvariant(signature = "y")
zvariant(signature = "u")
)]
#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, Serialize, Deserialize)]
#[repr(u32)]

View File

@@ -22,6 +22,8 @@ use rog_control_center::{
get_ipc_file, on_tmp_dir_exists, print_versions, RogApp, RogDbusClientBlocking, SHOWING_GUI,
SHOW_GUI,
};
#[cfg(not(feature = "mocking"))]
use supergfxctl::zbus_proxy::DaemonProxyBlocking as GfxProxyBlocking;
use tokio::runtime::Runtime;
#[cfg(not(feature = "mocking"))]
@@ -62,8 +64,8 @@ fn main() -> Result<()> {
let native_options = eframe::NativeOptions {
vsync: true,
hardware_acceleration: HardwareAcceleration::Preferred,
// min_window_size: Some(egui::vec2(960.0, 670.0)),
// max_window_size: Some(egui::vec2(960.0, 670.0)),
min_window_size: Some(egui::vec2(980.0, 670.0)),
max_window_size: Some(egui::vec2(980.0, 670.0)),
run_and_return: true,
..Default::default()
};
@@ -186,10 +188,27 @@ fn main() -> Result<()> {
&config,
)?;
if cli_parsed.board_name.is_some() || cli_parsed.layout_viewing {
if let Ok(mut lock) = states.lock() {
lock.run_in_bg = false;
running_in_bg.store(false, Ordering::Release);
}
}
if config.enable_tray_icon {
init_tray(supported_properties, states.clone());
}
if let Ok(mut states) = states.lock() {
// For some reason the gui is causing a broke pipe error on dbus send, so
// replace it.
let (asus_dbus, conn) =
rog_dbus::RogDbusClientBlocking::new().expect("Couldn't connect to asusd");
states.asus_dbus = asus_dbus;
let gfx_dbus = GfxProxyBlocking::new(&conn).expect("Couldn't connect to supergfxd");
states.gfx_dbus = gfx_dbus;
}
let mut bg_check_spawned = false;
loop {
if !running_in_bg.load(Ordering::Relaxed) {
@@ -212,7 +231,7 @@ fn main() -> Result<()> {
}
if let Ok(lock) = states.try_lock() {
if !lock.run_in_bg || cli_parsed.board_name.is_some() || cli_parsed.layout_viewing {
if !lock.run_in_bg {
break;
}

View File

@@ -1,5 +1,5 @@
use egui::{RichText, Ui};
use rog_platform::platform::PlatformPolicy;
use rog_platform::platform::ThrottlePolicy;
use crate::system_state::{FanCurvesState, SystemState};
use crate::widgets::fan_graphs;
@@ -29,7 +29,7 @@ impl RogApp {
}
fn fan_curve(
current: &mut PlatformPolicy,
current: &mut ThrottlePolicy,
curves: &mut FanCurvesState,
dbus: &RogDbusClientBlocking<'_>,
do_error: &mut Option<String>,

View File

@@ -3,9 +3,3 @@ mod app_settings;
mod aura_page;
mod fan_curve_page;
mod system_page;
pub use anime_page::*;
pub use app_settings::*;
pub use aura_page::*;
pub use fan_curve_page::*;
pub use system_page::*;

View File

@@ -10,7 +10,7 @@ use rog_aura::aura_detection::PowerZones;
use rog_aura::layouts::KeyLayout;
use rog_aura::usb::{AuraDevice, AuraPowerDev};
use rog_aura::{AuraEffect, AuraModeNum, AuraZone, LedBrightness};
use rog_platform::platform::{GpuMode, PlatformPolicy};
use rog_platform::platform::{GpuMode, ThrottlePolicy};
use rog_profiles::fan_curve_set::CurveData;
use rog_profiles::FanCurvePU;
use supergfxctl::pci_device::{GfxMode, GfxPower};
@@ -34,7 +34,7 @@ pub struct PlatformState {
pub mini_led_mode: Option<bool>,
pub dgpu_disable: Option<bool>,
pub egpu_enable: Option<bool>,
pub throttle: Option<PlatformPolicy>,
pub throttle: Option<ThrottlePolicy>,
pub charge_limit: Option<u8>,
}
@@ -65,9 +65,9 @@ impl PlatformState {
#[derive(Clone, Debug, Default)]
pub struct FanCurvesState {
pub show_curve: PlatformPolicy,
pub show_curve: ThrottlePolicy,
pub show_graph: FanCurvePU,
pub curves: BTreeMap<PlatformPolicy, Vec<CurveData>>,
pub curves: BTreeMap<ThrottlePolicy, Vec<CurveData>>,
pub available_fans: HashSet<FanCurvePU>,
pub drag_delta: Vec2,
}
@@ -75,13 +75,13 @@ pub struct FanCurvesState {
impl FanCurvesState {
pub fn new(dbus: &RogDbusClientBlocking<'_>) -> Result<Self> {
let profiles = vec![
PlatformPolicy::Balanced,
PlatformPolicy::Quiet,
PlatformPolicy::Performance,
ThrottlePolicy::Balanced,
ThrottlePolicy::Quiet,
ThrottlePolicy::Performance,
];
let mut available_fans = HashSet::new();
let mut curves: BTreeMap<PlatformPolicy, Vec<CurveData>> = BTreeMap::new();
let mut curves: BTreeMap<ThrottlePolicy, Vec<CurveData>> = BTreeMap::new();
for p in &profiles {
if let Ok(curve) = dbus.proxies().fan_curves().fan_curve_data(*p) {
if available_fans.is_empty() {

View File

@@ -14,7 +14,7 @@ use notify_rust::{Hint, Notification, NotificationHandle, Urgency};
use rog_dbus::zbus_anime::AnimeProxy;
use rog_dbus::zbus_aura::AuraProxy;
use rog_dbus::zbus_platform::PlatformProxy;
use rog_platform::platform::{GpuMode, PlatformPolicy};
use rog_platform::platform::{GpuMode, ThrottlePolicy};
use serde::{Deserialize, Serialize};
use supergfxctl::actions::UserActionRequired as GfxUserAction;
use supergfxctl::pci_device::{GfxMode, GfxPower};
@@ -546,11 +546,11 @@ fn _ac_power_notification(message: &str, on: &bool) -> Result<NotificationHandle
Ok(base_notification(message, &data).show()?)
}
fn do_thermal_notif(message: &str, profile: &PlatformPolicy) -> Result<NotificationHandle> {
fn do_thermal_notif(message: &str, profile: &ThrottlePolicy) -> Result<NotificationHandle> {
let icon = match profile {
PlatformPolicy::Balanced => "asus_notif_yellow",
PlatformPolicy::Performance => "asus_notif_red",
PlatformPolicy::Quiet => "asus_notif_green",
ThrottlePolicy::Balanced => "asus_notif_yellow",
ThrottlePolicy::Performance => "asus_notif_red",
ThrottlePolicy::Quiet => "asus_notif_green",
};
let profile: &str = (*profile).into();
let mut notif = base_notification(message, &profile.to_uppercase());

View File

@@ -1,6 +1,6 @@
use egui::plot::{Line, Plot, Points};
use egui::Ui;
use rog_platform::platform::PlatformPolicy;
use rog_platform::platform::ThrottlePolicy;
use rog_profiles::fan_curve_set::CurveData;
use rog_profiles::FanCurvePU;
@@ -13,9 +13,13 @@ pub fn fan_graphs(
do_error: &mut Option<String>,
ui: &mut Ui,
) {
if curves.available_fans.is_empty() {
return; // TODO:
}
ui.separator();
let mut item = |profile: PlatformPolicy, ui: &mut Ui| {
let mut item = |profile: ThrottlePolicy, ui: &mut Ui| {
ui.group(|ui| {
if ui
.selectable_value(&mut curves.show_curve, profile, format!("{profile:?}"))

View File

@@ -15,5 +15,3 @@ pub use aura_power::*;
pub use fan_graph::*;
pub use keyboard_layout::*;
pub use rog_bios::*;
pub use side_panel::*;
pub use top_bar::*;

View File

@@ -1,5 +1,5 @@
use egui::Ui;
use rog_platform::platform::{GpuMode, PlatformPolicy};
use rog_platform::platform::{GpuMode, ThrottlePolicy};
use crate::system_state::SystemState;
@@ -7,7 +7,7 @@ pub fn platform_profile(states: &mut SystemState, ui: &mut Ui) {
if let Some(mut throttle) = states.bios.throttle {
ui.heading("Platform profile");
let mut item = |p: PlatformPolicy, ui: &mut Ui| {
let mut item = |p: ThrottlePolicy, ui: &mut Ui| {
if ui
.selectable_value(&mut throttle, p, format!("{p:?}"))
.clicked()
@@ -25,7 +25,7 @@ pub fn platform_profile(states: &mut SystemState, ui: &mut Ui) {
};
ui.horizontal_wrapped(|ui| {
for a in PlatformPolicy::list() {
for a in ThrottlePolicy::list() {
item(a, ui);
}
});

View File

@@ -1,4 +1,4 @@
use egui::{vec2, Align2, FontId, Id, Sense};
use egui::{vec2, Align2, Button, FontId, Id, Rect, RichText, Sense, Vec2};
use crate::{RogApp, VERSION};
@@ -8,7 +8,7 @@ impl RogApp {
// The top panel is often a good place for a menu bar:
egui::menu::bar(ui, |ui| {
ui.horizontal(|ui| {
egui::global_dark_light_mode_buttons(ui);
self.dark_light_mode_buttons(ui);
egui::warn_if_debug_build(ui);
});
@@ -33,16 +33,45 @@ impl RogApp {
FontId::proportional(height - 2.0),
text_color,
);
// // Add the close button:
// let close_response = ui.put(
// Rect::from_min_size(titlebar_rect.right_top(),
// Vec2::splat(height)),
// Button::new(RichText::new("❌").size(height -
// 4.0)).frame(false), );
// if close_response.clicked() {
// frame.close();
// }
// Add the close button:
let close_response = ui.put(
Rect::from_min_size(titlebar_rect.right_top(), Vec2::splat(height)),
Button::new(RichText::new("").size(height - 4.0)).frame(false),
);
if close_response.clicked() {
frame.close();
}
});
});
}
fn dark_light_mode_buttons(&mut self, ui: &mut egui::Ui) {
let load_from_cfg = self.config.dark_mode != ui.ctx().style().visuals.dark_mode;
if ui
.add(egui::SelectableLabel::new(
!self.config.dark_mode,
"☀ Light",
))
.clicked()
|| (load_from_cfg && !self.config.dark_mode)
{
ui.ctx().set_visuals(egui::Visuals::light());
}
if ui
.add(egui::SelectableLabel::new(self.config.dark_mode, "🌙 Dark"))
.clicked()
|| (load_from_cfg && self.config.dark_mode)
{
ui.ctx().set_visuals(egui::Visuals::dark());
}
let applied_dark_mode = ui.ctx().style().visuals.dark_mode;
if self.config.dark_mode != applied_dark_mode {
self.config.dark_mode = applied_dark_mode;
let tmp = self.config.enabled_notifications.clone();
self.config.save(&tmp).ok();
}
}
}

View File

@@ -20,7 +20,7 @@
//!
//! …consequently `zbus-xmlgen` did not generate code for the above interfaces.
use rog_platform::platform::PlatformPolicy;
use rog_platform::platform::ThrottlePolicy;
use rog_profiles::fan_curve_set::CurveData;
use rog_profiles::FanCurvePU;
use zbus::dbus_proxy;
@@ -32,30 +32,30 @@ use zbus::dbus_proxy;
)]
trait FanCurves {
/// Get the fan-curve data for the currently active PlatformProfile
fn fan_curve_data(&self, profile: PlatformPolicy) -> zbus::Result<Vec<CurveData>>;
fn fan_curve_data(&self, profile: ThrottlePolicy) -> zbus::Result<Vec<CurveData>>;
/// Reset the stored (self) and device curve to the defaults of the
/// platform.
///
/// Each platform_profile has a different default and the defualt can be
/// read only for the currently active profile.
fn reset_profile_curves(&self, profile: PlatformPolicy) -> zbus::fdo::Result<()>;
fn reset_profile_curves(&self, profile: ThrottlePolicy) -> zbus::Result<()>;
/// SetActiveCurveToDefaults method
fn set_active_curve_to_defaults(&self) -> zbus::Result<()>;
/// Set the fan curve for the specified profile, or the profile the user is
/// currently in if profile == None. Will also activate the fan curve.
fn set_fan_curve(&self, profile: PlatformPolicy, curve: CurveData) -> zbus::Result<()>;
fn set_fan_curve(&self, profile: ThrottlePolicy, curve: CurveData) -> zbus::Result<()>;
/// Set a profile fan curve enabled status. Will also activate a fan curve.
fn set_fan_curves_enabled(&self, profile: PlatformPolicy, enabled: bool) -> zbus::Result<()>;
fn set_fan_curves_enabled(&self, profile: ThrottlePolicy, enabled: bool) -> zbus::Result<()>;
/// Set a single fan curve for a profile to enabled status. Will also
/// activate a fan curve.
async fn set_profile_fan_curve_enabled(
&self,
profile: PlatformPolicy,
profile: ThrottlePolicy,
fan: FanCurvePU,
enabled: bool,
) -> zbus::Result<()>;

View File

@@ -20,7 +20,7 @@
//!
//! …consequently `zbus-xmlgen` did not generate code for the above interfaces.
use rog_platform::platform::{GpuMode, PlatformPolicy, Properties};
use rog_platform::platform::{GpuMode, Properties, ThrottlePolicy};
use zbus::dbus_proxy;
#[dbus_proxy(
@@ -118,9 +118,9 @@ trait Platform {
#[dbus_proxy(property)]
fn set_ppt_platform_sppt(&self, value: u8) -> zbus::Result<()>;
/// PlatformPolicy property
/// ThrottlePolicy property
#[dbus_proxy(property)]
fn throttle_thermal_policy(&self) -> zbus::Result<PlatformPolicy>;
fn throttle_thermal_policy(&self) -> zbus::Result<ThrottlePolicy>;
#[dbus_proxy(property)]
fn set_throttle_thermal_policy(&self, value: PlatformPolicy) -> zbus::Result<()>;
fn set_throttle_thermal_policy(&self, value: ThrottlePolicy) -> zbus::Result<()>;
}

View File

@@ -6,7 +6,7 @@ use typeshare::typeshare;
use zbus::zvariant::{OwnedValue, Type, Value};
use crate::error::{PlatformError, Result};
use crate::platform::PlatformPolicy;
use crate::platform::ThrottlePolicy;
use crate::{read_attr_string, to_device};
const ATTR_AVAILABLE_GOVERNORS: &str = "cpufreq/scaling_available_governors";
@@ -180,12 +180,23 @@ impl From<CPUGovernor> for String {
}
#[typeshare]
#[repr(u8)]
#[repr(u32)]
#[derive(
Deserialize, Serialize, Type, Value, OwnedValue, Debug, PartialEq, PartialOrd, Clone, Copy,
Deserialize,
Serialize,
Type,
Value,
OwnedValue,
Default,
Debug,
PartialEq,
PartialOrd,
Clone,
Copy,
)]
#[zvariant(signature = "s")]
#[zvariant(signature = "u")]
pub enum CPUEPP {
#[default]
Default = 0,
Performance = 1,
BalancePerformance = 2,
@@ -193,12 +204,12 @@ pub enum CPUEPP {
Power = 4,
}
impl From<PlatformPolicy> for CPUEPP {
fn from(value: PlatformPolicy) -> Self {
impl From<ThrottlePolicy> for CPUEPP {
fn from(value: ThrottlePolicy) -> Self {
match value {
PlatformPolicy::Balanced => CPUEPP::BalancePerformance,
PlatformPolicy::Performance => CPUEPP::Performance,
PlatformPolicy::Quiet => CPUEPP::Power,
ThrottlePolicy::Balanced => CPUEPP::BalancePerformance,
ThrottlePolicy::Performance => CPUEPP::Performance,
ThrottlePolicy::Quiet => CPUEPP::Power,
}
}
}

View File

@@ -249,7 +249,7 @@ impl Display for GpuMode {
}
#[typeshare]
#[repr(u8)]
#[repr(u32)]
#[derive(
Deserialize,
Serialize,
@@ -266,17 +266,17 @@ impl Display for GpuMode {
Clone,
Copy,
)]
#[zvariant(signature = "s")]
#[zvariant(signature = "u")]
/// `throttle_thermal_policy` in asus_wmi
pub enum PlatformPolicy {
pub enum ThrottlePolicy {
#[default]
Balanced = 0,
Performance = 1,
Quiet = 2,
}
impl PlatformPolicy {
pub const fn next(&self) -> Self {
impl ThrottlePolicy {
pub const fn next(self) -> Self {
match self {
Self::Balanced => Self::Performance,
Self::Performance => Self::Quiet,
@@ -289,7 +289,7 @@ impl PlatformPolicy {
}
}
impl From<u8> for PlatformPolicy {
impl From<u8> for ThrottlePolicy {
fn from(num: u8) -> Self {
match num {
0 => Self::Balanced,
@@ -303,55 +303,45 @@ impl From<u8> for PlatformPolicy {
}
}
impl From<PlatformPolicy> for u8 {
fn from(p: PlatformPolicy) -> Self {
impl From<ThrottlePolicy> for u8 {
fn from(p: ThrottlePolicy) -> Self {
match p {
PlatformPolicy::Balanced => 0,
PlatformPolicy::Performance => 1,
PlatformPolicy::Quiet => 2,
ThrottlePolicy::Balanced => 0,
ThrottlePolicy::Performance => 1,
ThrottlePolicy::Quiet => 2,
}
}
}
impl From<PlatformPolicy> for &str {
fn from(profile: PlatformPolicy) -> &'static str {
impl From<ThrottlePolicy> for &str {
fn from(profile: ThrottlePolicy) -> &'static str {
match profile {
PlatformPolicy::Balanced => "balanced",
PlatformPolicy::Performance => "performance",
PlatformPolicy::Quiet => "quiet",
ThrottlePolicy::Balanced => "balanced",
ThrottlePolicy::Performance => "performance",
ThrottlePolicy::Quiet => "quiet",
}
}
}
impl std::str::FromStr for PlatformPolicy {
impl std::str::FromStr for ThrottlePolicy {
type Err = PlatformError;
fn from_str(profile: &str) -> Result<Self> {
match profile.to_ascii_lowercase().trim() {
"balanced" => Ok(PlatformPolicy::Balanced),
"performance" => Ok(PlatformPolicy::Performance),
"quiet" => Ok(PlatformPolicy::Quiet),
"balanced" => Ok(ThrottlePolicy::Balanced),
"performance" => Ok(ThrottlePolicy::Performance),
"quiet" => Ok(ThrottlePolicy::Quiet),
_ => Err(PlatformError::NotSupported),
}
}
}
impl Display for PlatformPolicy {
impl Display for ThrottlePolicy {
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
write!(f, "{:?}", self)
}
}
impl PlatformPolicy {
pub fn get_next_profile(current: PlatformPolicy) -> PlatformPolicy {
match current {
PlatformPolicy::Balanced => PlatformPolicy::Performance,
PlatformPolicy::Performance => PlatformPolicy::Quiet,
PlatformPolicy::Quiet => PlatformPolicy::Balanced,
}
}
}
/// CamelCase names of the properties. Intended for use with DBUS
#[typeshare]
#[repr(u8)]
@@ -365,7 +355,7 @@ pub enum Properties {
PanelOd,
MiniLedMode,
EgpuEnable,
PlatformPolicy,
ThrottlePolicy,
PptPl1Spl,
PptPl2Sppt,
PptFppt,

View File

@@ -4,12 +4,13 @@ pub mod fan_curve_set;
use error::ProfileError;
use fan_curve_set::CurveData;
use log::debug;
use rog_platform::platform::PlatformPolicy;
use rog_platform::platform::ThrottlePolicy;
use serde_derive::{Deserialize, Serialize};
use typeshare::typeshare;
pub use udev::Device;
#[cfg(feature = "dbus")]
use zbus::zvariant::Type;
use zbus::zvariant::{OwnedValue, Value};
pub const VERSION: &str = env!("CARGO_PKG_VERSION");
@@ -31,12 +32,16 @@ pub fn find_fan_curve_node() -> Result<Device, ProfileError> {
}
#[typeshare]
#[cfg_attr(feature = "dbus", derive(Type), zvariant(signature = "s"))]
#[cfg_attr(
feature = "dbus",
derive(Type, Value, OwnedValue),
zvariant(signature = "s")
)]
#[derive(Deserialize, Serialize, Debug, Hash, PartialEq, Eq, Clone, Copy)]
pub enum FanCurvePU {
CPU,
GPU,
MID,
CPU = 0,
GPU = 1,
MID = 2,
}
impl FanCurvePU {
@@ -118,7 +123,7 @@ impl FanCurveProfiles {
///
pub fn read_from_dev_profile(
&mut self,
profile: PlatformPolicy,
profile: ThrottlePolicy,
device: &Device,
) -> Result<(), ProfileError> {
let fans = Self::supported_fans()?;
@@ -136,9 +141,9 @@ impl FanCurveProfiles {
}
match profile {
PlatformPolicy::Balanced => self.balanced = curves,
PlatformPolicy::Performance => self.performance = curves,
PlatformPolicy::Quiet => self.quiet = curves,
ThrottlePolicy::Balanced => self.balanced = curves,
ThrottlePolicy::Performance => self.performance = curves,
ThrottlePolicy::Quiet => self.quiet = curves,
}
Ok(())
}
@@ -150,7 +155,7 @@ impl FanCurveProfiles {
/// read only for the currently active profile.
pub fn set_active_curve_to_defaults(
&mut self,
profile: PlatformPolicy,
profile: ThrottlePolicy,
device: &mut Device,
) -> Result<(), ProfileError> {
let fans = Self::supported_fans()?;
@@ -170,13 +175,13 @@ impl FanCurveProfiles {
// TODO: Make this return an error if curve is zeroed
pub fn write_profile_curve_to_platform(
&mut self,
profile: PlatformPolicy,
profile: ThrottlePolicy,
device: &mut Device,
) -> Result<(), ProfileError> {
let fans = match profile {
PlatformPolicy::Balanced => &mut self.balanced,
PlatformPolicy::Performance => &mut self.performance,
PlatformPolicy::Quiet => &mut self.quiet,
ThrottlePolicy::Balanced => &mut self.balanced,
ThrottlePolicy::Performance => &mut self.performance,
ThrottlePolicy::Quiet => &mut self.quiet,
};
for fan in fans {
debug!("write_profile_curve_to_platform: writing profile:{profile}, {fan:?}");
@@ -185,19 +190,19 @@ impl FanCurveProfiles {
Ok(())
}
pub fn set_profile_curves_enabled(&mut self, profile: PlatformPolicy, enabled: bool) {
pub fn set_profile_curves_enabled(&mut self, profile: ThrottlePolicy, enabled: bool) {
match profile {
PlatformPolicy::Balanced => {
ThrottlePolicy::Balanced => {
for curve in self.balanced.iter_mut() {
curve.enabled = enabled;
}
}
PlatformPolicy::Performance => {
ThrottlePolicy::Performance => {
for curve in self.performance.iter_mut() {
curve.enabled = enabled;
}
}
PlatformPolicy::Quiet => {
ThrottlePolicy::Quiet => {
for curve in self.quiet.iter_mut() {
curve.enabled = enabled;
}
@@ -207,12 +212,12 @@ impl FanCurveProfiles {
pub fn set_profile_fan_curve_enabled(
&mut self,
profile: PlatformPolicy,
profile: ThrottlePolicy,
fan: FanCurvePU,
enabled: bool,
) {
match profile {
PlatformPolicy::Balanced => {
ThrottlePolicy::Balanced => {
for curve in self.balanced.iter_mut() {
if curve.fan == fan {
curve.enabled = enabled;
@@ -220,7 +225,7 @@ impl FanCurveProfiles {
}
}
}
PlatformPolicy::Performance => {
ThrottlePolicy::Performance => {
for curve in self.performance.iter_mut() {
if curve.fan == fan {
curve.enabled = enabled;
@@ -228,7 +233,7 @@ impl FanCurveProfiles {
}
}
}
PlatformPolicy::Quiet => {
ThrottlePolicy::Quiet => {
for curve in self.quiet.iter_mut() {
if curve.fan == fan {
curve.enabled = enabled;
@@ -239,31 +244,31 @@ impl FanCurveProfiles {
}
}
pub fn get_fan_curves_for(&self, name: PlatformPolicy) -> &[CurveData] {
pub fn get_fan_curves_for(&self, name: ThrottlePolicy) -> &[CurveData] {
match name {
PlatformPolicy::Balanced => &self.balanced,
PlatformPolicy::Performance => &self.performance,
PlatformPolicy::Quiet => &self.quiet,
ThrottlePolicy::Balanced => &self.balanced,
ThrottlePolicy::Performance => &self.performance,
ThrottlePolicy::Quiet => &self.quiet,
}
}
pub fn get_fan_curve_for(&self, name: &PlatformPolicy, pu: FanCurvePU) -> Option<&CurveData> {
pub fn get_fan_curve_for(&self, name: &ThrottlePolicy, pu: FanCurvePU) -> Option<&CurveData> {
match name {
PlatformPolicy::Balanced => {
ThrottlePolicy::Balanced => {
for this_curve in self.balanced.iter() {
if this_curve.fan == pu {
return Some(this_curve);
}
}
}
PlatformPolicy::Performance => {
ThrottlePolicy::Performance => {
for this_curve in self.performance.iter() {
if this_curve.fan == pu {
return Some(this_curve);
}
}
}
PlatformPolicy::Quiet => {
ThrottlePolicy::Quiet => {
for this_curve in self.quiet.iter() {
if this_curve.fan == pu {
return Some(this_curve);
@@ -277,10 +282,10 @@ impl FanCurveProfiles {
pub fn save_fan_curve(
&mut self,
curve: CurveData,
profile: PlatformPolicy,
profile: ThrottlePolicy,
) -> Result<(), ProfileError> {
match profile {
PlatformPolicy::Balanced => {
ThrottlePolicy::Balanced => {
for this_curve in self.balanced.iter_mut() {
if this_curve.fan == curve.fan {
*this_curve = curve;
@@ -288,7 +293,7 @@ impl FanCurveProfiles {
}
}
}
PlatformPolicy::Performance => {
ThrottlePolicy::Performance => {
for this_curve in self.performance.iter_mut() {
if this_curve.fan == curve.fan {
*this_curve = curve;
@@ -296,7 +301,7 @@ impl FanCurveProfiles {
}
}
}
PlatformPolicy::Quiet => {
ThrottlePolicy::Quiet => {
for this_curve in self.quiet.iter_mut() {
if this_curve.fan == curve.fan {
*this_curve = curve;