mirror of
https://gitlab.com/asus-linux/asusctl.git
synced 2026-02-06 00:15:04 +01:00
Compare commits
10 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 2d396a49da | |||
| a6d89a622b | |||
| 51bcb0082b | |||
| eb54250e4d | |||
| eafc831231 | |||
| c625e97b7b | |||
| fea56879d6 | |||
| 03052e129b | |||
| 3dbc893905 | |||
| 50152961c7 |
+6
-1
@@ -5,12 +5,14 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
|
||||
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
|
||||
|
||||
## [Unreleased]
|
||||
## [v4.7.0-RC2]
|
||||
## [v4.7.0-RC3]
|
||||
### Added
|
||||
- Support for FX507Z LED modes
|
||||
- Support for GL503V LED modes
|
||||
- Support for G733C LED modes
|
||||
- Support for GV601VI LED modes
|
||||
- Support for FX505G LED modes
|
||||
- Support for GA402X LED modes
|
||||
- Support for G634J LED modes (layout is in progress)
|
||||
- Support the Rear Glow on some laptops
|
||||
- Added field to aura_support to determine which LED power zones are supported. This will need folks to contribute data.
|
||||
@@ -26,6 +28,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
||||
- Add generation of typescript types from the rust types used via dbus using typeshare
|
||||
- Add generation of introspection XML from asusd dbus
|
||||
- Add a reworked gnome extension to the main repo under `desktop-extensions/gnome/`. This was done to better keep the extension in sync with work done on asusd, especially around breaking dbus
|
||||
- Add support for the mid fan custom curves on some laptops
|
||||
### Changed
|
||||
- Move FX506HC to FX506H in arua DB to catch full series of this range
|
||||
- Move FX506LH to FX506L in arua DB to catch full series of this range
|
||||
@@ -35,10 +38,12 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
||||
- Prevent the multiple notifications from a profile change from occuring (too many functions with side effects!)
|
||||
- Apply keyboard brightness when setting a mode
|
||||
- Update GL503 led config
|
||||
- Arua LED power control has been heavily refactored for 0x19b6+ devices
|
||||
- Rog Control Center:
|
||||
- Added option to enable/disable system tray
|
||||
- Added button to fully quit app (exits from background)
|
||||
- Moved application settings to new page
|
||||
- Aura LED power refactor is now taken advantage of in RCC, exposing all settings
|
||||
### BREAKING
|
||||
- All Anime related DBUS methods/notifs are changed
|
||||
- All dbus interfaces that handled an enum have now been forced to use the enum as String type, not uint or similar, this unfortunately breaks a heap of stuff but has the benefit of allowing asusctl to use crates to generate a typescript (or other) binding to the types being used by zbus for the proxies. The implication here is that there will be an eventual tighter integration with the gnome extension and maybe KDE also.
|
||||
|
||||
Generated
+148
-114
@@ -163,9 +163,9 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "anyhow"
|
||||
version = "1.0.71"
|
||||
version = "1.0.72"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "9c7d0618f0e0b7e8ff11427422b64564d5fb0be1940354bfe2e0529b18a9d9b8"
|
||||
checksum = "3b13c32d80ecc7ab747b80c3784bce54ee8a7a0cc4fbda9bf4cda2cf6fe90854"
|
||||
|
||||
[[package]]
|
||||
name = "arboard"
|
||||
@@ -199,7 +199,7 @@ checksum = "96d30a06541fbafbc7f82ed10c06164cfbd2c401138f6addd8404629c4b16711"
|
||||
|
||||
[[package]]
|
||||
name = "asusctl"
|
||||
version = "4.7.0-RC1"
|
||||
version = "4.7.0-RC3"
|
||||
dependencies = [
|
||||
"asusd",
|
||||
"cargo-husky",
|
||||
@@ -218,7 +218,7 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "asusd"
|
||||
version = "4.7.0-RC1"
|
||||
version = "4.7.0-RC3"
|
||||
dependencies = [
|
||||
"async-trait",
|
||||
"cargo-husky",
|
||||
@@ -242,7 +242,7 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "asusd-user"
|
||||
version = "4.7.0-RC1"
|
||||
version = "4.7.0-RC3"
|
||||
dependencies = [
|
||||
"cargo-husky",
|
||||
"config-traits",
|
||||
@@ -272,9 +272,9 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "async-channel"
|
||||
version = "1.8.0"
|
||||
version = "1.9.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "cf46fee83e5ccffc220104713af3292ff9bc7c64c7de289f66dae8e38d826833"
|
||||
checksum = "81953c529336010edd6d8e358f886d9581267795c61b19475b71314bffa46d35"
|
||||
dependencies = [
|
||||
"concurrent-queue",
|
||||
"event-listener",
|
||||
@@ -290,7 +290,7 @@ dependencies = [
|
||||
"async-lock",
|
||||
"async-task",
|
||||
"concurrent-queue",
|
||||
"fastrand",
|
||||
"fastrand 1.9.0",
|
||||
"futures-lite",
|
||||
"slab",
|
||||
]
|
||||
@@ -321,7 +321,7 @@ dependencies = [
|
||||
"log",
|
||||
"parking",
|
||||
"polling",
|
||||
"rustix 0.37.22",
|
||||
"rustix 0.37.23",
|
||||
"slab",
|
||||
"socket2",
|
||||
"waker-fn",
|
||||
@@ -361,7 +361,7 @@ dependencies = [
|
||||
"cfg-if",
|
||||
"event-listener",
|
||||
"futures-lite",
|
||||
"rustix 0.37.22",
|
||||
"rustix 0.37.23",
|
||||
"signal-hook",
|
||||
"windows-sys 0.48.0",
|
||||
]
|
||||
@@ -374,7 +374,7 @@ checksum = "0e97ce7de6cf12de5d7226c73f5ba9811622f4db3a5b91b55c53e987e5f91cba"
|
||||
dependencies = [
|
||||
"proc-macro2",
|
||||
"quote",
|
||||
"syn 2.0.23",
|
||||
"syn 2.0.27",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
@@ -385,13 +385,13 @@ checksum = "ecc7ab41815b3c653ccd2978ec3255c81349336702dfdf62ee6f7069b12a3aae"
|
||||
|
||||
[[package]]
|
||||
name = "async-trait"
|
||||
version = "0.1.69"
|
||||
version = "0.1.72"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "7b2d0f03b3640e3a630367e40c468cb7f309529c708ed1d88597047b0e7c6ef7"
|
||||
checksum = "cc6dde6e4ed435a4c1ee4e73592f5ba9da2151af10076cc04858746af9352d09"
|
||||
dependencies = [
|
||||
"proc-macro2",
|
||||
"quote",
|
||||
"syn 2.0.23",
|
||||
"syn 2.0.27",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
@@ -566,7 +566,7 @@ dependencies = [
|
||||
"async-lock",
|
||||
"async-task",
|
||||
"atomic-waker",
|
||||
"fastrand",
|
||||
"fastrand 1.9.0",
|
||||
"futures-lite",
|
||||
"log",
|
||||
]
|
||||
@@ -594,7 +594,7 @@ checksum = "fdde5c9cd29ebd706ce1b35600920a33550e402fc998a2e53ad3b42c3c47a192"
|
||||
dependencies = [
|
||||
"proc-macro2",
|
||||
"quote",
|
||||
"syn 2.0.23",
|
||||
"syn 2.0.27",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
@@ -767,7 +767,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "f76990911f2267d837d9d0ad060aa63aaad170af40904b29461734c339030d4d"
|
||||
dependencies = [
|
||||
"quote",
|
||||
"syn 2.0.23",
|
||||
"syn 2.0.27",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
@@ -781,7 +781,7 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "config-traits"
|
||||
version = "4.7.0-RC1"
|
||||
version = "4.7.0-RC3"
|
||||
dependencies = [
|
||||
"cargo-husky",
|
||||
"log",
|
||||
@@ -834,9 +834,9 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "cpufeatures"
|
||||
version = "0.2.8"
|
||||
version = "0.2.9"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "03e69e28e9f7f77debdedbaafa2866e1de9ba56df55a8bd7cfc724c25a09987c"
|
||||
checksum = "a17b76ff3a4162b0b27f354a0c87015ddad39d35f9c0c36607a3bdd175dde1f1"
|
||||
dependencies = [
|
||||
"libc",
|
||||
]
|
||||
@@ -1026,9 +1026,9 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "either"
|
||||
version = "1.8.1"
|
||||
version = "1.9.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "7fcaabb2fef8c910e7f4c7ce9f67a1283a1715879a7c230ca9d6d1ae31f16d91"
|
||||
checksum = "a26ae43d7bcc3b814de94796a5e736d4029efb0ee900c12e2d54c993ad1a1e07"
|
||||
|
||||
[[package]]
|
||||
name = "emath"
|
||||
@@ -1079,7 +1079,7 @@ checksum = "5e9a1f9f7d83e59740248a6e14ecf93929ade55027844dfcea78beafccc15745"
|
||||
dependencies = [
|
||||
"proc-macro2",
|
||||
"quote",
|
||||
"syn 2.0.23",
|
||||
"syn 2.0.27",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
@@ -1111,6 +1111,12 @@ dependencies = [
|
||||
"parking_lot",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "equivalent"
|
||||
version = "1.0.1"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "5443807d6dff69373d433ab9ef5378ad8df50ca6298caf15de6e52e24aaf54d5"
|
||||
|
||||
[[package]]
|
||||
name = "errno"
|
||||
version = "0.3.1"
|
||||
@@ -1157,6 +1163,12 @@ dependencies = [
|
||||
"instant",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "fastrand"
|
||||
version = "2.0.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "6999dc1837253364c2ebb0704ba97994bd874e8f195d665c50b7548f6ea92764"
|
||||
|
||||
[[package]]
|
||||
name = "fdeflate"
|
||||
version = "0.3.0"
|
||||
@@ -1257,7 +1269,7 @@ version = "1.13.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "49a9d51ce47660b1e808d3c990b4709f2f415d928835a17dfd16991515c46bce"
|
||||
dependencies = [
|
||||
"fastrand",
|
||||
"fastrand 1.9.0",
|
||||
"futures-core",
|
||||
"futures-io",
|
||||
"memchr",
|
||||
@@ -1274,7 +1286,7 @@ checksum = "89ca545a94061b6365f2c7355b4b32bd20df3ff95f02da9329b34ccc3bd6ee72"
|
||||
dependencies = [
|
||||
"proc-macro2",
|
||||
"quote",
|
||||
"syn 2.0.23",
|
||||
"syn 2.0.27",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
@@ -1520,9 +1532,9 @@ checksum = "d2fabcfbdc87f4758337ca535fb41a6d701b65693ce38287d856d1674551ec9b"
|
||||
|
||||
[[package]]
|
||||
name = "glow"
|
||||
version = "0.12.2"
|
||||
version = "0.12.3"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "807edf58b70c0b5b2181dd39fe1839dbdb3ba02645630dc5f753e23da307f762"
|
||||
checksum = "ca0fe580e4b60a8ab24a868bc08e2f03cbcb20d3d676601fa909386713333728"
|
||||
dependencies = [
|
||||
"js-sys",
|
||||
"slotmap",
|
||||
@@ -1682,9 +1694,9 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "hashbrown"
|
||||
version = "0.12.3"
|
||||
version = "0.14.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "8a9ee70c43aaf417c914396645a0fa852624801b24ebb7ae78fe8272889ac888"
|
||||
checksum = "2c6201b9ff9fd90a5a3bac2e56a830d0caa509576f0e503818ee82c181b3437a"
|
||||
|
||||
[[package]]
|
||||
name = "heck"
|
||||
@@ -1694,9 +1706,9 @@ checksum = "95505c38b4572b2d910cecb0281560f54b440a19336cbbcb27bf6ce6adc6f5a8"
|
||||
|
||||
[[package]]
|
||||
name = "hermit-abi"
|
||||
version = "0.3.1"
|
||||
version = "0.3.2"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "fed44880c466736ef9a5c5b5facefb5ed0785676d0c02d612db14e54f0d84286"
|
||||
checksum = "443144c8cdadd93ebf52ddb4056d257f5b52c04d3c804e657d19eb73fc33668b"
|
||||
|
||||
[[package]]
|
||||
name = "hex"
|
||||
@@ -1754,11 +1766,11 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "indexmap"
|
||||
version = "1.9.3"
|
||||
version = "2.0.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "bd070e393353796e801d209ad339e89596eb4c8d430d18ede6a1cced8fafbd99"
|
||||
checksum = "d5477fe2230a79769d8dc68e0eabf5437907c0457a5614a9e8dddb67f65eb65d"
|
||||
dependencies = [
|
||||
"autocfg",
|
||||
"equivalent",
|
||||
"hashbrown",
|
||||
]
|
||||
|
||||
@@ -1809,12 +1821,12 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "is-terminal"
|
||||
version = "0.4.8"
|
||||
version = "0.4.9"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "24fddda5af7e54bf7da53067d6e802dbcc381d0a8eef629df528e3ebf68755cb"
|
||||
checksum = "cb0889898416213fab133e1d33a0e5858a48177452750691bde3666d0fdbaf8b"
|
||||
dependencies = [
|
||||
"hermit-abi",
|
||||
"rustix 0.38.2",
|
||||
"rustix 0.38.4",
|
||||
"windows-sys 0.48.0",
|
||||
]
|
||||
|
||||
@@ -1829,9 +1841,9 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "itoa"
|
||||
version = "1.0.7"
|
||||
version = "1.0.9"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "c0aa48fab2893d8a49caa94082ae8488f4e1050d73b367881dcd2198f4199fd8"
|
||||
checksum = "af150ab688ff2122fcef229be89cb50dd66af9e01a4ff320cc137eecc9bacc38"
|
||||
|
||||
[[package]]
|
||||
name = "jni"
|
||||
@@ -2003,9 +2015,9 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "mac-notification-sys"
|
||||
version = "0.5.6"
|
||||
version = "0.5.8"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "3e72d50edb17756489e79d52eb146927bec8eba9dd48faadf9ef08bca3791ad5"
|
||||
checksum = "abc434554ad0e640d772f7f262aa28e61d485212533d3673abe5f3d1729bd42a"
|
||||
dependencies = [
|
||||
"cc",
|
||||
"dirs-next",
|
||||
@@ -2206,9 +2218,9 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "num-traits"
|
||||
version = "0.2.15"
|
||||
version = "0.2.16"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "578ede34cf02f8924ab9447f50c28075b4d3e5b269972345e7e0372b38c6cdcd"
|
||||
checksum = "f30b0abd723be7e2ffca1272140fac1a2f084c77ec3e123c192b66af1ee9e6c2"
|
||||
dependencies = [
|
||||
"autocfg",
|
||||
]
|
||||
@@ -2262,7 +2274,7 @@ dependencies = [
|
||||
"proc-macro-crate",
|
||||
"proc-macro2",
|
||||
"quote",
|
||||
"syn 2.0.23",
|
||||
"syn 2.0.27",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
@@ -2426,9 +2438,9 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "paste"
|
||||
version = "1.0.12"
|
||||
version = "1.0.14"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "9f746c4065a8fa3fe23974dd82f15431cc8d40779821001404d10d2e79ca7d79"
|
||||
checksum = "de3145af08024dea9fa9914f381a17b8fc6034dfb00f3a84013f7ff43f29ed4c"
|
||||
|
||||
[[package]]
|
||||
name = "peeking_take_while"
|
||||
@@ -2547,9 +2559,9 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "proc-macro2"
|
||||
version = "1.0.63"
|
||||
version = "1.0.66"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "7b368fba921b0dce7e60f5e04ec15e565b3303972b42bcfde1d0713b881959eb"
|
||||
checksum = "18fb31db3f9bddb2ea821cde30a9f70117e3f119938b5ee630b7403aa6e2ead9"
|
||||
dependencies = [
|
||||
"unicode-ident",
|
||||
]
|
||||
@@ -2565,9 +2577,9 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "quote"
|
||||
version = "1.0.29"
|
||||
version = "1.0.32"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "573015e8ab27661678357f27dc26460738fd2b6c86e46f386fde94cb5d913105"
|
||||
checksum = "50f3b39ccfb720540debaa0164757101c08ecb8d326b15358ce76a62c7e85965"
|
||||
dependencies = [
|
||||
"proc-macro2",
|
||||
]
|
||||
@@ -2639,9 +2651,21 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "regex"
|
||||
version = "1.8.4"
|
||||
version = "1.9.1"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "d0ab3ca65655bb1e41f2a8c8cd662eb4fb035e67c3f78da1d61dffe89d07300f"
|
||||
checksum = "b2eae68fc220f7cf2532e4494aded17545fce192d59cd996e0fe7887f4ceb575"
|
||||
dependencies = [
|
||||
"aho-corasick",
|
||||
"memchr",
|
||||
"regex-automata",
|
||||
"regex-syntax",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "regex-automata"
|
||||
version = "0.3.3"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "39354c10dd07468c2e73926b23bb9c2caca74c5501e38a35da70406f1d923310"
|
||||
dependencies = [
|
||||
"aho-corasick",
|
||||
"memchr",
|
||||
@@ -2650,13 +2674,13 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "regex-syntax"
|
||||
version = "0.7.2"
|
||||
version = "0.7.4"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "436b050e76ed2903236f032a59761c1eb99e1b0aead2c257922771dab1fc8c78"
|
||||
checksum = "e5ea92a5b6195c6ef2a0295ea818b312502c6fc94dde986c5553242e18fd4ce2"
|
||||
|
||||
[[package]]
|
||||
name = "rog-control-center"
|
||||
version = "4.7.0-RC1"
|
||||
version = "4.7.0-RC3"
|
||||
dependencies = [
|
||||
"asusd",
|
||||
"cargo-husky",
|
||||
@@ -2689,7 +2713,7 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "rog_anime"
|
||||
version = "4.7.0-RC1"
|
||||
version = "4.7.0-RC3"
|
||||
dependencies = [
|
||||
"cargo-husky",
|
||||
"gif",
|
||||
@@ -2706,7 +2730,7 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "rog_aura"
|
||||
version = "4.7.0-RC1"
|
||||
version = "4.7.0-RC3"
|
||||
dependencies = [
|
||||
"cargo-husky",
|
||||
"log",
|
||||
@@ -2720,7 +2744,7 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "rog_dbus"
|
||||
version = "4.7.0-RC1"
|
||||
version = "4.7.0-RC3"
|
||||
dependencies = [
|
||||
"cargo-husky",
|
||||
"rog_anime",
|
||||
@@ -2732,13 +2756,14 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "rog_platform"
|
||||
version = "4.7.0-RC1"
|
||||
version = "4.7.0-RC3"
|
||||
dependencies = [
|
||||
"cargo-husky",
|
||||
"concat-idents",
|
||||
"inotify",
|
||||
"log",
|
||||
"rog_aura",
|
||||
"rog_profiles",
|
||||
"rusb",
|
||||
"serde",
|
||||
"serde_derive",
|
||||
@@ -2750,9 +2775,10 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "rog_profiles"
|
||||
version = "4.7.0-RC1"
|
||||
version = "4.7.0-RC3"
|
||||
dependencies = [
|
||||
"cargo-husky",
|
||||
"log",
|
||||
"serde",
|
||||
"serde_derive",
|
||||
"typeshare",
|
||||
@@ -2762,7 +2788,7 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "rog_simulators"
|
||||
version = "4.7.0-RC1"
|
||||
version = "4.7.0-RC3"
|
||||
dependencies = [
|
||||
"glam",
|
||||
"log",
|
||||
@@ -2815,9 +2841,9 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "rustix"
|
||||
version = "0.37.22"
|
||||
version = "0.37.23"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "8818fa822adcc98b18fedbb3632a6a33213c070556b5aa7c4c8cc21cff565c4c"
|
||||
checksum = "4d69718bf81c6127a49dc64e44a742e8bb9213c0ff8869a22c308f84c1d4ab06"
|
||||
dependencies = [
|
||||
"bitflags 1.3.2",
|
||||
"errno",
|
||||
@@ -2829,9 +2855,9 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "rustix"
|
||||
version = "0.38.2"
|
||||
version = "0.38.4"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "aabcb0461ebd01d6b79945797c27f8529082226cb630a9865a71870ff63532a4"
|
||||
checksum = "0a962918ea88d644592894bc6dc55acc6c0956488adcebbfb6e273506b7fd6e5"
|
||||
dependencies = [
|
||||
"bitflags 2.3.3",
|
||||
"errno",
|
||||
@@ -2842,9 +2868,9 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "ryu"
|
||||
version = "1.0.13"
|
||||
version = "1.0.15"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "f91339c0467de62360649f8d3e185ca8de4224ff281f66000de5eb2a77a79041"
|
||||
checksum = "1ad4cc8da4ef723ed60bced201181d83791ad433213d8c24efffda1eec85d741"
|
||||
|
||||
[[package]]
|
||||
name = "same-file"
|
||||
@@ -2863,9 +2889,9 @@ checksum = "e1cf6437eb19a8f4a6cc0f7dca544973b0b78843adbfeb3683d1a94a0024a294"
|
||||
|
||||
[[package]]
|
||||
name = "scopeguard"
|
||||
version = "1.1.0"
|
||||
version = "1.2.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "d29ab0c6d3fc0ee92fe66e2d99f700eab17a8d57d1c1d3b748380fb20baa78cd"
|
||||
checksum = "94143f37725109f92c262ed2cf5e59bce7498c01bcc1502d7b9afe439a4e9f49"
|
||||
|
||||
[[package]]
|
||||
name = "sctk-adwaita"
|
||||
@@ -2905,35 +2931,35 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "semver"
|
||||
version = "1.0.17"
|
||||
version = "1.0.18"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "bebd363326d05ec3e2f532ab7660680f3b02130d780c299bca73469d521bc0ed"
|
||||
checksum = "b0293b4b29daaf487284529cc2f5675b8e57c61f70167ba415a463651fd6a918"
|
||||
|
||||
[[package]]
|
||||
name = "serde"
|
||||
version = "1.0.164"
|
||||
version = "1.0.174"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "9e8c8cf938e98f769bc164923b06dce91cea1751522f46f8466461af04c9027d"
|
||||
checksum = "3b88756493a5bd5e5395d53baa70b194b05764ab85b59e43e4b8f4e1192fa9b1"
|
||||
dependencies = [
|
||||
"serde_derive",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "serde_derive"
|
||||
version = "1.0.164"
|
||||
version = "1.0.174"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "d9735b638ccc51c28bf6914d90a2e9725b377144fc612c49a611fddd1b631d68"
|
||||
checksum = "6e5c3a298c7f978e53536f95a63bdc4c4a64550582f31a0359a9afda6aede62e"
|
||||
dependencies = [
|
||||
"proc-macro2",
|
||||
"quote",
|
||||
"syn 2.0.23",
|
||||
"syn 2.0.27",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "serde_json"
|
||||
version = "1.0.99"
|
||||
version = "1.0.103"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "46266871c240a00b8f503b877622fe33430b3c7d963bdc0f2adc511e54a1eae3"
|
||||
checksum = "d03b412469450d4404fe8499a268edd7f8b79fecb074b0d812ad64ca21f4031b"
|
||||
dependencies = [
|
||||
"itoa",
|
||||
"ryu",
|
||||
@@ -2942,13 +2968,13 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "serde_repr"
|
||||
version = "0.1.12"
|
||||
version = "0.1.15"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "bcec881020c684085e55a25f7fd888954d56609ef363479dc5a1305eb0d40cab"
|
||||
checksum = "e168eaaf71e8f9bd6037feb05190485708e019f4fd87d161b3c0a0d37daf85e5"
|
||||
dependencies = [
|
||||
"proc-macro2",
|
||||
"quote",
|
||||
"syn 2.0.23",
|
||||
"syn 2.0.27",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
@@ -2979,9 +3005,9 @@ checksum = "43b2853a4d09f215c24cc5489c992ce46052d359b5109343cbafbf26bc62f8a3"
|
||||
|
||||
[[package]]
|
||||
name = "signal-hook"
|
||||
version = "0.3.15"
|
||||
version = "0.3.17"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "732768f1176d21d09e076c23a93123d40bba92d50c4058da34d45c8de8e682b9"
|
||||
checksum = "8621587d4798caf8eb44879d42e56b9a93ea5dcd315a6487c357130095b62801"
|
||||
dependencies = [
|
||||
"libc",
|
||||
"signal-hook-registry",
|
||||
@@ -3022,9 +3048,9 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "smallvec"
|
||||
version = "1.10.0"
|
||||
version = "1.11.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "a507befe795404456341dfab10cef66ead4c041f62b8b11bbb92bffe5d0953e0"
|
||||
checksum = "62bb4feee49fdd9f707ef802e22365a35de4b7b299de4763d44bfea899442ff9"
|
||||
|
||||
[[package]]
|
||||
name = "smithay-client-toolkit"
|
||||
@@ -3128,9 +3154,9 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "syn"
|
||||
version = "2.0.23"
|
||||
version = "2.0.27"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "59fb7d6d8281a51045d62b8eb3a7d1ce347b76f312af50cd3dc0af39c87c1737"
|
||||
checksum = "b60f673f44a8255b9c8c657daf66a596d435f2da81a555b06dc644d080ba45e0"
|
||||
dependencies = [
|
||||
"proc-macro2",
|
||||
"quote",
|
||||
@@ -3155,7 +3181,7 @@ dependencies = [
|
||||
"cfg-expr",
|
||||
"heck",
|
||||
"pkg-config",
|
||||
"toml 0.7.3",
|
||||
"toml 0.7.6",
|
||||
"version-compare",
|
||||
]
|
||||
|
||||
@@ -3171,9 +3197,9 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "target-lexicon"
|
||||
version = "0.12.8"
|
||||
version = "0.12.10"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "1b1c7f239eb94671427157bd93b3694320f3668d4e1eff08c7285366fd777fac"
|
||||
checksum = "1d2faeef5759ab89935255b1a4cd98e0baf99d1085e37d36599c625dac49ae8e"
|
||||
|
||||
[[package]]
|
||||
name = "tauri-winrt-notification"
|
||||
@@ -3187,15 +3213,14 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "tempfile"
|
||||
version = "3.6.0"
|
||||
version = "3.7.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "31c0432476357e58790aaa47a8efb0c5138f137343f3b5f23bd36a27e3b0a6d6"
|
||||
checksum = "5486094ee78b2e5038a6382ed7645bc084dc2ec433426ca4c3cb61e2007b8998"
|
||||
dependencies = [
|
||||
"autocfg",
|
||||
"cfg-if",
|
||||
"fastrand",
|
||||
"fastrand 2.0.0",
|
||||
"redox_syscall 0.3.5",
|
||||
"rustix 0.37.22",
|
||||
"rustix 0.38.4",
|
||||
"windows-sys 0.48.0",
|
||||
]
|
||||
|
||||
@@ -3210,29 +3235,29 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "thiserror"
|
||||
version = "1.0.40"
|
||||
version = "1.0.44"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "978c9a314bd8dc99be594bc3c175faaa9794be04a5a5e153caba6915336cebac"
|
||||
checksum = "611040a08a0439f8248d1990b111c95baa9c704c805fa1f62104b39655fd7f90"
|
||||
dependencies = [
|
||||
"thiserror-impl",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "thiserror-impl"
|
||||
version = "1.0.40"
|
||||
version = "1.0.44"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "f9456a42c5b0d803c8cd86e73dd7cc9edd429499f37a3550d286d5e86720569f"
|
||||
checksum = "090198534930841fab3a5d1bb637cde49e339654e606195f8d9c76eeb081dc96"
|
||||
dependencies = [
|
||||
"proc-macro2",
|
||||
"quote",
|
||||
"syn 2.0.23",
|
||||
"syn 2.0.27",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "time"
|
||||
version = "0.3.22"
|
||||
version = "0.3.23"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "ea9e1b3cf1243ae005d9e74085d4d542f3125458f3a81af210d901dcd7411efd"
|
||||
checksum = "59e399c068f43a5d116fedaf73b203fa4f9c519f17e2b34f63221d3792f81446"
|
||||
dependencies = [
|
||||
"serde",
|
||||
"time-core",
|
||||
@@ -3318,7 +3343,7 @@ checksum = "630bdcf245f78637c13ec01ffae6187cca34625e8c63150d424b59e55af2675e"
|
||||
dependencies = [
|
||||
"proc-macro2",
|
||||
"quote",
|
||||
"syn 2.0.23",
|
||||
"syn 2.0.27",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
@@ -3332,9 +3357,9 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "toml"
|
||||
version = "0.7.3"
|
||||
version = "0.7.6"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "b403acf6f2bb0859c93c7f0d967cb4a75a7ac552100f9322faf64dc047669b21"
|
||||
checksum = "c17e963a819c331dcacd7ab957d80bc2b9a9c1e71c804826d2f283dd65306542"
|
||||
dependencies = [
|
||||
"serde",
|
||||
"serde_spanned",
|
||||
@@ -3353,15 +3378,15 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "toml_edit"
|
||||
version = "0.19.8"
|
||||
version = "0.19.14"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "239410c8609e8125456927e6707163a3b1fdb40561e4b803bc041f466ccfdc13"
|
||||
checksum = "f8123f27e969974a3dfba720fdb560be359f57b44302d280ba72e76a74480e8a"
|
||||
dependencies = [
|
||||
"indexmap",
|
||||
"serde",
|
||||
"serde_spanned",
|
||||
"toml_datetime",
|
||||
"winnow",
|
||||
"winnow 0.5.0",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
@@ -3384,7 +3409,7 @@ checksum = "5f4f31f56159e98206da9efd823404b79b6ef3143b4a7ab76e67b1751b25a4ab"
|
||||
dependencies = [
|
||||
"proc-macro2",
|
||||
"quote",
|
||||
"syn 2.0.23",
|
||||
"syn 2.0.27",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
@@ -3490,9 +3515,9 @@ checksum = "92888ba5573ff080736b3648696b70cafad7d250551175acbaa4e0385b3e1460"
|
||||
|
||||
[[package]]
|
||||
name = "unicode-ident"
|
||||
version = "1.0.9"
|
||||
version = "1.0.11"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "b15811caf2415fb889178633e7724bad2509101cde276048e013b9def5e51fa0"
|
||||
checksum = "301abaae475aa91687eb82514b328ab47a211a533026cb25fc3e519b86adfc3c"
|
||||
|
||||
[[package]]
|
||||
name = "unicode-normalization"
|
||||
@@ -4055,6 +4080,15 @@ dependencies = [
|
||||
"memchr",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "winnow"
|
||||
version = "0.5.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "81fac9742fd1ad1bd9643b991319f72dd031016d44b77039a26977eb667141e7"
|
||||
dependencies = [
|
||||
"memchr",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "x11-dl"
|
||||
version = "2.21.0"
|
||||
@@ -4109,9 +4143,9 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "xml-rs"
|
||||
version = "0.8.15"
|
||||
version = "0.8.16"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "5a56c84a8ccd4258aed21c92f70c0f6dea75356b6892ae27c24139da456f9336"
|
||||
checksum = "47430998a7b5d499ccee752b41567bc3afc57e1327dc855b1a2aa44ce29b5fa1"
|
||||
|
||||
[[package]]
|
||||
name = "zbus"
|
||||
@@ -4164,7 +4198,7 @@ dependencies = [
|
||||
"quote",
|
||||
"regex",
|
||||
"syn 1.0.109",
|
||||
"winnow",
|
||||
"winnow 0.4.1",
|
||||
"zvariant_utils",
|
||||
]
|
||||
|
||||
|
||||
+1
-1
@@ -3,7 +3,7 @@ members = ["asusctl", "asusd", "asusd-user", "config-traits", "rog-platform", "r
|
||||
default-members = ["asusctl", "asusd", "asusd-user", "rog-control-center"]
|
||||
|
||||
[workspace.package]
|
||||
version = "4.7.0-RC1"
|
||||
version = "4.7.0-RC3"
|
||||
|
||||
[workspace.dependencies]
|
||||
async-trait = "^0.1"
|
||||
|
||||
+25
-45
@@ -4,7 +4,7 @@ use gumdrop::Options;
|
||||
use rog_aura::error::Error;
|
||||
use rog_aura::{AuraEffect, AuraModeNum, AuraZone, Colour, Direction, Speed};
|
||||
|
||||
#[derive(Options)]
|
||||
#[derive(Options, Debug)]
|
||||
pub struct LedPowerCommand1 {
|
||||
#[options(help = "print help message")]
|
||||
pub help: bool,
|
||||
@@ -20,63 +20,43 @@ pub struct LedPowerCommand1 {
|
||||
pub sleep: Option<bool>,
|
||||
}
|
||||
|
||||
#[derive(Options)]
|
||||
#[derive(Options, Debug)]
|
||||
pub struct LedPowerCommand2 {
|
||||
#[options(help = "print help message")]
|
||||
pub help: bool,
|
||||
#[options(command)]
|
||||
pub command: Option<SetAuraEnabled>,
|
||||
pub command: Option<SetAuraZoneEnabled>,
|
||||
}
|
||||
|
||||
#[derive(Options)]
|
||||
pub enum SetAuraEnabled {
|
||||
#[derive(Options, Debug)]
|
||||
pub enum SetAuraZoneEnabled {
|
||||
/// Applies to both old and new models
|
||||
#[options(help = "set <keyboard, logo, lightbar, rearglow> to enabled while device is awake")]
|
||||
Awake(AuraEnabled),
|
||||
#[options(
|
||||
help = "set <keyboard, logo, lightbar, rearglow> to enabled while the device is booting"
|
||||
)]
|
||||
Boot(AuraEnabled),
|
||||
#[options(
|
||||
help = "set <keyboard, logo, lightbar, rearglow> to animate while the device is suspended"
|
||||
)]
|
||||
Sleep(AuraEnabled),
|
||||
#[options(
|
||||
help = "set <keyboard, logo, lightbar, rearglow> to animate while the device is shutdown"
|
||||
)]
|
||||
Shutdown(AuraEnabled),
|
||||
#[options(help = "")]
|
||||
Keyboard(AuraPowerStates),
|
||||
#[options(help = "")]
|
||||
Logo(AuraPowerStates),
|
||||
#[options(help = "")]
|
||||
Lightbar(AuraPowerStates),
|
||||
#[options(help = "")]
|
||||
Lid(AuraPowerStates),
|
||||
#[options(help = "")]
|
||||
RearGlow(AuraPowerStates),
|
||||
}
|
||||
|
||||
#[derive(Debug, Clone, Default, Options)]
|
||||
pub struct AuraEnabled {
|
||||
#[derive(Debug, Clone, Options)]
|
||||
pub struct AuraPowerStates {
|
||||
#[options(help = "print help message")]
|
||||
pub help: bool,
|
||||
#[options(meta = "", help = "<true/false>")]
|
||||
pub keyboard: Option<bool>,
|
||||
#[options(meta = "", help = "<true/false>")]
|
||||
pub logo: Option<bool>,
|
||||
#[options(meta = "", help = "<true/false>")]
|
||||
pub frontglow: Option<bool>,
|
||||
#[options(meta = "", help = "<true/false>")]
|
||||
pub rearglow: Option<bool>,
|
||||
#[options(meta = "", help = "<true/false>")]
|
||||
pub lid: Option<bool>,
|
||||
#[options(help = "defaults to false if option unused")]
|
||||
pub boot: bool,
|
||||
#[options(help = "defaults to false if option unused")]
|
||||
pub awake: bool,
|
||||
#[options(help = "defaults to false if option unused")]
|
||||
pub sleep: bool,
|
||||
#[options(help = "defaults to false if option unused")]
|
||||
pub shutdown: bool,
|
||||
}
|
||||
|
||||
// impl FromStr for AuraEnabled {
|
||||
// type Err = Error;
|
||||
|
||||
// fn from_str(s: &str) -> Result<Self, Self::Err> {
|
||||
// let s = s.to_lowercase();
|
||||
// Ok(Self {
|
||||
// help: false,
|
||||
// keyboard: None,
|
||||
// logo: None,
|
||||
// lightbar: None,
|
||||
// })
|
||||
// }
|
||||
// }
|
||||
|
||||
#[derive(Options)]
|
||||
pub struct LedBrightness {
|
||||
level: Option<u32>,
|
||||
|
||||
+28
-71
@@ -10,14 +10,15 @@ use gumdrop::{Opt, Options};
|
||||
use profiles_cli::{FanCurveCommand, ProfileCommand};
|
||||
use rog_anime::usb::get_anime_type;
|
||||
use rog_anime::{AnimTime, AnimeDataBuffer, AnimeDiagonal, AnimeGif, AnimeImage, AnimeType, Vec2};
|
||||
use rog_aura::usb::{AuraDevRog1, AuraDevRog2, AuraDevTuf, AuraDevice, AuraPowerDev};
|
||||
use rog_aura::power::KbAuraPowerState;
|
||||
use rog_aura::usb::{AuraDevRog1, AuraDevTuf, AuraDevice, AuraPowerDev};
|
||||
use rog_aura::{self, AuraEffect};
|
||||
use rog_dbus::RogDbusClientBlocking;
|
||||
use rog_platform::platform::GpuMode;
|
||||
use rog_platform::supported::*;
|
||||
use rog_profiles::error::ProfileError;
|
||||
|
||||
use crate::aura_cli::LedBrightness;
|
||||
use crate::aura_cli::{AuraPowerStates, LedBrightness};
|
||||
use crate::cli_opts::*;
|
||||
|
||||
mod anime_cli;
|
||||
@@ -503,16 +504,14 @@ fn handle_led_power_1_do_1866(
|
||||
check(power.lightbar, AuraDevRog1::Lightbar);
|
||||
|
||||
let data = AuraPowerDev {
|
||||
x1866: enabled,
|
||||
x19b6: vec![],
|
||||
tuf: vec![],
|
||||
old_rog: enabled,
|
||||
..Default::default()
|
||||
};
|
||||
dbus.proxies().led().set_led_power(data, true)?;
|
||||
|
||||
let data = AuraPowerDev {
|
||||
x1866: disabled,
|
||||
x19b6: vec![],
|
||||
tuf: vec![],
|
||||
old_rog: disabled,
|
||||
..Default::default()
|
||||
};
|
||||
dbus.proxies().led().set_led_power(data, false)?;
|
||||
|
||||
@@ -542,16 +541,14 @@ fn handle_led_power_1_do_tuf(
|
||||
check(power.keyboard, AuraDevTuf::Keyboard);
|
||||
|
||||
let data = AuraPowerDev {
|
||||
x1866: vec![],
|
||||
x19b6: vec![],
|
||||
tuf: enabled,
|
||||
..Default::default()
|
||||
};
|
||||
dbus.proxies().led().set_led_power(data, true)?;
|
||||
|
||||
let data = AuraPowerDev {
|
||||
x1866: vec![],
|
||||
x19b6: vec![],
|
||||
tuf: disabled,
|
||||
..Default::default()
|
||||
};
|
||||
dbus.proxies().led().set_led_power(data, false)?;
|
||||
|
||||
@@ -591,66 +588,25 @@ fn handle_led_power2(
|
||||
println!("This option applies only to keyboards with product ID 0x19b6");
|
||||
}
|
||||
|
||||
let mut enabled: Vec<AuraDevRog2> = Vec::new();
|
||||
let mut disabled: Vec<AuraDevRog2> = Vec::new();
|
||||
let mut check = |e: Option<bool>, a: AuraDevRog2| {
|
||||
if let Some(arg) = e {
|
||||
if arg {
|
||||
enabled.push(a);
|
||||
} else {
|
||||
disabled.push(a);
|
||||
}
|
||||
}
|
||||
let set = |power: &mut KbAuraPowerState, set_to: &AuraPowerStates| {
|
||||
power.boot = set_to.boot;
|
||||
power.awake = set_to.awake;
|
||||
power.sleep = set_to.sleep;
|
||||
power.shutdown = set_to.shutdown;
|
||||
};
|
||||
|
||||
match pow {
|
||||
aura_cli::SetAuraEnabled::Boot(arg) => {
|
||||
check(arg.keyboard, AuraDevRog2::BootKeyb);
|
||||
check(arg.logo, AuraDevRog2::BootLogo);
|
||||
check(arg.frontglow, AuraDevRog2::BootBar);
|
||||
check(arg.rearglow, AuraDevRog2::BootRearGlow);
|
||||
check(arg.lid, AuraDevRog2::AwakeLid);
|
||||
}
|
||||
aura_cli::SetAuraEnabled::Sleep(arg) => {
|
||||
check(arg.keyboard, AuraDevRog2::SleepKeyb);
|
||||
check(arg.logo, AuraDevRog2::SleepLogo);
|
||||
check(arg.frontglow, AuraDevRog2::SleepBar);
|
||||
check(arg.rearglow, AuraDevRog2::SleepRearGlow);
|
||||
check(arg.lid, AuraDevRog2::SleepLid);
|
||||
}
|
||||
aura_cli::SetAuraEnabled::Awake(arg) => {
|
||||
check(arg.keyboard, AuraDevRog2::AwakeKeyb);
|
||||
check(arg.logo, AuraDevRog2::AwakeLogo);
|
||||
check(arg.frontglow, AuraDevRog2::AwakeBar);
|
||||
check(arg.rearglow, AuraDevRog2::AwakeRearGlow);
|
||||
check(arg.lid, AuraDevRog2::AwakeLid);
|
||||
}
|
||||
aura_cli::SetAuraEnabled::Shutdown(arg) => {
|
||||
check(arg.keyboard, AuraDevRog2::ShutdownKeyb);
|
||||
check(arg.logo, AuraDevRog2::ShutdownLogo);
|
||||
check(arg.frontglow, AuraDevRog2::ShutdownBar);
|
||||
check(arg.rearglow, AuraDevRog2::ShutdownRearGlow);
|
||||
check(arg.lid, AuraDevRog2::ShutdownLid);
|
||||
let mut enabled = dbus.proxies().led().led_power()?;
|
||||
if let Some(cmd) = &power.command {
|
||||
match cmd {
|
||||
aura_cli::SetAuraZoneEnabled::Keyboard(k) => set(&mut enabled.rog.keyboard, k),
|
||||
aura_cli::SetAuraZoneEnabled::Logo(l) => set(&mut enabled.rog.logo, l),
|
||||
aura_cli::SetAuraZoneEnabled::Lightbar(l) => set(&mut enabled.rog.lightbar, l),
|
||||
aura_cli::SetAuraZoneEnabled::Lid(l) => set(&mut enabled.rog.lid, l),
|
||||
aura_cli::SetAuraZoneEnabled::RearGlow(r) => set(&mut enabled.rog.rear_glow, r),
|
||||
}
|
||||
}
|
||||
|
||||
if !enabled.is_empty() {
|
||||
let data = AuraPowerDev {
|
||||
tuf: vec![],
|
||||
x1866: vec![],
|
||||
x19b6: enabled,
|
||||
};
|
||||
dbus.proxies().led().set_led_power(data, true)?;
|
||||
}
|
||||
|
||||
if !disabled.is_empty() {
|
||||
let data = AuraPowerDev {
|
||||
tuf: vec![],
|
||||
x1866: vec![],
|
||||
x19b6: disabled,
|
||||
};
|
||||
dbus.proxies().led().set_led_power(data, false)?;
|
||||
}
|
||||
dbus.proxies().led().set_led_power(enabled, true)?;
|
||||
}
|
||||
|
||||
Ok(())
|
||||
@@ -704,7 +660,7 @@ fn handle_fan_curve(
|
||||
supported: &PlatformProfileFunctions,
|
||||
cmd: &FanCurveCommand,
|
||||
) -> Result<(), Box<dyn std::error::Error>> {
|
||||
if !supported.fan_curves {
|
||||
if supported.fans.is_empty() {
|
||||
println!("Fan-curves not supported by either this kernel or by the laptop.");
|
||||
println!("This requires kernel 5.17 or the fan curve patch listed in the readme.");
|
||||
return Err(ProfileError::NotSupported.into());
|
||||
@@ -730,8 +686,9 @@ fn handle_fan_curve(
|
||||
}
|
||||
|
||||
if cmd.get_enabled {
|
||||
let res = dbus.proxies().profile().enabled_fan_profiles()?;
|
||||
println!("{:?}", res);
|
||||
// TODO:
|
||||
// let res = dbus.proxies().profile().enabled_fan_profiles()?;
|
||||
// println!("{:?}", res);
|
||||
}
|
||||
|
||||
if cmd.default {
|
||||
@@ -748,7 +705,7 @@ fn handle_fan_curve(
|
||||
if let Some(enabled) = cmd.enabled {
|
||||
dbus.proxies()
|
||||
.profile()
|
||||
.set_fan_curve_enabled(profile, enabled)?;
|
||||
.set_fan_curves_enabled(profile, enabled)?;
|
||||
}
|
||||
|
||||
if let Some(mut curve) = cmd.data.clone() {
|
||||
|
||||
@@ -34,12 +34,12 @@ pub struct FanCurveCommand {
|
||||
pub mod_profile: Option<Profile>,
|
||||
#[options(
|
||||
meta = "",
|
||||
help = "enable or disable <true/false> fan curve. `mod-profile` required"
|
||||
help = "enable or disable <true/false> fan curve. `mod_profile` required"
|
||||
)]
|
||||
pub enabled: Option<bool>,
|
||||
#[options(
|
||||
meta = "",
|
||||
help = "select fan <cpu/gpu> to modify. `mod-profile` required"
|
||||
help = "select fan <cpu/gpu/mid> to modify. `mod_profile` required"
|
||||
)]
|
||||
pub fan: Option<FanCurvePU>,
|
||||
|
||||
|
||||
@@ -1,9 +1,12 @@
|
||||
use std::collections::{BTreeMap, HashSet};
|
||||
|
||||
use config_traits::{StdConfig, StdConfigLoad};
|
||||
use rog_aura::aura_detection::LaptopLedData;
|
||||
use rog_aura::usb::{AuraDevRog1, AuraDevRog2, AuraDevTuf, AuraDevice, AuraPowerDev};
|
||||
use log::warn;
|
||||
use rog_aura::aura_detection::{LaptopLedData, ASUS_KEYBOARD_DEVICES};
|
||||
use rog_aura::power::AuraPower;
|
||||
use rog_aura::usb::{AuraDevRog1, AuraDevTuf, AuraDevice, AuraPowerDev};
|
||||
use rog_aura::{AuraEffect, AuraModeNum, AuraZone, Direction, LedBrightness, Speed, GRADIENT};
|
||||
use rog_platform::hid_raw::HidRaw;
|
||||
use serde_derive::{Deserialize, Serialize};
|
||||
|
||||
const CONFIG_FILE: &str = "aura.ron";
|
||||
@@ -15,7 +18,7 @@ const CONFIG_FILE: &str = "aura.ron";
|
||||
pub enum AuraPowerConfig {
|
||||
AuraDevTuf(HashSet<AuraDevTuf>),
|
||||
AuraDevRog1(HashSet<AuraDevRog1>),
|
||||
AuraDevRog2(HashSet<AuraDevRog2>),
|
||||
AuraDevRog2(AuraPower),
|
||||
}
|
||||
|
||||
impl AuraPowerConfig {
|
||||
@@ -27,10 +30,7 @@ impl AuraPowerConfig {
|
||||
let c: Vec<AuraDevRog1> = c.iter().copied().collect();
|
||||
AuraDevRog1::to_bytes(&c)
|
||||
}
|
||||
AuraPowerConfig::AuraDevRog2(c) => {
|
||||
let c: Vec<AuraDevRog2> = c.iter().copied().collect();
|
||||
AuraDevRog2::to_bytes(&c)
|
||||
}
|
||||
AuraPowerConfig::AuraDevRog2(c) => c.to_bytes(),
|
||||
}
|
||||
}
|
||||
|
||||
@@ -78,13 +78,9 @@ impl AuraPowerConfig {
|
||||
}
|
||||
}
|
||||
|
||||
pub fn set_0x19b6(&mut self, power: AuraDevRog2, on: bool) {
|
||||
pub fn set_0x19b6(&mut self, power: AuraPower) {
|
||||
if let Self::AuraDevRog2(p) = self {
|
||||
if on {
|
||||
p.insert(power);
|
||||
} else {
|
||||
p.remove(&power);
|
||||
}
|
||||
*p = power;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -94,18 +90,15 @@ impl From<&AuraPowerConfig> for AuraPowerDev {
|
||||
match config {
|
||||
AuraPowerConfig::AuraDevTuf(d) => AuraPowerDev {
|
||||
tuf: d.iter().copied().collect(),
|
||||
x1866: vec![],
|
||||
x19b6: vec![],
|
||||
..Default::default()
|
||||
},
|
||||
AuraPowerConfig::AuraDevRog1(d) => AuraPowerDev {
|
||||
tuf: vec![],
|
||||
x1866: d.iter().copied().collect(),
|
||||
x19b6: vec![],
|
||||
old_rog: d.iter().copied().collect(),
|
||||
..Default::default()
|
||||
},
|
||||
AuraPowerConfig::AuraDevRog2(d) => AuraPowerDev {
|
||||
tuf: vec![],
|
||||
x1866: vec![],
|
||||
x19b6: d.iter().copied().collect(),
|
||||
rog: d.clone(),
|
||||
..Default::default()
|
||||
},
|
||||
}
|
||||
}
|
||||
@@ -124,8 +117,15 @@ pub struct AuraConfig {
|
||||
|
||||
impl StdConfig for AuraConfig {
|
||||
fn new() -> Self {
|
||||
// Self::create_default(AuraDevice::X19b6, &LaptopLedData::get_data())
|
||||
panic!("AuraConfig::new() should not be used, use AuraConfig::create_default() instead");
|
||||
warn!("AuraConfig: creating new config");
|
||||
let mut prod_id = AuraDevice::Unknown;
|
||||
for prod in ASUS_KEYBOARD_DEVICES {
|
||||
if HidRaw::new(prod.into()).is_ok() {
|
||||
prod_id = prod;
|
||||
break;
|
||||
}
|
||||
}
|
||||
Self::create_default(prod_id, &LaptopLedData::get_data())
|
||||
}
|
||||
|
||||
fn config_dir() -> std::path::PathBuf {
|
||||
@@ -143,24 +143,7 @@ impl AuraConfig {
|
||||
pub fn create_default(prod_id: AuraDevice, support_data: &LaptopLedData) -> Self {
|
||||
// create a default config here
|
||||
let enabled = if prod_id == AuraDevice::X19b6 {
|
||||
AuraPowerConfig::AuraDevRog2(HashSet::from([
|
||||
AuraDevRog2::BootLogo,
|
||||
AuraDevRog2::BootKeyb,
|
||||
AuraDevRog2::SleepLogo,
|
||||
AuraDevRog2::SleepKeyb,
|
||||
AuraDevRog2::AwakeLogo,
|
||||
AuraDevRog2::AwakeKeyb,
|
||||
AuraDevRog2::ShutdownLogo,
|
||||
AuraDevRog2::ShutdownKeyb,
|
||||
AuraDevRog2::BootBar,
|
||||
AuraDevRog2::AwakeBar,
|
||||
AuraDevRog2::SleepBar,
|
||||
AuraDevRog2::ShutdownBar,
|
||||
AuraDevRog2::BootRearGlow,
|
||||
AuraDevRog2::AwakeRearGlow,
|
||||
AuraDevRog2::SleepRearGlow,
|
||||
AuraDevRog2::ShutdownRearGlow,
|
||||
]))
|
||||
AuraPowerConfig::AuraDevRog2(AuraPower::new_all_on())
|
||||
} else if prod_id == AuraDevice::Tuf {
|
||||
AuraPowerConfig::AuraDevTuf(HashSet::from([
|
||||
AuraDevTuf::Awake,
|
||||
|
||||
@@ -53,48 +53,7 @@ impl CtrlKbdLedZbus {
|
||||
/// Set a variety of states, input is array of enum.
|
||||
/// `enabled` sets if the sent array should be disabled or enabled
|
||||
///
|
||||
/// ```text
|
||||
/// pub struct AuraPowerDev {
|
||||
/// tuf: Vec<AuraDevTuf>,
|
||||
/// x1866: Vec<AuraDevRog1>,
|
||||
/// x19b6: Vec<AuraDevRog2>,
|
||||
/// }
|
||||
/// pub enum AuraDevTuf {
|
||||
/// Boot,
|
||||
/// Awake,
|
||||
/// Sleep,
|
||||
/// Keyboard,
|
||||
/// }
|
||||
/// pub enum AuraDevRog1 {
|
||||
/// Awake = 0x000002,
|
||||
/// Keyboard = 0x080000,
|
||||
/// Lightbar = 0x040500,
|
||||
/// Boot = 0xc31209,
|
||||
/// Sleep = 0x300804,
|
||||
/// }
|
||||
/// pub enum AuraDevRog2 {
|
||||
/// BootLogo = 1,
|
||||
/// BootKeyb = 1 << 1,
|
||||
/// AwakeLogo = 1 << 2,
|
||||
/// AwakeKeyb = 1 << 3,
|
||||
/// SleepLogo = 1 << 4,
|
||||
/// SleepKeyb = 1 << 5,
|
||||
/// ShutdownLogo = 1 << 6,
|
||||
/// ShutdownKeyb = 1 << 7,
|
||||
/// BootBar = 1 << (7 + 2),
|
||||
/// AwakeBar = 1 << (7 + 3),
|
||||
/// SleepBar = 1 << (7 + 4),
|
||||
/// ShutdownBar = 1 << (7 + 5),
|
||||
/// BootLid = 1 << (15 + 1),
|
||||
/// AwakeLid = 1 << (15 + 2),
|
||||
/// SleepLid = 1 << (15 + 3),
|
||||
/// ShutdownLid = 1 << (15 + 4),
|
||||
/// BootRearGlow = 1 << (23 + 1),
|
||||
/// AwakeRearGlow = 1 << (23 + 2),
|
||||
/// SleepRearGlow = 1 << (23 + 3),
|
||||
/// ShutdownRearGlow = 1 << (23 + 4),
|
||||
/// }
|
||||
/// ```
|
||||
/// For Modern ROG devices the "enabled" flag is ignored.
|
||||
async fn set_led_power(
|
||||
&mut self,
|
||||
#[zbus(signal_context)] ctxt: SignalContext<'_>,
|
||||
@@ -105,12 +64,10 @@ impl CtrlKbdLedZbus {
|
||||
for p in options.tuf {
|
||||
ctrl.config.enabled.set_tuf(p, enabled);
|
||||
}
|
||||
for p in options.x1866 {
|
||||
for p in options.old_rog {
|
||||
ctrl.config.enabled.set_0x1866(p, enabled);
|
||||
}
|
||||
for p in options.x19b6 {
|
||||
ctrl.config.enabled.set_0x19b6(p, enabled);
|
||||
}
|
||||
ctrl.config.enabled.set_0x19b6(options.rog);
|
||||
|
||||
ctrl.config.write();
|
||||
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
use std::path::PathBuf;
|
||||
|
||||
use config_traits::{StdConfig, StdConfigLoad};
|
||||
use rog_profiles::fan_curve_set::FanCurveSet;
|
||||
use rog_profiles::fan_curve_set::CurveData;
|
||||
use rog_profiles::Profile;
|
||||
use serde_derive::{Deserialize, Serialize};
|
||||
|
||||
@@ -36,9 +36,9 @@ impl StdConfigLoad for ProfileConfig {}
|
||||
|
||||
#[derive(Deserialize, Serialize, Debug, Default)]
|
||||
pub struct FanCurveConfig {
|
||||
pub balanced: FanCurveSet,
|
||||
pub performance: FanCurveSet,
|
||||
pub quiet: FanCurveSet,
|
||||
pub balanced: Vec<CurveData>,
|
||||
pub performance: Vec<CurveData>,
|
||||
pub quiet: Vec<CurveData>,
|
||||
}
|
||||
|
||||
impl StdConfig for FanCurveConfig {
|
||||
|
||||
@@ -56,13 +56,9 @@ impl GetSupported for CtrlPlatformProfile {
|
||||
);
|
||||
}
|
||||
|
||||
let res = FanCurveProfiles::is_supported();
|
||||
let mut fan_curve_supported = res.is_err();
|
||||
if let Ok(r) = res {
|
||||
fan_curve_supported = r;
|
||||
};
|
||||
let res = FanCurveProfiles::supported_fans();
|
||||
|
||||
if !fan_curve_supported {
|
||||
if res.is_err() {
|
||||
info!(
|
||||
"fan curves kernel interface not found, your laptop does not support this, or the \
|
||||
interface is missing."
|
||||
@@ -71,7 +67,7 @@ impl GetSupported for CtrlPlatformProfile {
|
||||
|
||||
PlatformProfileFunctions {
|
||||
platform_profile: Profile::is_platform_profile_supported(),
|
||||
fan_curves: fan_curve_supported,
|
||||
fans: res.unwrap_or_default(),
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -113,10 +109,10 @@ impl CtrlPlatformProfile {
|
||||
let active = Profile::get_active_profile().unwrap_or(Profile::Balanced);
|
||||
|
||||
if let Some(curves) = controller.fan_curves.as_ref() {
|
||||
info!(
|
||||
"{MOD_NAME}: {active:?}: {}",
|
||||
String::from(curves.profiles().get_fan_curves_for(active))
|
||||
);
|
||||
info!("{MOD_NAME}: {active:?}:");
|
||||
for curve in curves.profiles().get_fan_curves_for(active) {
|
||||
info!("{}", String::from(curve));
|
||||
}
|
||||
}
|
||||
}
|
||||
if let Some(curves) = controller.fan_curves.as_ref() {
|
||||
|
||||
@@ -4,8 +4,8 @@ use std::sync::Arc;
|
||||
use async_trait::async_trait;
|
||||
use config_traits::StdConfig;
|
||||
use log::{error, info, warn};
|
||||
use rog_profiles::fan_curve_set::{CurveData, FanCurveSet};
|
||||
use rog_profiles::{FanCurveProfiles, Profile};
|
||||
use rog_profiles::fan_curve_set::CurveData;
|
||||
use rog_profiles::{FanCurvePU, FanCurveProfiles, Profile};
|
||||
use zbus::export::futures_util::lock::Mutex;
|
||||
use zbus::export::futures_util::StreamExt;
|
||||
use zbus::fdo::Error;
|
||||
@@ -83,19 +83,9 @@ impl ProfileZbus {
|
||||
.ok();
|
||||
}
|
||||
|
||||
/// Get a list of profiles that have fan-curves enabled.
|
||||
async fn enabled_fan_profiles(&mut self) -> zbus::fdo::Result<Vec<Profile>> {
|
||||
let mut ctrl = self.0.lock().await;
|
||||
ctrl.profile_config.read();
|
||||
if let Some(curves) = &mut ctrl.fan_curves {
|
||||
return Ok(curves.profiles().get_enabled_curve_profiles());
|
||||
}
|
||||
Err(Error::Failed(UNSUPPORTED_MSG.to_owned()))
|
||||
}
|
||||
|
||||
/// Set a profile fan curve enabled status. Will also activate a fan curve
|
||||
/// if in the same profile mode
|
||||
async fn set_fan_curve_enabled(
|
||||
/// Set all fan curves for a profile to enabled status. Will also activate a
|
||||
/// fan curve if in the same profile mode
|
||||
async fn set_fan_curves_enabled(
|
||||
&mut self,
|
||||
profile: Profile,
|
||||
enabled: bool,
|
||||
@@ -105,7 +95,33 @@ impl ProfileZbus {
|
||||
if let Some(curves) = &mut ctrl.fan_curves {
|
||||
curves
|
||||
.profiles_mut()
|
||||
.set_profile_curve_enabled(profile, enabled);
|
||||
.set_profile_curves_enabled(profile, enabled);
|
||||
|
||||
ctrl.write_profile_curve_to_platform()
|
||||
.map_err(|e| warn!("{MOD_NAME}: write_profile_curve_to_platform, {}", e))
|
||||
.ok();
|
||||
|
||||
ctrl.save_config();
|
||||
Ok(())
|
||||
} else {
|
||||
Err(Error::Failed(UNSUPPORTED_MSG.to_owned()))
|
||||
}
|
||||
}
|
||||
|
||||
/// Set a single fan curve for a profile to enabled status. Will also
|
||||
/// activate a fan curve if in the same profile mode
|
||||
async fn set_profile_fan_curve_enabled(
|
||||
&mut self,
|
||||
profile: Profile,
|
||||
fan: FanCurvePU,
|
||||
enabled: bool,
|
||||
) -> zbus::fdo::Result<()> {
|
||||
let mut ctrl = self.0.lock().await;
|
||||
ctrl.profile_config.read();
|
||||
if let Some(curves) = &mut ctrl.fan_curves {
|
||||
curves
|
||||
.profiles_mut()
|
||||
.set_profile_fan_curve_enabled(profile, fan, enabled);
|
||||
|
||||
ctrl.write_profile_curve_to_platform()
|
||||
.map_err(|e| warn!("{MOD_NAME}: write_profile_curve_to_platform, {}", e))
|
||||
@@ -119,12 +135,12 @@ impl ProfileZbus {
|
||||
}
|
||||
|
||||
/// Get the fan-curve data for the currently active Profile
|
||||
async fn fan_curve_data(&mut self, profile: Profile) -> zbus::fdo::Result<FanCurveSet> {
|
||||
async fn fan_curve_data(&mut self, profile: Profile) -> zbus::fdo::Result<Vec<CurveData>> {
|
||||
let mut ctrl = self.0.lock().await;
|
||||
ctrl.profile_config.read();
|
||||
if let Some(curves) = &mut ctrl.fan_curves {
|
||||
let curve = curves.profiles().get_fan_curves_for(profile);
|
||||
return Ok(curve.clone());
|
||||
return Ok(curve.to_vec());
|
||||
}
|
||||
Err(Error::Failed(UNSUPPORTED_MSG.to_owned()))
|
||||
}
|
||||
|
||||
@@ -11,51 +11,10 @@
|
||||
Set a variety of states, input is array of enum.
|
||||
`enabled` sets if the sent array should be disabled or enabled
|
||||
|
||||
```text
|
||||
pub struct AuraPowerDev {
|
||||
tuf: Vec<AuraDevTuf>,
|
||||
x1866: Vec<AuraDevRog1>,
|
||||
x19b6: Vec<AuraDevRog2>,
|
||||
}
|
||||
pub enum AuraDevTuf {
|
||||
Boot,
|
||||
Awake,
|
||||
Sleep,
|
||||
Keyboard,
|
||||
}
|
||||
pub enum AuraDevRog1 {
|
||||
Awake = 0x000002,
|
||||
Keyboard = 0x080000,
|
||||
Lightbar = 0x040500,
|
||||
Boot = 0xc31209,
|
||||
Sleep = 0x300804,
|
||||
}
|
||||
pub enum AuraDevRog2 {
|
||||
BootLogo = 1,
|
||||
BootKeyb = 1 << 1,
|
||||
AwakeLogo = 1 << 2,
|
||||
AwakeKeyb = 1 << 3,
|
||||
SleepLogo = 1 << 4,
|
||||
SleepKeyb = 1 << 5,
|
||||
ShutdownLogo = 1 << 6,
|
||||
ShutdownKeyb = 1 << 7,
|
||||
BootBar = 1 << (7 + 2),
|
||||
AwakeBar = 1 << (7 + 3),
|
||||
SleepBar = 1 << (7 + 4),
|
||||
ShutdownBar = 1 << (7 + 5),
|
||||
BootLid = 1 << (15 + 1),
|
||||
AwakeLid = 1 << (15 + 2),
|
||||
SleepLid = 1 << (15 + 3),
|
||||
ShutdownLid = 1 << (15 + 4),
|
||||
BootRearGlow = 1 << (23 + 1),
|
||||
AwakeRearGlow = 1 << (23 + 2),
|
||||
SleepRearGlow = 1 << (23 + 3),
|
||||
ShutdownRearGlow = 1 << (23 + 4),
|
||||
}
|
||||
```
|
||||
For Modern ROG devices the "enabled" flag is ignored.
|
||||
-->
|
||||
<method name="SetLedPower">
|
||||
<arg name="options" type="(asasas)" direction="in"/>
|
||||
<arg name="options" type="(asas((sbbbb)(sbbbb)(sbbbb)(sbbbb)(sbbbb)))" direction="in"/>
|
||||
<arg name="enabled" type="b" direction="in"/>
|
||||
</method>
|
||||
<method name="SetLedMode">
|
||||
@@ -76,7 +35,7 @@
|
||||
<arg type="s" direction="out"/>
|
||||
</method>
|
||||
<method name="LedPower">
|
||||
<arg type="asasas" direction="out"/>
|
||||
<arg type="asas((sbbbb)(sbbbb)(sbbbb)(sbbbb)(sbbbb))" direction="out"/>
|
||||
</method>
|
||||
<!--
|
||||
Return the current mode data
|
||||
@@ -102,7 +61,7 @@
|
||||
<arg name="data" type="(ss(yyy)(yyy)ss)"/>
|
||||
</signal>
|
||||
<signal name="NotifyPowerStates">
|
||||
<arg name="data" type="(asasas)"/>
|
||||
<arg name="data" type="(asas((sbbbb)(sbbbb)(sbbbb)(sbbbb)(sbbbb)))"/>
|
||||
</signal>
|
||||
<!--
|
||||
Return the current LED brightness
|
||||
|
||||
+69
-65
@@ -107,6 +107,64 @@ export interface AuraEffect {
|
||||
direction: Direction;
|
||||
}
|
||||
|
||||
/** The powerr zones this laptop supports */
|
||||
export enum PowerZones {
|
||||
/** The logo on some laptop lids */
|
||||
Logo = "Logo",
|
||||
/** The full keyboard (not zones) */
|
||||
Keyboard = "Keyboard",
|
||||
/** The lightbar, typically on the front of the laptop */
|
||||
Lightbar = "Lightbar",
|
||||
/** The leds that may be placed around the edge of the laptop lid */
|
||||
Lid = "Lid",
|
||||
/** The led strip on the rear of some laptops */
|
||||
RearGlow = "RearGlow",
|
||||
}
|
||||
|
||||
export interface KbAuraPowerState {
|
||||
zone: PowerZones;
|
||||
boot: boolean;
|
||||
awake: boolean;
|
||||
sleep: boolean;
|
||||
shutdown: boolean;
|
||||
}
|
||||
|
||||
/**
|
||||
* Track and control the Aura keyboard power state
|
||||
*
|
||||
* # Bits for newer 0x18c6, 0x19B6, 0x1a30, keyboard models
|
||||
*
|
||||
* | Byte 1 | Byte 2 | Byte 3 | Byte 4 | Label |
|
||||
* |--------|---------|---------|---------|----------|
|
||||
* |00000001| 00000000| 00000000| 00000000|boot_logo_|
|
||||
* |00000010| 00000000| 00000000| 00000000|boot_keyb_|
|
||||
* |00000100| 00000000| 00000000| 00000000|awake_logo|
|
||||
* |00001000| 00000000| 00000000| 00000000|awake_keyb|
|
||||
* |00010000| 00000000| 00000000| 00000000|sleep_logo|
|
||||
* |00100000| 00000000| 00000000| 00000000|sleep_keyb|
|
||||
* |01000000| 00000000| 00000000| 00000000|shut_logo_|
|
||||
* |10000000| 00000000| 00000000| 00000000|shut_keyb_|
|
||||
* |00000000| 00000010| 00000000| 00000000|boot_bar__|
|
||||
* |00000000| 00000100| 00000000| 00000000|awake_bar_|
|
||||
* |00000000| 00001000| 00000000| 00000000|sleep_bar_|
|
||||
* |00000000| 00010000| 00000000| 00000000|shut_bar__|
|
||||
* |00000000| 00000000| 00000001| 00000000|boot_lid__|
|
||||
* |00000000| 00000000| 00000010| 00000000|awkae_lid_|
|
||||
* |00000000| 00000000| 00000100| 00000000|sleep_lid_|
|
||||
* |00000000| 00000000| 00001000| 00000000|shut_lid__|
|
||||
* |00000000| 00000000| 00000000| 00000001|boot_rear_|
|
||||
* |00000000| 00000000| 00000000| 00000010|awake_rear|
|
||||
* |00000000| 00000000| 00000000| 00000100|sleep_rear|
|
||||
* |00000000| 00000000| 00000000| 00001000|shut_rear_|
|
||||
*/
|
||||
export interface AuraPower {
|
||||
keyboard: KbAuraPowerState;
|
||||
logo: KbAuraPowerState;
|
||||
lightbar: KbAuraPowerState;
|
||||
lid: KbAuraPowerState;
|
||||
rear_glow: KbAuraPowerState;
|
||||
}
|
||||
|
||||
export enum AuraDevTuf {
|
||||
Boot = "Boot",
|
||||
Awake = "Awake",
|
||||
@@ -138,74 +196,20 @@ export enum AuraDevRog1 {
|
||||
Sleep = "Sleep",
|
||||
}
|
||||
|
||||
/**
|
||||
* # Bits for newer 0x18c6, 0x19B6, 0x1a30, keyboard models
|
||||
*
|
||||
* | Byte 1 | Byte 2 | Byte 3 | Byte 4 | Label |
|
||||
* |--------|---------|---------|---------|----------|
|
||||
* |00000001| 00000000| 00000000| 00000000|boot_logo_|
|
||||
* |00000010| 00000000| 00000000| 00000000|boot_keyb_|
|
||||
* |00000100| 00000000| 00000000| 00000000|awake_logo|
|
||||
* |00001000| 00000000| 00000000| 00000000|awake_keyb|
|
||||
* |00010000| 00000000| 00000000| 00000000|sleep_logo|
|
||||
* |00100000| 00000000| 00000000| 00000000|sleep_keyb|
|
||||
* |01000000| 00000000| 00000000| 00000000|shut_logo_|
|
||||
* |10000000| 00000000| 00000000| 00000000|shut_keyb_|
|
||||
* |00000000| 00000010| 00000000| 00000000|boot_bar__|
|
||||
* |00000000| 00000100| 00000000| 00000000|awake_bar_|
|
||||
* |00000000| 00001000| 00000000| 00000000|sleep_bar_|
|
||||
* |00000000| 00010000| 00000000| 00000000|shut_bar__|
|
||||
* |00000000| 00000000| 00000001| 00000000|boot_lid__|
|
||||
* |00000000| 00000000| 00000010| 00000000|awkae_lid_|
|
||||
* |00000000| 00000000| 00000100| 00000000|sleep_lid_|
|
||||
* |00000000| 00000000| 00001000| 00000000|shut_lid__|
|
||||
* |00000000| 00000000| 00000000| 00000001|boot_rear_|
|
||||
* |00000000| 00000000| 00000000| 00000010|awake_rear|
|
||||
* |00000000| 00000000| 00000000| 00000100|sleep_rear|
|
||||
* |00000000| 00000000| 00000000| 00001000|shut_rear_|
|
||||
*/
|
||||
export enum AuraDevRog2 {
|
||||
BootLogo = "BootLogo",
|
||||
BootKeyb = "BootKeyb",
|
||||
AwakeLogo = "AwakeLogo",
|
||||
AwakeKeyb = "AwakeKeyb",
|
||||
SleepLogo = "SleepLogo",
|
||||
SleepKeyb = "SleepKeyb",
|
||||
ShutdownLogo = "ShutdownLogo",
|
||||
ShutdownKeyb = "ShutdownKeyb",
|
||||
BootBar = "BootBar",
|
||||
AwakeBar = "AwakeBar",
|
||||
SleepBar = "SleepBar",
|
||||
ShutdownBar = "ShutdownBar",
|
||||
BootLid = "BootLid",
|
||||
AwakeLid = "AwakeLid",
|
||||
SleepLid = "SleepLid",
|
||||
ShutdownLid = "ShutdownLid",
|
||||
BootRearGlow = "BootRearGlow",
|
||||
AwakeRearGlow = "AwakeRearGlow",
|
||||
SleepRearGlow = "SleepRearGlow",
|
||||
ShutdownRearGlow = "ShutdownRearGlow",
|
||||
}
|
||||
|
||||
/** This struct is intended as a helper to pass args to generic dbus interface */
|
||||
export interface AuraPowerDev {
|
||||
/**
|
||||
* TUF laptops use a similar style of control to the older ROG devices but
|
||||
* through WMI
|
||||
*/
|
||||
tuf: AuraDevTuf[];
|
||||
x1866: AuraDevRog1[];
|
||||
x19b6: AuraDevRog2[];
|
||||
}
|
||||
|
||||
/** The powerr zones this laptop supports */
|
||||
export enum PowerZones {
|
||||
/** The logo on some laptop lids */
|
||||
Logo = "Logo",
|
||||
/** The full keyboard (not zones) */
|
||||
Keyboard = "Keyboard",
|
||||
/** The lightbar, typically on the front of the laptop */
|
||||
Lightbar = "Lightbar",
|
||||
/** The leds that may be placed around the edge of the laptop lid */
|
||||
Lid = "Lid",
|
||||
/** The led strip on the rear of some laptops */
|
||||
RearGlow = "RearGlow",
|
||||
/**
|
||||
* Pre-0x19b6 devices use a different smaller scheme to the newer ROG
|
||||
* devices
|
||||
*/
|
||||
old_rog: AuraDevRog1[];
|
||||
/** ASUS standardised control scheme from 2020 onwards */
|
||||
rog: AuraPower;
|
||||
}
|
||||
|
||||
export enum LedBrightness {
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import { AuraDevRog1, AuraDevRog2, AuraDevTuf, AuraDevice, AuraEffect, AuraModeNum, AuraPowerDev, AuraZone, Direction, Speed } from "../../bindings/aura";
|
||||
import { AuraDevRog1, AuraDevTuf, AuraDevice, AuraEffect, AuraModeNum, AuraPower, AuraPowerDev, AuraZone, Direction, PowerZones, Speed } from "../../bindings/aura";
|
||||
import { DbusBase } from "./base";
|
||||
|
||||
export class AuraDbus extends DbusBase {
|
||||
@@ -7,8 +7,44 @@ export class AuraDbus extends DbusBase {
|
||||
public aura_modes: Map<AuraModeNum, AuraEffect> = new Map;
|
||||
public leds_powered: AuraPowerDev = {
|
||||
tuf: [],
|
||||
x1866: [],
|
||||
x19b6: []
|
||||
old_rog: [],
|
||||
rog: {
|
||||
keyboard: {
|
||||
zone: PowerZones.Keyboard,
|
||||
boot: false,
|
||||
awake: false,
|
||||
sleep: false,
|
||||
shutdown: false
|
||||
},
|
||||
logo: {
|
||||
zone: PowerZones.Logo,
|
||||
boot: false,
|
||||
awake: false,
|
||||
sleep: false,
|
||||
shutdown: false
|
||||
},
|
||||
lightbar: {
|
||||
zone: PowerZones.Lightbar,
|
||||
boot: false,
|
||||
awake: false,
|
||||
sleep: false,
|
||||
shutdown: false
|
||||
},
|
||||
lid: {
|
||||
zone: PowerZones.Lid,
|
||||
boot: false,
|
||||
awake: false,
|
||||
sleep: false,
|
||||
shutdown: false
|
||||
},
|
||||
rear_glow: {
|
||||
zone: PowerZones.RearGlow,
|
||||
boot: false,
|
||||
awake: false,
|
||||
sleep: false,
|
||||
shutdown: false
|
||||
},
|
||||
}
|
||||
};
|
||||
// TODO: interface or something to enforce requirement of "sync()" method
|
||||
public notifyAuraModeSubscribers: any[] = [];
|
||||
@@ -32,21 +68,51 @@ export class AuraDbus extends DbusBase {
|
||||
}
|
||||
|
||||
_parsePowerStates(data: any[]) {
|
||||
const power: AuraPowerDev = {
|
||||
tuf: [],
|
||||
x1866: [],
|
||||
x19b6: []
|
||||
};
|
||||
const power: AuraPowerDev = this.leds_powered;
|
||||
|
||||
power.tuf = data[0].map((value: string) => {
|
||||
return AuraDevTuf[value as AuraDevTuf];
|
||||
});
|
||||
power.x1866 = data[1].map((value: string) => {
|
||||
power.old_rog = data[1].map((value: string) => {
|
||||
return AuraDevRog1[value as AuraDevRog1];
|
||||
});
|
||||
power.x19b6 = data[2].map((value: string) => {
|
||||
return AuraDevRog2[value as AuraDevRog2];
|
||||
});
|
||||
power.rog = {
|
||||
keyboard: {
|
||||
zone: PowerZones[data[2][0][0] as PowerZones],
|
||||
boot: data[2][0][1],
|
||||
awake: data[2][0][2],
|
||||
sleep: data[2][0][3],
|
||||
shutdown: data[2][0][4]
|
||||
},
|
||||
logo: {
|
||||
zone: PowerZones[data[2][1][0] as PowerZones],
|
||||
boot: data[2][1][1],
|
||||
awake: data[2][1][2],
|
||||
sleep: data[2][1][3],
|
||||
shutdown: data[2][1][4]
|
||||
},
|
||||
lightbar: {
|
||||
zone: PowerZones[data[2][2][0] as PowerZones],
|
||||
boot: data[2][2][1],
|
||||
awake: data[2][2][2],
|
||||
sleep: data[2][2][3],
|
||||
shutdown: data[2][2][4]
|
||||
},
|
||||
lid: {
|
||||
zone: PowerZones[data[2][3][0] as PowerZones],
|
||||
boot: data[2][3][1],
|
||||
awake: data[2][3][2],
|
||||
sleep: data[2][3][3],
|
||||
shutdown: data[2][3][4]
|
||||
},
|
||||
rear_glow: {
|
||||
zone: PowerZones[data[2][4][0] as PowerZones],
|
||||
boot: data[2][4][1],
|
||||
awake: data[2][4][2],
|
||||
sleep: data[2][4][3],
|
||||
shutdown: data[2][4][4]
|
||||
}
|
||||
};
|
||||
|
||||
return power;
|
||||
}
|
||||
@@ -59,9 +125,9 @@ export class AuraDbus extends DbusBase {
|
||||
//@ts-ignore
|
||||
log("LED power tuf: " + this.leds_powered.tuf);
|
||||
//@ts-ignore
|
||||
log("LED power x1866: " + this.leds_powered.x1866);
|
||||
log("LED power x1866: " + this.leds_powered.old_rog);
|
||||
//@ts-ignore
|
||||
log("LED power x19b6: " + this.leds_powered.x19b6);
|
||||
log("LED power x19b6: " + this.leds_powered.rog);
|
||||
} catch (e) {
|
||||
//@ts-ignore
|
||||
log("Failed to fetch supported functionalities", e);
|
||||
@@ -180,26 +246,26 @@ export class AuraDbus extends DbusBase {
|
||||
const power: AuraPowerDev = this._parsePowerStates(data[0]);
|
||||
this.leds_powered = power;
|
||||
switch (this.device) {
|
||||
case AuraDevice.Tuf:
|
||||
//@ts-ignore
|
||||
log("LED power has changed to ", this.leds_powered.tuf);
|
||||
break;
|
||||
case AuraDevice.X1854:
|
||||
case AuraDevice.X1869:
|
||||
case AuraDevice.X18c6:
|
||||
//@ts-ignore
|
||||
log("LED power has changed to ", this.leds_powered.x1866);
|
||||
break;
|
||||
case AuraDevice.X19b6:
|
||||
case AuraDevice.X1a30:
|
||||
//@ts-ignore
|
||||
log("LED power has changed to ", this.leds_powered.x19b6);
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
case AuraDevice.Tuf:
|
||||
//@ts-ignore
|
||||
log("LED power has changed to ", this.leds_powered.tuf);
|
||||
break;
|
||||
case AuraDevice.X1854:
|
||||
case AuraDevice.X1869:
|
||||
case AuraDevice.X18c6:
|
||||
//@ts-ignore
|
||||
log("LED power has changed to ", this.leds_powered.old_rog);
|
||||
break;
|
||||
case AuraDevice.X19b6:
|
||||
case AuraDevice.X1a30:
|
||||
//@ts-ignore
|
||||
log("LED power has changed to ", this.leds_powered.rog);
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
//@ts-ignore
|
||||
log("LED power has changed to ", this.leds_powered.x19b6);
|
||||
log("LED power has changed to ", this.leds_powered.rog);
|
||||
this.notifyAuraPowerSubscribers.forEach(sub => {
|
||||
sub.sync();
|
||||
});
|
||||
|
||||
@@ -31,6 +31,14 @@
|
||||
advanced_type: None,
|
||||
power_zones: [Keyboard],
|
||||
),
|
||||
(
|
||||
board_name: "FX505G",
|
||||
layout_name: "fx505d",
|
||||
basic_modes: [Static, Breathe, Strobe, Rainbow, Pulse],
|
||||
basic_zones: [],
|
||||
advanced_type: None,
|
||||
power_zones: [Keyboard],
|
||||
),
|
||||
(
|
||||
board_name: "FX506H",
|
||||
layout_name: "fa506i",
|
||||
@@ -375,6 +383,14 @@
|
||||
advanced_type: None,
|
||||
power_zones: [Keyboard],
|
||||
),
|
||||
(
|
||||
board_name: "GA402X",
|
||||
layout_name: "ga401q",
|
||||
basic_modes: [Static, Breathe, Pulse, Rainbow],
|
||||
basic_zones: [],
|
||||
advanced_type: None,
|
||||
power_zones: [Keyboard],
|
||||
),
|
||||
(
|
||||
board_name: "GA503Q",
|
||||
layout_name: "ga401q",
|
||||
|
||||
@@ -24,7 +24,7 @@ pub struct LedSupportFile(Vec<LaptopLedData>);
|
||||
/// The powerr zones this laptop supports
|
||||
#[typeshare]
|
||||
#[cfg_attr(feature = "dbus", derive(Type), zvariant(signature = "s"))]
|
||||
#[derive(Serialize, Deserialize, PartialEq, Eq, Debug, Default, Clone)]
|
||||
#[derive(Serialize, Deserialize, PartialEq, Eq, Debug, Default, Copy, Clone)]
|
||||
pub enum PowerZones {
|
||||
/// The logo on some laptop lids
|
||||
#[default]
|
||||
|
||||
@@ -0,0 +1,162 @@
|
||||
//! Older code that is not useful but stillr elevant as a reference
|
||||
|
||||
/// # Bits for newer 0x18c6, 0x19B6, 0x1a30, keyboard models
|
||||
///
|
||||
/// | Byte 1 | Byte 2 | Byte 3 | Byte 4 | Label |
|
||||
/// |--------|---------|---------|---------|----------|
|
||||
/// |00000001| 00000000| 00000000| 00000000|boot_logo_|
|
||||
/// |00000010| 00000000| 00000000| 00000000|boot_keyb_|
|
||||
/// |00000100| 00000000| 00000000| 00000000|awake_logo|
|
||||
/// |00001000| 00000000| 00000000| 00000000|awake_keyb|
|
||||
/// |00010000| 00000000| 00000000| 00000000|sleep_logo|
|
||||
/// |00100000| 00000000| 00000000| 00000000|sleep_keyb|
|
||||
/// |01000000| 00000000| 00000000| 00000000|shut_logo_|
|
||||
/// |10000000| 00000000| 00000000| 00000000|shut_keyb_|
|
||||
/// |00000000| 00000010| 00000000| 00000000|boot_bar__|
|
||||
/// |00000000| 00000100| 00000000| 00000000|awake_bar_|
|
||||
/// |00000000| 00001000| 00000000| 00000000|sleep_bar_|
|
||||
/// |00000000| 00010000| 00000000| 00000000|shut_bar__|
|
||||
/// |00000000| 00000000| 00000001| 00000000|boot_lid__|
|
||||
/// |00000000| 00000000| 00000010| 00000000|awkae_lid_|
|
||||
/// |00000000| 00000000| 00000100| 00000000|sleep_lid_|
|
||||
/// |00000000| 00000000| 00001000| 00000000|shut_lid__|
|
||||
/// |00000000| 00000000| 00000000| 00000001|boot_rear_|
|
||||
/// |00000000| 00000000| 00000000| 00000010|awake_rear|
|
||||
/// |00000000| 00000000| 00000000| 00000100|sleep_rear|
|
||||
/// |00000000| 00000000| 00000000| 00001000|shut_rear_|
|
||||
#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash)]
|
||||
#[repr(u32)]
|
||||
pub enum AuraDevRog2 {
|
||||
BootLogo = 1,
|
||||
BootKeyb = 1 << 1,
|
||||
AwakeLogo = 1 << 2,
|
||||
AwakeKeyb = 1 << 3,
|
||||
SleepLogo = 1 << 4,
|
||||
SleepKeyb = 1 << 5,
|
||||
ShutdownLogo = 1 << 6,
|
||||
ShutdownKeyb = 1 << 7,
|
||||
BootBar = 1 << (7 + 2),
|
||||
AwakeBar = 1 << (7 + 3),
|
||||
SleepBar = 1 << (7 + 4),
|
||||
ShutdownBar = 1 << (7 + 5),
|
||||
BootLid = 1 << (15 + 1),
|
||||
AwakeLid = 1 << (15 + 2),
|
||||
SleepLid = 1 << (15 + 3),
|
||||
ShutdownLid = 1 << (15 + 4),
|
||||
BootRearGlow = 1 << (23 + 1),
|
||||
AwakeRearGlow = 1 << (23 + 2),
|
||||
SleepRearGlow = 1 << (23 + 3),
|
||||
ShutdownRearGlow = 1 << (23 + 4),
|
||||
}
|
||||
|
||||
impl From<AuraDevRog2> for u32 {
|
||||
fn from(a: AuraDevRog2) -> Self {
|
||||
a as u32
|
||||
}
|
||||
}
|
||||
|
||||
impl AuraDevRog2 {
|
||||
pub fn to_bytes(control: &[Self]) -> [u8; 4] {
|
||||
let mut a: u32 = 0;
|
||||
for n in control {
|
||||
a |= *n as u32;
|
||||
}
|
||||
[
|
||||
(a & 0xff) as u8,
|
||||
((a & 0xff00) >> 8) as u8,
|
||||
((a & 0xff0000) >> 16) as u8,
|
||||
((a & 0xff000000) >> 24) as u8,
|
||||
]
|
||||
}
|
||||
|
||||
pub const fn dev_id() -> &'static str {
|
||||
"0x196b"
|
||||
}
|
||||
}
|
||||
|
||||
#[cfg(test)]
|
||||
mod tests {
|
||||
use crate::deprecated::AuraDevRog2;
|
||||
|
||||
#[test]
|
||||
fn check_0x19b6_control_bytes_binary_rep() {
|
||||
fn to_binary_string(bytes: &[AuraDevRog2]) -> String {
|
||||
let bytes = AuraDevRog2::to_bytes(bytes);
|
||||
format!(
|
||||
"{:08b}, {:08b}, {:08b}, {:08b}",
|
||||
bytes[0], bytes[1], bytes[2], bytes[3]
|
||||
)
|
||||
}
|
||||
|
||||
let boot_logo_ = to_binary_string(&[AuraDevRog2::BootLogo]);
|
||||
let boot_keyb_ = to_binary_string(&[AuraDevRog2::BootKeyb]);
|
||||
let sleep_logo = to_binary_string(&[AuraDevRog2::SleepLogo]);
|
||||
let sleep_keyb = to_binary_string(&[AuraDevRog2::SleepKeyb]);
|
||||
let awake_logo = to_binary_string(&[AuraDevRog2::AwakeLogo]);
|
||||
let awake_keyb = to_binary_string(&[AuraDevRog2::AwakeKeyb]);
|
||||
let shut_logo_ = to_binary_string(&[AuraDevRog2::ShutdownLogo]);
|
||||
let shut_keyb_ = to_binary_string(&[AuraDevRog2::ShutdownKeyb]);
|
||||
let boot_bar__ = to_binary_string(&[AuraDevRog2::BootBar]);
|
||||
let awake_bar_ = to_binary_string(&[AuraDevRog2::AwakeBar]);
|
||||
let sleep_bar_ = to_binary_string(&[AuraDevRog2::SleepBar]);
|
||||
let shut_bar__ = to_binary_string(&[AuraDevRog2::ShutdownBar]);
|
||||
let boot_lid__ = to_binary_string(&[AuraDevRog2::BootLid]);
|
||||
let awkae_lid_ = to_binary_string(&[AuraDevRog2::AwakeLid]);
|
||||
let sleep_lid_ = to_binary_string(&[AuraDevRog2::SleepLid]);
|
||||
let shut_lid__ = to_binary_string(&[AuraDevRog2::ShutdownLid]);
|
||||
let boot_rear_ = to_binary_string(&[AuraDevRog2::BootRearGlow]);
|
||||
let awake_rear = to_binary_string(&[AuraDevRog2::AwakeRearGlow]);
|
||||
let sleep_rear = to_binary_string(&[AuraDevRog2::SleepRearGlow]);
|
||||
let shut_rear_ = to_binary_string(&[AuraDevRog2::ShutdownRearGlow]);
|
||||
|
||||
assert_eq!(boot_logo_, "00000001, 00000000, 00000000, 00000000");
|
||||
assert_eq!(boot_keyb_, "00000010, 00000000, 00000000, 00000000");
|
||||
assert_eq!(awake_logo, "00000100, 00000000, 00000000, 00000000");
|
||||
assert_eq!(awake_keyb, "00001000, 00000000, 00000000, 00000000");
|
||||
assert_eq!(sleep_logo, "00010000, 00000000, 00000000, 00000000");
|
||||
assert_eq!(sleep_keyb, "00100000, 00000000, 00000000, 00000000");
|
||||
assert_eq!(shut_logo_, "01000000, 00000000, 00000000, 00000000");
|
||||
assert_eq!(shut_keyb_, "10000000, 00000000, 00000000, 00000000");
|
||||
//
|
||||
assert_eq!(boot_bar__, "00000000, 00000010, 00000000, 00000000");
|
||||
assert_eq!(awake_bar_, "00000000, 00000100, 00000000, 00000000");
|
||||
assert_eq!(sleep_bar_, "00000000, 00001000, 00000000, 00000000");
|
||||
assert_eq!(shut_bar__, "00000000, 00010000, 00000000, 00000000");
|
||||
//
|
||||
assert_eq!(boot_lid__, "00000000, 00000000, 00000001, 00000000");
|
||||
assert_eq!(awkae_lid_, "00000000, 00000000, 00000010, 00000000");
|
||||
assert_eq!(sleep_lid_, "00000000, 00000000, 00000100, 00000000");
|
||||
assert_eq!(shut_lid__, "00000000, 00000000, 00001000, 00000000");
|
||||
//
|
||||
assert_eq!(boot_rear_, "00000000, 00000000, 00000000, 00000001");
|
||||
assert_eq!(awake_rear, "00000000, 00000000, 00000000, 00000010");
|
||||
assert_eq!(sleep_rear, "00000000, 00000000, 00000000, 00000100");
|
||||
assert_eq!(shut_rear_, "00000000, 00000000, 00000000, 00001000");
|
||||
|
||||
// All on
|
||||
let byte1 = [
|
||||
AuraDevRog2::BootLogo,
|
||||
AuraDevRog2::BootKeyb,
|
||||
AuraDevRog2::SleepLogo,
|
||||
AuraDevRog2::SleepKeyb,
|
||||
AuraDevRog2::AwakeLogo,
|
||||
AuraDevRog2::AwakeKeyb,
|
||||
AuraDevRog2::ShutdownLogo,
|
||||
AuraDevRog2::ShutdownKeyb,
|
||||
AuraDevRog2::BootBar,
|
||||
AuraDevRog2::AwakeBar,
|
||||
AuraDevRog2::SleepBar,
|
||||
AuraDevRog2::ShutdownBar,
|
||||
AuraDevRog2::AwakeLid,
|
||||
AuraDevRog2::BootLid,
|
||||
AuraDevRog2::SleepLid,
|
||||
AuraDevRog2::ShutdownLid,
|
||||
AuraDevRog2::AwakeRearGlow,
|
||||
AuraDevRog2::BootRearGlow,
|
||||
AuraDevRog2::SleepRearGlow,
|
||||
AuraDevRog2::ShutdownRearGlow,
|
||||
];
|
||||
let out = to_binary_string(&byte1);
|
||||
assert_eq!(out, "11111111, 00011110, 00001111, 00001111");
|
||||
}
|
||||
}
|
||||
@@ -18,6 +18,10 @@ pub mod aura_detection;
|
||||
pub mod layouts;
|
||||
pub mod usb;
|
||||
|
||||
pub mod power;
|
||||
|
||||
mod deprecated;
|
||||
|
||||
pub const LED_MSG_LEN: usize = 17;
|
||||
pub const VERSION: &str = env!("CARGO_PKG_VERSION");
|
||||
|
||||
|
||||
@@ -0,0 +1,343 @@
|
||||
use std::fmt::Debug;
|
||||
|
||||
use serde::{Deserialize, Serialize};
|
||||
use typeshare::typeshare;
|
||||
#[cfg(feature = "dbus")]
|
||||
use zbus::zvariant::Type;
|
||||
|
||||
use crate::aura_detection::PowerZones;
|
||||
|
||||
#[typeshare]
|
||||
#[cfg_attr(feature = "dbus", derive(Type))]
|
||||
#[derive(Clone, Copy, Debug, PartialEq, Eq, Serialize, Deserialize)]
|
||||
pub struct KbAuraPowerState {
|
||||
pub zone: PowerZones,
|
||||
pub boot: bool,
|
||||
pub awake: bool,
|
||||
pub sleep: bool,
|
||||
pub shutdown: bool,
|
||||
}
|
||||
|
||||
impl Default for KbAuraPowerState {
|
||||
fn default() -> Self {
|
||||
Self {
|
||||
zone: PowerZones::Keyboard,
|
||||
boot: false,
|
||||
awake: false,
|
||||
sleep: false,
|
||||
shutdown: false,
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
impl KbAuraPowerState {
|
||||
pub fn to_byte(&self, zone: PowerZones) -> u32 {
|
||||
match zone {
|
||||
PowerZones::Logo => {
|
||||
self.boot as u32
|
||||
| (self.awake as u32) << 2
|
||||
| (self.sleep as u32) << 4
|
||||
| (self.shutdown as u32) << 6
|
||||
}
|
||||
PowerZones::Keyboard => {
|
||||
(self.boot as u32) << 1
|
||||
| (self.awake as u32) << 3
|
||||
| (self.sleep as u32) << 5
|
||||
| (self.shutdown as u32) << 7
|
||||
}
|
||||
PowerZones::Lightbar => {
|
||||
(self.boot as u32) << (7 + 2)
|
||||
| (self.awake as u32) << (7 + 3)
|
||||
| (self.sleep as u32) << (7 + 4)
|
||||
| (self.shutdown as u32) << (7 + 5)
|
||||
}
|
||||
PowerZones::Lid => {
|
||||
(self.boot as u32) << (15 + 1)
|
||||
| (self.awake as u32) << (15 + 2)
|
||||
| (self.sleep as u32) << (15 + 3)
|
||||
| (self.shutdown as u32) << (15 + 4)
|
||||
}
|
||||
PowerZones::RearGlow => {
|
||||
(self.boot as u32) << (23 + 1)
|
||||
| (self.awake as u32) << (23 + 2)
|
||||
| (self.sleep as u32) << (23 + 3)
|
||||
| (self.shutdown as u32) << (23 + 4)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// Track and control the Aura keyboard power state
|
||||
///
|
||||
/// # Bits for newer 0x18c6, 0x19B6, 0x1a30, keyboard models
|
||||
///
|
||||
/// | Byte 1 | Byte 2 | Byte 3 | Byte 4 | Label |
|
||||
/// |--------|---------|---------|---------|----------|
|
||||
/// |00000001| 00000000| 00000000| 00000000|boot_logo_|
|
||||
/// |00000010| 00000000| 00000000| 00000000|boot_keyb_|
|
||||
/// |00000100| 00000000| 00000000| 00000000|awake_logo|
|
||||
/// |00001000| 00000000| 00000000| 00000000|awake_keyb|
|
||||
/// |00010000| 00000000| 00000000| 00000000|sleep_logo|
|
||||
/// |00100000| 00000000| 00000000| 00000000|sleep_keyb|
|
||||
/// |01000000| 00000000| 00000000| 00000000|shut_logo_|
|
||||
/// |10000000| 00000000| 00000000| 00000000|shut_keyb_|
|
||||
/// |00000000| 00000010| 00000000| 00000000|boot_bar__|
|
||||
/// |00000000| 00000100| 00000000| 00000000|awake_bar_|
|
||||
/// |00000000| 00001000| 00000000| 00000000|sleep_bar_|
|
||||
/// |00000000| 00010000| 00000000| 00000000|shut_bar__|
|
||||
/// |00000000| 00000000| 00000001| 00000000|boot_lid__|
|
||||
/// |00000000| 00000000| 00000010| 00000000|awkae_lid_|
|
||||
/// |00000000| 00000000| 00000100| 00000000|sleep_lid_|
|
||||
/// |00000000| 00000000| 00001000| 00000000|shut_lid__|
|
||||
/// |00000000| 00000000| 00000000| 00000001|boot_rear_|
|
||||
/// |00000000| 00000000| 00000000| 00000010|awake_rear|
|
||||
/// |00000000| 00000000| 00000000| 00000100|sleep_rear|
|
||||
/// |00000000| 00000000| 00000000| 00001000|shut_rear_|
|
||||
#[typeshare]
|
||||
#[cfg_attr(feature = "dbus", derive(Type))]
|
||||
#[derive(Clone, Debug, Default, PartialEq, Eq, Serialize, Deserialize)]
|
||||
pub struct AuraPower {
|
||||
pub keyboard: KbAuraPowerState,
|
||||
pub logo: KbAuraPowerState,
|
||||
pub lightbar: KbAuraPowerState,
|
||||
pub lid: KbAuraPowerState,
|
||||
pub rear_glow: KbAuraPowerState,
|
||||
}
|
||||
|
||||
impl AuraPower {
|
||||
pub fn new_all_on() -> Self {
|
||||
Self {
|
||||
keyboard: KbAuraPowerState {
|
||||
zone: PowerZones::Keyboard,
|
||||
boot: true,
|
||||
awake: true,
|
||||
sleep: true,
|
||||
shutdown: true,
|
||||
},
|
||||
logo: KbAuraPowerState {
|
||||
zone: PowerZones::Logo,
|
||||
boot: true,
|
||||
awake: true,
|
||||
sleep: true,
|
||||
shutdown: true,
|
||||
},
|
||||
lightbar: KbAuraPowerState {
|
||||
zone: PowerZones::Lightbar,
|
||||
boot: true,
|
||||
awake: true,
|
||||
sleep: true,
|
||||
shutdown: true,
|
||||
},
|
||||
lid: KbAuraPowerState {
|
||||
zone: PowerZones::Lid,
|
||||
boot: true,
|
||||
awake: true,
|
||||
sleep: true,
|
||||
shutdown: true,
|
||||
},
|
||||
rear_glow: KbAuraPowerState {
|
||||
zone: PowerZones::RearGlow,
|
||||
boot: true,
|
||||
awake: true,
|
||||
sleep: true,
|
||||
shutdown: true,
|
||||
},
|
||||
}
|
||||
}
|
||||
|
||||
pub fn to_bytes(&self) -> [u8; 4] {
|
||||
let mut a: u32 = 0;
|
||||
a |= self.keyboard.to_byte(PowerZones::Keyboard);
|
||||
a |= self.logo.to_byte(PowerZones::Logo);
|
||||
a |= self.lid.to_byte(PowerZones::Lid);
|
||||
a |= self.lightbar.to_byte(PowerZones::Lightbar);
|
||||
a |= self.rear_glow.to_byte(PowerZones::RearGlow);
|
||||
[
|
||||
(a & 0xff) as u8,
|
||||
((a & 0xff00) >> 8) as u8,
|
||||
((a & 0xff0000) >> 16) as u8,
|
||||
((a & 0xff000000) >> 24) as u8,
|
||||
]
|
||||
}
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn check_0x19b6_control_bytes_binary_rep() {
|
||||
fn to_binary_string(power: &AuraPower) -> String {
|
||||
let bytes = power.to_bytes();
|
||||
format!(
|
||||
"{:08b}, {:08b}, {:08b}, {:08b}",
|
||||
bytes[0], bytes[1], bytes[2], bytes[3]
|
||||
)
|
||||
}
|
||||
|
||||
let boot_logo_ = to_binary_string(&AuraPower {
|
||||
logo: KbAuraPowerState {
|
||||
boot: true,
|
||||
..Default::default()
|
||||
},
|
||||
..Default::default()
|
||||
});
|
||||
let boot_keyb_ = to_binary_string(&AuraPower {
|
||||
keyboard: KbAuraPowerState {
|
||||
boot: true,
|
||||
..Default::default()
|
||||
},
|
||||
..Default::default()
|
||||
});
|
||||
let sleep_logo = to_binary_string(&AuraPower {
|
||||
logo: KbAuraPowerState {
|
||||
sleep: true,
|
||||
..Default::default()
|
||||
},
|
||||
..Default::default()
|
||||
});
|
||||
let sleep_keyb = to_binary_string(&AuraPower {
|
||||
keyboard: KbAuraPowerState {
|
||||
sleep: true,
|
||||
..Default::default()
|
||||
},
|
||||
..Default::default()
|
||||
});
|
||||
let awake_logo = to_binary_string(&AuraPower {
|
||||
logo: KbAuraPowerState {
|
||||
awake: true,
|
||||
..Default::default()
|
||||
},
|
||||
..Default::default()
|
||||
});
|
||||
let awake_keyb = to_binary_string(&AuraPower {
|
||||
keyboard: KbAuraPowerState {
|
||||
awake: true,
|
||||
..Default::default()
|
||||
},
|
||||
..Default::default()
|
||||
});
|
||||
let shut_logo_ = to_binary_string(&AuraPower {
|
||||
logo: KbAuraPowerState {
|
||||
shutdown: true,
|
||||
..Default::default()
|
||||
},
|
||||
..Default::default()
|
||||
});
|
||||
let shut_keyb_ = to_binary_string(&AuraPower {
|
||||
keyboard: KbAuraPowerState {
|
||||
shutdown: true,
|
||||
..Default::default()
|
||||
},
|
||||
..Default::default()
|
||||
});
|
||||
let boot_bar__ = to_binary_string(&AuraPower {
|
||||
lightbar: KbAuraPowerState {
|
||||
boot: true,
|
||||
..Default::default()
|
||||
},
|
||||
..Default::default()
|
||||
});
|
||||
let awake_bar_ = to_binary_string(&AuraPower {
|
||||
lightbar: KbAuraPowerState {
|
||||
awake: true,
|
||||
..Default::default()
|
||||
},
|
||||
..Default::default()
|
||||
});
|
||||
let sleep_bar_ = to_binary_string(&AuraPower {
|
||||
lightbar: KbAuraPowerState {
|
||||
sleep: true,
|
||||
..Default::default()
|
||||
},
|
||||
..Default::default()
|
||||
});
|
||||
let shut_bar__ = to_binary_string(&AuraPower {
|
||||
lightbar: KbAuraPowerState {
|
||||
shutdown: true,
|
||||
..Default::default()
|
||||
},
|
||||
..Default::default()
|
||||
});
|
||||
let boot_lid__ = to_binary_string(&AuraPower {
|
||||
lid: KbAuraPowerState {
|
||||
boot: true,
|
||||
..Default::default()
|
||||
},
|
||||
..Default::default()
|
||||
});
|
||||
let awkae_lid_ = to_binary_string(&AuraPower {
|
||||
lid: KbAuraPowerState {
|
||||
awake: true,
|
||||
..Default::default()
|
||||
},
|
||||
..Default::default()
|
||||
});
|
||||
let sleep_lid_ = to_binary_string(&AuraPower {
|
||||
lid: KbAuraPowerState {
|
||||
sleep: true,
|
||||
..Default::default()
|
||||
},
|
||||
..Default::default()
|
||||
});
|
||||
let shut_lid__ = to_binary_string(&AuraPower {
|
||||
lid: KbAuraPowerState {
|
||||
shutdown: true,
|
||||
..Default::default()
|
||||
},
|
||||
..Default::default()
|
||||
});
|
||||
let boot_rear_ = to_binary_string(&AuraPower {
|
||||
rear_glow: KbAuraPowerState {
|
||||
boot: true,
|
||||
..Default::default()
|
||||
},
|
||||
..Default::default()
|
||||
});
|
||||
let awake_rear = to_binary_string(&AuraPower {
|
||||
rear_glow: KbAuraPowerState {
|
||||
awake: true,
|
||||
..Default::default()
|
||||
},
|
||||
..Default::default()
|
||||
});
|
||||
let sleep_rear = to_binary_string(&AuraPower {
|
||||
rear_glow: KbAuraPowerState {
|
||||
sleep: true,
|
||||
..Default::default()
|
||||
},
|
||||
..Default::default()
|
||||
});
|
||||
let shut_rear_ = to_binary_string(&AuraPower {
|
||||
rear_glow: KbAuraPowerState {
|
||||
shutdown: true,
|
||||
..Default::default()
|
||||
},
|
||||
..Default::default()
|
||||
});
|
||||
|
||||
assert_eq!(boot_logo_, "00000001, 00000000, 00000000, 00000000");
|
||||
assert_eq!(boot_keyb_, "00000010, 00000000, 00000000, 00000000");
|
||||
assert_eq!(awake_logo, "00000100, 00000000, 00000000, 00000000");
|
||||
assert_eq!(awake_keyb, "00001000, 00000000, 00000000, 00000000");
|
||||
assert_eq!(sleep_logo, "00010000, 00000000, 00000000, 00000000");
|
||||
assert_eq!(sleep_keyb, "00100000, 00000000, 00000000, 00000000");
|
||||
assert_eq!(shut_logo_, "01000000, 00000000, 00000000, 00000000");
|
||||
assert_eq!(shut_keyb_, "10000000, 00000000, 00000000, 00000000");
|
||||
//
|
||||
assert_eq!(boot_bar__, "00000000, 00000010, 00000000, 00000000");
|
||||
assert_eq!(awake_bar_, "00000000, 00000100, 00000000, 00000000");
|
||||
assert_eq!(sleep_bar_, "00000000, 00001000, 00000000, 00000000");
|
||||
assert_eq!(shut_bar__, "00000000, 00010000, 00000000, 00000000");
|
||||
//
|
||||
assert_eq!(boot_lid__, "00000000, 00000000, 00000001, 00000000");
|
||||
assert_eq!(awkae_lid_, "00000000, 00000000, 00000010, 00000000");
|
||||
assert_eq!(sleep_lid_, "00000000, 00000000, 00000100, 00000000");
|
||||
assert_eq!(shut_lid__, "00000000, 00000000, 00001000, 00000000");
|
||||
//
|
||||
assert_eq!(boot_rear_, "00000000, 00000000, 00000000, 00000001");
|
||||
assert_eq!(awake_rear, "00000000, 00000000, 00000000, 00000010");
|
||||
assert_eq!(sleep_rear, "00000000, 00000000, 00000000, 00000100");
|
||||
assert_eq!(shut_rear_, "00000000, 00000000, 00000000, 00001000");
|
||||
|
||||
// All on
|
||||
let byte1 = AuraPower::new_all_on();
|
||||
let out = to_binary_string(&byte1);
|
||||
assert_eq!(out, "11111111, 00011110, 00001111, 00001111");
|
||||
}
|
||||
+9
-177
@@ -6,6 +6,8 @@ use typeshare::typeshare;
|
||||
#[cfg(feature = "dbus")]
|
||||
use zbus::zvariant::Type;
|
||||
|
||||
use crate::power::AuraPower;
|
||||
|
||||
pub const LED_INIT1: [u8; 2] = [0x5d, 0xb9];
|
||||
pub const LED_INIT2: &str = "]ASUS Tech.Inc."; // ] == 0x5d
|
||||
pub const LED_INIT3: [u8; 6] = [0x5d, 0x05, 0x20, 0x31, 0, 0x08];
|
||||
@@ -88,9 +90,14 @@ impl Debug for AuraDevice {
|
||||
#[cfg_attr(feature = "dbus", derive(Type))]
|
||||
#[derive(Clone, Default, Debug, Serialize, Deserialize)]
|
||||
pub struct AuraPowerDev {
|
||||
/// TUF laptops use a similar style of control to the older ROG devices but
|
||||
/// through WMI
|
||||
pub tuf: Vec<AuraDevTuf>,
|
||||
pub x1866: Vec<AuraDevRog1>,
|
||||
pub x19b6: Vec<AuraDevRog2>,
|
||||
/// Pre-0x19b6 devices use a different smaller scheme to the newer ROG
|
||||
/// devices
|
||||
pub old_rog: Vec<AuraDevRog1>,
|
||||
/// ASUS standardised control scheme from 2020 onwards
|
||||
pub rog: AuraPower,
|
||||
}
|
||||
|
||||
#[typeshare]
|
||||
@@ -177,102 +184,9 @@ impl BitAnd<AuraDevRog1> for AuraDevRog1 {
|
||||
}
|
||||
}
|
||||
|
||||
/// # Bits for newer 0x18c6, 0x19B6, 0x1a30, keyboard models
|
||||
///
|
||||
/// | Byte 1 | Byte 2 | Byte 3 | Byte 4 | Label |
|
||||
/// |--------|---------|---------|---------|----------|
|
||||
/// |00000001| 00000000| 00000000| 00000000|boot_logo_|
|
||||
/// |00000010| 00000000| 00000000| 00000000|boot_keyb_|
|
||||
/// |00000100| 00000000| 00000000| 00000000|awake_logo|
|
||||
/// |00001000| 00000000| 00000000| 00000000|awake_keyb|
|
||||
/// |00010000| 00000000| 00000000| 00000000|sleep_logo|
|
||||
/// |00100000| 00000000| 00000000| 00000000|sleep_keyb|
|
||||
/// |01000000| 00000000| 00000000| 00000000|shut_logo_|
|
||||
/// |10000000| 00000000| 00000000| 00000000|shut_keyb_|
|
||||
/// |00000000| 00000010| 00000000| 00000000|boot_bar__|
|
||||
/// |00000000| 00000100| 00000000| 00000000|awake_bar_|
|
||||
/// |00000000| 00001000| 00000000| 00000000|sleep_bar_|
|
||||
/// |00000000| 00010000| 00000000| 00000000|shut_bar__|
|
||||
/// |00000000| 00000000| 00000001| 00000000|boot_lid__|
|
||||
/// |00000000| 00000000| 00000010| 00000000|awkae_lid_|
|
||||
/// |00000000| 00000000| 00000100| 00000000|sleep_lid_|
|
||||
/// |00000000| 00000000| 00001000| 00000000|shut_lid__|
|
||||
/// |00000000| 00000000| 00000000| 00000001|boot_rear_|
|
||||
/// |00000000| 00000000| 00000000| 00000010|awake_rear|
|
||||
/// |00000000| 00000000| 00000000| 00000100|sleep_rear|
|
||||
/// |00000000| 00000000| 00000000| 00001000|shut_rear_|
|
||||
#[typeshare]
|
||||
#[cfg_attr(feature = "dbus", derive(Type), zvariant(signature = "s"))]
|
||||
#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, Serialize, Deserialize)]
|
||||
#[repr(u32)]
|
||||
pub enum AuraDevRog2 {
|
||||
BootLogo = 1,
|
||||
BootKeyb = 1 << 1,
|
||||
AwakeLogo = 1 << 2,
|
||||
AwakeKeyb = 1 << 3,
|
||||
SleepLogo = 1 << 4,
|
||||
SleepKeyb = 1 << 5,
|
||||
ShutdownLogo = 1 << 6,
|
||||
ShutdownKeyb = 1 << 7,
|
||||
BootBar = 1 << (7 + 2),
|
||||
AwakeBar = 1 << (7 + 3),
|
||||
SleepBar = 1 << (7 + 4),
|
||||
ShutdownBar = 1 << (7 + 5),
|
||||
BootLid = 1 << (15 + 1),
|
||||
AwakeLid = 1 << (15 + 2),
|
||||
SleepLid = 1 << (15 + 3),
|
||||
ShutdownLid = 1 << (15 + 4),
|
||||
BootRearGlow = 1 << (23 + 1),
|
||||
AwakeRearGlow = 1 << (23 + 2),
|
||||
SleepRearGlow = 1 << (23 + 3),
|
||||
ShutdownRearGlow = 1 << (23 + 4),
|
||||
}
|
||||
|
||||
impl From<AuraDevRog2> for u32 {
|
||||
fn from(a: AuraDevRog2) -> Self {
|
||||
a as u32
|
||||
}
|
||||
}
|
||||
|
||||
impl AuraDevRog2 {
|
||||
pub fn to_bytes(control: &[Self]) -> [u8; 4] {
|
||||
let mut a: u32 = 0;
|
||||
for n in control {
|
||||
a |= *n as u32;
|
||||
}
|
||||
[
|
||||
(a & 0xff) as u8,
|
||||
((a & 0xff00) >> 8) as u8,
|
||||
((a & 0xff0000) >> 16) as u8,
|
||||
((a & 0xff000000) >> 24) as u8,
|
||||
]
|
||||
}
|
||||
|
||||
pub const fn dev_id() -> &'static str {
|
||||
"0x196b"
|
||||
}
|
||||
}
|
||||
|
||||
impl BitOr<AuraDevRog2> for AuraDevRog2 {
|
||||
type Output = u16;
|
||||
|
||||
fn bitor(self, rhs: AuraDevRog2) -> Self::Output {
|
||||
self as u16 | rhs as u16
|
||||
}
|
||||
}
|
||||
|
||||
impl BitAnd<AuraDevRog2> for AuraDevRog2 {
|
||||
type Output = u16;
|
||||
|
||||
fn bitand(self, rhs: AuraDevRog2) -> Self::Output {
|
||||
self as u16 & rhs as u16
|
||||
}
|
||||
}
|
||||
|
||||
#[cfg(test)]
|
||||
mod tests {
|
||||
use super::AuraDevRog1;
|
||||
use crate::usb::AuraDevRog2;
|
||||
|
||||
#[test]
|
||||
fn check_0x1866_control_bytes() {
|
||||
@@ -308,86 +222,4 @@ mod tests {
|
||||
println!("{:08b}, {:08b}, {:08b}", bytes[0], bytes[1], bytes[2]);
|
||||
assert_eq!(bytes, [0xff, 0x1f, 0x000f, 0x00]);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn check_0x19b6_control_bytes_binary_rep() {
|
||||
fn to_binary_string(bytes: &[AuraDevRog2]) -> String {
|
||||
let bytes = AuraDevRog2::to_bytes(bytes);
|
||||
format!(
|
||||
"{:08b}, {:08b}, {:08b}, {:08b}",
|
||||
bytes[0], bytes[1], bytes[2], bytes[3]
|
||||
)
|
||||
}
|
||||
|
||||
let boot_logo_ = to_binary_string(&[AuraDevRog2::BootLogo]);
|
||||
let boot_keyb_ = to_binary_string(&[AuraDevRog2::BootKeyb]);
|
||||
let sleep_logo = to_binary_string(&[AuraDevRog2::SleepLogo]);
|
||||
let sleep_keyb = to_binary_string(&[AuraDevRog2::SleepKeyb]);
|
||||
let awake_logo = to_binary_string(&[AuraDevRog2::AwakeLogo]);
|
||||
let awake_keyb = to_binary_string(&[AuraDevRog2::AwakeKeyb]);
|
||||
let shut_logo_ = to_binary_string(&[AuraDevRog2::ShutdownLogo]);
|
||||
let shut_keyb_ = to_binary_string(&[AuraDevRog2::ShutdownKeyb]);
|
||||
let boot_bar__ = to_binary_string(&[AuraDevRog2::BootBar]);
|
||||
let awake_bar_ = to_binary_string(&[AuraDevRog2::AwakeBar]);
|
||||
let sleep_bar_ = to_binary_string(&[AuraDevRog2::SleepBar]);
|
||||
let shut_bar__ = to_binary_string(&[AuraDevRog2::ShutdownBar]);
|
||||
let boot_lid__ = to_binary_string(&[AuraDevRog2::BootLid]);
|
||||
let awkae_lid_ = to_binary_string(&[AuraDevRog2::AwakeLid]);
|
||||
let sleep_lid_ = to_binary_string(&[AuraDevRog2::SleepLid]);
|
||||
let shut_lid__ = to_binary_string(&[AuraDevRog2::ShutdownLid]);
|
||||
let boot_rear_ = to_binary_string(&[AuraDevRog2::BootRearGlow]);
|
||||
let awake_rear = to_binary_string(&[AuraDevRog2::AwakeRearGlow]);
|
||||
let sleep_rear = to_binary_string(&[AuraDevRog2::SleepRearGlow]);
|
||||
let shut_rear_ = to_binary_string(&[AuraDevRog2::ShutdownRearGlow]);
|
||||
|
||||
assert_eq!(boot_logo_, "00000001, 00000000, 00000000, 00000000");
|
||||
assert_eq!(boot_keyb_, "00000010, 00000000, 00000000, 00000000");
|
||||
assert_eq!(awake_logo, "00000100, 00000000, 00000000, 00000000");
|
||||
assert_eq!(awake_keyb, "00001000, 00000000, 00000000, 00000000");
|
||||
assert_eq!(sleep_logo, "00010000, 00000000, 00000000, 00000000");
|
||||
assert_eq!(sleep_keyb, "00100000, 00000000, 00000000, 00000000");
|
||||
assert_eq!(shut_logo_, "01000000, 00000000, 00000000, 00000000");
|
||||
assert_eq!(shut_keyb_, "10000000, 00000000, 00000000, 00000000");
|
||||
//
|
||||
assert_eq!(boot_bar__, "00000000, 00000010, 00000000, 00000000");
|
||||
assert_eq!(awake_bar_, "00000000, 00000100, 00000000, 00000000");
|
||||
assert_eq!(sleep_bar_, "00000000, 00001000, 00000000, 00000000");
|
||||
assert_eq!(shut_bar__, "00000000, 00010000, 00000000, 00000000");
|
||||
//
|
||||
assert_eq!(boot_lid__, "00000000, 00000000, 00000001, 00000000");
|
||||
assert_eq!(awkae_lid_, "00000000, 00000000, 00000010, 00000000");
|
||||
assert_eq!(sleep_lid_, "00000000, 00000000, 00000100, 00000000");
|
||||
assert_eq!(shut_lid__, "00000000, 00000000, 00001000, 00000000");
|
||||
//
|
||||
assert_eq!(boot_rear_, "00000000, 00000000, 00000000, 00000001");
|
||||
assert_eq!(awake_rear, "00000000, 00000000, 00000000, 00000010");
|
||||
assert_eq!(sleep_rear, "00000000, 00000000, 00000000, 00000100");
|
||||
assert_eq!(shut_rear_, "00000000, 00000000, 00000000, 00001000");
|
||||
|
||||
// All on
|
||||
let byte1 = [
|
||||
AuraDevRog2::BootLogo,
|
||||
AuraDevRog2::BootKeyb,
|
||||
AuraDevRog2::SleepLogo,
|
||||
AuraDevRog2::SleepKeyb,
|
||||
AuraDevRog2::AwakeLogo,
|
||||
AuraDevRog2::AwakeKeyb,
|
||||
AuraDevRog2::ShutdownLogo,
|
||||
AuraDevRog2::ShutdownKeyb,
|
||||
AuraDevRog2::BootBar,
|
||||
AuraDevRog2::AwakeBar,
|
||||
AuraDevRog2::SleepBar,
|
||||
AuraDevRog2::ShutdownBar,
|
||||
AuraDevRog2::AwakeLid,
|
||||
AuraDevRog2::BootLid,
|
||||
AuraDevRog2::SleepLid,
|
||||
AuraDevRog2::ShutdownLid,
|
||||
AuraDevRog2::AwakeRearGlow,
|
||||
AuraDevRog2::BootRearGlow,
|
||||
AuraDevRog2::SleepRearGlow,
|
||||
AuraDevRog2::ShutdownRearGlow,
|
||||
];
|
||||
let out = to_binary_string(&byte1);
|
||||
assert_eq!(out, "11111111, 00011110, 00001111, 00001111");
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,6 +1,5 @@
|
||||
use egui::Ui;
|
||||
use egui::{RichText, Ui};
|
||||
use rog_platform::supported::SupportedFunctions;
|
||||
use rog_profiles::Profile;
|
||||
|
||||
use crate::system_state::{FanCurvesState, ProfilesState, SystemState};
|
||||
use crate::widgets::fan_graphs;
|
||||
@@ -12,10 +11,6 @@ impl RogApp {
|
||||
|
||||
egui::CentralPanel::default().show(ctx, |ui| {
|
||||
ui.heading("Custom fan curves");
|
||||
ui.label(
|
||||
"A fan curve is only active when the related profile is active and the curve is \
|
||||
enabled",
|
||||
);
|
||||
Self::fan_curve(
|
||||
supported,
|
||||
&mut states.profiles,
|
||||
@@ -44,35 +39,68 @@ impl RogApp {
|
||||
ui: &mut Ui,
|
||||
) {
|
||||
ui.separator();
|
||||
ui.label("Enabled fan-curves");
|
||||
|
||||
let mut changed = false;
|
||||
ui.horizontal(|ui| {
|
||||
let mut item = |p: Profile, curves: &mut FanCurvesState, mut checked: bool| {
|
||||
if ui
|
||||
.add(egui::Checkbox::new(&mut checked, format!("{:?}", p)))
|
||||
.changed()
|
||||
{
|
||||
dbus.proxies()
|
||||
.profile()
|
||||
.set_fan_curve_enabled(p, checked)
|
||||
.map_err(|err| {
|
||||
*do_error = Some(err.to_string());
|
||||
})
|
||||
.ok();
|
||||
ui.label("Current profile: ");
|
||||
ui.label(RichText::new(format!("{}", profiles.current)).strong());
|
||||
});
|
||||
|
||||
if !checked {
|
||||
curves.enabled.remove(&p);
|
||||
} else {
|
||||
curves.enabled.insert(p);
|
||||
// ui.horizontal(|ui| {
|
||||
// ui.label("Enabled fan-curves: ");
|
||||
// let mut fan_curve_enable = |profile: Profile, fan: FanCurvePU, mut
|
||||
// checked: bool| { if ui
|
||||
// .add(egui::Checkbox::new(&mut checked, format!("{:?}", fan)))
|
||||
// .changed()
|
||||
// {
|
||||
// dbus.proxies()
|
||||
// .profile()
|
||||
// .set_fan_curves_enabled(profile, checked)
|
||||
// .map_err(|err| {
|
||||
// *do_error = Some(err.to_string());
|
||||
// })
|
||||
// .ok();
|
||||
// changed = true;
|
||||
// }
|
||||
// };
|
||||
|
||||
// if let Some(curves) = curves.curves.get_mut(&profiles.current) {
|
||||
// for curve in curves.iter_mut() {
|
||||
// fan_curve_enable(profiles.current, curve.fan, curve.enabled);
|
||||
// }
|
||||
// }
|
||||
// });
|
||||
|
||||
ui.horizontal(|ui| {
|
||||
ui.label("Enabled fan-curves: ");
|
||||
let mut checked = false;
|
||||
let mut label = String::default();
|
||||
if let Some(curves) = curves.curves.get_mut(&profiles.current) {
|
||||
for curve in curves.iter() {
|
||||
label.push_str(&<&str>::from(curve.fan).to_ascii_uppercase());
|
||||
label.push(' ');
|
||||
if curve.enabled {
|
||||
// TODO: it's possible to set just one fan to active
|
||||
checked = true;
|
||||
}
|
||||
changed = true;
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
profiles.list.sort();
|
||||
for f in &profiles.list {
|
||||
item(*f, curves, curves.enabled.contains(f));
|
||||
if ui
|
||||
.add(egui::Checkbox::new(
|
||||
&mut checked,
|
||||
RichText::new(label).strong(),
|
||||
))
|
||||
.changed()
|
||||
{
|
||||
dbus.proxies()
|
||||
.profile()
|
||||
.set_fan_curves_enabled(profiles.current, checked)
|
||||
.map_err(|err| {
|
||||
*do_error = Some(err.to_string());
|
||||
})
|
||||
.ok();
|
||||
changed = true;
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
@@ -12,7 +12,7 @@ use rog_aura::usb::AuraPowerDev;
|
||||
use rog_aura::{AuraEffect, AuraModeNum};
|
||||
use rog_platform::platform::GpuMode;
|
||||
use rog_platform::supported::SupportedFunctions;
|
||||
use rog_profiles::fan_curve_set::FanCurveSet;
|
||||
use rog_profiles::fan_curve_set::CurveData;
|
||||
use rog_profiles::{FanCurvePU, Profile};
|
||||
use supergfxctl::pci_device::{GfxMode, GfxPower};
|
||||
#[cfg(not(feature = "mocking"))]
|
||||
@@ -96,8 +96,8 @@ impl ProfilesState {
|
||||
pub struct FanCurvesState {
|
||||
pub show_curve: Profile,
|
||||
pub show_graph: FanCurvePU,
|
||||
pub enabled: HashSet<Profile>,
|
||||
pub curves: BTreeMap<Profile, FanCurveSet>,
|
||||
pub curves: BTreeMap<Profile, Vec<CurveData>>,
|
||||
pub available_fans: HashSet<FanCurvePU>,
|
||||
pub drag_delta: Vec2,
|
||||
}
|
||||
|
||||
@@ -108,34 +108,24 @@ impl FanCurvesState {
|
||||
} else {
|
||||
vec![Profile::Balanced, Profile::Quiet, Profile::Performance]
|
||||
};
|
||||
let enabled = if supported.platform_profile.fan_curves {
|
||||
dbus.proxies()
|
||||
.profile()
|
||||
.enabled_fan_profiles()?
|
||||
.iter()
|
||||
.cloned()
|
||||
.collect::<HashSet<_>>()
|
||||
} else {
|
||||
HashSet::from([Profile::Balanced, Profile::Quiet, Profile::Performance])
|
||||
};
|
||||
|
||||
let mut curves: BTreeMap<Profile, FanCurveSet> = BTreeMap::new();
|
||||
let mut curves: BTreeMap<Profile, Vec<CurveData>> = BTreeMap::new();
|
||||
for p in &profiles {
|
||||
if supported.platform_profile.fan_curves {
|
||||
if !supported.platform_profile.fans.is_empty() {
|
||||
if let Ok(curve) = dbus.proxies().profile().fan_curve_data(*p) {
|
||||
curves.insert(*p, curve);
|
||||
}
|
||||
} else {
|
||||
let mut curve = FanCurveSet::default();
|
||||
curve.cpu.pwm = [30, 40, 60, 100, 140, 180, 200, 250];
|
||||
curve.cpu.temp = [20, 30, 40, 50, 70, 80, 90, 100];
|
||||
curve.gpu.pwm = [40, 80, 100, 140, 170, 200, 230, 250];
|
||||
curve.gpu.temp = [20, 30, 40, 50, 70, 80, 90, 100];
|
||||
curves.insert(*p, curve);
|
||||
curves.insert(*p, Vec::default());
|
||||
}
|
||||
}
|
||||
|
||||
let show_curve = if supported.platform_profile.fan_curves {
|
||||
let mut available_fans = HashSet::new();
|
||||
for fan in supported.platform_profile.fans.iter() {
|
||||
available_fans.insert(*fan);
|
||||
}
|
||||
|
||||
let show_curve = if !supported.platform_profile.fans.is_empty() {
|
||||
dbus.proxies().profile().active_profile()?
|
||||
} else {
|
||||
Profile::Balanced
|
||||
@@ -144,8 +134,8 @@ impl FanCurvesState {
|
||||
Ok(Self {
|
||||
show_curve,
|
||||
show_graph: FanCurvePU::CPU,
|
||||
enabled,
|
||||
curves,
|
||||
available_fans,
|
||||
drag_delta: Vec2::default(),
|
||||
})
|
||||
}
|
||||
@@ -177,7 +167,7 @@ impl AuraState {
|
||||
} else {
|
||||
BTreeMap::new()
|
||||
},
|
||||
enabled: dbus.proxies().led().led_powered().unwrap_or_default(),
|
||||
enabled: dbus.proxies().led().led_power().unwrap_or_default(),
|
||||
bright: dbus.proxies().led().led_brightness().unwrap_or_default(),
|
||||
wave_red: [0u8; 22],
|
||||
wave_green: [0u8; 22],
|
||||
@@ -427,11 +417,7 @@ impl Default for SystemState {
|
||||
aura: AuraState {
|
||||
current_mode: AuraModeNum::Static,
|
||||
modes: Default::default(),
|
||||
enabled: AuraPowerDev {
|
||||
tuf: vec![],
|
||||
x1866: vec![],
|
||||
x19b6: vec![],
|
||||
},
|
||||
enabled: AuraPowerDev::default(),
|
||||
..Default::default()
|
||||
},
|
||||
anime: AnimeState::default(),
|
||||
|
||||
@@ -274,19 +274,48 @@ pub fn start_notifications(
|
||||
let conn = zbus::Connection::system()
|
||||
.await
|
||||
.map_err(|e| {
|
||||
error!("zbus signal: receive_power_states: {e}");
|
||||
error!("zbus signal: receive_device_state: {e}");
|
||||
e
|
||||
})
|
||||
.unwrap();
|
||||
let proxy = LedProxy::new(&conn)
|
||||
.await
|
||||
.map_err(|e| {
|
||||
error!("zbus signal: receive_device_state: {e}");
|
||||
e
|
||||
})
|
||||
.unwrap();
|
||||
if let Ok(mut p) = proxy.receive_notify_power_states().await {
|
||||
info!("Started zbus signal thread: receive_notify_power_states");
|
||||
while let Some(e) = p.next().await {
|
||||
if let Ok(out) = e.args() {
|
||||
if let Ok(mut lock) = page_states1.lock() {
|
||||
lock.aura.enabled = out.data;
|
||||
lock.set_notified();
|
||||
}
|
||||
}
|
||||
}
|
||||
};
|
||||
});
|
||||
|
||||
let page_states1 = page_states.clone();
|
||||
tokio::spawn(async move {
|
||||
let conn = zbus::Connection::system()
|
||||
.await
|
||||
.map_err(|e| {
|
||||
error!("zbus signal: receive_device_state: {e}");
|
||||
e
|
||||
})
|
||||
.unwrap();
|
||||
let proxy = AnimeProxy::new(&conn)
|
||||
.await
|
||||
.map_err(|e| {
|
||||
error!("zbus signal: receive_power_states: {e}");
|
||||
error!("zbus signal: receive_device_state: {e}");
|
||||
e
|
||||
})
|
||||
.unwrap();
|
||||
if let Ok(p) = proxy.receive_device_state().await {
|
||||
info!("Started zbus signal thread: receive_power_states");
|
||||
info!("Started zbus signal thread: receive_device_state");
|
||||
p.for_each(|_| {
|
||||
if let Ok(_lock) = page_states1.lock() {
|
||||
// TODO: lock.anime.
|
||||
@@ -320,7 +349,7 @@ pub fn start_notifications(
|
||||
}
|
||||
|
||||
if let Ok(mut p) = proxy.receive_notify_gpu_mux_mode().await {
|
||||
info!("Started zbus signal thread: receive_power_states");
|
||||
info!("Started zbus signal thread: receive_notify_gpu_mux_mode");
|
||||
while let Some(e) = p.next().await {
|
||||
if let Ok(out) = e.args() {
|
||||
if out.mode == actual_mux_mode {
|
||||
|
||||
@@ -1,12 +1,12 @@
|
||||
use egui::{RichText, Ui};
|
||||
use rog_aura::usb::{AuraDevRog1, AuraDevRog2, AuraDevTuf, AuraDevice, AuraPowerDev};
|
||||
use rog_aura::AuraZone;
|
||||
use rog_aura::power::{AuraPower, KbAuraPowerState};
|
||||
use rog_aura::usb::{AuraDevRog1, AuraDevTuf, AuraDevice, AuraPowerDev};
|
||||
use rog_platform::supported::SupportedFunctions;
|
||||
|
||||
use crate::system_state::SystemState;
|
||||
|
||||
pub fn aura_power_group(supported: &SupportedFunctions, states: &mut SystemState, ui: &mut Ui) {
|
||||
ui.heading("LED settings");
|
||||
ui.heading("Keyboard LED power settings");
|
||||
|
||||
match supported.keyboard_led.dev_id {
|
||||
AuraDevice::X1854 | AuraDevice::X1869 | AuraDevice::X1866 => {
|
||||
@@ -22,10 +22,10 @@ pub fn aura_power_group(supported: &SupportedFunctions, states: &mut SystemState
|
||||
|
||||
fn aura_power1(supported: &SupportedFunctions, states: &mut SystemState, ui: &mut Ui) {
|
||||
let enabled_states = &mut states.aura.enabled;
|
||||
let mut boot = enabled_states.x1866.contains(&AuraDevRog1::Boot);
|
||||
let mut sleep = enabled_states.x1866.contains(&AuraDevRog1::Sleep);
|
||||
let mut keyboard = enabled_states.x1866.contains(&AuraDevRog1::Keyboard);
|
||||
let mut lightbar = enabled_states.x1866.contains(&AuraDevRog1::Lightbar);
|
||||
let mut boot = enabled_states.old_rog.contains(&AuraDevRog1::Boot);
|
||||
let mut sleep = enabled_states.old_rog.contains(&AuraDevRog1::Sleep);
|
||||
let mut keyboard = enabled_states.old_rog.contains(&AuraDevRog1::Keyboard);
|
||||
let mut lightbar = enabled_states.old_rog.contains(&AuraDevRog1::Lightbar);
|
||||
if supported.keyboard_led.dev_id == AuraDevice::Tuf {
|
||||
boot = enabled_states.tuf.contains(&AuraDevTuf::Boot);
|
||||
sleep = enabled_states.tuf.contains(&AuraDevTuf::Sleep);
|
||||
@@ -130,8 +130,7 @@ fn aura_power1(supported: &SupportedFunctions, states: &mut SystemState, ui: &mu
|
||||
let mut send = |enable: bool, data: Vec<AuraDevTuf>| {
|
||||
let options = AuraPowerDev {
|
||||
tuf: data,
|
||||
x1866: vec![],
|
||||
x19b6: vec![],
|
||||
..Default::default()
|
||||
};
|
||||
// build data to send
|
||||
states
|
||||
@@ -153,21 +152,21 @@ fn aura_power1(supported: &SupportedFunctions, states: &mut SystemState, ui: &mu
|
||||
let mut modify_x1866 = |b: bool, a: AuraDevRog1| {
|
||||
if b {
|
||||
enabled.push(a);
|
||||
if !enabled_states.x1866.contains(&a) {
|
||||
enabled_states.x1866.push(a);
|
||||
if !enabled_states.old_rog.contains(&a) {
|
||||
enabled_states.old_rog.push(a);
|
||||
}
|
||||
} else {
|
||||
disabled.push(a);
|
||||
// This would be so much better as a hashset
|
||||
if enabled_states.x1866.contains(&a) {
|
||||
if enabled_states.old_rog.contains(&a) {
|
||||
let mut idx = 0;
|
||||
for (i, n) in enabled_states.x1866.iter().enumerate() {
|
||||
for (i, n) in enabled_states.old_rog.iter().enumerate() {
|
||||
if *n == a {
|
||||
idx = i;
|
||||
break;
|
||||
}
|
||||
}
|
||||
enabled_states.x1866.remove(idx);
|
||||
enabled_states.old_rog.remove(idx);
|
||||
}
|
||||
}
|
||||
};
|
||||
@@ -180,9 +179,8 @@ fn aura_power1(supported: &SupportedFunctions, states: &mut SystemState, ui: &mu
|
||||
|
||||
let mut send = |enable: bool, data: Vec<AuraDevRog1>| {
|
||||
let options = AuraPowerDev {
|
||||
tuf: vec![],
|
||||
x1866: data,
|
||||
x19b6: vec![],
|
||||
old_rog: data,
|
||||
..Default::default()
|
||||
};
|
||||
// build data to send
|
||||
states
|
||||
@@ -202,115 +200,52 @@ fn aura_power1(supported: &SupportedFunctions, states: &mut SystemState, ui: &mu
|
||||
}
|
||||
|
||||
fn aura_power2(supported: &SupportedFunctions, states: &mut SystemState, ui: &mut Ui) {
|
||||
let enabled_states = &mut states.aura.enabled;
|
||||
let has_logo = supported.keyboard_led.basic_zones.contains(&AuraZone::Logo);
|
||||
let has_lightbar = supported
|
||||
.keyboard_led
|
||||
.basic_zones
|
||||
.contains(&AuraZone::BarLeft)
|
||||
|| supported
|
||||
.keyboard_led
|
||||
.basic_zones
|
||||
.contains(&AuraZone::BarRight);
|
||||
let AuraPower {
|
||||
keyboard,
|
||||
logo,
|
||||
lightbar,
|
||||
lid,
|
||||
rear_glow,
|
||||
} = &mut states.aura.enabled.rog;
|
||||
|
||||
let boot_bar = &mut enabled_states.x19b6.contains(&AuraDevRog2::AwakeBar);
|
||||
let boot_logo = &mut enabled_states.x19b6.contains(&AuraDevRog2::BootLogo);
|
||||
let boot_keyb = &mut enabled_states.x19b6.contains(&AuraDevRog2::BootKeyb);
|
||||
|
||||
let awake_bar = &mut enabled_states.x19b6.contains(&AuraDevRog2::BootBar);
|
||||
let awake_logo = &mut enabled_states.x19b6.contains(&AuraDevRog2::AwakeLogo);
|
||||
let awake_keyb = &mut enabled_states.x19b6.contains(&AuraDevRog2::AwakeKeyb);
|
||||
|
||||
let sleep_bar = &mut enabled_states.x19b6.contains(&AuraDevRog2::SleepBar);
|
||||
let sleep_logo = &mut enabled_states.x19b6.contains(&AuraDevRog2::SleepLogo);
|
||||
let sleep_keyb = &mut enabled_states.x19b6.contains(&AuraDevRog2::SleepKeyb);
|
||||
const LABELS: [&str; 4] = ["Boot", "Awake", "Sleep", "Shutdown"];
|
||||
|
||||
let mut changed = false;
|
||||
|
||||
let mut item = |keyboard: &mut bool, logo: &mut bool, lightbar: &mut bool, ui: &mut Ui| {
|
||||
ui.horizontal_wrapped(|ui| {
|
||||
if ui.checkbox(keyboard, "Keyboard").changed() {
|
||||
changed = true;
|
||||
}
|
||||
if has_logo && ui.checkbox(logo, "Logo").changed() {
|
||||
changed = true;
|
||||
}
|
||||
if has_lightbar && ui.checkbox(lightbar, "Lightbar").changed() {
|
||||
changed = true;
|
||||
let mut item = |power: &mut KbAuraPowerState, ui: &mut Ui| {
|
||||
ui.vertical(|ui| {
|
||||
if supported.keyboard_led.power_zones.contains(&power.zone) {
|
||||
ui.horizontal_wrapped(|ui| {
|
||||
ui.label(RichText::new(format!("{:?}", power.zone)).size(14.0));
|
||||
});
|
||||
if ui.checkbox(&mut power.boot, LABELS[0]).changed() {
|
||||
changed = true;
|
||||
}
|
||||
if ui.checkbox(&mut power.awake, LABELS[1]).changed() {
|
||||
changed = true;
|
||||
}
|
||||
if ui.checkbox(&mut power.sleep, LABELS[2]).changed() {
|
||||
changed = true;
|
||||
}
|
||||
if ui.checkbox(&mut power.shutdown, LABELS[3]).changed() {
|
||||
changed = true;
|
||||
}
|
||||
}
|
||||
});
|
||||
};
|
||||
|
||||
ui.horizontal_wrapped(|ui| {
|
||||
ui.vertical(|ui| {
|
||||
let h = 16.0;
|
||||
ui.set_row_height(22.0);
|
||||
ui.horizontal_wrapped(|ui| {
|
||||
ui.label(RichText::new("Boot").size(h));
|
||||
});
|
||||
ui.horizontal_wrapped(|ui| {
|
||||
ui.label(RichText::new("Awake").size(h));
|
||||
});
|
||||
ui.horizontal_wrapped(|ui| {
|
||||
ui.label(RichText::new("Sleep").size(h));
|
||||
});
|
||||
});
|
||||
ui.vertical(|ui| {
|
||||
ui.set_row_height(22.0);
|
||||
item(boot_keyb, boot_logo, boot_bar, ui);
|
||||
item(awake_keyb, awake_logo, awake_bar, ui);
|
||||
item(sleep_keyb, sleep_logo, sleep_bar, ui);
|
||||
});
|
||||
item(lid, ui);
|
||||
item(logo, ui);
|
||||
item(keyboard, ui);
|
||||
item(lightbar, ui);
|
||||
item(rear_glow, ui);
|
||||
});
|
||||
|
||||
if changed {
|
||||
let mut enabled = Vec::new();
|
||||
let mut disabled = Vec::new();
|
||||
|
||||
let mut modify = |b: bool, a: AuraDevRog2| {
|
||||
if b {
|
||||
enabled.push(a);
|
||||
if !enabled_states.x19b6.contains(&a) {
|
||||
enabled_states.x19b6.push(a);
|
||||
}
|
||||
} else {
|
||||
disabled.push(a);
|
||||
// This would be so much better as a hashset
|
||||
if enabled_states.x19b6.contains(&a) {
|
||||
let mut idx = 0;
|
||||
for (i, n) in enabled_states.x19b6.iter().enumerate() {
|
||||
if *n == a {
|
||||
idx = i;
|
||||
break;
|
||||
}
|
||||
}
|
||||
enabled_states.x19b6.remove(idx);
|
||||
}
|
||||
}
|
||||
};
|
||||
modify(*boot_keyb, AuraDevRog2::BootKeyb);
|
||||
modify(*sleep_keyb, AuraDevRog2::SleepKeyb);
|
||||
modify(*awake_keyb, AuraDevRog2::AwakeKeyb);
|
||||
if supported.keyboard_led.basic_zones.contains(&AuraZone::Logo) {
|
||||
modify(*boot_logo, AuraDevRog2::BootLogo);
|
||||
modify(*sleep_logo, AuraDevRog2::SleepLogo);
|
||||
modify(*awake_logo, AuraDevRog2::AwakeLogo);
|
||||
}
|
||||
if supported
|
||||
.keyboard_led
|
||||
.basic_zones
|
||||
.contains(&AuraZone::BarLeft)
|
||||
{
|
||||
modify(*boot_bar, AuraDevRog2::AwakeBar);
|
||||
modify(*sleep_bar, AuraDevRog2::SleepBar);
|
||||
modify(*awake_bar, AuraDevRog2::BootBar);
|
||||
}
|
||||
|
||||
let mut send = |enable: bool, data: Vec<AuraDevRog2>| {
|
||||
let mut send = |enable: bool, data: AuraPower| {
|
||||
let options = AuraPowerDev {
|
||||
tuf: vec![],
|
||||
x1866: vec![],
|
||||
x19b6: data,
|
||||
rog: data,
|
||||
..Default::default()
|
||||
};
|
||||
// build data to send
|
||||
states
|
||||
@@ -323,7 +258,15 @@ fn aura_power2(supported: &SupportedFunctions, states: &mut SystemState, ui: &mu
|
||||
})
|
||||
.ok();
|
||||
};
|
||||
send(true, enabled);
|
||||
send(false, disabled);
|
||||
send(
|
||||
true,
|
||||
AuraPower {
|
||||
keyboard: *keyboard,
|
||||
logo: *logo,
|
||||
lightbar: *lightbar,
|
||||
lid: *lid,
|
||||
rear_glow: *rear_glow,
|
||||
},
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
use egui::plot::Points;
|
||||
use egui::Ui;
|
||||
use rog_platform::supported::SupportedFunctions;
|
||||
use rog_profiles::fan_curve_set::CurveData;
|
||||
use rog_profiles::{FanCurvePU, Profile};
|
||||
|
||||
use crate::system_state::FanCurvesState;
|
||||
@@ -15,20 +16,36 @@ pub fn fan_graphs(
|
||||
) {
|
||||
ui.separator();
|
||||
|
||||
let mut item = |p: Profile, ui: &mut Ui| {
|
||||
let mut item = |profile: Profile, ui: &mut Ui| {
|
||||
ui.group(|ui| {
|
||||
ui.selectable_value(&mut curves.show_curve, p, format!("{p:?}"));
|
||||
ui.add_enabled_ui(curves.show_curve == p, |ui| {
|
||||
ui.selectable_value(
|
||||
&mut curves.show_graph,
|
||||
FanCurvePU::CPU,
|
||||
format!("{:?}", FanCurvePU::CPU),
|
||||
);
|
||||
ui.selectable_value(
|
||||
&mut curves.show_graph,
|
||||
FanCurvePU::GPU,
|
||||
format!("{:?}", FanCurvePU::GPU),
|
||||
);
|
||||
if ui
|
||||
.selectable_value(&mut curves.show_curve, profile, format!("{profile:?}"))
|
||||
.clicked()
|
||||
{
|
||||
dbus.proxies().profile().set_active_profile(profile).ok();
|
||||
}
|
||||
ui.add_enabled_ui(curves.show_curve == profile, |ui| {
|
||||
if curves.available_fans.contains(&FanCurvePU::CPU) {
|
||||
ui.selectable_value(
|
||||
&mut curves.show_graph,
|
||||
FanCurvePU::CPU,
|
||||
format!("{:?}", FanCurvePU::CPU),
|
||||
);
|
||||
}
|
||||
if curves.available_fans.contains(&FanCurvePU::GPU) {
|
||||
ui.selectable_value(
|
||||
&mut curves.show_graph,
|
||||
FanCurvePU::GPU,
|
||||
format!("{:?}", FanCurvePU::GPU),
|
||||
);
|
||||
}
|
||||
if curves.available_fans.contains(&FanCurvePU::MID) {
|
||||
ui.selectable_value(
|
||||
&mut curves.show_graph,
|
||||
FanCurvePU::MID,
|
||||
format!("{:?}", FanCurvePU::MID),
|
||||
);
|
||||
}
|
||||
});
|
||||
});
|
||||
};
|
||||
@@ -43,11 +60,13 @@ pub fn fan_graphs(
|
||||
|
||||
use egui::plot::{Line, Plot};
|
||||
|
||||
let data = if curves.show_graph == FanCurvePU::CPU {
|
||||
&mut curve.cpu
|
||||
} else {
|
||||
&mut curve.gpu
|
||||
};
|
||||
let mut data = &mut CurveData::default();
|
||||
for c in curve {
|
||||
if c.fan == curves.show_graph {
|
||||
data = c;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
let mut points: Vec<[f64; 2]> = data
|
||||
.temp
|
||||
|
||||
@@ -18,7 +18,7 @@ impl RogApp {
|
||||
*page = Page::System;
|
||||
}
|
||||
|
||||
if self.supported.platform_profile.fan_curves {
|
||||
if !self.supported.platform_profile.fans.is_empty() {
|
||||
ui.separator();
|
||||
if ui
|
||||
.selectable_value(page, Page::FanCurves, "Fan Curves")
|
||||
|
||||
@@ -79,7 +79,7 @@ trait Led {
|
||||
|
||||
// As property doesn't work for AuraPowerDev (complexity of serialization?)
|
||||
// #[dbus_proxy(property)]
|
||||
fn led_powered(&self) -> zbus::Result<AuraPowerDev>;
|
||||
fn led_power(&self) -> zbus::Result<AuraPowerDev>;
|
||||
}
|
||||
|
||||
pub struct LedProxyPerkey<'a>(LedProxyBlocking<'a>);
|
||||
|
||||
@@ -20,8 +20,8 @@
|
||||
//!
|
||||
//! …consequently `zbus-xmlgen` did not generate code for the above interfaces.
|
||||
|
||||
use rog_profiles::fan_curve_set::{CurveData, FanCurveSet};
|
||||
use rog_profiles::Profile;
|
||||
use rog_profiles::fan_curve_set::CurveData;
|
||||
use rog_profiles::{FanCurvePU, Profile};
|
||||
use zbus::dbus_proxy;
|
||||
|
||||
#[dbus_proxy(
|
||||
@@ -30,14 +30,11 @@ use zbus::dbus_proxy;
|
||||
)]
|
||||
trait Profile {
|
||||
/// Get the fan-curve data for the currently active Profile
|
||||
fn fan_curve_data(&self, profile: Profile) -> zbus::Result<FanCurveSet>;
|
||||
fn fan_curve_data(&self, profile: Profile) -> zbus::Result<Vec<CurveData>>;
|
||||
|
||||
/// Fetch the active profile name
|
||||
fn active_profile(&self) -> zbus::Result<Profile>;
|
||||
|
||||
/// Get a list of profiles that have fan-curves enabled.
|
||||
fn enabled_fan_profiles(&self) -> zbus::Result<Vec<Profile>>;
|
||||
|
||||
/// Toggle to next platform_profile. Names provided by `Profiles`.
|
||||
/// If fan-curves are supported will also activate a fan curve for profile.
|
||||
fn next_profile(&self) -> zbus::Result<()>;
|
||||
@@ -49,7 +46,16 @@ trait Profile {
|
||||
fn set_active_profile(&self, profile: Profile) -> zbus::Result<()>;
|
||||
|
||||
/// Set a profile fan curve enabled status. Will also activate a fan curve.
|
||||
fn set_fan_curve_enabled(&self, profile: Profile, enabled: bool) -> zbus::Result<()>;
|
||||
fn set_fan_curves_enabled(&self, profile: Profile, 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(
|
||||
&mut self,
|
||||
profile: Profile,
|
||||
fan: FanCurvePU,
|
||||
enabled: bool,
|
||||
) -> 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.
|
||||
|
||||
@@ -7,6 +7,7 @@ edition = "2021"
|
||||
[dependencies]
|
||||
log.workspace = true
|
||||
rog_aura = { path = "../rog-aura" }
|
||||
rog_profiles = { path = "../rog-profiles" }
|
||||
serde.workspace = true
|
||||
serde_derive.workspace = true
|
||||
zbus.workspace = true
|
||||
|
||||
@@ -3,6 +3,7 @@ use std::fmt;
|
||||
use rog_aura::aura_detection::PowerZones;
|
||||
use rog_aura::usb::AuraDevice;
|
||||
use rog_aura::{AdvancedAuraType, AuraModeNum, AuraZone};
|
||||
use rog_profiles::FanCurvePU;
|
||||
use serde_derive::{Deserialize, Serialize};
|
||||
use typeshare::typeshare;
|
||||
use zbus::zvariant::Type;
|
||||
@@ -31,7 +32,7 @@ pub struct ChargeSupportedFunctions {
|
||||
#[derive(Serialize, Deserialize, Type, Debug, Default, Clone)]
|
||||
pub struct PlatformProfileFunctions {
|
||||
pub platform_profile: bool,
|
||||
pub fan_curves: bool,
|
||||
pub fans: Vec<FanCurvePU>,
|
||||
}
|
||||
|
||||
#[typeshare]
|
||||
@@ -106,7 +107,7 @@ impl fmt::Display for PlatformProfileFunctions {
|
||||
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
|
||||
writeln!(f, "Platform profiles:")?;
|
||||
writeln!(f, "\tplatform: {}", self.platform_profile)?;
|
||||
writeln!(f, "\tfan curves: {}", self.fan_curves)
|
||||
writeln!(f, "\tfan curves: {:?}", self.fans)
|
||||
}
|
||||
}
|
||||
impl fmt::Display for LedSupportedFunctions {
|
||||
|
||||
@@ -10,6 +10,7 @@ default = ["dbus"]
|
||||
dbus = ["zbus"]
|
||||
|
||||
[dependencies]
|
||||
log.workspace = true
|
||||
udev.workspace = true
|
||||
serde.workspace = true
|
||||
serde_derive.workspace = true
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
use log::trace;
|
||||
use serde_derive::{Deserialize, Serialize};
|
||||
use typeshare::typeshare;
|
||||
use udev::Device;
|
||||
@@ -8,7 +9,8 @@ use crate::error::ProfileError;
|
||||
use crate::FanCurvePU;
|
||||
|
||||
pub(crate) fn pwm_str(fan: char, index: usize) -> String {
|
||||
let mut buf = "pwm1_auto_point1_pwm".to_owned();
|
||||
// The char 'X' is replaced via indexing
|
||||
let mut buf = "pwmX_auto_pointX_pwm".to_owned();
|
||||
unsafe {
|
||||
let tmp = buf.as_bytes_mut();
|
||||
tmp[3] = fan as u8;
|
||||
@@ -18,7 +20,8 @@ pub(crate) fn pwm_str(fan: char, index: usize) -> String {
|
||||
}
|
||||
|
||||
pub(crate) fn temp_str(fan: char, index: usize) -> String {
|
||||
let mut buf = "pwm1_auto_point1_temp".to_owned();
|
||||
// The char 'X' is replaced via indexing
|
||||
let mut buf = "pwmX_auto_pointX_temp".to_owned();
|
||||
unsafe {
|
||||
let tmp = buf.as_bytes_mut();
|
||||
tmp[3] = fan as u8;
|
||||
@@ -34,6 +37,7 @@ pub struct CurveData {
|
||||
pub fan: FanCurvePU,
|
||||
pub pwm: [u8; 8],
|
||||
pub temp: [u8; 8],
|
||||
pub enabled: bool,
|
||||
}
|
||||
|
||||
impl From<&CurveData> for String {
|
||||
@@ -65,7 +69,7 @@ impl std::str::FromStr for CurveData {
|
||||
type Err = ProfileError;
|
||||
|
||||
/// Parse a string to the correct values that the fan curve kernel driver
|
||||
/// expects
|
||||
/// expects. The returned `CurveData` is not enabled by default.
|
||||
///
|
||||
/// If the fan curve is given with percentage char '%' then the fan power
|
||||
/// values are converted otherwise the expected fan power range is
|
||||
@@ -126,6 +130,7 @@ impl std::str::FromStr for CurveData {
|
||||
fan: FanCurvePU::CPU,
|
||||
pwm,
|
||||
temp,
|
||||
enabled: false,
|
||||
})
|
||||
}
|
||||
}
|
||||
@@ -144,114 +149,39 @@ impl CurveData {
|
||||
}
|
||||
}
|
||||
|
||||
fn read_from_device(&mut self, device: &Device) {
|
||||
pub fn read_from_device(&mut self, device: &Device) {
|
||||
for attr in device.attributes() {
|
||||
let tmp = attr.name().to_string_lossy();
|
||||
if tmp.starts_with("pwm1") && tmp.ends_with("_temp") {
|
||||
let pwm_num: char = self.fan.into();
|
||||
let pwm = format!("pwm{pwm_num}");
|
||||
if tmp.starts_with(&pwm) && tmp.ends_with("_temp") {
|
||||
Self::set_val_from_attr(tmp.as_ref(), device, &mut self.temp);
|
||||
}
|
||||
if tmp.starts_with("pwm1") && tmp.ends_with("_pwm") {
|
||||
if tmp.starts_with(&pwm) && tmp.ends_with("_pwm") {
|
||||
Self::set_val_from_attr(tmp.as_ref(), device, &mut self.pwm);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
fn init_if_zeroed(&mut self, device: &mut Device) -> std::io::Result<()> {
|
||||
if self.pwm == [0u8; 8] && self.temp == [0u8; 8] {
|
||||
// Need to reset the device to defaults to get the proper profile defaults
|
||||
match self.fan {
|
||||
FanCurvePU::CPU => device.set_attribute_value("pwm1_enable", "3")?,
|
||||
FanCurvePU::GPU => device.set_attribute_value("pwm2_enable", "3")?,
|
||||
};
|
||||
self.read_from_device(device);
|
||||
}
|
||||
Ok(())
|
||||
}
|
||||
|
||||
/// Write this curve to the device fan specified by `self.fan`
|
||||
fn write_to_device(&self, device: &mut Device, enable: bool) -> std::io::Result<()> {
|
||||
let pwm_num = match self.fan {
|
||||
FanCurvePU::CPU => '1',
|
||||
FanCurvePU::GPU => '2',
|
||||
};
|
||||
let enable = if enable { "1" } else { "2" };
|
||||
pub fn write_to_device(&self, device: &mut Device) -> std::io::Result<()> {
|
||||
let pwm_num: char = self.fan.into();
|
||||
let enable = if self.enabled { "1" } else { "2" };
|
||||
|
||||
for (index, out) in self.pwm.iter().enumerate() {
|
||||
let pwm = pwm_str(pwm_num, index);
|
||||
trace!("writing {pwm}");
|
||||
device.set_attribute_value(&pwm, &out.to_string())?;
|
||||
}
|
||||
|
||||
for (index, out) in self.temp.iter().enumerate() {
|
||||
let temp = temp_str(pwm_num, index);
|
||||
trace!("writing {temp}");
|
||||
device.set_attribute_value(&temp, &out.to_string())?;
|
||||
}
|
||||
|
||||
// Enable must be done *after* all points are written
|
||||
match self.fan {
|
||||
FanCurvePU::CPU => device.set_attribute_value("pwm1_enable", enable)?,
|
||||
FanCurvePU::GPU => device.set_attribute_value("pwm2_enable", enable)?,
|
||||
};
|
||||
|
||||
Ok(())
|
||||
}
|
||||
}
|
||||
|
||||
/// A `FanCurveSet` contains both CPU and GPU fan curve data
|
||||
#[typeshare]
|
||||
#[cfg_attr(feature = "dbus", derive(Type))]
|
||||
#[derive(Deserialize, Serialize, Debug, Clone)]
|
||||
pub struct FanCurveSet {
|
||||
pub enabled: bool,
|
||||
pub cpu: CurveData,
|
||||
pub gpu: CurveData,
|
||||
}
|
||||
|
||||
impl Default for FanCurveSet {
|
||||
fn default() -> Self {
|
||||
Self {
|
||||
enabled: false,
|
||||
cpu: CurveData {
|
||||
fan: FanCurvePU::CPU,
|
||||
pwm: [0u8; 8],
|
||||
temp: [0u8; 8],
|
||||
},
|
||||
gpu: CurveData {
|
||||
fan: FanCurvePU::GPU,
|
||||
pwm: [0u8; 8],
|
||||
temp: [0u8; 8],
|
||||
},
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
impl From<&FanCurveSet> for String {
|
||||
fn from(s: &FanCurveSet) -> Self {
|
||||
format!(
|
||||
"Enabled: {}, {}, {}",
|
||||
s.enabled,
|
||||
String::from(&s.cpu),
|
||||
String::from(&s.gpu),
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
impl FanCurveSet {
|
||||
pub(crate) fn read_cpu_from_device(&mut self, device: &Device) {
|
||||
self.cpu.read_from_device(device);
|
||||
}
|
||||
|
||||
pub(crate) fn read_gpu_from_device(&mut self, device: &Device) {
|
||||
self.gpu.read_from_device(device);
|
||||
}
|
||||
|
||||
pub(crate) fn write_cpu_fan(&mut self, device: &mut Device) -> std::io::Result<()> {
|
||||
self.cpu.init_if_zeroed(device)?;
|
||||
self.cpu.write_to_device(device, self.enabled)
|
||||
}
|
||||
|
||||
pub(crate) fn write_gpu_fan(&mut self, device: &mut Device) -> std::io::Result<()> {
|
||||
self.gpu.init_if_zeroed(device)?;
|
||||
self.gpu.write_to_device(device, self.enabled)
|
||||
device.set_attribute_value(format!("pwm{pwm_num}_enable"), enable)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -315,14 +245,14 @@ mod tests {
|
||||
assert_eq!(temp_str('1', 7), "pwm1_auto_point8_temp");
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn set_to_string() {
|
||||
let set = FanCurveSet::default();
|
||||
let string = String::from(&set);
|
||||
assert_eq!(
|
||||
string.as_str(),
|
||||
"Enabled: false, CPU: 0c:0%,0c:0%,0c:0%,0c:0%,0c:0%,0c:0%,0c:0%,0c:0%, GPU: \
|
||||
0c:0%,0c:0%,0c:0%,0c:0%,0c:0%,0c:0%,0c:0%,0c:0%"
|
||||
);
|
||||
}
|
||||
// #[test]
|
||||
// fn set_to_string() {
|
||||
// let set = FanCurveSet::default();
|
||||
// let string = String::from(&set);
|
||||
// assert_eq!(
|
||||
// string.as_str(),
|
||||
// "Enabled: false, CPU:
|
||||
// 0c:0%,0c:0%,0c:0%,0c:0%,0c:0%,0c:0%,0c:0%,0c:0%, GPU: \ 0c:
|
||||
// 0%,0c:0%,0c:0%,0c:0%,0c:0%,0c:0%,0c:0%,0c:0%" );
|
||||
// }
|
||||
}
|
||||
|
||||
+175
-92
@@ -7,7 +7,8 @@ use std::io::Write;
|
||||
use std::path::Path;
|
||||
|
||||
use error::ProfileError;
|
||||
use fan_curve_set::{CurveData, FanCurveSet};
|
||||
use fan_curve_set::CurveData;
|
||||
use log::debug;
|
||||
use serde_derive::{Deserialize, Serialize};
|
||||
use typeshare::typeshare;
|
||||
use udev::Device;
|
||||
@@ -131,10 +132,30 @@ impl Display for Profile {
|
||||
|
||||
#[typeshare]
|
||||
#[cfg_attr(feature = "dbus", derive(Type), zvariant(signature = "s"))]
|
||||
#[derive(Deserialize, Serialize, Debug, PartialEq, Eq, Clone, Copy)]
|
||||
#[derive(Deserialize, Serialize, Debug, Hash, PartialEq, Eq, Clone, Copy)]
|
||||
pub enum FanCurvePU {
|
||||
CPU,
|
||||
GPU,
|
||||
MID,
|
||||
}
|
||||
|
||||
impl FanCurvePU {
|
||||
fn which_fans(device: &Device) -> Vec<Self> {
|
||||
let mut fans = Vec::with_capacity(3);
|
||||
for fan in [Self::CPU, Self::GPU, Self::MID] {
|
||||
let pwm_num: char = fan.into();
|
||||
let pwm_enable = format!("pwm{pwm_num}_enable");
|
||||
debug!("Looking for {pwm_enable}");
|
||||
for attr in device.attributes() {
|
||||
let tmp = attr.name().to_string_lossy();
|
||||
if tmp.contains(&pwm_enable) {
|
||||
debug!("Found {pwm_enable}");
|
||||
fans.push(fan);
|
||||
}
|
||||
}
|
||||
}
|
||||
fans
|
||||
}
|
||||
}
|
||||
|
||||
impl From<FanCurvePU> for &str {
|
||||
@@ -142,6 +163,17 @@ impl From<FanCurvePU> for &str {
|
||||
match pu {
|
||||
FanCurvePU::CPU => "cpu",
|
||||
FanCurvePU::GPU => "gpu",
|
||||
FanCurvePU::MID => "mid",
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
impl From<FanCurvePU> for char {
|
||||
fn from(pu: FanCurvePU) -> char {
|
||||
match pu {
|
||||
FanCurvePU::CPU => '1',
|
||||
FanCurvePU::GPU => '2',
|
||||
FanCurvePU::MID => '3',
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -153,6 +185,7 @@ impl std::str::FromStr for FanCurvePU {
|
||||
match fan.to_ascii_lowercase().trim() {
|
||||
"cpu" => Ok(FanCurvePU::CPU),
|
||||
"gpu" => Ok(FanCurvePU::GPU),
|
||||
"mid" => Ok(FanCurvePU::MID),
|
||||
_ => Err(ProfileError::ParseProfileName),
|
||||
}
|
||||
}
|
||||
@@ -169,9 +202,9 @@ impl Default for FanCurvePU {
|
||||
#[cfg_attr(feature = "dbus", derive(Type))]
|
||||
#[derive(Deserialize, Serialize, Debug, Default)]
|
||||
pub struct FanCurveProfiles {
|
||||
pub balanced: FanCurveSet,
|
||||
pub performance: FanCurveSet,
|
||||
pub quiet: FanCurveSet,
|
||||
pub balanced: Vec<CurveData>,
|
||||
pub performance: Vec<CurveData>,
|
||||
pub quiet: Vec<CurveData>,
|
||||
}
|
||||
|
||||
impl FanCurveProfiles {
|
||||
@@ -180,35 +213,49 @@ impl FanCurveProfiles {
|
||||
enumerator.match_subsystem("hwmon")?;
|
||||
|
||||
for device in enumerator.scan_devices()? {
|
||||
// if device.parent_with_subsystem("platform")?.is_some() {
|
||||
if let Some(name) = device.attribute_value("name") {
|
||||
if name == "asus_custom_fan_curve" {
|
||||
debug!("asus_custom_fan_curve found");
|
||||
return Ok(device);
|
||||
}
|
||||
}
|
||||
// }
|
||||
}
|
||||
Err(ProfileError::NotSupported)
|
||||
}
|
||||
|
||||
pub fn is_supported() -> Result<bool, ProfileError> {
|
||||
if Self::get_device().is_ok() {
|
||||
return Ok(true);
|
||||
}
|
||||
|
||||
Ok(false)
|
||||
/// Return an array of `FanCurvePU`. An empty array indicates no support for
|
||||
/// Curves.
|
||||
pub fn supported_fans() -> Result<Vec<FanCurvePU>, ProfileError> {
|
||||
let device = Self::get_device()?;
|
||||
Ok(FanCurvePU::which_fans(&device))
|
||||
}
|
||||
|
||||
///
|
||||
pub fn read_from_dev_profile(&mut self, profile: Profile, device: &Device) {
|
||||
let mut tmp = FanCurveSet::default();
|
||||
tmp.read_cpu_from_device(device);
|
||||
tmp.read_gpu_from_device(device);
|
||||
match profile {
|
||||
Profile::Balanced => self.balanced = tmp,
|
||||
Profile::Performance => self.performance = tmp,
|
||||
Profile::Quiet => self.quiet = tmp,
|
||||
pub fn read_from_dev_profile(
|
||||
&mut self,
|
||||
profile: Profile,
|
||||
device: &Device,
|
||||
) -> Result<(), ProfileError> {
|
||||
let fans = Self::supported_fans()?;
|
||||
let mut curves = Vec::with_capacity(3);
|
||||
|
||||
for fan in fans {
|
||||
let mut curve = CurveData {
|
||||
fan,
|
||||
..Default::default()
|
||||
};
|
||||
debug!("Reading curve for {fan:?}");
|
||||
curve.read_from_device(device);
|
||||
debug!("Curve: {curve:?}");
|
||||
curves.push(curve);
|
||||
}
|
||||
|
||||
match profile {
|
||||
Profile::Balanced => self.balanced = curves,
|
||||
Profile::Performance => self.performance = curves,
|
||||
Profile::Quiet => self.quiet = curves,
|
||||
}
|
||||
Ok(())
|
||||
}
|
||||
|
||||
/// Reset the stored (self) and device curve to the defaults of the
|
||||
@@ -220,19 +267,15 @@ impl FanCurveProfiles {
|
||||
&mut self,
|
||||
profile: Profile,
|
||||
device: &mut Device,
|
||||
) -> std::io::Result<()> {
|
||||
// Do reset
|
||||
device.set_attribute_value("pwm1_enable", "3")?;
|
||||
device.set_attribute_value("pwm2_enable", "3")?;
|
||||
// Then read
|
||||
let mut tmp = FanCurveSet::default();
|
||||
tmp.read_cpu_from_device(device);
|
||||
tmp.read_gpu_from_device(device);
|
||||
match profile {
|
||||
Profile::Balanced => self.balanced = tmp,
|
||||
Profile::Performance => self.performance = tmp,
|
||||
Profile::Quiet => self.quiet = tmp,
|
||||
) -> Result<(), ProfileError> {
|
||||
let fans = Self::supported_fans()?;
|
||||
// Do reset for all
|
||||
for fan in fans {
|
||||
let pwm_num: char = fan.into();
|
||||
let pwm = format!("pwm{pwm_num}_enable");
|
||||
device.set_attribute_value(&pwm, "3")?;
|
||||
}
|
||||
self.read_from_dev_profile(profile, device)?;
|
||||
Ok(())
|
||||
}
|
||||
|
||||
@@ -250,50 +293,68 @@ impl FanCurveProfiles {
|
||||
Profile::Performance => &mut self.performance,
|
||||
Profile::Quiet => &mut self.quiet,
|
||||
};
|
||||
fans.write_cpu_fan(device)?;
|
||||
fans.write_gpu_fan(device)?;
|
||||
for fan in fans {
|
||||
debug!("write_profile_curve_to_platform: writing profile:{profile}, {fan:?}");
|
||||
fan.write_to_device(device)?;
|
||||
}
|
||||
Ok(())
|
||||
}
|
||||
|
||||
pub fn get_enabled_curve_profiles(&self) -> Vec<Profile> {
|
||||
let mut tmp = Vec::new();
|
||||
if self.balanced.enabled {
|
||||
tmp.push(Profile::Balanced);
|
||||
}
|
||||
if self.performance.enabled {
|
||||
tmp.push(Profile::Performance);
|
||||
}
|
||||
if self.quiet.enabled {
|
||||
tmp.push(Profile::Quiet);
|
||||
}
|
||||
tmp
|
||||
}
|
||||
|
||||
pub fn set_profile_curve_enabled(&mut self, profile: Profile, enabled: bool) {
|
||||
pub fn set_profile_curves_enabled(&mut self, profile: Profile, enabled: bool) {
|
||||
match profile {
|
||||
Profile::Balanced => self.balanced.enabled = enabled,
|
||||
Profile::Performance => self.performance.enabled = enabled,
|
||||
Profile::Quiet => self.quiet.enabled = enabled,
|
||||
Profile::Balanced => {
|
||||
for curve in self.balanced.iter_mut() {
|
||||
curve.enabled = enabled;
|
||||
}
|
||||
}
|
||||
Profile::Performance => {
|
||||
for curve in self.performance.iter_mut() {
|
||||
curve.enabled = enabled;
|
||||
}
|
||||
}
|
||||
Profile::Quiet => {
|
||||
for curve in self.quiet.iter_mut() {
|
||||
curve.enabled = enabled;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
pub fn get_all_fan_curves(&self) -> Vec<FanCurveSet> {
|
||||
vec![
|
||||
self.balanced.clone(),
|
||||
self.performance.clone(),
|
||||
self.quiet.clone(),
|
||||
]
|
||||
}
|
||||
|
||||
pub fn get_active_fan_curves(&self) -> Result<&FanCurveSet, ProfileError> {
|
||||
match Profile::get_active_profile()? {
|
||||
Profile::Balanced => Ok(&self.balanced),
|
||||
Profile::Performance => Ok(&self.performance),
|
||||
Profile::Quiet => Ok(&self.quiet),
|
||||
pub fn set_profile_fan_curve_enabled(
|
||||
&mut self,
|
||||
profile: Profile,
|
||||
fan: FanCurvePU,
|
||||
enabled: bool,
|
||||
) {
|
||||
match profile {
|
||||
Profile::Balanced => {
|
||||
for curve in self.balanced.iter_mut() {
|
||||
if curve.fan == fan {
|
||||
curve.enabled = enabled;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
Profile::Performance => {
|
||||
for curve in self.performance.iter_mut() {
|
||||
if curve.fan == fan {
|
||||
curve.enabled = enabled;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
Profile::Quiet => {
|
||||
for curve in self.quiet.iter_mut() {
|
||||
if curve.fan == fan {
|
||||
curve.enabled = enabled;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
pub fn get_fan_curves_for(&self, name: Profile) -> &FanCurveSet {
|
||||
pub fn get_fan_curves_for(&self, name: Profile) -> &[CurveData] {
|
||||
match name {
|
||||
Profile::Balanced => &self.balanced,
|
||||
Profile::Performance => &self.performance,
|
||||
@@ -301,37 +362,59 @@ impl FanCurveProfiles {
|
||||
}
|
||||
}
|
||||
|
||||
pub fn get_fan_curve_for(&self, name: &Profile, pu: &FanCurvePU) -> &CurveData {
|
||||
pub fn get_fan_curve_for(&self, name: &Profile, pu: FanCurvePU) -> Option<&CurveData> {
|
||||
match name {
|
||||
Profile::Balanced => match pu {
|
||||
FanCurvePU::CPU => &self.balanced.cpu,
|
||||
FanCurvePU::GPU => &self.balanced.gpu,
|
||||
},
|
||||
Profile::Performance => match pu {
|
||||
FanCurvePU::CPU => &self.performance.cpu,
|
||||
FanCurvePU::GPU => &self.performance.gpu,
|
||||
},
|
||||
Profile::Quiet => match pu {
|
||||
FanCurvePU::CPU => &self.quiet.cpu,
|
||||
FanCurvePU::GPU => &self.quiet.gpu,
|
||||
},
|
||||
Profile::Balanced => {
|
||||
for this_curve in self.balanced.iter() {
|
||||
if this_curve.fan == pu {
|
||||
return Some(this_curve);
|
||||
}
|
||||
}
|
||||
}
|
||||
Profile::Performance => {
|
||||
for this_curve in self.performance.iter() {
|
||||
if this_curve.fan == pu {
|
||||
return Some(this_curve);
|
||||
}
|
||||
}
|
||||
}
|
||||
Profile::Quiet => {
|
||||
for this_curve in self.quiet.iter() {
|
||||
if this_curve.fan == pu {
|
||||
return Some(this_curve);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
None
|
||||
}
|
||||
|
||||
pub fn save_fan_curve(&mut self, curve: CurveData, profile: Profile) -> std::io::Result<()> {
|
||||
match profile {
|
||||
Profile::Balanced => match curve.fan {
|
||||
FanCurvePU::CPU => self.balanced.cpu = curve,
|
||||
FanCurvePU::GPU => self.balanced.gpu = curve,
|
||||
},
|
||||
Profile::Performance => match curve.fan {
|
||||
FanCurvePU::CPU => self.performance.cpu = curve,
|
||||
FanCurvePU::GPU => self.performance.gpu = curve,
|
||||
},
|
||||
Profile::Quiet => match curve.fan {
|
||||
FanCurvePU::CPU => self.quiet.cpu = curve,
|
||||
FanCurvePU::GPU => self.quiet.gpu = curve,
|
||||
},
|
||||
Profile::Balanced => {
|
||||
for this_curve in self.balanced.iter_mut() {
|
||||
if this_curve.fan == curve.fan {
|
||||
*this_curve = curve;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
Profile::Performance => {
|
||||
for this_curve in self.performance.iter_mut() {
|
||||
if this_curve.fan == curve.fan {
|
||||
*this_curve = curve;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
Profile::Quiet => {
|
||||
for this_curve in self.quiet.iter_mut() {
|
||||
if this_curve.fan == curve.fan {
|
||||
*this_curve = curve;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
Ok(())
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user