mirror of
https://gitlab.com/asus-linux/asusctl.git
synced 2026-02-06 00:15:04 +01:00
Merge branch 'main' into main
This commit is contained in:
@@ -16,7 +16,7 @@
|
||||
|
||||
## Relevant logs and/or screenshots
|
||||
|
||||
(run `journalctl -b -u supergfxd > ~/supergfxd.log` and attach `~/supergfxd.log`)
|
||||
(run `journalctl -b -u asusd > ~/asusd.log` and attach `~/asusd.log`)
|
||||
|
||||
(Paste any relevant logs - use code blocks (```) to format console output, logs, and code, as
|
||||
it's very hard to read otherwise.)
|
||||
|
||||
318
Cargo.lock
generated
318
Cargo.lock
generated
@@ -4,9 +4,9 @@ version = 3
|
||||
|
||||
[[package]]
|
||||
name = "ab_glyph"
|
||||
version = "0.2.23"
|
||||
version = "0.2.24"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "80179d7dd5d7e8c285d67c4a1e652972a92de7475beddfb92028c76463b13225"
|
||||
checksum = "8e08104bebc65a46f8bc7aa733d39ea6874bfa7156f41a46b805785e3af1587d"
|
||||
dependencies = [
|
||||
"ab_glyph_rasterizer",
|
||||
"owned_ttf_parser",
|
||||
@@ -123,7 +123,7 @@ checksum = "175571dd1d178ced59193a6fc02dde1b972eb0bc56c892cde9beeceac5bf0f6b"
|
||||
|
||||
[[package]]
|
||||
name = "asusctl"
|
||||
version = "6.0.0-alpha1"
|
||||
version = "6.0.0-alpha3"
|
||||
dependencies = [
|
||||
"asusd",
|
||||
"cargo-husky",
|
||||
@@ -140,12 +140,12 @@ dependencies = [
|
||||
"tinybmp",
|
||||
"tokio",
|
||||
"toml 0.5.11",
|
||||
"zbus 4.0.1",
|
||||
"zbus 4.1.2",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "asusd"
|
||||
version = "6.0.0-alpha1"
|
||||
version = "6.0.0-alpha3"
|
||||
dependencies = [
|
||||
"cargo-husky",
|
||||
"concat-idents",
|
||||
@@ -167,12 +167,12 @@ dependencies = [
|
||||
"systemd-zbus",
|
||||
"tokio",
|
||||
"udev 0.8.0",
|
||||
"zbus 4.0.1",
|
||||
"zbus 4.1.2",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "asusd-user"
|
||||
version = "6.0.0-alpha1"
|
||||
version = "6.0.0-alpha3"
|
||||
dependencies = [
|
||||
"cargo-husky",
|
||||
"config-traits",
|
||||
@@ -187,7 +187,7 @@ dependencies = [
|
||||
"serde_derive",
|
||||
"serde_json",
|
||||
"smol",
|
||||
"zbus 4.0.1",
|
||||
"zbus 4.1.2",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
@@ -206,8 +206,8 @@ version = "0.7.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "258b52a1aa741b9f09783b2d86cf0aeeb617bbf847f6933340a39644227acbdb"
|
||||
dependencies = [
|
||||
"event-listener 5.2.0",
|
||||
"event-listener-strategy 0.5.0",
|
||||
"event-listener 5.3.0",
|
||||
"event-listener-strategy 0.5.1",
|
||||
"futures-core",
|
||||
"pin-project-lite",
|
||||
]
|
||||
@@ -230,17 +230,17 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "f28243a43d821d11341ab73c80bed182dc015c514b951616cf79bd4af39af0c3"
|
||||
dependencies = [
|
||||
"concurrent-queue",
|
||||
"event-listener 5.2.0",
|
||||
"event-listener-strategy 0.5.0",
|
||||
"event-listener 5.3.0",
|
||||
"event-listener-strategy 0.5.1",
|
||||
"futures-core",
|
||||
"pin-project-lite",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "async-executor"
|
||||
version = "1.8.0"
|
||||
version = "1.10.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "17ae5ebefcc48e7452b4987947920dac9450be1110cadf34d1b8c116bdbaf97c"
|
||||
checksum = "5f98c37cf288e302c16ef6c8472aad1e034c6c84ce5ea7b8101c98eb4a802fee"
|
||||
dependencies = [
|
||||
"async-lock 3.3.0",
|
||||
"async-task",
|
||||
@@ -362,19 +362,21 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "async-process"
|
||||
version = "2.1.0"
|
||||
version = "2.2.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "451e3cf68011bd56771c79db04a9e333095ab6349f7e47592b788e9b98720cc8"
|
||||
checksum = "d999d925640d51b662b7b4e404224dd81de70f4aa4a199383c2c5e5b86885fa3"
|
||||
dependencies = [
|
||||
"async-channel 2.2.0",
|
||||
"async-io 2.3.2",
|
||||
"async-lock 3.3.0",
|
||||
"async-signal",
|
||||
"async-task",
|
||||
"blocking",
|
||||
"cfg-if",
|
||||
"event-listener 5.2.0",
|
||||
"event-listener 5.3.0",
|
||||
"futures-lite 2.3.0",
|
||||
"rustix 0.38.32",
|
||||
"tracing",
|
||||
"windows-sys 0.52.0",
|
||||
]
|
||||
|
||||
@@ -386,7 +388,7 @@ checksum = "30c5ef0ede93efbf733c1a727f3b6b5a1060bbedd5600183e66f6e4be4af0ec5"
|
||||
dependencies = [
|
||||
"proc-macro2",
|
||||
"quote",
|
||||
"syn 2.0.55",
|
||||
"syn 2.0.58",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
@@ -421,7 +423,7 @@ checksum = "a507401cad91ec6a857ed5513a2073c82a9b9048762b885bb98655b306964681"
|
||||
dependencies = [
|
||||
"proc-macro2",
|
||||
"quote",
|
||||
"syn 2.0.55",
|
||||
"syn 2.0.58",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
@@ -439,7 +441,7 @@ dependencies = [
|
||||
"derive_utils",
|
||||
"proc-macro2",
|
||||
"quote",
|
||||
"syn 2.0.55",
|
||||
"syn 2.0.58",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
@@ -513,7 +515,7 @@ dependencies = [
|
||||
"regex",
|
||||
"rustc-hash",
|
||||
"shlex",
|
||||
"syn 2.0.55",
|
||||
"syn 2.0.58",
|
||||
"which",
|
||||
]
|
||||
|
||||
@@ -590,15 +592,15 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "bumpalo"
|
||||
version = "3.15.4"
|
||||
version = "3.16.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "7ff69b9dd49fd426c69a0db9fc04dd934cdb6645ff000864d98f7e2af8830eaa"
|
||||
checksum = "79296716171880943b8470b5f8d03aa55eb2e645a4874bdbb28adb49162e012c"
|
||||
|
||||
[[package]]
|
||||
name = "by_address"
|
||||
version = "1.2.0"
|
||||
version = "1.2.1"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "e7e9330396d4065c0788ac665e5ba4857c4744f5ff4239b6f06493aca55e0e08"
|
||||
checksum = "64fa3c856b712db6612c019f14756e64e4bcea13337a6b33b696333a9eaa2d06"
|
||||
|
||||
[[package]]
|
||||
name = "bytemuck"
|
||||
@@ -617,7 +619,7 @@ checksum = "4da9a32f3fed317401fa3c862968128267c3106685286e15d5aaa3d7389c2f60"
|
||||
dependencies = [
|
||||
"proc-macro2",
|
||||
"quote",
|
||||
"syn 2.0.55",
|
||||
"syn 2.0.58",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
@@ -666,9 +668,9 @@ checksum = "7b02b629252fe8ef6460461409564e2c21d0c8e77e0944f3d189ff06c4e932ad"
|
||||
|
||||
[[package]]
|
||||
name = "cc"
|
||||
version = "1.0.90"
|
||||
version = "1.0.92"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "8cd6604a82acf3039f1144f54b8eb34e91ffba622051189e71b781822d5ee1f5"
|
||||
checksum = "2678b2e3449475e95b0aa6f9b506a28e61b3dc8996592b983695e8ebb58a8b41"
|
||||
dependencies = [
|
||||
"jobserver",
|
||||
"libc",
|
||||
@@ -718,9 +720,9 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "chrono"
|
||||
version = "0.4.35"
|
||||
version = "0.4.37"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "8eaf5903dcbc0a39312feb77df2ff4c76387d591b9fc7b04a238dcf8bb62639a"
|
||||
checksum = "8a0d04d43504c61aa6c7531f1871dd0d418d91130162063b789da00fd7057a5e"
|
||||
dependencies = [
|
||||
"android-tzdata",
|
||||
"iana-time-zone",
|
||||
@@ -826,7 +828,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "f76990911f2267d837d9d0ad060aa63aaad170af40904b29461734c339030d4d"
|
||||
dependencies = [
|
||||
"quote",
|
||||
"syn 2.0.55",
|
||||
"syn 2.0.58",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
@@ -840,7 +842,7 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "config-traits"
|
||||
version = "6.0.0-alpha1"
|
||||
version = "6.0.0-alpha3"
|
||||
dependencies = [
|
||||
"cargo-husky",
|
||||
"log",
|
||||
@@ -854,7 +856,7 @@ dependencies = [
|
||||
[[package]]
|
||||
name = "const-field-offset"
|
||||
version = "0.1.5"
|
||||
source = "git+https://github.com/flukejones/sixtyfps.git?branch=feat/color_hsv#d73de5db8ac10b0b46a1c28c85722902dcf70d30"
|
||||
source = "git+https://github.com/flukejones/sixtyfps.git?branch=feat/color_hsv#490f571f6c3242516bf2067f0e02cfd02ae76223"
|
||||
dependencies = [
|
||||
"const-field-offset-macro",
|
||||
"field-offset",
|
||||
@@ -863,11 +865,11 @@ dependencies = [
|
||||
[[package]]
|
||||
name = "const-field-offset-macro"
|
||||
version = "0.1.5"
|
||||
source = "git+https://github.com/flukejones/sixtyfps.git?branch=feat/color_hsv#d73de5db8ac10b0b46a1c28c85722902dcf70d30"
|
||||
source = "git+https://github.com/flukejones/sixtyfps.git?branch=feat/color_hsv#490f571f6c3242516bf2067f0e02cfd02ae76223"
|
||||
dependencies = [
|
||||
"proc-macro2",
|
||||
"quote",
|
||||
"syn 2.0.55",
|
||||
"syn 2.0.58",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
@@ -908,9 +910,9 @@ checksum = "06ea2b9bc92be3c2baa9334a323ebca2d6f074ff852cd1d7b11064035cd3868f"
|
||||
|
||||
[[package]]
|
||||
name = "core-graphics"
|
||||
version = "0.23.1"
|
||||
version = "0.23.2"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "970a29baf4110c26fedbc7f82107d42c23f7e88e404c4577ed73fe99ff85a212"
|
||||
checksum = "c07782be35f9e1140080c6b96f0d44b739e2278479f64e02fdab4e32dfd8b081"
|
||||
dependencies = [
|
||||
"bitflags 1.3.2",
|
||||
"core-foundation",
|
||||
@@ -950,7 +952,7 @@ checksum = "7704b5fdd17b18ae31c4c1da5a2e0305a2bf17b5249300a9ee9ed7b72114c636"
|
||||
|
||||
[[package]]
|
||||
name = "cpuctl"
|
||||
version = "6.0.0-alpha1"
|
||||
version = "6.0.0-alpha3"
|
||||
|
||||
[[package]]
|
||||
name = "cpufeatures"
|
||||
@@ -1033,7 +1035,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "ad291aa74992b9b7a7e88c38acbbf6ad7e107f1d90ee8775b7bc1fc3394f485c"
|
||||
dependencies = [
|
||||
"quote",
|
||||
"syn 2.0.55",
|
||||
"syn 2.0.58",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
@@ -1089,7 +1091,7 @@ checksum = "61bb5a1014ce6dfc2a378578509abe775a5aa06bff584a547555d9efdb81b926"
|
||||
dependencies = [
|
||||
"proc-macro2",
|
||||
"quote",
|
||||
"syn 2.0.55",
|
||||
"syn 2.0.58",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
@@ -1160,7 +1162,7 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "dmi_id"
|
||||
version = "6.0.0-alpha1"
|
||||
version = "6.0.0-alpha3"
|
||||
dependencies = [
|
||||
"log",
|
||||
"udev 0.8.0",
|
||||
@@ -1168,9 +1170,9 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "downcast-rs"
|
||||
version = "1.2.0"
|
||||
version = "1.2.1"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "9ea835d29036a4087793836fa931b08837ad5e957da9e23886b29586fb9b6650"
|
||||
checksum = "75b325c5dbd37f80359721ad39aca5a29fb04c89279657cffdda8736d0c0b9d2"
|
||||
|
||||
[[package]]
|
||||
name = "drm"
|
||||
@@ -1277,7 +1279,7 @@ checksum = "5c785274071b1b420972453b306eeca06acf4633829db4223b58a2a8c5953bc4"
|
||||
dependencies = [
|
||||
"proc-macro2",
|
||||
"quote",
|
||||
"syn 2.0.55",
|
||||
"syn 2.0.58",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
@@ -1348,9 +1350,9 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "event-listener"
|
||||
version = "5.2.0"
|
||||
version = "5.3.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "2b5fb89194fa3cad959b833185b3063ba881dbfc7030680b314250779fb4cc91"
|
||||
checksum = "6d9944b8ca13534cdfb2800775f8dd4902ff3fc75a50101466decadfdf322a24"
|
||||
dependencies = [
|
||||
"concurrent-queue",
|
||||
"parking",
|
||||
@@ -1369,11 +1371,11 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "event-listener-strategy"
|
||||
version = "0.5.0"
|
||||
version = "0.5.1"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "feedafcaa9b749175d5ac357452a9d41ea2911da598fde46ce1fe02c37751291"
|
||||
checksum = "332f51cb23d20b0de8458b86580878211da09bcd4503cb579c225b3d124cabb3"
|
||||
dependencies = [
|
||||
"event-listener 5.2.0",
|
||||
"event-listener 5.3.0",
|
||||
"pin-project-lite",
|
||||
]
|
||||
|
||||
@@ -1555,7 +1557,7 @@ checksum = "1a5c6c585bc94aaf2c7b51dd4c2ba22680844aba4c687be581871a6f518c5742"
|
||||
dependencies = [
|
||||
"proc-macro2",
|
||||
"quote",
|
||||
"syn 2.0.55",
|
||||
"syn 2.0.58",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
@@ -1695,9 +1697,9 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "getrandom"
|
||||
version = "0.2.12"
|
||||
version = "0.2.14"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "190092ea657667030ac6a35e305e62fc4dd69fd98ac98631e5d3a2b1575a12b5"
|
||||
checksum = "94b22e06ecb0110981051723910cbf0b5f5e09a2062dd7663334ee79a9d1286c"
|
||||
dependencies = [
|
||||
"cfg-if",
|
||||
"js-sys",
|
||||
@@ -1877,9 +1879,9 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "half"
|
||||
version = "2.4.0"
|
||||
version = "2.4.1"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "b5eceaaeec696539ddaf7b333340f1af35a5aa87ae3e4f3ead0532f72affab2e"
|
||||
checksum = "6dd08c532ae367adf81c312a4580bc67f1d0fe8bc9c460520283f4c0ff277888"
|
||||
dependencies = [
|
||||
"cfg-if",
|
||||
"crunchy",
|
||||
@@ -1930,8 +1932,8 @@ checksum = "9a3a5bfb195931eeb336b2a7b4d761daec841b97f947d34394601737a7bba5e4"
|
||||
|
||||
[[package]]
|
||||
name = "i-slint-backend-linuxkms"
|
||||
version = "1.5.1"
|
||||
source = "git+https://github.com/flukejones/sixtyfps.git?branch=feat/color_hsv#d73de5db8ac10b0b46a1c28c85722902dcf70d30"
|
||||
version = "1.6.0"
|
||||
source = "git+https://github.com/flukejones/sixtyfps.git?branch=feat/color_hsv#490f571f6c3242516bf2067f0e02cfd02ae76223"
|
||||
dependencies = [
|
||||
"calloop",
|
||||
"drm",
|
||||
@@ -1950,8 +1952,8 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "i-slint-backend-qt"
|
||||
version = "1.5.1"
|
||||
source = "git+https://github.com/flukejones/sixtyfps.git?branch=feat/color_hsv#d73de5db8ac10b0b46a1c28c85722902dcf70d30"
|
||||
version = "1.6.0"
|
||||
source = "git+https://github.com/flukejones/sixtyfps.git?branch=feat/color_hsv#490f571f6c3242516bf2067f0e02cfd02ae76223"
|
||||
dependencies = [
|
||||
"const-field-offset",
|
||||
"i-slint-common",
|
||||
@@ -1962,8 +1964,8 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "i-slint-backend-selector"
|
||||
version = "1.5.1"
|
||||
source = "git+https://github.com/flukejones/sixtyfps.git?branch=feat/color_hsv#d73de5db8ac10b0b46a1c28c85722902dcf70d30"
|
||||
version = "1.6.0"
|
||||
source = "git+https://github.com/flukejones/sixtyfps.git?branch=feat/color_hsv#490f571f6c3242516bf2067f0e02cfd02ae76223"
|
||||
dependencies = [
|
||||
"cfg-if",
|
||||
"i-slint-backend-linuxkms",
|
||||
@@ -1975,8 +1977,8 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "i-slint-backend-winit"
|
||||
version = "1.5.1"
|
||||
source = "git+https://github.com/flukejones/sixtyfps.git?branch=feat/color_hsv#d73de5db8ac10b0b46a1c28c85722902dcf70d30"
|
||||
version = "1.6.0"
|
||||
source = "git+https://github.com/flukejones/sixtyfps.git?branch=feat/color_hsv#490f571f6c3242516bf2067f0e02cfd02ae76223"
|
||||
dependencies = [
|
||||
"bytemuck",
|
||||
"cfg-if",
|
||||
@@ -2008,8 +2010,8 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "i-slint-common"
|
||||
version = "1.5.1"
|
||||
source = "git+https://github.com/flukejones/sixtyfps.git?branch=feat/color_hsv#d73de5db8ac10b0b46a1c28c85722902dcf70d30"
|
||||
version = "1.6.0"
|
||||
source = "git+https://github.com/flukejones/sixtyfps.git?branch=feat/color_hsv#490f571f6c3242516bf2067f0e02cfd02ae76223"
|
||||
dependencies = [
|
||||
"cfg-if",
|
||||
"derive_more",
|
||||
@@ -2019,8 +2021,8 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "i-slint-compiler"
|
||||
version = "1.5.1"
|
||||
source = "git+https://github.com/flukejones/sixtyfps.git?branch=feat/color_hsv#d73de5db8ac10b0b46a1c28c85722902dcf70d30"
|
||||
version = "1.6.0"
|
||||
source = "git+https://github.com/flukejones/sixtyfps.git?branch=feat/color_hsv#490f571f6c3242516bf2067f0e02cfd02ae76223"
|
||||
dependencies = [
|
||||
"by_address",
|
||||
"codemap",
|
||||
@@ -2048,8 +2050,8 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "i-slint-core"
|
||||
version = "1.5.1"
|
||||
source = "git+https://github.com/flukejones/sixtyfps.git?branch=feat/color_hsv#d73de5db8ac10b0b46a1c28c85722902dcf70d30"
|
||||
version = "1.6.0"
|
||||
source = "git+https://github.com/flukejones/sixtyfps.git?branch=feat/color_hsv#490f571f6c3242516bf2067f0e02cfd02ae76223"
|
||||
dependencies = [
|
||||
"auto_enums",
|
||||
"bytemuck",
|
||||
@@ -2093,17 +2095,17 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "i-slint-core-macros"
|
||||
version = "1.5.1"
|
||||
source = "git+https://github.com/flukejones/sixtyfps.git?branch=feat/color_hsv#d73de5db8ac10b0b46a1c28c85722902dcf70d30"
|
||||
version = "1.6.0"
|
||||
source = "git+https://github.com/flukejones/sixtyfps.git?branch=feat/color_hsv#490f571f6c3242516bf2067f0e02cfd02ae76223"
|
||||
dependencies = [
|
||||
"quote",
|
||||
"syn 2.0.55",
|
||||
"syn 2.0.58",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "i-slint-renderer-femtovg"
|
||||
version = "1.5.1"
|
||||
source = "git+https://github.com/flukejones/sixtyfps.git?branch=feat/color_hsv#d73de5db8ac10b0b46a1c28c85722902dcf70d30"
|
||||
version = "1.6.0"
|
||||
source = "git+https://github.com/flukejones/sixtyfps.git?branch=feat/color_hsv#490f571f6c3242516bf2067f0e02cfd02ae76223"
|
||||
dependencies = [
|
||||
"cfg-if",
|
||||
"const-field-offset",
|
||||
@@ -2133,8 +2135,8 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "i-slint-renderer-skia"
|
||||
version = "1.5.1"
|
||||
source = "git+https://github.com/flukejones/sixtyfps.git?branch=feat/color_hsv#d73de5db8ac10b0b46a1c28c85722902dcf70d30"
|
||||
version = "1.6.0"
|
||||
source = "git+https://github.com/flukejones/sixtyfps.git?branch=feat/color_hsv#490f571f6c3242516bf2067f0e02cfd02ae76223"
|
||||
dependencies = [
|
||||
"bytemuck",
|
||||
"cfg-if",
|
||||
@@ -2486,9 +2488,9 @@ checksum = "4ec2a862134d2a7d32d7983ddcdd1c4923530833c9f2ea1a44fc5fa473989058"
|
||||
|
||||
[[package]]
|
||||
name = "libredox"
|
||||
version = "0.0.1"
|
||||
version = "0.0.2"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "85c833ca1e66078851dba29046874e38f08b2c883700aa29a03ddd3b23814ee8"
|
||||
checksum = "3af92c55d7d839293953fcd0fda5ecfe93297cfde6ffbdec13b41d99c0ba6607"
|
||||
dependencies = [
|
||||
"bitflags 2.5.0",
|
||||
"libc",
|
||||
@@ -2497,13 +2499,12 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "libredox"
|
||||
version = "0.0.2"
|
||||
version = "0.1.3"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "3af92c55d7d839293953fcd0fda5ecfe93297cfde6ffbdec13b41d99c0ba6607"
|
||||
checksum = "c0ff37bd590ca25063e35af745c343cb7a0271906fb7b37e4813e8f79f00268d"
|
||||
dependencies = [
|
||||
"bitflags 2.5.0",
|
||||
"libc",
|
||||
"redox_syscall 0.4.1",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
@@ -2606,12 +2607,12 @@ checksum = "90ed8c1e510134f979dbc4f070f87d4313098b704861a105fe34231c70a3901c"
|
||||
|
||||
[[package]]
|
||||
name = "logind-zbus"
|
||||
version = "4.0.0"
|
||||
version = "4.0.2"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "4afde78d03ee08949efb760d0cd7ad9599379d91207de5c6e778fe9f8f98eae2"
|
||||
checksum = "15b2375aeabe771d0774a333bf20aa89ea1805f4f9d094fc45e7390bfc7da42a"
|
||||
dependencies = [
|
||||
"serde",
|
||||
"zbus 4.0.1",
|
||||
"zbus 4.1.2",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
@@ -2684,9 +2685,9 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "memchr"
|
||||
version = "2.7.1"
|
||||
version = "2.7.2"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "523dc4f511e55ab87b694dc30d0f820d60906ef06413f93d4d7a1385599cc149"
|
||||
checksum = "6c8640c5d730cb13ebd907d8d04b52f55ac9a2eec55b440c8892f40d56c76c1d"
|
||||
|
||||
[[package]]
|
||||
name = "memmap2"
|
||||
@@ -2845,6 +2846,18 @@ dependencies = [
|
||||
"bitflags 2.5.0",
|
||||
"cfg-if",
|
||||
"libc",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "nix"
|
||||
version = "0.28.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "ab2156c4fce2f8df6c499cc1c763e4394b7482525bf2a9701c9d79d215f519e4"
|
||||
dependencies = [
|
||||
"bitflags 2.5.0",
|
||||
"cfg-if",
|
||||
"cfg_aliases 0.1.1",
|
||||
"libc",
|
||||
"memoffset 0.9.1",
|
||||
]
|
||||
|
||||
@@ -2866,7 +2879,7 @@ dependencies = [
|
||||
"mac-notification-sys",
|
||||
"serde",
|
||||
"tauri-winrt-notification",
|
||||
"zbus 4.0.1",
|
||||
"zbus 4.1.2",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
@@ -2913,7 +2926,7 @@ dependencies = [
|
||||
"proc-macro-crate 3.1.0",
|
||||
"proc-macro2",
|
||||
"quote",
|
||||
"syn 2.0.55",
|
||||
"syn 2.0.58",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
@@ -3088,14 +3101,14 @@ checksum = "2f38a4412a78282e09a2cf38d195ea5420d15ba0602cb375210efbc877243965"
|
||||
dependencies = [
|
||||
"proc-macro2",
|
||||
"quote",
|
||||
"syn 2.0.55",
|
||||
"syn 2.0.58",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "pin-project-lite"
|
||||
version = "0.2.13"
|
||||
version = "0.2.14"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "8afb450f006bf6385ca15ef45d71d2288452bc3683ce2e2cacc0d18e4be60b58"
|
||||
checksum = "bda66fc9667c18cb2758a2ac84d1167245054bcf85d5d1aaa6923f45801bdd02"
|
||||
|
||||
[[package]]
|
||||
name = "pin-utils"
|
||||
@@ -3214,7 +3227,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "8d3928fb5db768cb86f891ff014f0144589297e3c6a1aba6ed7cecfdace270c7"
|
||||
dependencies = [
|
||||
"proc-macro2",
|
||||
"syn 2.0.55",
|
||||
"syn 2.0.58",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
@@ -3363,12 +3376,12 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "redox_users"
|
||||
version = "0.4.4"
|
||||
version = "0.4.5"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "a18479200779601e498ada4e8c1e1f50e3ee19deb0259c25825a98b5603b2cb4"
|
||||
checksum = "bd283d9651eeda4b2a83a43c1c91b266c40fd76ecd39a50a8c630ae69dc72891"
|
||||
dependencies = [
|
||||
"getrandom",
|
||||
"libredox 0.0.1",
|
||||
"libredox 0.1.3",
|
||||
"thiserror",
|
||||
]
|
||||
|
||||
@@ -3426,7 +3439,7 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "rog-control-center"
|
||||
version = "6.0.0-alpha1"
|
||||
version = "6.0.0-alpha3"
|
||||
dependencies = [
|
||||
"asusd",
|
||||
"betrayer",
|
||||
@@ -3460,12 +3473,12 @@ dependencies = [
|
||||
"tokio",
|
||||
"versions",
|
||||
"winit",
|
||||
"zbus 4.0.1",
|
||||
"zbus 4.1.2",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "rog_anime"
|
||||
version = "6.0.0-alpha1"
|
||||
version = "6.0.0-alpha3"
|
||||
dependencies = [
|
||||
"cargo-husky",
|
||||
"dmi_id",
|
||||
@@ -3477,12 +3490,12 @@ dependencies = [
|
||||
"serde",
|
||||
"serde_derive",
|
||||
"typeshare",
|
||||
"zbus 4.0.1",
|
||||
"zbus 4.1.2",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "rog_aura"
|
||||
version = "6.0.0-alpha1"
|
||||
version = "6.0.0-alpha3"
|
||||
dependencies = [
|
||||
"cargo-husky",
|
||||
"dmi_id",
|
||||
@@ -3491,12 +3504,12 @@ dependencies = [
|
||||
"serde",
|
||||
"serde_derive",
|
||||
"typeshare",
|
||||
"zbus 4.0.1",
|
||||
"zbus 4.1.2",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "rog_dbus"
|
||||
version = "6.0.0-alpha1"
|
||||
version = "6.0.0-alpha3"
|
||||
dependencies = [
|
||||
"asusd",
|
||||
"cargo-husky",
|
||||
@@ -3504,13 +3517,12 @@ dependencies = [
|
||||
"rog_aura",
|
||||
"rog_platform",
|
||||
"rog_profiles",
|
||||
"rog_slash",
|
||||
"zbus 4.0.1",
|
||||
"zbus 4.1.2",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "rog_platform"
|
||||
version = "6.0.0-alpha1"
|
||||
version = "6.0.0-alpha3"
|
||||
dependencies = [
|
||||
"cargo-husky",
|
||||
"concat-idents",
|
||||
@@ -3522,12 +3534,12 @@ dependencies = [
|
||||
"serde_derive",
|
||||
"typeshare",
|
||||
"udev 0.8.0",
|
||||
"zbus 4.0.1",
|
||||
"zbus 4.1.2",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "rog_profiles"
|
||||
version = "6.0.0-alpha1"
|
||||
version = "6.0.0-alpha3"
|
||||
dependencies = [
|
||||
"cargo-husky",
|
||||
"log",
|
||||
@@ -3536,12 +3548,12 @@ dependencies = [
|
||||
"serde_derive",
|
||||
"typeshare",
|
||||
"udev 0.8.0",
|
||||
"zbus 4.0.1",
|
||||
"zbus 4.1.2",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "rog_simulators"
|
||||
version = "6.0.0-alpha1"
|
||||
version = "6.0.0-alpha3"
|
||||
dependencies = [
|
||||
"glam",
|
||||
"log",
|
||||
@@ -3658,9 +3670,9 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "rustversion"
|
||||
version = "1.0.14"
|
||||
version = "1.0.15"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "7ffc183a10b4478d04cbbbfc96d0873219d962dd5accaff2ffbd4ceb7df837f4"
|
||||
checksum = "80af6f9131f277a45a3fba6ce8e2258037bb0477a67e610d3c1fe046ab31de47"
|
||||
|
||||
[[package]]
|
||||
name = "rustybuzz"
|
||||
@@ -3786,7 +3798,7 @@ checksum = "7eb0b34b42edc17f6b7cac84a52a1c5f0e1bb2227e997ca9011ea3dd34e8610b"
|
||||
dependencies = [
|
||||
"proc-macro2",
|
||||
"quote",
|
||||
"syn 2.0.55",
|
||||
"syn 2.0.58",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
@@ -3802,13 +3814,13 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "serde_repr"
|
||||
version = "0.1.18"
|
||||
version = "0.1.19"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "0b2e6b945e9d3df726b65d6ee24060aff8e3533d431f677a9695db04eff9dfdb"
|
||||
checksum = "6c64451ba24fc7a6a2d60fc75dd9c83c90903b19028d4eff35e88fc1e86564e9"
|
||||
dependencies = [
|
||||
"proc-macro2",
|
||||
"quote",
|
||||
"syn 2.0.55",
|
||||
"syn 2.0.58",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
@@ -3907,8 +3919,8 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "slint"
|
||||
version = "1.5.1"
|
||||
source = "git+https://github.com/flukejones/sixtyfps.git?branch=feat/color_hsv#d73de5db8ac10b0b46a1c28c85722902dcf70d30"
|
||||
version = "1.6.0"
|
||||
source = "git+https://github.com/flukejones/sixtyfps.git?branch=feat/color_hsv#490f571f6c3242516bf2067f0e02cfd02ae76223"
|
||||
dependencies = [
|
||||
"const-field-offset",
|
||||
"i-slint-backend-selector",
|
||||
@@ -3923,8 +3935,8 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "slint-build"
|
||||
version = "1.5.1"
|
||||
source = "git+https://github.com/flukejones/sixtyfps.git?branch=feat/color_hsv#d73de5db8ac10b0b46a1c28c85722902dcf70d30"
|
||||
version = "1.6.0"
|
||||
source = "git+https://github.com/flukejones/sixtyfps.git?branch=feat/color_hsv#490f571f6c3242516bf2067f0e02cfd02ae76223"
|
||||
dependencies = [
|
||||
"i-slint-compiler",
|
||||
"spin_on",
|
||||
@@ -3934,8 +3946,8 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "slint-macros"
|
||||
version = "1.5.1"
|
||||
source = "git+https://github.com/flukejones/sixtyfps.git?branch=feat/color_hsv#d73de5db8ac10b0b46a1c28c85722902dcf70d30"
|
||||
version = "1.6.0"
|
||||
source = "git+https://github.com/flukejones/sixtyfps.git?branch=feat/color_hsv#490f571f6c3242516bf2067f0e02cfd02ae76223"
|
||||
dependencies = [
|
||||
"i-slint-compiler",
|
||||
"proc-macro2",
|
||||
@@ -4128,13 +4140,13 @@ dependencies = [
|
||||
"proc-macro2",
|
||||
"quote",
|
||||
"rustversion",
|
||||
"syn 2.0.55",
|
||||
"syn 2.0.58",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "supergfxctl"
|
||||
version = "5.2.2"
|
||||
source = "git+https://gitlab.com/asus-linux/supergfxctl.git#68c12374d2cc20e5503b7694168afa2bf52af705"
|
||||
source = "git+https://gitlab.com/asus-linux/supergfxctl.git#4eb6e97c22b68ae8d1e80500709b0c0580776ad3"
|
||||
dependencies = [
|
||||
"log",
|
||||
"logind-zbus",
|
||||
@@ -4143,7 +4155,7 @@ dependencies = [
|
||||
"serde_json",
|
||||
"tokio",
|
||||
"udev 0.8.0",
|
||||
"zbus 4.0.1",
|
||||
"zbus 4.1.2",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
@@ -4169,9 +4181,9 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "syn"
|
||||
version = "2.0.55"
|
||||
version = "2.0.58"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "002a1b3dbf967edfafc32655d0f377ab0bb7b994aa1d32c8cc7e9b8bf3ebb8f0"
|
||||
checksum = "44cfb93f38070beee36b3fef7d4f5a16f27751d94b187b666a5cc5e9b0d30687"
|
||||
dependencies = [
|
||||
"proc-macro2",
|
||||
"quote",
|
||||
@@ -4180,12 +4192,12 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "systemd-zbus"
|
||||
version = "0.2.0"
|
||||
version = "0.3.1"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "a7402f02e82714cc736e1c37449344ae06a181f9b8318d81a65af76d85868d51"
|
||||
checksum = "a98ac0c9c7b08a92b01576551942fbfc80c64e7f2354e04b57264d9349fd2b2e"
|
||||
dependencies = [
|
||||
"serde",
|
||||
"zbus 4.0.1",
|
||||
"zbus 4.1.2",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
@@ -4259,7 +4271,7 @@ checksum = "c61f3ba182994efc43764a46c018c347bc492c79f024e705f46567b418f6d4f7"
|
||||
dependencies = [
|
||||
"proc-macro2",
|
||||
"quote",
|
||||
"syn 2.0.55",
|
||||
"syn 2.0.58",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
@@ -4356,9 +4368,9 @@ checksum = "1f3ccbac311fea05f86f61904b462b55fb3df8837a366dfc601a0161d0532f20"
|
||||
|
||||
[[package]]
|
||||
name = "tokio"
|
||||
version = "1.36.0"
|
||||
version = "1.37.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "61285f6515fa018fb2d1e46eb21223fff441ee8db5d0f1435e8ab4f5cdb80931"
|
||||
checksum = "1adbebffeca75fcfd058afa480fb6c0b81e165a0323f9c9d39c9697e37c46787"
|
||||
dependencies = [
|
||||
"backtrace",
|
||||
"libc",
|
||||
@@ -4378,7 +4390,7 @@ checksum = "5b8a1e28f2deaa14e508979454cb3a223b10b938b45af148bc0986de36f1923b"
|
||||
dependencies = [
|
||||
"proc-macro2",
|
||||
"quote",
|
||||
"syn 2.0.55",
|
||||
"syn 2.0.58",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
@@ -4465,7 +4477,7 @@ checksum = "34704c8d6ebcbc939824180af020566b01a7c01f80641264eba0999f6c2b6be7"
|
||||
dependencies = [
|
||||
"proc-macro2",
|
||||
"quote",
|
||||
"syn 2.0.55",
|
||||
"syn 2.0.58",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
@@ -4508,7 +4520,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "ecce25dea8aeaadc44909f4c1226d22d84512fccd07d22447ecbad176bc09545"
|
||||
dependencies = [
|
||||
"quote",
|
||||
"syn 2.0.55",
|
||||
"syn 2.0.58",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
@@ -4710,7 +4722,7 @@ dependencies = [
|
||||
[[package]]
|
||||
name = "vtable"
|
||||
version = "0.2.0"
|
||||
source = "git+https://github.com/flukejones/sixtyfps.git?branch=feat/color_hsv#d73de5db8ac10b0b46a1c28c85722902dcf70d30"
|
||||
source = "git+https://github.com/flukejones/sixtyfps.git?branch=feat/color_hsv#490f571f6c3242516bf2067f0e02cfd02ae76223"
|
||||
dependencies = [
|
||||
"const-field-offset",
|
||||
"portable-atomic",
|
||||
@@ -4721,11 +4733,11 @@ dependencies = [
|
||||
[[package]]
|
||||
name = "vtable-macro"
|
||||
version = "0.2.0"
|
||||
source = "git+https://github.com/flukejones/sixtyfps.git?branch=feat/color_hsv#d73de5db8ac10b0b46a1c28c85722902dcf70d30"
|
||||
source = "git+https://github.com/flukejones/sixtyfps.git?branch=feat/color_hsv#490f571f6c3242516bf2067f0e02cfd02ae76223"
|
||||
dependencies = [
|
||||
"proc-macro2",
|
||||
"quote",
|
||||
"syn 2.0.55",
|
||||
"syn 2.0.58",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
@@ -4771,7 +4783,7 @@ dependencies = [
|
||||
"once_cell",
|
||||
"proc-macro2",
|
||||
"quote",
|
||||
"syn 2.0.55",
|
||||
"syn 2.0.58",
|
||||
"wasm-bindgen-shared",
|
||||
]
|
||||
|
||||
@@ -4805,7 +4817,7 @@ checksum = "e94f17b526d0a461a191c78ea52bbce64071ed5c04c9ffe424dcb38f74171bb7"
|
||||
dependencies = [
|
||||
"proc-macro2",
|
||||
"quote",
|
||||
"syn 2.0.55",
|
||||
"syn 2.0.58",
|
||||
"wasm-bindgen-backend",
|
||||
"wasm-bindgen-shared",
|
||||
]
|
||||
@@ -5000,9 +5012,9 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "winapi-wsapoll"
|
||||
version = "0.1.1"
|
||||
version = "0.1.2"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "44c17110f57155602a80dca10be03852116403c9ff3cd25b079d666f2aa3df6e"
|
||||
checksum = "1eafc5f679c576995526e81635d0cf9695841736712b4e892f87abbe6fed3f28"
|
||||
dependencies = [
|
||||
"winapi",
|
||||
]
|
||||
@@ -5481,9 +5493,9 @@ checksum = "054a8e68b76250b253f671d1268cb7f1ae089ec35e195b2efb2a4e9a836d0621"
|
||||
|
||||
[[package]]
|
||||
name = "xml-rs"
|
||||
version = "0.8.19"
|
||||
version = "0.8.20"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "0fcb9cbac069e033553e8bb871be2fbdffcab578eb25bd0f7c508cedc6dcd75a"
|
||||
checksum = "791978798f0597cfc70478424c2b4fdc2b7a8024aaff78497ef00f24ef674193"
|
||||
|
||||
[[package]]
|
||||
name = "xmlwriter"
|
||||
@@ -5534,28 +5546,28 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "zbus"
|
||||
version = "4.0.1"
|
||||
version = "4.1.2"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "7b8e3d6ae3342792a6cc2340e4394334c7402f3d793b390d2c5494a4032b3030"
|
||||
checksum = "c9ff46f2a25abd690ed072054733e0bc3157e3d4c45f41bd183dce09c2ff8ab9"
|
||||
dependencies = [
|
||||
"async-broadcast 0.7.0",
|
||||
"async-executor",
|
||||
"async-fs 2.1.1",
|
||||
"async-io 2.3.2",
|
||||
"async-lock 3.3.0",
|
||||
"async-process 2.1.0",
|
||||
"async-process 2.2.0",
|
||||
"async-recursion",
|
||||
"async-task",
|
||||
"async-trait",
|
||||
"blocking",
|
||||
"derivative",
|
||||
"enumflags2",
|
||||
"event-listener 5.2.0",
|
||||
"event-listener 5.3.0",
|
||||
"futures-core",
|
||||
"futures-sink",
|
||||
"futures-util",
|
||||
"hex",
|
||||
"nix 0.27.1",
|
||||
"nix 0.28.0",
|
||||
"ordered-stream",
|
||||
"rand",
|
||||
"serde",
|
||||
@@ -5566,7 +5578,7 @@ dependencies = [
|
||||
"uds_windows",
|
||||
"windows-sys 0.52.0",
|
||||
"xdg-home",
|
||||
"zbus_macros 4.0.1",
|
||||
"zbus_macros 4.1.2",
|
||||
"zbus_names 3.0.0",
|
||||
"zvariant 4.0.2",
|
||||
]
|
||||
@@ -5587,11 +5599,11 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "zbus_macros"
|
||||
version = "4.0.1"
|
||||
version = "4.1.2"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "b7a3e850ff1e7217a3b7a07eba90d37fe9bb9e89a310f718afcde5885ca9b6d7"
|
||||
checksum = "4e0e3852c93dcdb49c9462afe67a2a468f7bd464150d866e861eaf06208633e0"
|
||||
dependencies = [
|
||||
"proc-macro-crate 1.3.1",
|
||||
"proc-macro-crate 3.1.0",
|
||||
"proc-macro2",
|
||||
"quote",
|
||||
"regex",
|
||||
@@ -5638,7 +5650,7 @@ checksum = "9ce1b18ccd8e73a9321186f97e46f9f04b778851177567b1975109d26a08d2a6"
|
||||
dependencies = [
|
||||
"proc-macro2",
|
||||
"quote",
|
||||
"syn 2.0.55",
|
||||
"syn 2.0.58",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
|
||||
10
Cargo.toml
10
Cargo.toml
@@ -25,7 +25,7 @@ default-members = [
|
||||
resolver = "2"
|
||||
|
||||
[workspace.package]
|
||||
version = "6.0.0-alpha1"
|
||||
version = "6.0.0-alpha3"
|
||||
rust-version = "1.76"
|
||||
|
||||
[workspace.dependencies]
|
||||
@@ -40,8 +40,8 @@ dirs = "^4.0"
|
||||
smol = "^1.3"
|
||||
mio = "0.8.11"
|
||||
|
||||
zbus = "~4.0.1"
|
||||
logind-zbus = { version = "~4.0.0" } #, default-features = false, features = ["non_blocking"] }
|
||||
zbus = "~4.1.2"
|
||||
logind-zbus = { version = "~4.0.2" } #, default-features = false, features = ["non_blocking"] }
|
||||
|
||||
serde = "^1.0"
|
||||
serde_derive = "^1.0"
|
||||
@@ -77,11 +77,11 @@ lto = "fat"
|
||||
debug = false
|
||||
opt-level = 3
|
||||
panic = "abort"
|
||||
#codegen-units = 1
|
||||
codegen-units = 1
|
||||
|
||||
[profile.dev]
|
||||
debug = true
|
||||
opt-level = 1
|
||||
codegen-units = 16
|
||||
|
||||
[profile.bench]
|
||||
debug = false
|
||||
|
||||
3
Makefile
3
Makefile
@@ -132,6 +132,9 @@ introspect:
|
||||
xmlstarlet ed -L -O -d '//interface[@name="org.freedesktop.DBus.Properties"]' bindings/dbus-xml/org-asuslinux-*
|
||||
xmlstarlet ed -L -O -d '//interface[@name="org.freedesktop.DBus.Peer"]' bindings/dbus-xml/org-asuslinux-*
|
||||
|
||||
translate:
|
||||
find -name \*.slint | xargs slint-tr-extractor -o rog-control-center/translations/en/rog-control-center.po
|
||||
|
||||
build:
|
||||
ifeq ($(VENDORED),1)
|
||||
cargo vendor
|
||||
|
||||
37
README.md
37
README.md
@@ -51,6 +51,8 @@ and AniMe parts should work regardless of your latop make.
|
||||
|
||||
## Implemented
|
||||
|
||||
The list is a bit outdated as many features have been enabled in the Linux kernel with upstream patches and then supported in asusctl suite.
|
||||
|
||||
- [X] System daemon
|
||||
- [X] GUI app (includes tray and notifications)
|
||||
- [X] Setting/modifying built-in LED modes
|
||||
@@ -68,28 +70,12 @@ A gui is now in the repo - ROG Control Center. At this time it is still a WIP, b
|
||||
|
||||
# BUILDING
|
||||
|
||||
Requirements are rust >= 1.75 installed from rustup.io if the distro provided version is too old, and `make`.
|
||||
|
||||
**Ubuntu (unsuported):**
|
||||
|
||||
apt install libinput-dev libseat-dev libpango1.0-dev libgdk-pixbuf-2.0-dev libglib2.0-dev cmake libclang-dev libudev-dev libayatana-appindicator3-1
|
||||
curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh
|
||||
source "$HOME/.cargo/env"
|
||||
make
|
||||
sudo make install
|
||||
|
||||
**popos (unsuported):**
|
||||
|
||||
sudo apt install cmake libinput-dev libseat-dev libclang-dev libudev-dev libclang-dev libglib2.0-dev libatkmm-1.6-dev libpangomm-1.4-dev librust-gdk-pixbuf-dev
|
||||
curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh
|
||||
source "$HOME/.cargo/env"
|
||||
make
|
||||
sudo make install
|
||||
|
||||
Rust and cargo are required, they can be installed from [rustup.rs](https://rustup.rs/) or from the distro repos if newer than 1.75.
|
||||
|
||||
**fedora:**
|
||||
|
||||
dnf install cmake clang-devel libinput-devel libseat-devel systemd-devel glib2-devel cairo-devel atkmm-devel pangomm-devel gdk-pixbuf2-devel libappindicator-gtk3
|
||||
dnf install cmake clang-devel libinput-devel libseat-devel libgbm-devel libxkbcommon-devel systemd-devel \
|
||||
libdrm-devel expat-devel pcre2-devel libzstd-devellibappindicator-gtk3
|
||||
make
|
||||
sudo make install
|
||||
|
||||
@@ -98,28 +84,33 @@ Requirements are rust >= 1.75 installed from rustup.io if the distro provided ve
|
||||
Works with KDE Plasma (without GTK packages)
|
||||
|
||||
zypper in -t pattern devel_basis
|
||||
zypper in rustup make cmake libinput-devel libseat-devel systemd-devel clang-devel llvm-devel gdk-pixbuf-devel cairo-devel pango-devel freetype-devel libexpat-devel libayatana-indicator3-7
|
||||
zypper in rustup make cmake libinput-devel libseat-devel libgbm-devel systemd-devel clang-devel llvm-devel gdk-pixbuf-devel cairo-devel pango-devel freetype-devel libexpat-devel libayatana-indicator3-7
|
||||
make
|
||||
sudo make install
|
||||
|
||||
**Ubuntu, Popos (unsuported):**
|
||||
|
||||
instructions removed as outdated
|
||||
|
||||
## Installing
|
||||
- Fedora copr = https://copr.fedorainfracloud.org/coprs/lukenukem/asus-linux/
|
||||
- openSUSE = https://download.opensuse.org/repositories/home:/luke_nukem:/asus/
|
||||
- Ubuntu = not supported due to packaging woes, but you can build and install on your own.
|
||||
|
||||
=======
|
||||
|
||||
The default init method is to use the udev rule, this ensures that the service is
|
||||
started when the device is initialised and ready.
|
||||
|
||||
You may also need to activate the service for debian install. If running Pop!_OS, I suggest disabling `system76-power` gnome-shell extension and systemd service.
|
||||
|
||||
## Upgrading
|
||||
|
||||
If you are upgrading from a previous installed version, you will need to restart the service or reboot.
|
||||
|
||||
```
|
||||
$ systemctl daemon-reload && systemctl restart asusd
|
||||
```
|
||||
|
||||
You may also need to activate the service for debian install. If running Pop!_OS, I suggest disabling `system76-power` gnome-shell extension and systemd service.
|
||||
|
||||
## Uninstalling
|
||||
|
||||
Run `sudo make uninstall` in the source repo, and remove `/etc/asusd/`.
|
||||
|
||||
@@ -5,10 +5,12 @@ use std::process::exit;
|
||||
|
||||
use rog_anime::usb::get_anime_type;
|
||||
use rog_anime::{AnimeDiagonal, AnimeType};
|
||||
use rog_dbus::RogDbusClientBlocking;
|
||||
use rog_dbus::zbus_anime::AnimeProxyBlocking;
|
||||
use zbus::blocking::Connection;
|
||||
|
||||
fn main() -> Result<(), Box<dyn Error>> {
|
||||
let (client, _) = RogDbusClientBlocking::new().unwrap();
|
||||
let conn = Connection::system().unwrap();
|
||||
let proxy = AnimeProxyBlocking::new(&conn).unwrap();
|
||||
|
||||
let args: Vec<String> = env::args().collect();
|
||||
if args.len() != 3 {
|
||||
@@ -26,11 +28,7 @@ fn main() -> Result<(), Box<dyn Error>> {
|
||||
|
||||
let anime_type = get_anime_type()?;
|
||||
|
||||
client
|
||||
.proxies()
|
||||
.anime()
|
||||
.write(matrix.into_data_buffer(anime_type)?)
|
||||
.unwrap();
|
||||
proxy.write(matrix.into_data_buffer(anime_type)?).unwrap();
|
||||
|
||||
Ok(())
|
||||
}
|
||||
|
||||
@@ -3,7 +3,8 @@ use std::time::Duration;
|
||||
|
||||
use rog_anime::usb::get_anime_type;
|
||||
use rog_anime::{AnimeDiagonal, AnimeType};
|
||||
use rog_dbus::RogDbusClientBlocking;
|
||||
use rog_dbus::zbus_anime::AnimeProxyBlocking;
|
||||
use zbus::blocking::Connection;
|
||||
|
||||
// In usable data:
|
||||
// Top row start at 1, ends at 32
|
||||
@@ -11,7 +12,8 @@ use rog_dbus::RogDbusClientBlocking;
|
||||
// 74w x 36h diagonal used by the windows app
|
||||
|
||||
fn main() {
|
||||
let (client, _) = RogDbusClientBlocking::new().unwrap();
|
||||
let conn = Connection::system().unwrap();
|
||||
let proxy = AnimeProxyBlocking::new(&conn).unwrap();
|
||||
|
||||
for step in (2..50).rev() {
|
||||
let mut matrix = AnimeDiagonal::new(AnimeType::GA401, None);
|
||||
@@ -28,9 +30,7 @@ fn main() {
|
||||
}
|
||||
|
||||
let anime_type = get_anime_type().unwrap();
|
||||
client
|
||||
.proxies()
|
||||
.anime()
|
||||
proxy
|
||||
.write(matrix.into_data_buffer(anime_type).unwrap())
|
||||
.unwrap();
|
||||
sleep(Duration::from_millis(300));
|
||||
|
||||
@@ -4,10 +4,12 @@ use std::thread::sleep;
|
||||
|
||||
use rog_anime::usb::get_anime_type;
|
||||
use rog_anime::{ActionData, ActionLoader, Sequences};
|
||||
use rog_dbus::RogDbusClientBlocking;
|
||||
use rog_dbus::zbus_anime::AnimeProxyBlocking;
|
||||
use zbus::blocking::Connection;
|
||||
|
||||
fn main() {
|
||||
let (client, _) = RogDbusClientBlocking::new().unwrap();
|
||||
let conn = Connection::system().unwrap();
|
||||
let proxy = AnimeProxyBlocking::new(&conn).unwrap();
|
||||
|
||||
let args: Vec<String> = env::args().collect();
|
||||
if args.len() != 3 {
|
||||
@@ -33,11 +35,7 @@ fn main() {
|
||||
for action in seq.iter() {
|
||||
if let ActionData::Animation(frames) = action {
|
||||
for frame in frames.frames() {
|
||||
client
|
||||
.proxies()
|
||||
.anime()
|
||||
.write(frame.frame().clone())
|
||||
.unwrap();
|
||||
proxy.write(frame.frame().clone()).unwrap();
|
||||
sleep(frame.delay());
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2,7 +2,8 @@ use std::convert::TryFrom;
|
||||
|
||||
use rog_anime::usb::get_anime_type;
|
||||
use rog_anime::{AnimeDataBuffer, AnimeGrid};
|
||||
use rog_dbus::RogDbusClientBlocking;
|
||||
use rog_dbus::zbus_anime::AnimeProxyBlocking;
|
||||
use zbus::blocking::Connection;
|
||||
|
||||
// In usable data:
|
||||
// Top row start at 1, ends at 32
|
||||
@@ -10,7 +11,9 @@ use rog_dbus::RogDbusClientBlocking;
|
||||
// 74w x 36h diagonal used by the windows app
|
||||
|
||||
fn main() {
|
||||
let (client, _) = RogDbusClientBlocking::new().unwrap();
|
||||
let conn = Connection::system().unwrap();
|
||||
let proxy = AnimeProxyBlocking::new(&conn).unwrap();
|
||||
|
||||
let anime_type = get_anime_type().unwrap();
|
||||
let mut matrix = AnimeGrid::new(anime_type);
|
||||
let tmp = matrix.get_mut();
|
||||
@@ -43,5 +46,5 @@ fn main() {
|
||||
|
||||
let matrix = <AnimeDataBuffer>::try_from(matrix).unwrap();
|
||||
|
||||
client.proxies().anime().write(matrix).unwrap();
|
||||
proxy.write(matrix).unwrap();
|
||||
}
|
||||
|
||||
@@ -1,12 +1,14 @@
|
||||
use rog_anime::usb::get_anime_type;
|
||||
use rog_anime::AnimeDataBuffer;
|
||||
use rog_dbus::RogDbusClientBlocking;
|
||||
use rog_dbus::zbus_anime::AnimeProxyBlocking;
|
||||
use zbus::blocking::Connection;
|
||||
|
||||
// In usable data:
|
||||
// Top row start at 1, ends at 32
|
||||
|
||||
fn main() {
|
||||
let (client, _) = RogDbusClientBlocking::new().unwrap();
|
||||
let conn = Connection::system().unwrap();
|
||||
let proxy = AnimeProxyBlocking::new(&conn).unwrap();
|
||||
let anime_type = get_anime_type().unwrap();
|
||||
let mut matrix = AnimeDataBuffer::new(anime_type);
|
||||
matrix.data_mut()[1] = 100; // start = 1
|
||||
@@ -127,5 +129,5 @@ fn main() {
|
||||
matrix.data_mut()[1244] = 100; // end
|
||||
println!("{:?}", &matrix);
|
||||
|
||||
client.proxies().anime().write(matrix).unwrap();
|
||||
proxy.write(matrix).unwrap();
|
||||
}
|
||||
|
||||
@@ -6,10 +6,12 @@ use std::process::exit;
|
||||
|
||||
use rog_anime::usb::get_anime_type;
|
||||
use rog_anime::{AnimeDataBuffer, AnimeImage, Vec2};
|
||||
use rog_dbus::RogDbusClientBlocking;
|
||||
use rog_dbus::zbus_anime::AnimeProxyBlocking;
|
||||
use zbus::blocking::Connection;
|
||||
|
||||
fn main() -> Result<(), Box<dyn Error>> {
|
||||
let (client, _) = RogDbusClientBlocking::new().unwrap();
|
||||
let conn = Connection::system().unwrap();
|
||||
let proxy = AnimeProxyBlocking::new(&conn).unwrap();
|
||||
|
||||
let args: Vec<String> = env::args().collect();
|
||||
if args.len() != 7 {
|
||||
@@ -31,11 +33,7 @@ fn main() -> Result<(), Box<dyn Error>> {
|
||||
anime_type,
|
||||
)?;
|
||||
|
||||
client
|
||||
.proxies()
|
||||
.anime()
|
||||
.write(<AnimeDataBuffer>::try_from(&matrix)?)
|
||||
.unwrap();
|
||||
proxy.write(<AnimeDataBuffer>::try_from(&matrix)?).unwrap();
|
||||
|
||||
Ok(())
|
||||
}
|
||||
|
||||
@@ -9,10 +9,12 @@ use std::time::Duration;
|
||||
|
||||
use rog_anime::usb::get_anime_type;
|
||||
use rog_anime::{AnimeDataBuffer, AnimeImage, Vec2};
|
||||
use rog_dbus::RogDbusClientBlocking;
|
||||
use rog_dbus::zbus_anime::AnimeProxyBlocking;
|
||||
use zbus::blocking::Connection;
|
||||
|
||||
fn main() -> Result<(), Box<dyn Error>> {
|
||||
let (client, _) = RogDbusClientBlocking::new().unwrap();
|
||||
let conn = Connection::system().unwrap();
|
||||
let proxy = AnimeProxyBlocking::new(&conn).unwrap();
|
||||
|
||||
let args: Vec<String> = env::args().collect();
|
||||
if args.len() != 7 {
|
||||
@@ -41,11 +43,7 @@ fn main() -> Result<(), Box<dyn Error>> {
|
||||
}
|
||||
matrix.update();
|
||||
|
||||
client
|
||||
.proxies()
|
||||
.anime()
|
||||
.write(<AnimeDataBuffer>::try_from(&matrix)?)
|
||||
.unwrap();
|
||||
proxy.write(<AnimeDataBuffer>::try_from(&matrix)?).unwrap();
|
||||
sleep(Duration::from_micros(500));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,16 +1,17 @@
|
||||
//! Using a combination of key-colour array plus a key layout to generate
|
||||
//! outputs.
|
||||
|
||||
use rog_aura::advanced::LedCode;
|
||||
use rog_aura::effects::{AdvancedEffects, Effect};
|
||||
use rog_aura::layouts::KeyLayout;
|
||||
use rog_aura::keyboard::{KeyLayout, LedCode};
|
||||
use rog_aura::Colour;
|
||||
use rog_dbus::RogDbusClientBlocking;
|
||||
use rog_dbus::zbus_aura::AuraProxyBlocking;
|
||||
use zbus::blocking::Connection;
|
||||
|
||||
fn main() -> Result<(), Box<dyn std::error::Error>> {
|
||||
let layout = KeyLayout::default_layout();
|
||||
|
||||
let (client, _) = RogDbusClientBlocking::new().unwrap();
|
||||
let conn = Connection::system().unwrap();
|
||||
let proxy = AuraProxyBlocking::new(&conn).unwrap();
|
||||
|
||||
let mut seq = AdvancedEffects::new(true);
|
||||
|
||||
@@ -62,7 +63,7 @@ fn main() -> Result<(), Box<dyn std::error::Error>> {
|
||||
seq.next_state(&layout);
|
||||
let packets = seq.create_packets();
|
||||
|
||||
client.proxies().aura().direct_addressing_raw(packets)?;
|
||||
proxy.direct_addressing_raw(packets)?;
|
||||
std::thread::sleep(std::time::Duration::from_millis(33));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -10,10 +10,10 @@ pub struct LedPowerCommand1 {
|
||||
pub help: bool,
|
||||
#[options(meta = "", help = "Control if LEDs enabled while awake <true/false>")]
|
||||
pub awake: Option<bool>,
|
||||
#[options(meta = "", help = "Use with awake option <true/false>")]
|
||||
pub keyboard: Option<bool>,
|
||||
#[options(meta = "", help = "Use with awake option <true/false>")]
|
||||
pub lightbar: Option<bool>,
|
||||
#[options(help = "Use with awake option, if excluded defaults to false")]
|
||||
pub keyboard: bool,
|
||||
#[options(help = "Use with awake option, if excluded defaults to false")]
|
||||
pub lightbar: bool,
|
||||
#[options(meta = "", help = "Control boot animations <true/false>")]
|
||||
pub boot: Option<bool>,
|
||||
#[options(meta = "", help = "Control suspend animations <true/false>")]
|
||||
|
||||
@@ -12,14 +12,17 @@ use fan_curve_cli::FanCurveCommand;
|
||||
use gumdrop::{Opt, Options};
|
||||
use rog_anime::usb::get_anime_type;
|
||||
use rog_anime::{AnimTime, AnimeDataBuffer, AnimeDiagonal, AnimeGif, AnimeImage, AnimeType, Vec2};
|
||||
use rog_aura::power::KbAuraPowerState;
|
||||
use rog_aura::usb::{AuraDevRog1, AuraDevTuf, AuraDevice, AuraPowerDev};
|
||||
use rog_aura::{self, AuraEffect};
|
||||
use rog_aura::aura_detection::PowerZones;
|
||||
use rog_aura::keyboard::{AuraPowerState, LaptopAuraPower};
|
||||
use rog_aura::{self, AuraDeviceType, AuraEffect};
|
||||
use rog_dbus::zbus_anime::AnimeProxyBlocking;
|
||||
use rog_dbus::zbus_aura::AuraProxyBlocking;
|
||||
use rog_dbus::RogDbusClientBlocking;
|
||||
use rog_dbus::zbus_fan_curves::FanCurvesProxyBlocking;
|
||||
use rog_dbus::zbus_platform::PlatformProxyBlocking;
|
||||
use rog_platform::platform::{GpuMode, Properties, ThrottlePolicy};
|
||||
use rog_profiles::error::ProfileError;
|
||||
use rog_slash::SlashMode;
|
||||
use zbus::blocking::Connection;
|
||||
|
||||
use crate::aura_cli::{AuraPowerStates, LedBrightness};
|
||||
use crate::cli_opts::*;
|
||||
@@ -47,13 +50,21 @@ fn main() {
|
||||
}
|
||||
};
|
||||
|
||||
if let Ok((dbus, _)) = RogDbusClientBlocking::new().map_err(|e| {
|
||||
let conn = Connection::system().unwrap();
|
||||
if let Ok(platform_proxy) = PlatformProxyBlocking::new(&conn).map_err(|e| {
|
||||
check_service("asusd");
|
||||
println!("\nError: {e}\n");
|
||||
print_info();
|
||||
}) {
|
||||
let supported_properties = dbus.proxies().platform().supported_properties().unwrap();
|
||||
let supported_interfaces = dbus.proxies().platform().supported_interfaces().unwrap();
|
||||
let self_version = env!("CARGO_PKG_VERSION");
|
||||
let asusd_version = platform_proxy.version().unwrap();
|
||||
if asusd_version != self_version {
|
||||
println!("Version mismatch: asusctl = {self_version}, asusd = {asusd_version}");
|
||||
return;
|
||||
}
|
||||
|
||||
let supported_properties = platform_proxy.supported_properties().unwrap();
|
||||
let supported_interfaces = platform_proxy.supported_interfaces().unwrap();
|
||||
|
||||
if parsed.version {
|
||||
println!("asusctl v{}", env!("CARGO_PKG_VERSION"));
|
||||
@@ -61,7 +72,7 @@ fn main() {
|
||||
print_info();
|
||||
}
|
||||
|
||||
if let Err(err) = do_parsed(&parsed, &supported_interfaces, &supported_properties, &dbus) {
|
||||
if let Err(err) = do_parsed(&parsed, &supported_interfaces, &supported_properties, conn) {
|
||||
print_error_help(&*err, &supported_interfaces, &supported_properties);
|
||||
}
|
||||
}
|
||||
@@ -146,20 +157,24 @@ fn do_parsed(
|
||||
parsed: &CliStart,
|
||||
supported_interfaces: &[String],
|
||||
supported_properties: &[Properties],
|
||||
dbus: &RogDbusClientBlocking<'_>,
|
||||
conn: Connection,
|
||||
) -> Result<(), Box<dyn std::error::Error>> {
|
||||
match &parsed.command {
|
||||
Some(CliCommand::LedMode(mode)) => handle_led_mode(&find_aura_iface()?, mode)?,
|
||||
Some(CliCommand::LedPow1(pow)) => handle_led_power1(&find_aura_iface()?, pow)?,
|
||||
Some(CliCommand::LedPow2(pow)) => handle_led_power2(&find_aura_iface()?, pow)?,
|
||||
Some(CliCommand::Profile(cmd)) => handle_throttle_profile(dbus, supported_properties, cmd)?,
|
||||
Some(CliCommand::Profile(cmd)) => {
|
||||
handle_throttle_profile(&conn, supported_properties, cmd)?
|
||||
}
|
||||
Some(CliCommand::FanCurve(cmd)) => {
|
||||
handle_fan_curve(dbus, supported_interfaces, cmd)?;
|
||||
handle_fan_curve(&conn, supported_interfaces, cmd)?;
|
||||
}
|
||||
Some(CliCommand::Graphics(_)) => do_gfx(),
|
||||
Some(CliCommand::Anime(cmd)) => handle_anime(dbus, cmd)?,
|
||||
Some(CliCommand::Slash(cmd)) => handle_slash(dbus, cmd)?,
|
||||
Some(CliCommand::Bios(cmd)) => handle_platform_properties(dbus, supported_properties, cmd)?,
|
||||
Some(CliCommand::Anime(cmd)) => handle_anime(&conn, cmd)?,
|
||||
Some(CliCommand::Slash(cmd)) => handle_slash(&conn, cmd)?,
|
||||
Some(CliCommand::Bios(cmd)) => {
|
||||
handle_platform_properties(&conn, supported_properties, cmd)?
|
||||
}
|
||||
None => {
|
||||
if (!parsed.show_supported
|
||||
&& parsed.kbd_bright.is_none()
|
||||
@@ -177,19 +192,19 @@ fn do_parsed(
|
||||
.first()
|
||||
.unwrap()
|
||||
.device_type()
|
||||
.unwrap_or(AuraDevice::Unknown)
|
||||
.unwrap_or(AuraDeviceType::Unknown)
|
||||
} else {
|
||||
AuraDevice::Unknown
|
||||
AuraDeviceType::Unknown
|
||||
};
|
||||
let commands: Vec<String> = cmdlist.lines().map(|s| s.to_owned()).collect();
|
||||
for command in commands.iter().filter(|command| {
|
||||
if !dev_type.is_old_style()
|
||||
&& !dev_type.is_tuf_style()
|
||||
if !dev_type.is_old_laptop()
|
||||
&& !dev_type.is_tuf_laptop()
|
||||
&& command.trim().starts_with("led-pow-1")
|
||||
{
|
||||
return false;
|
||||
}
|
||||
if !dev_type.is_new_style() && command.trim().starts_with("led-pow-2") {
|
||||
if !dev_type.is_new_laptop() && command.trim().starts_with("led-pow-2") {
|
||||
return false;
|
||||
}
|
||||
true
|
||||
@@ -265,9 +280,8 @@ fn do_parsed(
|
||||
}
|
||||
|
||||
if let Some(chg_limit) = parsed.chg_limit {
|
||||
dbus.proxies()
|
||||
.platform()
|
||||
.set_charge_control_end_threshold(chg_limit)?;
|
||||
let proxy = PlatformProxyBlocking::new(&conn)?;
|
||||
proxy.set_charge_control_end_threshold(chg_limit)?;
|
||||
}
|
||||
|
||||
Ok(())
|
||||
@@ -281,10 +295,7 @@ fn do_gfx() {
|
||||
println!("This command will be removed in future");
|
||||
}
|
||||
|
||||
fn handle_anime(
|
||||
dbus: &RogDbusClientBlocking<'_>,
|
||||
cmd: &AnimeCommand,
|
||||
) -> Result<(), Box<dyn std::error::Error>> {
|
||||
fn handle_anime(conn: &Connection, cmd: &AnimeCommand) -> Result<(), Box<dyn std::error::Error>> {
|
||||
if (cmd.command.is_none()
|
||||
&& cmd.enable_display.is_none()
|
||||
&& cmd.enable_powersave_anim.is_none()
|
||||
@@ -301,23 +312,24 @@ fn handle_anime(
|
||||
println!("\n{}", lst);
|
||||
}
|
||||
}
|
||||
let proxy = AnimeProxyBlocking::new(conn)?;
|
||||
if let Some(enable) = cmd.enable_display {
|
||||
dbus.proxies().anime().set_enable_display(enable)?;
|
||||
proxy.set_enable_display(enable)?;
|
||||
}
|
||||
if let Some(enable) = cmd.enable_powersave_anim {
|
||||
dbus.proxies().anime().set_builtins_enabled(enable)?;
|
||||
proxy.set_builtins_enabled(enable)?;
|
||||
}
|
||||
if let Some(bright) = cmd.brightness {
|
||||
dbus.proxies().anime().set_brightness(bright)?;
|
||||
proxy.set_brightness(bright)?;
|
||||
}
|
||||
if let Some(enable) = cmd.off_when_lid_closed {
|
||||
dbus.proxies().anime().set_off_when_lid_closed(enable)?;
|
||||
proxy.set_off_when_lid_closed(enable)?;
|
||||
}
|
||||
if let Some(enable) = cmd.off_when_suspended {
|
||||
dbus.proxies().anime().set_off_when_suspended(enable)?;
|
||||
proxy.set_off_when_suspended(enable)?;
|
||||
}
|
||||
if let Some(enable) = cmd.off_when_unplugged {
|
||||
dbus.proxies().anime().set_off_when_unplugged(enable)?;
|
||||
proxy.set_off_when_unplugged(enable)?;
|
||||
}
|
||||
if cmd.off_with_his_head.is_some() {
|
||||
println!("Did Alice _really_ make it back from Wonderland?");
|
||||
@@ -333,7 +345,7 @@ fn handle_anime(
|
||||
if cmd.clear {
|
||||
let data = vec![255u8; anime_type.data_length()];
|
||||
let tmp = AnimeDataBuffer::from_vec(anime_type, data)?;
|
||||
dbus.proxies().anime().write(tmp)?;
|
||||
proxy.write(tmp)?;
|
||||
}
|
||||
|
||||
if let Some(action) = cmd.command.as_ref() {
|
||||
@@ -357,9 +369,7 @@ fn handle_anime(
|
||||
anime_type,
|
||||
)?;
|
||||
|
||||
dbus.proxies()
|
||||
.anime()
|
||||
.write(<AnimeDataBuffer>::try_from(&matrix)?)?;
|
||||
proxy.write(<AnimeDataBuffer>::try_from(&matrix)?)?;
|
||||
}
|
||||
AnimeActions::PixelImage(image) => {
|
||||
if image.help_requested() || image.path.is_empty() {
|
||||
@@ -378,9 +388,7 @@ fn handle_anime(
|
||||
anime_type,
|
||||
)?;
|
||||
|
||||
dbus.proxies()
|
||||
.anime()
|
||||
.write(matrix.into_data_buffer(anime_type)?)?;
|
||||
proxy.write(matrix.into_data_buffer(anime_type)?)?;
|
||||
}
|
||||
AnimeActions::Gif(gif) => {
|
||||
if gif.help_requested() || gif.path.is_empty() {
|
||||
@@ -405,7 +413,7 @@ fn handle_anime(
|
||||
let mut loops = gif.loops as i32;
|
||||
loop {
|
||||
for frame in matrix.frames() {
|
||||
dbus.proxies().anime().write(frame.frame().clone())?;
|
||||
proxy.write(frame.frame().clone())?;
|
||||
sleep(frame.delay());
|
||||
}
|
||||
if loops >= 0 {
|
||||
@@ -436,7 +444,7 @@ fn handle_anime(
|
||||
let mut loops = gif.loops as i32;
|
||||
loop {
|
||||
for frame in matrix.frames() {
|
||||
dbus.proxies().anime().write(frame.frame().clone())?;
|
||||
proxy.write(frame.frame().clone())?;
|
||||
sleep(frame.delay());
|
||||
}
|
||||
if loops >= 0 {
|
||||
@@ -457,9 +465,7 @@ fn handle_anime(
|
||||
return Ok(());
|
||||
}
|
||||
|
||||
dbus.proxies()
|
||||
.anime()
|
||||
.set_builtin_animations(rog_anime::Animations {
|
||||
proxy.set_builtin_animations(rog_anime::Animations {
|
||||
boot: builtins.boot,
|
||||
awake: builtins.awake,
|
||||
sleep: builtins.sleep,
|
||||
@@ -606,15 +612,15 @@ fn handle_led_power1(
|
||||
) -> Result<(), Box<dyn std::error::Error>> {
|
||||
for aura in aura {
|
||||
let dev_type = aura.device_type()?;
|
||||
if !dev_type.is_old_style() && !dev_type.is_tuf_style() {
|
||||
if !dev_type.is_old_laptop() && !dev_type.is_tuf_laptop() {
|
||||
println!("This option applies only to keyboards 2021+");
|
||||
}
|
||||
|
||||
if power.awake.is_none()
|
||||
&& power.sleep.is_none()
|
||||
&& power.boot.is_none()
|
||||
&& power.keyboard.is_none()
|
||||
&& power.lightbar.is_none()
|
||||
&& !power.keyboard
|
||||
&& !power.lightbar
|
||||
{
|
||||
if !power.help {
|
||||
println!("Missing arg or command\n");
|
||||
@@ -623,15 +629,10 @@ fn handle_led_power1(
|
||||
return Ok(());
|
||||
}
|
||||
|
||||
if dev_type.is_old_style() {
|
||||
if dev_type.is_old_laptop() || dev_type.is_tuf_laptop() {
|
||||
handle_led_power_1_do_1866(aura, power)?;
|
||||
return Ok(());
|
||||
}
|
||||
|
||||
if dev_type.is_tuf_style() {
|
||||
handle_led_power_1_do_tuf(aura, power)?;
|
||||
return Ok(());
|
||||
}
|
||||
}
|
||||
|
||||
println!("These options are for keyboards of product ID 0x1866 or TUF only");
|
||||
@@ -642,62 +643,24 @@ fn handle_led_power_1_do_1866(
|
||||
aura: &AuraProxyBlocking,
|
||||
power: &LedPowerCommand1,
|
||||
) -> Result<(), Box<dyn std::error::Error>> {
|
||||
let mut enabled: Vec<AuraDevRog1> = Vec::new();
|
||||
let mut disabled: Vec<AuraDevRog1> = Vec::new();
|
||||
|
||||
let mut check = |e: Option<bool>, a: AuraDevRog1| {
|
||||
if let Some(arg) = e {
|
||||
if arg {
|
||||
enabled.push(a);
|
||||
let zone = if power.keyboard && power.lightbar {
|
||||
PowerZones::KeyboardAndLightbar
|
||||
} else if power.lightbar {
|
||||
PowerZones::Lightbar
|
||||
} else {
|
||||
disabled.push(a);
|
||||
}
|
||||
}
|
||||
PowerZones::Keyboard
|
||||
};
|
||||
let states = LaptopAuraPower {
|
||||
states: vec![AuraPowerState {
|
||||
zone,
|
||||
boot: power.boot.unwrap_or_default(),
|
||||
awake: power.awake.unwrap_or_default(),
|
||||
sleep: power.sleep.unwrap_or_default(),
|
||||
shutdown: false,
|
||||
}],
|
||||
};
|
||||
|
||||
check(power.awake, AuraDevRog1::Awake);
|
||||
check(power.boot, AuraDevRog1::Boot);
|
||||
check(power.sleep, AuraDevRog1::Sleep);
|
||||
check(power.keyboard, AuraDevRog1::Keyboard);
|
||||
check(power.lightbar, AuraDevRog1::Lightbar);
|
||||
|
||||
let data = AuraPowerDev {
|
||||
old_rog: enabled,
|
||||
..Default::default()
|
||||
};
|
||||
|
||||
aura.set_led_power(data.clone())?; // TODO: verify this
|
||||
|
||||
Ok(())
|
||||
}
|
||||
|
||||
fn handle_led_power_1_do_tuf(
|
||||
aura: &AuraProxyBlocking,
|
||||
power: &LedPowerCommand1,
|
||||
) -> Result<(), Box<dyn std::error::Error>> {
|
||||
let mut enabled: Vec<AuraDevTuf> = Vec::new();
|
||||
let mut disabled: Vec<AuraDevTuf> = Vec::new();
|
||||
|
||||
let mut check = |e: Option<bool>, a: AuraDevTuf| {
|
||||
if let Some(arg) = e {
|
||||
if arg {
|
||||
enabled.push(a);
|
||||
} else {
|
||||
disabled.push(a);
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
check(power.awake, AuraDevTuf::Awake);
|
||||
check(power.boot, AuraDevTuf::Boot);
|
||||
check(power.sleep, AuraDevTuf::Sleep);
|
||||
check(power.keyboard, AuraDevTuf::Keyboard);
|
||||
|
||||
let data = AuraPowerDev {
|
||||
tuf: enabled,
|
||||
..Default::default()
|
||||
};
|
||||
aura.set_led_power(data.clone())?; // TODO: verify this
|
||||
aura.set_led_power(states)?;
|
||||
|
||||
Ok(())
|
||||
}
|
||||
@@ -708,7 +671,7 @@ fn handle_led_power2(
|
||||
) -> Result<(), Box<dyn std::error::Error>> {
|
||||
for aura in aura {
|
||||
let dev_type = aura.device_type()?;
|
||||
if !dev_type.is_new_style() {
|
||||
if !dev_type.is_new_laptop() {
|
||||
println!("This option applies only to keyboards 2021+");
|
||||
continue;
|
||||
}
|
||||
@@ -737,25 +700,30 @@ fn handle_led_power2(
|
||||
return Ok(());
|
||||
}
|
||||
|
||||
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;
|
||||
let mut states = aura.led_power()?;
|
||||
let mut set = |zone: PowerZones, set_to: &AuraPowerStates| {
|
||||
for state in states.states.iter_mut() {
|
||||
if state.zone == zone {
|
||||
state.boot = set_to.boot;
|
||||
state.awake = set_to.awake;
|
||||
state.sleep = set_to.sleep;
|
||||
state.shutdown = set_to.shutdown;
|
||||
break;
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
let mut enabled = aura.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),
|
||||
aura_cli::SetAuraZoneEnabled::Keyboard(k) => set(PowerZones::Keyboard, k),
|
||||
aura_cli::SetAuraZoneEnabled::Logo(l) => set(PowerZones::Logo, l),
|
||||
aura_cli::SetAuraZoneEnabled::Lightbar(l) => set(PowerZones::Lightbar, l),
|
||||
aura_cli::SetAuraZoneEnabled::Lid(l) => set(PowerZones::Lid, l),
|
||||
aura_cli::SetAuraZoneEnabled::RearGlow(r) => set(PowerZones::RearGlow, r),
|
||||
}
|
||||
}
|
||||
|
||||
aura.set_led_power(enabled)?;
|
||||
aura.set_led_power(states)?;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -763,7 +731,7 @@ fn handle_led_power2(
|
||||
}
|
||||
|
||||
fn handle_throttle_profile(
|
||||
dbus: &RogDbusClientBlocking<'_>,
|
||||
conn: &Connection,
|
||||
supported: &[Properties],
|
||||
cmd: &ProfileCommand,
|
||||
) -> Result<(), Box<dyn std::error::Error>> {
|
||||
@@ -783,16 +751,14 @@ fn handle_throttle_profile(
|
||||
}
|
||||
return Ok(());
|
||||
}
|
||||
let current = dbus.proxies().platform().throttle_thermal_policy()?;
|
||||
|
||||
let proxy = PlatformProxyBlocking::new(conn)?;
|
||||
let current = proxy.throttle_thermal_policy()?;
|
||||
|
||||
if cmd.next {
|
||||
dbus.proxies()
|
||||
.platform()
|
||||
.set_throttle_thermal_policy(current.next())?;
|
||||
proxy.set_throttle_thermal_policy(current.next())?;
|
||||
} else if let Some(profile) = cmd.profile_set {
|
||||
dbus.proxies()
|
||||
.platform()
|
||||
.set_throttle_thermal_policy(profile)?;
|
||||
proxy.set_throttle_thermal_policy(profile)?;
|
||||
}
|
||||
|
||||
if cmd.list {
|
||||
@@ -810,7 +776,7 @@ fn handle_throttle_profile(
|
||||
}
|
||||
|
||||
fn handle_fan_curve(
|
||||
dbus: &RogDbusClientBlocking<'_>,
|
||||
conn: &Connection,
|
||||
supported: &[String],
|
||||
cmd: &FanCurveCommand,
|
||||
) -> Result<(), Box<dyn std::error::Error>> {
|
||||
@@ -841,37 +807,35 @@ fn handle_fan_curve(
|
||||
return Ok(());
|
||||
}
|
||||
|
||||
let plat_proxy = PlatformProxyBlocking::new(conn)?;
|
||||
let fan_proxy = FanCurvesProxyBlocking::new(conn)?;
|
||||
if cmd.get_enabled {
|
||||
let profile = dbus.proxies().platform().throttle_thermal_policy()?;
|
||||
let curves = dbus.proxies().fan_curves().fan_curve_data(profile)?;
|
||||
let profile = plat_proxy.throttle_thermal_policy()?;
|
||||
let curves = fan_proxy.fan_curve_data(profile)?;
|
||||
for curve in curves.iter() {
|
||||
println!("{}", String::from(curve));
|
||||
}
|
||||
}
|
||||
|
||||
if cmd.default {
|
||||
let active = dbus.proxies().platform().throttle_thermal_policy()?;
|
||||
dbus.proxies().fan_curves().set_curves_to_defaults(active)?;
|
||||
let active = plat_proxy.throttle_thermal_policy()?;
|
||||
fan_proxy.set_curves_to_defaults(active)?;
|
||||
}
|
||||
|
||||
if let Some(profile) = cmd.mod_profile {
|
||||
if cmd.enable_fan_curves.is_none() && cmd.data.is_none() {
|
||||
let data = dbus.proxies().fan_curves().fan_curve_data(profile)?;
|
||||
let data = fan_proxy.fan_curve_data(profile)?;
|
||||
let data = toml::to_string(&data)?;
|
||||
println!("\nFan curves for {:?}\n\n{}", profile, data);
|
||||
}
|
||||
|
||||
if let Some(enabled) = cmd.enable_fan_curves {
|
||||
dbus.proxies()
|
||||
.fan_curves()
|
||||
.set_fan_curves_enabled(profile, enabled)?;
|
||||
fan_proxy.set_fan_curves_enabled(profile, enabled)?;
|
||||
}
|
||||
|
||||
if let Some(enabled) = cmd.enable_fan_curve {
|
||||
if let Some(fan) = cmd.fan {
|
||||
dbus.proxies()
|
||||
.fan_curves()
|
||||
.set_profile_fan_curve_enabled(profile, fan, enabled)?;
|
||||
fan_proxy.set_profile_fan_curve_enabled(profile, fan, enabled)?;
|
||||
} else {
|
||||
println!(
|
||||
"--enable-fan-curves, --enable-fan-curve, --fan, and --data options require \
|
||||
@@ -883,7 +847,7 @@ fn handle_fan_curve(
|
||||
if let Some(mut curve) = cmd.data.clone() {
|
||||
let fan = cmd.fan.unwrap_or_default();
|
||||
curve.set_fan(fan);
|
||||
dbus.proxies().fan_curves().set_fan_curve(profile, curve)?;
|
||||
fan_proxy.set_fan_curve(profile, curve)?;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -891,7 +855,7 @@ fn handle_fan_curve(
|
||||
}
|
||||
|
||||
fn handle_platform_properties(
|
||||
dbus: &RogDbusClientBlocking<'_>,
|
||||
conn: &Connection,
|
||||
supported: &[Properties],
|
||||
cmd: &BiosCommand,
|
||||
) -> Result<(), Box<dyn std::error::Error>> {
|
||||
@@ -917,34 +881,34 @@ fn handle_platform_properties(
|
||||
}
|
||||
}
|
||||
|
||||
let proxy = PlatformProxyBlocking::new(conn)?;
|
||||
|
||||
if let Some(opt) = cmd.post_sound_set {
|
||||
dbus.proxies().platform().set_boot_sound(opt)?;
|
||||
proxy.set_boot_sound(opt)?;
|
||||
}
|
||||
if cmd.post_sound_get {
|
||||
let res = dbus.proxies().platform().boot_sound()?;
|
||||
let res = proxy.boot_sound()?;
|
||||
println!("Bios POST sound on: {}", res);
|
||||
}
|
||||
|
||||
if let Some(opt) = cmd.gpu_mux_mode_set {
|
||||
println!("Rebuilding initrd to include drivers");
|
||||
dbus.proxies()
|
||||
.platform()
|
||||
.set_gpu_mux_mode(GpuMode::from_mux(opt))?;
|
||||
proxy.set_gpu_mux_mode(GpuMode::from_mux(opt))?;
|
||||
println!(
|
||||
"The mode change is not active until you reboot, on boot the bios will make the \
|
||||
required change"
|
||||
);
|
||||
}
|
||||
if cmd.gpu_mux_mode_get {
|
||||
let res = dbus.proxies().platform().gpu_mux_mode()?;
|
||||
let res = proxy.gpu_mux_mode()?;
|
||||
println!("Bios GPU MUX: {:?}", res);
|
||||
}
|
||||
|
||||
if let Some(opt) = cmd.panel_overdrive_set {
|
||||
dbus.proxies().platform().set_panel_od(opt)?;
|
||||
proxy.set_panel_od(opt)?;
|
||||
}
|
||||
if cmd.panel_overdrive_get {
|
||||
let res = dbus.proxies().platform().panel_od()?;
|
||||
let res = proxy.panel_od()?;
|
||||
println!("Panel overdrive on: {}", res);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -3,8 +3,8 @@ use std::time::Duration;
|
||||
|
||||
use config_traits::{StdConfig, StdConfigLoad};
|
||||
use rog_anime::{ActionLoader, AnimTime, AnimeType, Fade, Sequences as AnimeSequences, Vec2};
|
||||
use rog_aura::advanced::LedCode;
|
||||
use rog_aura::effects::{AdvancedEffects as AuraSequences, Breathe, DoomFlicker, Effect, Static};
|
||||
use rog_aura::keyboard::LedCode;
|
||||
use rog_aura::{Colour, Speed};
|
||||
use serde_derive::{Deserialize, Serialize};
|
||||
|
||||
|
||||
@@ -7,7 +7,7 @@ use std::time::{Duration, Instant};
|
||||
use config_traits::StdConfig;
|
||||
use rog_anime::error::AnimeError;
|
||||
use rog_anime::{ActionData, ActionLoader, AnimTime, Fade, Sequences, Vec2};
|
||||
use rog_dbus::RogDbusClientBlocking;
|
||||
use rog_dbus::zbus_anime::AnimeProxyBlocking;
|
||||
use serde_derive::{Deserialize, Serialize};
|
||||
use zbus::interface;
|
||||
use zbus::zvariant::{ObjectPath, Type};
|
||||
@@ -61,14 +61,14 @@ pub enum TimeType {
|
||||
/// thread and a zbus server behind `Arc<Mutex<T>>`
|
||||
pub struct CtrlAnimeInner<'a> {
|
||||
sequences: Sequences,
|
||||
client: RogDbusClientBlocking<'a>,
|
||||
client: AnimeProxyBlocking<'a>,
|
||||
do_early_return: Arc<AtomicBool>,
|
||||
}
|
||||
|
||||
impl<'a> CtrlAnimeInner<'static> {
|
||||
pub fn new(
|
||||
sequences: Sequences,
|
||||
client: RogDbusClientBlocking<'static>,
|
||||
client: AnimeProxyBlocking<'static>,
|
||||
do_early_return: Arc<AtomicBool>,
|
||||
) -> Result<Self, Error> {
|
||||
Ok(Self {
|
||||
@@ -93,19 +93,13 @@ impl<'a> CtrlAnimeInner<'static> {
|
||||
return Ok(true); // Do safe exit
|
||||
}
|
||||
self.client
|
||||
.proxies()
|
||||
.anime()
|
||||
.write(output)
|
||||
.map_err(|e| AnimeError::Dbus(format!("{}", e)))
|
||||
.map(|_| false)
|
||||
});
|
||||
}
|
||||
ActionData::Image(image) => {
|
||||
self.client
|
||||
.proxies()
|
||||
.anime()
|
||||
.write(image.as_ref().clone())
|
||||
.ok();
|
||||
self.client.write(image.as_ref().clone()).ok();
|
||||
}
|
||||
ActionData::Pause(duration) => {
|
||||
let start = Instant::now();
|
||||
@@ -132,7 +126,7 @@ impl<'a> CtrlAnimeInner<'static> {
|
||||
|
||||
pub struct CtrlAnime<'a> {
|
||||
config: Arc<Mutex<ConfigAnime>>,
|
||||
client: RogDbusClientBlocking<'a>,
|
||||
client: AnimeProxyBlocking<'a>,
|
||||
inner: Arc<Mutex<CtrlAnimeInner<'a>>>,
|
||||
/// Must be the same Atomic as in CtrlAnimeInner
|
||||
inner_early_return: Arc<AtomicBool>,
|
||||
@@ -142,7 +136,7 @@ impl CtrlAnime<'static> {
|
||||
pub fn new(
|
||||
config: Arc<Mutex<ConfigAnime>>,
|
||||
inner: Arc<Mutex<CtrlAnimeInner<'static>>>,
|
||||
client: RogDbusClientBlocking<'static>,
|
||||
client: AnimeProxyBlocking<'static>,
|
||||
inner_early_return: Arc<AtomicBool>,
|
||||
) -> Result<Self, Error> {
|
||||
Ok(CtrlAnime {
|
||||
@@ -356,13 +350,13 @@ impl CtrlAnime<'static> {
|
||||
pub fn set_state(&mut self, on: bool) -> zbus::fdo::Result<()> {
|
||||
// Operations here need to be in specific order
|
||||
if on {
|
||||
self.client.proxies().anime().set_enable_display(on).ok();
|
||||
self.client.set_enable_display(on).ok();
|
||||
// Let the inner loop run
|
||||
self.inner_early_return.store(false, Ordering::SeqCst);
|
||||
} else {
|
||||
// Must make the inner run loop return early
|
||||
self.inner_early_return.store(true, Ordering::SeqCst);
|
||||
self.client.proxies().anime().set_enable_display(on).ok();
|
||||
self.client.set_enable_display(on).ok();
|
||||
}
|
||||
Ok(())
|
||||
}
|
||||
|
||||
@@ -8,8 +8,11 @@ use asusd_user::ctrl_anime::{CtrlAnime, CtrlAnimeInner};
|
||||
use config_traits::{StdConfig, StdConfigLoad};
|
||||
use rog_anime::usb::get_anime_type;
|
||||
use rog_aura::aura_detection::LaptopLedData;
|
||||
use rog_aura::layouts::KeyLayout;
|
||||
use rog_dbus::{RogDbusClientBlocking, DBUS_NAME};
|
||||
use rog_aura::keyboard::KeyLayout;
|
||||
use rog_dbus::zbus_anime::AnimeProxyBlocking;
|
||||
use rog_dbus::zbus_aura::AuraProxyBlocking;
|
||||
use rog_dbus::zbus_platform::PlatformProxyBlocking;
|
||||
use rog_dbus::DBUS_NAME;
|
||||
use smol::Executor;
|
||||
use zbus::Connection;
|
||||
|
||||
@@ -32,10 +35,10 @@ fn main() -> Result<(), Box<dyn std::error::Error>> {
|
||||
println!(" rog-dbus v{}", rog_dbus::VERSION);
|
||||
println!("rog-platform v{}", rog_platform::VERSION);
|
||||
|
||||
let (client, _) = RogDbusClientBlocking::new()?;
|
||||
let supported = client
|
||||
.proxies()
|
||||
.platform()
|
||||
let conn = zbus::blocking::Connection::system().unwrap();
|
||||
let platform_proxy = PlatformProxyBlocking::new(&conn).unwrap();
|
||||
|
||||
let supported = platform_proxy
|
||||
.supported_interfaces()
|
||||
.unwrap_or_default()
|
||||
.contains(&"Anime".to_string());
|
||||
@@ -51,6 +54,7 @@ fn main() -> Result<(), Box<dyn std::error::Error>> {
|
||||
let anime = anime_config.create(anime_type)?;
|
||||
let anime_config = Arc::new(Mutex::new(anime_config));
|
||||
|
||||
let anime_proxy_blocking = AnimeProxyBlocking::new(&conn).unwrap();
|
||||
executor
|
||||
.spawn(async move {
|
||||
// Create server
|
||||
@@ -59,12 +63,21 @@ fn main() -> Result<(), Box<dyn std::error::Error>> {
|
||||
|
||||
// Inner behind mutex required for thread safety
|
||||
let inner = Arc::new(Mutex::new(
|
||||
CtrlAnimeInner::new(anime, client, early_return.clone()).unwrap(),
|
||||
CtrlAnimeInner::new(
|
||||
anime,
|
||||
anime_proxy_blocking.clone(),
|
||||
early_return.clone(),
|
||||
)
|
||||
.unwrap(),
|
||||
));
|
||||
// Need new client object for dbus control part
|
||||
let (client, _) = RogDbusClientBlocking::new().unwrap();
|
||||
let anime_control =
|
||||
CtrlAnime::new(anime_config, inner.clone(), client, early_return).unwrap();
|
||||
let anime_control = CtrlAnime::new(
|
||||
anime_config,
|
||||
inner.clone(),
|
||||
anime_proxy_blocking,
|
||||
early_return,
|
||||
)
|
||||
.unwrap();
|
||||
anime_control.add_to_server(&mut connection).await;
|
||||
loop {
|
||||
if let Ok(inner) = inner.clone().try_lock() {
|
||||
@@ -89,22 +102,14 @@ fn main() -> Result<(), Box<dyn std::error::Error>> {
|
||||
})
|
||||
.unwrap_or_else(|_| KeyLayout::default_layout());
|
||||
|
||||
let aura_proxy_blocking = AuraProxyBlocking::new(&conn).unwrap();
|
||||
executor
|
||||
.spawn(async move {
|
||||
// Create server
|
||||
let (client, _) = RogDbusClientBlocking::new().unwrap();
|
||||
// let connection = Connection::session().await.unwrap();
|
||||
// connection.request_name(DBUS_NAME).await.unwrap();
|
||||
|
||||
loop {
|
||||
aura_config.aura.next_state(&layout);
|
||||
let packets = aura_config.aura.create_packets();
|
||||
|
||||
client
|
||||
.proxies()
|
||||
.aura()
|
||||
.direct_addressing_raw(packets)
|
||||
.unwrap();
|
||||
aura_proxy_blocking.direct_addressing_raw(packets).unwrap();
|
||||
std::thread::sleep(std::time::Duration::from_millis(33));
|
||||
}
|
||||
})
|
||||
|
||||
@@ -1,112 +1,14 @@
|
||||
use std::collections::{BTreeMap, HashSet};
|
||||
use std::collections::BTreeMap;
|
||||
|
||||
use config_traits::{StdConfig, StdConfigLoad};
|
||||
use log::{debug, info};
|
||||
use log::{debug, info, warn};
|
||||
use rog_aura::aura_detection::LaptopLedData;
|
||||
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_aura::keyboard::LaptopAuraPower;
|
||||
use rog_aura::{
|
||||
AuraDeviceType, AuraEffect, AuraModeNum, AuraZone, Direction, LedBrightness, Speed, GRADIENT,
|
||||
};
|
||||
use serde_derive::{Deserialize, Serialize};
|
||||
|
||||
/// Enable/disable LED control in various states such as
|
||||
/// when the device is awake, suspended, shutting down or
|
||||
/// booting.
|
||||
#[derive(Clone, Debug, PartialEq, Eq, Serialize, Deserialize)]
|
||||
pub enum AuraPowerConfig {
|
||||
AuraDevTuf(HashSet<AuraDevTuf>),
|
||||
AuraDevRog1(HashSet<AuraDevRog1>),
|
||||
AuraDevRog2(AuraPower),
|
||||
}
|
||||
|
||||
impl Default for AuraPowerConfig {
|
||||
fn default() -> Self {
|
||||
Self::AuraDevTuf(HashSet::default())
|
||||
}
|
||||
}
|
||||
|
||||
impl AuraPowerConfig {
|
||||
/// Invalid for TUF laptops
|
||||
pub fn to_bytes(control: &Self) -> [u8; 4] {
|
||||
match control {
|
||||
AuraPowerConfig::AuraDevTuf(_) => [0, 0, 0, 0],
|
||||
AuraPowerConfig::AuraDevRog1(c) => {
|
||||
let c: Vec<AuraDevRog1> = c.iter().copied().collect();
|
||||
AuraDevRog1::to_bytes(&c)
|
||||
}
|
||||
AuraPowerConfig::AuraDevRog2(c) => c.to_bytes(),
|
||||
}
|
||||
}
|
||||
|
||||
pub fn to_tuf_bool_array(control: &Self) -> Option<[bool; 5]> {
|
||||
if let Self::AuraDevTuf(c) = control {
|
||||
return Some([
|
||||
true,
|
||||
c.contains(&AuraDevTuf::Boot),
|
||||
c.contains(&AuraDevTuf::Awake),
|
||||
c.contains(&AuraDevTuf::Sleep),
|
||||
c.contains(&AuraDevTuf::Keyboard),
|
||||
]);
|
||||
}
|
||||
|
||||
if let Self::AuraDevRog1(c) = control {
|
||||
return Some([
|
||||
true,
|
||||
c.contains(&AuraDevRog1::Boot),
|
||||
c.contains(&AuraDevRog1::Awake),
|
||||
c.contains(&AuraDevRog1::Sleep),
|
||||
c.contains(&AuraDevRog1::Keyboard),
|
||||
]);
|
||||
}
|
||||
|
||||
None
|
||||
}
|
||||
|
||||
pub fn set_tuf(&mut self, power: AuraDevTuf, on: bool) {
|
||||
if let Self::AuraDevTuf(p) = self {
|
||||
if on {
|
||||
p.insert(power);
|
||||
} else {
|
||||
p.remove(&power);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
pub fn set_0x1866(&mut self, power: AuraDevRog1, on: bool) {
|
||||
if let Self::AuraDevRog1(p) = self {
|
||||
if on {
|
||||
p.insert(power);
|
||||
} else {
|
||||
p.remove(&power);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
pub fn set_0x19b6(&mut self, power: AuraPower) {
|
||||
if let Self::AuraDevRog2(p) = self {
|
||||
*p = power;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
impl From<&AuraPowerConfig> for AuraPowerDev {
|
||||
fn from(config: &AuraPowerConfig) -> Self {
|
||||
match config {
|
||||
AuraPowerConfig::AuraDevTuf(d) => AuraPowerDev {
|
||||
tuf: d.iter().copied().collect(),
|
||||
..Default::default()
|
||||
},
|
||||
AuraPowerConfig::AuraDevRog1(d) => AuraPowerDev {
|
||||
old_rog: d.iter().copied().collect(),
|
||||
..Default::default()
|
||||
},
|
||||
AuraPowerConfig::AuraDevRog2(d) => AuraPowerDev {
|
||||
rog: d.clone(),
|
||||
..Default::default()
|
||||
},
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#[derive(Deserialize, Serialize, Default, Debug, Clone)]
|
||||
// #[serde(default)]
|
||||
pub struct AuraConfig {
|
||||
@@ -116,15 +18,7 @@ pub struct AuraConfig {
|
||||
pub builtins: BTreeMap<AuraModeNum, AuraEffect>,
|
||||
pub multizone: Option<BTreeMap<AuraModeNum, Vec<AuraEffect>>>,
|
||||
pub multizone_on: bool,
|
||||
pub enabled: AuraPowerConfig,
|
||||
}
|
||||
|
||||
impl AuraConfig {
|
||||
/// Detect the keyboard type and load from default DB if data available
|
||||
pub fn new_with(prod_id: AuraDevice) -> Self {
|
||||
info!("Setting up AuraConfig for {prod_id:?}");
|
||||
Self::from_default_support(prod_id, &LaptopLedData::get_data())
|
||||
}
|
||||
pub enabled: LaptopAuraPower,
|
||||
}
|
||||
|
||||
impl StdConfig for AuraConfig {
|
||||
@@ -148,28 +42,18 @@ impl StdConfig for AuraConfig {
|
||||
impl StdConfigLoad for AuraConfig {}
|
||||
|
||||
impl AuraConfig {
|
||||
pub fn from_default_support(prod_id: AuraDevice, support_data: &LaptopLedData) -> Self {
|
||||
/// Detect the keyboard type and load from default DB if data available
|
||||
pub fn new(prod_id: &str) -> Self {
|
||||
info!("Setting up AuraConfig for {prod_id:?}");
|
||||
// create a default config here
|
||||
let enabled = if prod_id.is_new_style() {
|
||||
AuraPowerConfig::AuraDevRog2(AuraPower::new_all_on())
|
||||
} else if prod_id.is_tuf_style() {
|
||||
AuraPowerConfig::AuraDevTuf(HashSet::from([
|
||||
AuraDevTuf::Awake,
|
||||
AuraDevTuf::Boot,
|
||||
AuraDevTuf::Sleep,
|
||||
AuraDevTuf::Keyboard,
|
||||
]))
|
||||
} else {
|
||||
AuraPowerConfig::AuraDevRog1(HashSet::from([
|
||||
AuraDevRog1::Awake,
|
||||
AuraDevRog1::Boot,
|
||||
AuraDevRog1::Sleep,
|
||||
AuraDevRog1::Keyboard,
|
||||
AuraDevRog1::Lightbar,
|
||||
]))
|
||||
};
|
||||
let device_type = AuraDeviceType::from(&*prod_id);
|
||||
if device_type == AuraDeviceType::Unknown {
|
||||
warn!("idProduct:{prod_id:?} is unknown");
|
||||
}
|
||||
let support_data = LaptopLedData::get_data();
|
||||
let enabled = LaptopAuraPower::new(device_type, &support_data);
|
||||
let mut config = AuraConfig {
|
||||
config_name: format!("aura_{prod_id:?}.ron"),
|
||||
config_name: format!("aura_{prod_id}.ron"),
|
||||
brightness: LedBrightness::Med,
|
||||
current_mode: AuraModeNum::Static,
|
||||
builtins: BTreeMap::new(),
|
||||
@@ -249,16 +133,13 @@ impl AuraConfig {
|
||||
|
||||
#[cfg(test)]
|
||||
mod tests {
|
||||
use rog_aura::aura_detection::LaptopLedData;
|
||||
use rog_aura::usb::AuraDevice;
|
||||
use rog_aura::{AuraEffect, AuraModeNum, AuraZone, Colour};
|
||||
|
||||
use super::AuraConfig;
|
||||
|
||||
#[test]
|
||||
fn set_multizone_4key_config() {
|
||||
let mut config =
|
||||
AuraConfig::from_default_support(AuraDevice::X19b6, &LaptopLedData::default());
|
||||
let mut config = AuraConfig::new("19b6");
|
||||
|
||||
let effect = AuraEffect {
|
||||
colour1: Colour {
|
||||
@@ -348,8 +229,7 @@ mod tests {
|
||||
|
||||
#[test]
|
||||
fn set_multizone_multimode_config() {
|
||||
let mut config =
|
||||
AuraConfig::from_default_support(AuraDevice::X19b6, &LaptopLedData::default());
|
||||
let mut config = AuraConfig::new("19b6");
|
||||
|
||||
let effect = AuraEffect {
|
||||
zone: AuraZone::Key1,
|
||||
|
||||
@@ -3,15 +3,17 @@ use std::collections::{BTreeMap, HashSet};
|
||||
use config_traits::{StdConfig, StdConfigLoad};
|
||||
use inotify::Inotify;
|
||||
use log::{debug, info, warn};
|
||||
use rog_aura::advanced::{LedUsbPackets, UsbPackets};
|
||||
use rog_aura::aura_detection::LaptopLedData;
|
||||
use rog_aura::usb::{AuraDevice, LED_APPLY, LED_SET};
|
||||
use rog_aura::{AuraEffect, Direction, LedBrightness, Speed, GRADIENT, LED_MSG_LEN};
|
||||
use rog_aura::keyboard::{LedUsbPackets, UsbPackets};
|
||||
use rog_aura::usb::{LED_APPLY, LED_SET};
|
||||
use rog_aura::{
|
||||
AuraDeviceType, AuraEffect, Direction, LedBrightness, Speed, GRADIENT, LED_MSG_LEN,
|
||||
};
|
||||
use rog_platform::hid_raw::HidRaw;
|
||||
use rog_platform::keyboard_led::KeyboardLed;
|
||||
use zbus::zvariant::OwnedObjectPath;
|
||||
|
||||
use super::config::{AuraConfig, AuraPowerConfig};
|
||||
use super::config::AuraConfig;
|
||||
use crate::ctrl_aura::manager::dbus_path_for_dev;
|
||||
use crate::error::RogError;
|
||||
|
||||
@@ -50,7 +52,7 @@ impl LEDNode {
|
||||
|
||||
/// Individual controller for one Aura device
|
||||
pub struct CtrlKbdLed {
|
||||
pub led_prod: AuraDevice,
|
||||
pub led_type: AuraDeviceType,
|
||||
pub led_node: LEDNode,
|
||||
pub supported_data: LaptopLedData, // TODO: is storing this really required?
|
||||
pub per_key_mode_active: bool,
|
||||
@@ -92,10 +94,11 @@ impl CtrlKbdLed {
|
||||
}
|
||||
// Device is something like 002, while its parent is the MCU
|
||||
// Think of it like the device is an endpoint of the USB device attached
|
||||
let mut aura_dev = AuraDevice::Unknown;
|
||||
let mut prod_id = String::new();
|
||||
if let Some(usb_id) = usb_device.attribute_value("idProduct") {
|
||||
aura_dev = AuraDevice::from(usb_id.to_str().unwrap());
|
||||
if aura_dev == AuraDevice::Unknown || found.contains(&aura_dev) {
|
||||
prod_id = usb_id.to_string_lossy().to_string();
|
||||
let aura_dev = AuraDeviceType::from(prod_id.as_str());
|
||||
if aura_dev == AuraDeviceType::Unknown || found.contains(&aura_dev) {
|
||||
log::debug!("Unknown or invalid device: {usb_id:?}, skipping");
|
||||
continue;
|
||||
}
|
||||
@@ -112,7 +115,7 @@ impl CtrlKbdLed {
|
||||
let dbus_path = dbus_path_for_dev(&usb_device).unwrap_or_default();
|
||||
let dev = HidRaw::from_device(end_point)?;
|
||||
let mut dev = Self::from_hidraw(dev, dbus_path, data)?;
|
||||
dev.config = Self::init_config(aura_dev, data);
|
||||
dev.config = Self::init_config(&prod_id, data);
|
||||
devices.push(dev);
|
||||
}
|
||||
}
|
||||
@@ -130,8 +133,8 @@ impl CtrlKbdLed {
|
||||
data: &LaptopLedData,
|
||||
) -> Result<Self, RogError> {
|
||||
let rgb_led = KeyboardLed::new()?;
|
||||
let prod_id = AuraDevice::from(device.prod_id());
|
||||
if prod_id == AuraDevice::Unknown {
|
||||
let prod_id = AuraDeviceType::from(device.prod_id());
|
||||
if prod_id == AuraDeviceType::Unknown {
|
||||
log::error!("{} is AuraDevice::Unknown", device.prod_id());
|
||||
return Err(RogError::NoAuraNode);
|
||||
}
|
||||
@@ -140,7 +143,7 @@ impl CtrlKbdLed {
|
||||
// let config = Self::init_config(prod_id, data);
|
||||
|
||||
let ctrl = CtrlKbdLed {
|
||||
led_prod: prod_id,
|
||||
led_type: prod_id,
|
||||
led_node: LEDNode::Rog(rgb_led, device),
|
||||
supported_data: data.clone(),
|
||||
per_key_mode_active: false,
|
||||
@@ -150,9 +153,9 @@ impl CtrlKbdLed {
|
||||
Ok(ctrl)
|
||||
}
|
||||
|
||||
pub fn init_config(prod_id: AuraDevice, supported_basic_modes: &LaptopLedData) -> AuraConfig {
|
||||
pub fn init_config(prod_id: &str, supported_basic_modes: &LaptopLedData) -> AuraConfig {
|
||||
// New loads data from the DB also
|
||||
let mut config_init = AuraConfig::new_with(prod_id);
|
||||
let mut config_init = AuraConfig::new(prod_id);
|
||||
// config_init.set_filename(prod_id);
|
||||
let mut config_loaded = config_init.clone().load();
|
||||
// update the initialised data with what we loaded from disk
|
||||
@@ -191,12 +194,14 @@ impl CtrlKbdLed {
|
||||
/// leds/side leds LED active
|
||||
pub(super) fn set_power_states(&mut self) -> Result<(), RogError> {
|
||||
if let LEDNode::KbdLed(platform) = &mut self.led_node {
|
||||
if let Some(pwr) = AuraPowerConfig::to_tuf_bool_array(&self.config.enabled) {
|
||||
let buf = [1, pwr[1] as u8, pwr[2] as u8, pwr[3] as u8, pwr[4] as u8];
|
||||
platform.set_kbd_rgb_state(&buf)?;
|
||||
}
|
||||
// TODO: tuf bool array
|
||||
// if let Some(pwr) =
|
||||
// AuraPowerConfig::to_tuf_bool_array(&self.config.enabled) {
|
||||
// let buf = [1, pwr[1] as u8, pwr[2] as u8, pwr[3] as u8,
|
||||
// pwr[4] as u8]; platform.set_kbd_rgb_state(&buf)?;
|
||||
// }
|
||||
} else if let LEDNode::Rog(_, hid_raw) = &self.led_node {
|
||||
let bytes = AuraPowerConfig::to_bytes(&self.config.enabled);
|
||||
let bytes = self.config.enabled.to_bytes(self.led_type.into());
|
||||
let message = [0x5d, 0xbd, 0x01, bytes[0], bytes[1], bytes[2], bytes[3]];
|
||||
|
||||
hid_raw.write_bytes(&message)?;
|
||||
@@ -342,8 +347,7 @@ impl CtrlKbdLed {
|
||||
#[cfg(test)]
|
||||
mod tests {
|
||||
use rog_aura::aura_detection::{LaptopLedData, PowerZones};
|
||||
use rog_aura::usb::AuraDevice;
|
||||
use rog_aura::{AuraModeNum, AuraZone};
|
||||
use rog_aura::{AuraDeviceType, AuraModeNum, AuraZone};
|
||||
use rog_platform::hid_raw::HidRaw;
|
||||
use rog_platform::keyboard_led::KeyboardLed;
|
||||
use zbus::zvariant::OwnedObjectPath;
|
||||
@@ -353,20 +357,21 @@ mod tests {
|
||||
use crate::ctrl_aura::controller::LEDNode;
|
||||
|
||||
#[test]
|
||||
#[ignore = "Unable to run in CI as the HIDRAW device is required"]
|
||||
fn create_multizone_if_no_config() {
|
||||
// Checking to ensure set_mode errors when unsupported modes are tried
|
||||
let config = AuraConfig::from_default_support(AuraDevice::X19b6, &LaptopLedData::default());
|
||||
let config = AuraConfig::new("19b6");
|
||||
let supported_basic_modes = LaptopLedData {
|
||||
board_name: String::new(),
|
||||
layout_name: "ga401".to_owned(),
|
||||
basic_modes: vec![AuraModeNum::Static],
|
||||
basic_zones: vec![],
|
||||
advanced_type: rog_aura::AdvancedAuraType::None,
|
||||
advanced_type: rog_aura::keyboard::AdvancedAuraType::None,
|
||||
power_zones: vec![PowerZones::Keyboard, PowerZones::RearGlow],
|
||||
};
|
||||
let mut controller = CtrlKbdLed {
|
||||
led_prod: AuraDevice::X19b6,
|
||||
led_node: LEDNode::Rog(KeyboardLed::default(), HidRaw::new("id_product").unwrap()),
|
||||
led_type: AuraDeviceType::LaptopPost2021,
|
||||
led_node: LEDNode::Rog(KeyboardLed::default(), HidRaw::new("19b6").unwrap()),
|
||||
supported_data: supported_basic_modes,
|
||||
per_key_mode_active: false,
|
||||
config,
|
||||
@@ -391,20 +396,22 @@ mod tests {
|
||||
}
|
||||
|
||||
#[test]
|
||||
#[ignore = "Unable to run in CI as the HIDRAW device is required"]
|
||||
// TODO: use sim device
|
||||
fn next_mode_create_multizone_if_no_config() {
|
||||
// Checking to ensure set_mode errors when unsupported modes are tried
|
||||
let config = AuraConfig::from_default_support(AuraDevice::X19b6, &LaptopLedData::default());
|
||||
let config = AuraConfig::new("19b6");
|
||||
let supported_basic_modes = LaptopLedData {
|
||||
board_name: String::new(),
|
||||
layout_name: "ga401".to_owned(),
|
||||
basic_modes: vec![AuraModeNum::Static],
|
||||
basic_zones: vec![AuraZone::Key1, AuraZone::Key2],
|
||||
advanced_type: rog_aura::AdvancedAuraType::None,
|
||||
advanced_type: rog_aura::keyboard::AdvancedAuraType::None,
|
||||
power_zones: vec![PowerZones::Keyboard, PowerZones::RearGlow],
|
||||
};
|
||||
let mut controller = CtrlKbdLed {
|
||||
led_prod: AuraDevice::X19b6,
|
||||
led_node: LEDNode::Rog(KeyboardLed::default(), HidRaw::new("id_product").unwrap()),
|
||||
led_type: AuraDeviceType::LaptopPost2021,
|
||||
led_node: LEDNode::Rog(KeyboardLed::default(), HidRaw::new("19b6").unwrap()),
|
||||
supported_data: supported_basic_modes,
|
||||
per_key_mode_active: false,
|
||||
config,
|
||||
|
||||
@@ -9,11 +9,10 @@ use std::collections::HashSet;
|
||||
use log::{debug, error, info, warn};
|
||||
use mio::{Events, Interest, Poll, Token};
|
||||
use rog_aura::aura_detection::LaptopLedData;
|
||||
use rog_aura::usb::AuraDevice;
|
||||
use rog_aura::AuraDeviceType;
|
||||
use rog_platform::hid_raw::HidRaw;
|
||||
use tokio::task::spawn_blocking;
|
||||
use udev::{Device, MonitorBuilder};
|
||||
// use zbus::fdo::ObjectManager;
|
||||
use zbus::object_server::SignalContext;
|
||||
use zbus::zvariant::{ObjectPath, OwnedObjectPath};
|
||||
use zbus::Connection;
|
||||
@@ -87,8 +86,8 @@ impl AuraManager {
|
||||
continue;
|
||||
};
|
||||
|
||||
let aura_device = AuraDevice::from(&*id_product);
|
||||
if aura_device == AuraDevice::Unknown {
|
||||
let aura_device = AuraDeviceType::from(&*id_product);
|
||||
if aura_device == AuraDeviceType::Unknown {
|
||||
warn!("idProduct:{id_product:?} is unknown, not using");
|
||||
continue;
|
||||
}
|
||||
@@ -136,7 +135,7 @@ impl AuraManager {
|
||||
if let Ok(mut ctrl) =
|
||||
CtrlKbdLed::from_hidraw(raw, path.clone(), &data)
|
||||
{
|
||||
ctrl.config = CtrlKbdLed::init_config(aura_device, &data);
|
||||
ctrl.config = CtrlKbdLed::init_config(&id_product, &data);
|
||||
interfaces.insert(path.clone());
|
||||
info!("AuraManager starting device at: {dev_node:?}, {path:?}");
|
||||
let sig_ctx = CtrlAuraZbus::signal_context(&conn_copy)?;
|
||||
|
||||
@@ -3,10 +3,9 @@ use std::sync::Arc;
|
||||
|
||||
use config_traits::StdConfig;
|
||||
use log::{debug, error, info, warn};
|
||||
use rog_aura::advanced::UsbPackets;
|
||||
use rog_aura::aura_detection::PowerZones;
|
||||
use rog_aura::usb::{AuraDevice, AuraPowerDev};
|
||||
use rog_aura::{AuraEffect, AuraModeNum, AuraZone, LedBrightness};
|
||||
use rog_aura::keyboard::{LaptopAuraPower, UsbPackets};
|
||||
use rog_aura::{AuraDeviceType, AuraEffect, AuraModeNum, AuraZone, LedBrightness};
|
||||
use zbus::export::futures_util::lock::{Mutex, MutexGuard};
|
||||
use zbus::export::futures_util::StreamExt;
|
||||
use zbus::fdo::Error as ZbErr;
|
||||
@@ -43,9 +42,9 @@ impl CtrlAuraZbus {
|
||||
impl CtrlAuraZbus {
|
||||
/// Return the device type for this Aura keyboard
|
||||
#[zbus(property)]
|
||||
async fn device_type(&self) -> AuraDevice {
|
||||
async fn device_type(&self) -> AuraDeviceType {
|
||||
let ctrl = self.0.lock().await;
|
||||
ctrl.led_prod
|
||||
ctrl.led_type
|
||||
}
|
||||
|
||||
/// Return the current LED brightness
|
||||
@@ -167,9 +166,9 @@ impl CtrlAuraZbus {
|
||||
|
||||
// As property doesn't work for AuraPowerDev (complexity of serialization?)
|
||||
#[zbus(property)]
|
||||
async fn led_power(&self) -> AuraPowerDev {
|
||||
async fn led_power(&self) -> LaptopAuraPower {
|
||||
let ctrl = self.0.lock().await;
|
||||
AuraPowerDev::from(&ctrl.config.enabled)
|
||||
ctrl.config.enabled.clone()
|
||||
}
|
||||
|
||||
/// Set a variety of states, input is array of enum.
|
||||
@@ -177,16 +176,16 @@ impl CtrlAuraZbus {
|
||||
///
|
||||
/// For Modern ROG devices the "enabled" flag is ignored.
|
||||
#[zbus(property)]
|
||||
async fn set_led_power(&mut self, options: AuraPowerDev) -> Result<(), ZbErr> {
|
||||
async fn set_led_power(&mut self, options: LaptopAuraPower) -> Result<(), ZbErr> {
|
||||
let mut ctrl = self.0.lock().await;
|
||||
// TODO: set the older devices
|
||||
// for p in options.tuf {
|
||||
// ctrl.config.enabled.set_tuf(p, enabled);
|
||||
// }
|
||||
// for p in options.old_rog {
|
||||
// ctrl.config.enabled.set_0x1866(p, enabled);
|
||||
// }
|
||||
ctrl.config.enabled.set_0x19b6(options.rog);
|
||||
for opt in options.states {
|
||||
let zone = opt.zone;
|
||||
for config in ctrl.config.enabled.states.iter_mut() {
|
||||
if config.zone == zone {
|
||||
*config = opt;
|
||||
}
|
||||
}
|
||||
}
|
||||
ctrl.config.write();
|
||||
Ok(ctrl.set_power_states().map_err(|e| {
|
||||
warn!("{}", e);
|
||||
|
||||
@@ -274,19 +274,13 @@ impl crate::Reloadable for CtrlFanCurveZbus {
|
||||
/// Fetch the active profile and use that to set all related components up
|
||||
async fn reload(&mut self) -> Result<(), RogError> {
|
||||
let active = self.platform.get_throttle_thermal_policy()?.into();
|
||||
let mut config = self.config.lock().await;
|
||||
if let Ok(mut device) = find_fan_curve_node() {
|
||||
// There is a possibility that the curve was default zeroed, so this call
|
||||
// initialises the data from system read and we need to save it
|
||||
// after
|
||||
loop {
|
||||
if let Ok(mut config) = self.config.try_lock() {
|
||||
config
|
||||
.profiles
|
||||
.write_profile_curve_to_platform(active, &mut device)?;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Ok(())
|
||||
}
|
||||
}
|
||||
|
||||
@@ -176,7 +176,7 @@ impl CtrlPlatform {
|
||||
fn set_gfx_mode(&self, mode: GpuMode) -> Result<(), RogError> {
|
||||
self.platform.set_gpu_mux_mode(mode.to_mux_attr())?;
|
||||
// self.update_initramfs(enable)?;
|
||||
if mode == GpuMode::Discrete {
|
||||
if mode == GpuMode::Ultimate {
|
||||
info!("Set system-level graphics mode: Dedicated Nvidia");
|
||||
} else {
|
||||
info!("Set system-level graphics mode: Optimus");
|
||||
@@ -265,6 +265,7 @@ impl CtrlPlatform {
|
||||
|
||||
#[interface(name = "org.asuslinux.Platform")]
|
||||
impl CtrlPlatform {
|
||||
#[zbus(property)]
|
||||
async fn version(&self) -> String {
|
||||
crate::VERSION.to_string()
|
||||
}
|
||||
|
||||
@@ -92,6 +92,7 @@ where
|
||||
.read(true)
|
||||
.write(true)
|
||||
.create(true)
|
||||
.truncate(false)
|
||||
.open(self.file_path())
|
||||
.unwrap_or_else(|e| panic!("Could not open {:?} {e}", self.file_path()))
|
||||
}
|
||||
|
||||
@@ -1,149 +0,0 @@
|
||||
use crate::advanced::LedCode;
|
||||
|
||||
impl From<LedCode> for &str {
|
||||
fn from(k: LedCode) -> Self {
|
||||
(&k).into()
|
||||
}
|
||||
}
|
||||
|
||||
impl From<&LedCode> for &str {
|
||||
fn from(k: &LedCode) -> Self {
|
||||
#[allow(clippy::match_same_arms)]
|
||||
match k {
|
||||
LedCode::VolUp => "Volume Up",
|
||||
LedCode::VolDown => "Volume Down",
|
||||
LedCode::MicMute => "Mute Mic",
|
||||
LedCode::RogApp => "ROG",
|
||||
LedCode::RogFan => "Fan Control",
|
||||
LedCode::Esc => "Escape",
|
||||
LedCode::F1 => "F1",
|
||||
LedCode::F2 => "F2",
|
||||
LedCode::F3 => "F3",
|
||||
LedCode::F4 => "F4",
|
||||
LedCode::F5 => "F5",
|
||||
LedCode::F6 => "F6",
|
||||
LedCode::F7 => "F7",
|
||||
LedCode::F8 => "F8",
|
||||
LedCode::F9 => "F9",
|
||||
LedCode::F10 => "F10",
|
||||
LedCode::F11 => "F11",
|
||||
LedCode::F12 => "F12",
|
||||
LedCode::Del => "Delete",
|
||||
LedCode::Tilde => "Tilde",
|
||||
LedCode::N1 => "1",
|
||||
LedCode::N2 => "2",
|
||||
LedCode::N3 => "3",
|
||||
LedCode::N4 => "4",
|
||||
LedCode::N5 => "5",
|
||||
LedCode::N6 => "6",
|
||||
LedCode::N7 => "7",
|
||||
LedCode::N8 => "8",
|
||||
LedCode::N9 => "9",
|
||||
LedCode::N0 => "0",
|
||||
LedCode::Hyphen => "-",
|
||||
LedCode::Equals => "=",
|
||||
LedCode::Backspace => "Backspace",
|
||||
LedCode::Backspace3_1 => "Backspace LED 1",
|
||||
LedCode::Backspace3_2 => "Backspace LED 2",
|
||||
LedCode::Backspace3_3 => "Backspace LED 3",
|
||||
LedCode::Home => "Home",
|
||||
LedCode::Tab => "Tab",
|
||||
LedCode::Q => "Q",
|
||||
LedCode::W => "W",
|
||||
LedCode::E => "E",
|
||||
LedCode::R => "R",
|
||||
LedCode::T => "T",
|
||||
LedCode::Y => "Y",
|
||||
LedCode::U => "U",
|
||||
LedCode::I => "I",
|
||||
LedCode::O => "O",
|
||||
LedCode::P => "P",
|
||||
LedCode::LBracket => "[",
|
||||
LedCode::RBracket => "]",
|
||||
LedCode::BackSlash => "\\",
|
||||
LedCode::PgUp => "Page Up",
|
||||
LedCode::Caps => "Caps Lock",
|
||||
LedCode::A => "A",
|
||||
LedCode::S => "S",
|
||||
LedCode::D => "D",
|
||||
LedCode::F => "F",
|
||||
LedCode::G => "G",
|
||||
LedCode::H => "H",
|
||||
LedCode::J => "J",
|
||||
LedCode::K => "K",
|
||||
LedCode::L => "L",
|
||||
LedCode::SemiColon => ";",
|
||||
LedCode::Quote => "'",
|
||||
LedCode::Return => "Return",
|
||||
LedCode::Return3_1 => "Return LED 1",
|
||||
LedCode::Return3_2 => "Return LED 2",
|
||||
LedCode::Return3_3 => "Return LED 3",
|
||||
LedCode::PgDn => "Page Down",
|
||||
LedCode::LShift => "Left Shift",
|
||||
LedCode::LShift3_1 => "Left Shift LED 1",
|
||||
LedCode::LShift3_2 => "Left Shift LED 2",
|
||||
LedCode::LShift3_3 => "Left Shift LED 3",
|
||||
LedCode::Z => "Z",
|
||||
LedCode::X => "X",
|
||||
LedCode::C => "C",
|
||||
LedCode::V => "V",
|
||||
LedCode::B => "B",
|
||||
LedCode::N => "N",
|
||||
LedCode::M => "M",
|
||||
LedCode::Comma => ",",
|
||||
LedCode::Period => ".",
|
||||
LedCode::Star => "*",
|
||||
LedCode::NumPadDel => "Delete",
|
||||
LedCode::NumPadPlus => "+",
|
||||
LedCode::NumPadEnter => "Enter",
|
||||
LedCode::NumPadPause => "Pause",
|
||||
LedCode::NumPadPrtSc => "Print Screen",
|
||||
LedCode::NumPadHome => "Home",
|
||||
LedCode::NumLock => "Num-Lock",
|
||||
LedCode::FwdSlash => "/",
|
||||
LedCode::Rshift => "Right Shift",
|
||||
LedCode::Rshift3_1 => "Right Shift LED 1",
|
||||
LedCode::Rshift3_2 => "Right Shift LED 2",
|
||||
LedCode::Rshift3_3 => "Right Shift LED 3",
|
||||
LedCode::End => "End",
|
||||
LedCode::LCtrl => "Left Control",
|
||||
LedCode::LFn => "Left Fn",
|
||||
LedCode::Meta => "Meta",
|
||||
LedCode::LAlt => "Left Alt",
|
||||
LedCode::Spacebar => "Space",
|
||||
LedCode::Spacebar5_1 => "Space LED 1",
|
||||
LedCode::Spacebar5_2 => "Space LED 2",
|
||||
LedCode::Spacebar5_3 => "Space LED 3",
|
||||
LedCode::Spacebar5_4 => "Space LED 4",
|
||||
LedCode::Spacebar5_5 => "Space LED 5",
|
||||
LedCode::RAlt => "Right Alt",
|
||||
LedCode::PrtSc => "Print Screen",
|
||||
LedCode::RCtrl => "Right Control",
|
||||
LedCode::Pause => "Pause",
|
||||
LedCode::Up => "Up",
|
||||
LedCode::Down => "Down",
|
||||
LedCode::Left => "Left",
|
||||
LedCode::Right => "Right",
|
||||
LedCode::RFn => "Right Fn",
|
||||
LedCode::MediaPlay => "Media Play",
|
||||
LedCode::MediaStop => "Media Stop",
|
||||
LedCode::MediaNext => "Media Next",
|
||||
LedCode::MediaPrev => "Media Previous",
|
||||
LedCode::LidLogo => "Lid Logo",
|
||||
LedCode::LidLeft => "Lid Left",
|
||||
LedCode::LidRight => "Lid Right",
|
||||
LedCode::LightbarRight => "Lightbar Right",
|
||||
LedCode::LightbarRightCorner => "Lightbar Right Corner",
|
||||
LedCode::LightbarRightBottom => "Lightbar Right Bottom",
|
||||
LedCode::LightbarLeftBottom => "Lightbar Left Bottom",
|
||||
LedCode::LightbarLeftCorner => "Lightbar Left Corner",
|
||||
LedCode::LightbarLeft => "Lightbar Left",
|
||||
LedCode::Spacing | LedCode::Blocking => "",
|
||||
LedCode::SingleZone => "Single Zoned Keyboard",
|
||||
LedCode::ZonedKbLeft => "Left Zone (zone 1)",
|
||||
LedCode::ZonedKbLeftMid => "Center-left Zone (zone 2)",
|
||||
LedCode::ZonedKbRightMid => "Center-right Zone (zone 3)",
|
||||
LedCode::ZonedKbRight => "Right Zone (zone 4)",
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -4,21 +4,11 @@ use serde_derive::{Deserialize, Serialize};
|
||||
use typeshare::typeshare;
|
||||
use zbus::zvariant::{OwnedValue, Type, Value};
|
||||
|
||||
use crate::usb::AuraDevice;
|
||||
use crate::{AdvancedAuraType, AuraModeNum, AuraZone};
|
||||
use crate::keyboard::AdvancedAuraType;
|
||||
use crate::{AuraModeNum, AuraZone};
|
||||
|
||||
pub const ASUS_LED_MODE_CONF: &str = "/usr/share/asusd/aura_support.ron";
|
||||
pub const ASUS_LED_MODE_USER_CONF: &str = "/etc/asusd/asusd_user_ledmodes.ron";
|
||||
pub const ASUS_KEYBOARD_DEVICES: [AuraDevice; 8] = [
|
||||
AuraDevice::Tuf,
|
||||
AuraDevice::X1854,
|
||||
AuraDevice::X1869,
|
||||
AuraDevice::X1866,
|
||||
AuraDevice::X18c6,
|
||||
AuraDevice::X19b6,
|
||||
AuraDevice::X1a30,
|
||||
AuraDevice::X1abe,
|
||||
];
|
||||
|
||||
#[derive(Debug, Default, Clone, PartialEq, Eq, Deserialize, Serialize)]
|
||||
pub struct LedSupportFile(Vec<LaptopLedData>);
|
||||
@@ -30,7 +20,7 @@ pub struct LedSupportFile(Vec<LaptopLedData>);
|
||||
derive(Type, Value, OwnedValue),
|
||||
zvariant(signature = "u")
|
||||
)]
|
||||
#[derive(Serialize, Deserialize, PartialEq, Eq, Debug, Default, Copy, Clone)]
|
||||
#[derive(Serialize, Deserialize, PartialEq, Eq, Hash, Debug, Default, Copy, Clone)]
|
||||
pub enum PowerZones {
|
||||
/// The logo on some laptop lids
|
||||
#[default]
|
||||
@@ -43,6 +33,8 @@ pub enum PowerZones {
|
||||
Lid = 3,
|
||||
/// The led strip on the rear of some laptops
|
||||
RearGlow = 4,
|
||||
/// On pre-2021 laptops there is either 1 or 2 zones used
|
||||
KeyboardAndLightbar = 5,
|
||||
}
|
||||
|
||||
#[derive(Debug, Clone, Default, PartialEq, Eq, Deserialize, Serialize)]
|
||||
@@ -153,10 +145,10 @@ mod tests {
|
||||
use ron::ser::PrettyConfig;
|
||||
|
||||
use super::LaptopLedData;
|
||||
use crate::advanced::LedCode;
|
||||
use crate::aura_detection::{LedSupportFile, PowerZones};
|
||||
use crate::keyboard::{AdvancedAuraType, LedCode};
|
||||
// use crate::zoned::Zone;
|
||||
use crate::{AdvancedAuraType, AuraModeNum, AuraZone};
|
||||
use crate::{AuraModeNum, AuraZone};
|
||||
|
||||
#[test]
|
||||
fn check_data_parse() {
|
||||
|
||||
@@ -1,9 +1,3 @@
|
||||
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];
|
||||
pub const LED_INIT4: &str = "^ASUS Tech.Inc."; // ^ == 0x5e
|
||||
pub const LED_INIT5: [u8; 6] = [0x5e, 0x05, 0x20, 0x31, 0, 0x08];
|
||||
|
||||
use std::fmt::Display;
|
||||
use std::str::FromStr;
|
||||
|
||||
|
||||
@@ -1,162 +0,0 @@
|
||||
//! 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");
|
||||
}
|
||||
}
|
||||
@@ -1,5 +1,5 @@
|
||||
use super::{EffectState, InputForEffect};
|
||||
use crate::advanced::LedCode;
|
||||
use crate::keyboard::{KeyLayout, LedCode};
|
||||
use crate::Colour;
|
||||
|
||||
pub struct InputBased {
|
||||
@@ -14,7 +14,7 @@ pub struct InputBased {
|
||||
}
|
||||
|
||||
impl EffectState for InputBased {
|
||||
fn next_colour_state(&mut self, _layout: &crate::layouts::KeyLayout) {
|
||||
fn next_colour_state(&mut self, _layout: &KeyLayout) {
|
||||
self.input.next_colour_state();
|
||||
self.colour = self.input.get_colour();
|
||||
}
|
||||
|
||||
@@ -1,8 +1,7 @@
|
||||
use serde::{Deserialize, Serialize};
|
||||
|
||||
use super::EffectState;
|
||||
use crate::advanced::LedCode;
|
||||
use crate::layouts::KeyLayout;
|
||||
use crate::keyboard::{KeyLayout, LedCode};
|
||||
use crate::{effect_state_impl, Colour, Speed};
|
||||
|
||||
#[derive(Debug, Clone, Deserialize, Serialize)]
|
||||
|
||||
@@ -1,8 +1,7 @@
|
||||
use serde::{Deserialize, Serialize};
|
||||
|
||||
use crate::advanced::LedCode;
|
||||
use crate::effects::{p_random, EffectState};
|
||||
use crate::layouts::KeyLayout;
|
||||
use crate::keyboard::{KeyLayout, LedCode};
|
||||
use crate::{effect_state_impl, Colour};
|
||||
|
||||
#[derive(Debug, Clone, Deserialize, Serialize)]
|
||||
|
||||
@@ -12,8 +12,7 @@ pub use breathe::*;
|
||||
mod static_;
|
||||
pub use static_::*;
|
||||
|
||||
use crate::advanced::{LedCode, LedUsbPackets, UsbPackets};
|
||||
use crate::layouts::KeyLayout;
|
||||
use crate::keyboard::{KeyLayout, LedCode, LedUsbPackets, UsbPackets};
|
||||
use crate::Colour;
|
||||
|
||||
// static mut RNDINDEX: usize = 0;
|
||||
@@ -132,12 +131,12 @@ macro_rules! effect_state_impl {
|
||||
self.colour
|
||||
}
|
||||
|
||||
fn get_led(&self) -> $crate::advanced::LedCode {
|
||||
fn get_led(&self) -> $crate::keyboard::LedCode {
|
||||
self.led.clone()
|
||||
}
|
||||
|
||||
/// Change the led type
|
||||
fn set_led(&mut self, address: $crate::advanced::LedCode) {
|
||||
fn set_led(&mut self, address: $crate::keyboard::LedCode) {
|
||||
self.led = address;
|
||||
}
|
||||
};
|
||||
@@ -148,14 +147,14 @@ macro_rules! effect_impl {
|
||||
($($effect:ident),*) => {
|
||||
impl Effect {
|
||||
/// Get the type of LED set
|
||||
pub fn led(&self) -> $crate::advanced::LedCode {
|
||||
pub fn led(&self) -> $crate::keyboard::LedCode {
|
||||
match self {
|
||||
$(Effect::$effect(c) => c.get_led(),)*
|
||||
}
|
||||
}
|
||||
|
||||
/// Change the led type (can be used to change location of the effect)
|
||||
pub fn set_led(&mut self, address: $crate::advanced::LedCode) {
|
||||
pub fn set_led(&mut self, address: $crate::keyboard::LedCode) {
|
||||
match self {
|
||||
$(Effect::$effect(c) => c.set_led(address),)*
|
||||
}
|
||||
@@ -200,9 +199,8 @@ effect_impl!(Static, Breathe, DoomFlicker, DoomLightFlash);
|
||||
|
||||
#[cfg(test)]
|
||||
mod tests {
|
||||
use crate::advanced::LedCode;
|
||||
use crate::effects::{AdvancedEffects, Breathe, DoomFlicker, Effect, Static};
|
||||
use crate::layouts::KeyLayout;
|
||||
use crate::keyboard::{KeyLayout, LedCode};
|
||||
use crate::{Colour, Speed};
|
||||
|
||||
#[test]
|
||||
|
||||
@@ -1,8 +1,7 @@
|
||||
use serde::{Deserialize, Serialize};
|
||||
|
||||
use super::EffectState;
|
||||
use crate::advanced::LedCode;
|
||||
use crate::layouts::KeyLayout;
|
||||
use crate::keyboard::{KeyLayout, LedCode};
|
||||
use crate::{effect_state_impl, Colour};
|
||||
|
||||
#[derive(Debug, Clone, Deserialize, Serialize)]
|
||||
|
||||
@@ -490,9 +490,157 @@ impl From<LedUsbPackets> for UsbPackets {
|
||||
}
|
||||
}
|
||||
|
||||
impl From<LedCode> for &str {
|
||||
fn from(k: LedCode) -> Self {
|
||||
(&k).into()
|
||||
}
|
||||
}
|
||||
|
||||
impl From<&LedCode> for &str {
|
||||
fn from(k: &LedCode) -> Self {
|
||||
#[allow(clippy::match_same_arms)]
|
||||
match k {
|
||||
LedCode::VolUp => "Volume Up",
|
||||
LedCode::VolDown => "Volume Down",
|
||||
LedCode::MicMute => "Mute Mic",
|
||||
LedCode::RogApp => "ROG",
|
||||
LedCode::RogFan => "Fan Control",
|
||||
LedCode::Esc => "Escape",
|
||||
LedCode::F1 => "F1",
|
||||
LedCode::F2 => "F2",
|
||||
LedCode::F3 => "F3",
|
||||
LedCode::F4 => "F4",
|
||||
LedCode::F5 => "F5",
|
||||
LedCode::F6 => "F6",
|
||||
LedCode::F7 => "F7",
|
||||
LedCode::F8 => "F8",
|
||||
LedCode::F9 => "F9",
|
||||
LedCode::F10 => "F10",
|
||||
LedCode::F11 => "F11",
|
||||
LedCode::F12 => "F12",
|
||||
LedCode::Del => "Delete",
|
||||
LedCode::Tilde => "Tilde",
|
||||
LedCode::N1 => "1",
|
||||
LedCode::N2 => "2",
|
||||
LedCode::N3 => "3",
|
||||
LedCode::N4 => "4",
|
||||
LedCode::N5 => "5",
|
||||
LedCode::N6 => "6",
|
||||
LedCode::N7 => "7",
|
||||
LedCode::N8 => "8",
|
||||
LedCode::N9 => "9",
|
||||
LedCode::N0 => "0",
|
||||
LedCode::Hyphen => "-",
|
||||
LedCode::Equals => "=",
|
||||
LedCode::Backspace => "Backspace",
|
||||
LedCode::Backspace3_1 => "Backspace LED 1",
|
||||
LedCode::Backspace3_2 => "Backspace LED 2",
|
||||
LedCode::Backspace3_3 => "Backspace LED 3",
|
||||
LedCode::Home => "Home",
|
||||
LedCode::Tab => "Tab",
|
||||
LedCode::Q => "Q",
|
||||
LedCode::W => "W",
|
||||
LedCode::E => "E",
|
||||
LedCode::R => "R",
|
||||
LedCode::T => "T",
|
||||
LedCode::Y => "Y",
|
||||
LedCode::U => "U",
|
||||
LedCode::I => "I",
|
||||
LedCode::O => "O",
|
||||
LedCode::P => "P",
|
||||
LedCode::LBracket => "[",
|
||||
LedCode::RBracket => "]",
|
||||
LedCode::BackSlash => "\\",
|
||||
LedCode::PgUp => "Page Up",
|
||||
LedCode::Caps => "Caps Lock",
|
||||
LedCode::A => "A",
|
||||
LedCode::S => "S",
|
||||
LedCode::D => "D",
|
||||
LedCode::F => "F",
|
||||
LedCode::G => "G",
|
||||
LedCode::H => "H",
|
||||
LedCode::J => "J",
|
||||
LedCode::K => "K",
|
||||
LedCode::L => "L",
|
||||
LedCode::SemiColon => ";",
|
||||
LedCode::Quote => "'",
|
||||
LedCode::Return => "Return",
|
||||
LedCode::Return3_1 => "Return LED 1",
|
||||
LedCode::Return3_2 => "Return LED 2",
|
||||
LedCode::Return3_3 => "Return LED 3",
|
||||
LedCode::PgDn => "Page Down",
|
||||
LedCode::LShift => "Left Shift",
|
||||
LedCode::LShift3_1 => "Left Shift LED 1",
|
||||
LedCode::LShift3_2 => "Left Shift LED 2",
|
||||
LedCode::LShift3_3 => "Left Shift LED 3",
|
||||
LedCode::Z => "Z",
|
||||
LedCode::X => "X",
|
||||
LedCode::C => "C",
|
||||
LedCode::V => "V",
|
||||
LedCode::B => "B",
|
||||
LedCode::N => "N",
|
||||
LedCode::M => "M",
|
||||
LedCode::Comma => ",",
|
||||
LedCode::Period => ".",
|
||||
LedCode::Star => "*",
|
||||
LedCode::NumPadDel => "Delete",
|
||||
LedCode::NumPadPlus => "+",
|
||||
LedCode::NumPadEnter => "Enter",
|
||||
LedCode::NumPadPause => "Pause",
|
||||
LedCode::NumPadPrtSc => "Print Screen",
|
||||
LedCode::NumPadHome => "Home",
|
||||
LedCode::NumLock => "Num-Lock",
|
||||
LedCode::FwdSlash => "/",
|
||||
LedCode::Rshift => "Right Shift",
|
||||
LedCode::Rshift3_1 => "Right Shift LED 1",
|
||||
LedCode::Rshift3_2 => "Right Shift LED 2",
|
||||
LedCode::Rshift3_3 => "Right Shift LED 3",
|
||||
LedCode::End => "End",
|
||||
LedCode::LCtrl => "Left Control",
|
||||
LedCode::LFn => "Left Fn",
|
||||
LedCode::Meta => "Meta",
|
||||
LedCode::LAlt => "Left Alt",
|
||||
LedCode::Spacebar => "Space",
|
||||
LedCode::Spacebar5_1 => "Space LED 1",
|
||||
LedCode::Spacebar5_2 => "Space LED 2",
|
||||
LedCode::Spacebar5_3 => "Space LED 3",
|
||||
LedCode::Spacebar5_4 => "Space LED 4",
|
||||
LedCode::Spacebar5_5 => "Space LED 5",
|
||||
LedCode::RAlt => "Right Alt",
|
||||
LedCode::PrtSc => "Print Screen",
|
||||
LedCode::RCtrl => "Right Control",
|
||||
LedCode::Pause => "Pause",
|
||||
LedCode::Up => "Up",
|
||||
LedCode::Down => "Down",
|
||||
LedCode::Left => "Left",
|
||||
LedCode::Right => "Right",
|
||||
LedCode::RFn => "Right Fn",
|
||||
LedCode::MediaPlay => "Media Play",
|
||||
LedCode::MediaStop => "Media Stop",
|
||||
LedCode::MediaNext => "Media Next",
|
||||
LedCode::MediaPrev => "Media Previous",
|
||||
LedCode::LidLogo => "Lid Logo",
|
||||
LedCode::LidLeft => "Lid Left",
|
||||
LedCode::LidRight => "Lid Right",
|
||||
LedCode::LightbarRight => "Lightbar Right",
|
||||
LedCode::LightbarRightCorner => "Lightbar Right Corner",
|
||||
LedCode::LightbarRightBottom => "Lightbar Right Bottom",
|
||||
LedCode::LightbarLeftBottom => "Lightbar Left Bottom",
|
||||
LedCode::LightbarLeftCorner => "Lightbar Left Corner",
|
||||
LedCode::LightbarLeft => "Lightbar Left",
|
||||
LedCode::Spacing | LedCode::Blocking => "",
|
||||
LedCode::SingleZone => "Single Zoned Keyboard",
|
||||
LedCode::ZonedKbLeft => "Left Zone (zone 1)",
|
||||
LedCode::ZonedKbLeftMid => "Center-left Zone (zone 2)",
|
||||
LedCode::ZonedKbRightMid => "Center-right Zone (zone 3)",
|
||||
LedCode::ZonedKbRight => "Right Zone (zone 4)",
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#[cfg(test)]
|
||||
mod tests {
|
||||
use crate::advanced::{LedCode, LedUsbPackets, UsbPackets};
|
||||
use crate::keyboard::{LedCode, LedUsbPackets, UsbPackets};
|
||||
|
||||
macro_rules! colour_check_zoned {
|
||||
($zone:expr, $pkt_idx_start:expr) => {
|
||||
@@ -8,10 +8,10 @@ use std::slice::Iter;
|
||||
use log::warn;
|
||||
use serde::{Deserialize, Serialize};
|
||||
|
||||
use crate::advanced::LedCode;
|
||||
use crate::aura_detection::LaptopLedData;
|
||||
use crate::error::Error;
|
||||
use crate::{AdvancedAuraType, AuraModeNum, AuraZone};
|
||||
use crate::keyboard::{AdvancedAuraType, LedCode};
|
||||
use crate::{AuraModeNum, AuraZone};
|
||||
|
||||
/// The `key_type` plays a role in effects (eventually). You could for example
|
||||
/// add a `ShapeType::Spacing` to pad out an effect, such as a laserbeam across
|
||||
@@ -459,7 +459,7 @@ mod tests {
|
||||
use std::path::PathBuf;
|
||||
|
||||
use crate::aura_detection::LedSupportFile;
|
||||
use crate::layouts::KeyLayout;
|
||||
use crate::keyboard::KeyLayout;
|
||||
|
||||
#[test]
|
||||
fn check_parse_all() {
|
||||
20
rog-aura/src/keyboard/mod.rs
Normal file
20
rog-aura/src/keyboard/mod.rs
Normal file
@@ -0,0 +1,20 @@
|
||||
/// All handling for `RgbAddress`ing.
|
||||
mod advanced;
|
||||
pub use advanced::*;
|
||||
|
||||
/// Helpers for consructing keyboard layouts for UI use and effects
|
||||
mod layouts;
|
||||
pub use layouts::*;
|
||||
|
||||
mod power;
|
||||
pub use power::*;
|
||||
|
||||
#[derive(Debug, Clone, PartialEq, Eq, Default, serde::Deserialize, serde::Serialize)]
|
||||
pub enum AdvancedAuraType {
|
||||
/// A `None` will apply the effect to the whole keyboard via basic-static
|
||||
/// mode
|
||||
#[default]
|
||||
None,
|
||||
Zoned(Vec<LedCode>),
|
||||
PerKey,
|
||||
}
|
||||
522
rog-aura/src/keyboard/power.rs
Normal file
522
rog-aura/src/keyboard/power.rs
Normal file
@@ -0,0 +1,522 @@
|
||||
//! Power state for Laptop MCU RGB/LED. This is generally for newer
|
||||
//! 0x18c6, 0x19B6, 0x1a30, keyboard models (2021+)
|
||||
use std::fmt::Debug;
|
||||
use std::ops::{BitAnd, BitOr};
|
||||
|
||||
use log::warn;
|
||||
use serde::{Deserialize, Serialize};
|
||||
use typeshare::typeshare;
|
||||
#[cfg(feature = "dbus")]
|
||||
use zbus::zvariant::{OwnedValue, Type, Value};
|
||||
|
||||
use crate::aura_detection::{LaptopLedData, PowerZones};
|
||||
use crate::AuraDeviceType;
|
||||
|
||||
/// Meaning of this struct depends on the laptop generation.
|
||||
/// - 2021+, the struct is a single zone with 4 states
|
||||
/// - pre-2021, the struct is 1 or 2 zones and 3 states
|
||||
/// - Tuf, the struct is 1 zone and 3 states
|
||||
#[typeshare]
|
||||
#[cfg_attr(feature = "dbus", derive(Type, Value, OwnedValue))]
|
||||
#[derive(Clone, Copy, Debug, PartialEq, Eq, Serialize, Deserialize)]
|
||||
pub struct AuraPowerState {
|
||||
pub zone: PowerZones,
|
||||
pub boot: bool,
|
||||
pub awake: bool,
|
||||
pub sleep: bool,
|
||||
/// Ignored for pre-2021 and Tuf
|
||||
pub shutdown: bool,
|
||||
}
|
||||
|
||||
impl Default for AuraPowerState {
|
||||
/// Defaults all to off
|
||||
fn default() -> Self {
|
||||
Self {
|
||||
zone: PowerZones::Keyboard,
|
||||
boot: true,
|
||||
awake: true,
|
||||
sleep: true,
|
||||
shutdown: true,
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
impl AuraPowerState {
|
||||
fn default_for(zone: PowerZones) -> Self {
|
||||
Self {
|
||||
zone,
|
||||
boot: true,
|
||||
awake: true,
|
||||
sleep: true,
|
||||
shutdown: true,
|
||||
}
|
||||
}
|
||||
|
||||
fn tuf_to_bytes(&self) -> Vec<u8> {
|
||||
todo!("0s and 1s for bool array")
|
||||
}
|
||||
|
||||
/// # Bits for older 0x1866 keyboard model
|
||||
///
|
||||
/// Keybord and Lightbar require Awake, Boot and Sleep apply to both
|
||||
/// Keybord and Lightbar regardless of if either are enabled (or Awake is
|
||||
/// enabled)
|
||||
///
|
||||
/// | Byte 1 | Byte 2 | Byte 3 | function | hex |
|
||||
/// |------------|------------|------------|----------|----------|
|
||||
/// | 0000, 0000 | 0000, 0000 | 0000, 0010 | Awake | 00,00,02 |
|
||||
/// | 0000, 1000 | 0000, 0000 | 0000, 0000 | Keyboard | 08,00,00 |
|
||||
/// | 0000, 0100 | 0000, 0101 | 0000, 0000 | Lightbar | 04,05,00 |
|
||||
/// | 1100, 0011 | 0001, 0010 | 0000, 1001 | Boot/Sht | c3,12,09 |
|
||||
/// | 0011, 0000 | 0000, 1000 | 0000, 0100 | Sleep | 30,08,04 |
|
||||
/// | 1111, 1111 | 0001, 1111 | 0000, 1111 | all on | |
|
||||
fn old_to_bytes(&self) -> Vec<u8> {
|
||||
let mut a: u32 = 0;
|
||||
if self.awake {
|
||||
a |= OldAuraPower::Awake as u32;
|
||||
}
|
||||
if self.boot {
|
||||
a |= OldAuraPower::Boot as u32;
|
||||
}
|
||||
if self.sleep {
|
||||
a |= OldAuraPower::Sleep as u32;
|
||||
}
|
||||
if matches!(
|
||||
self.zone,
|
||||
PowerZones::Keyboard | PowerZones::KeyboardAndLightbar
|
||||
) {
|
||||
a |= OldAuraPower::Keyboard as u32;
|
||||
}
|
||||
if matches!(
|
||||
self.zone,
|
||||
PowerZones::Lightbar | PowerZones::KeyboardAndLightbar
|
||||
) {
|
||||
a |= OldAuraPower::Lightbar as u32;
|
||||
}
|
||||
vec![
|
||||
((a & 0xff0000) >> 16) as u8,
|
||||
((a & 0xff00) >> 8) as u8,
|
||||
(a & 0xff) as u8,
|
||||
0x00,
|
||||
]
|
||||
}
|
||||
|
||||
fn new_to_byte(&self) -> u32 {
|
||||
match self.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)
|
||||
}
|
||||
PowerZones::KeyboardAndLightbar => 0,
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#[typeshare]
|
||||
#[cfg_attr(feature = "dbus", derive(Type, Value, OwnedValue))]
|
||||
#[derive(Clone, Debug, Default, PartialEq, Eq, Serialize, Deserialize)]
|
||||
pub struct LaptopAuraPower {
|
||||
pub states: Vec<AuraPowerState>,
|
||||
}
|
||||
|
||||
impl LaptopAuraPower {
|
||||
/// # 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_|
|
||||
fn new_to_bytes(&self) -> Vec<u8> {
|
||||
let mut a: u32 = 0;
|
||||
for state in self.states.iter() {
|
||||
a |= state.new_to_byte();
|
||||
}
|
||||
vec![
|
||||
(a & 0xff) as u8,
|
||||
((a & 0xff00) >> 8) as u8,
|
||||
((a & 0xff0000) >> 16) as u8,
|
||||
((a & 0xff000000) >> 24) as u8,
|
||||
]
|
||||
}
|
||||
|
||||
// TODO: use support data to setup correct zones
|
||||
pub fn new(aura_type: AuraDeviceType, support_data: &LaptopLedData) -> Self {
|
||||
match aura_type {
|
||||
AuraDeviceType::Unknown | AuraDeviceType::LaptopPost2021 => {
|
||||
let mut states = Vec::new();
|
||||
for zone in support_data.power_zones.iter() {
|
||||
states.push(AuraPowerState::default_for(*zone))
|
||||
}
|
||||
Self { states }
|
||||
}
|
||||
AuraDeviceType::LaptopPre2021 => {
|
||||
if support_data.power_zones.contains(&PowerZones::Lightbar) {
|
||||
Self {
|
||||
states: vec![AuraPowerState::default_for(PowerZones::KeyboardAndLightbar)],
|
||||
}
|
||||
} else {
|
||||
Self {
|
||||
states: vec![AuraPowerState::default_for(PowerZones::Keyboard)],
|
||||
}
|
||||
}
|
||||
}
|
||||
AuraDeviceType::LaptopTuf => Self {
|
||||
states: vec![AuraPowerState::default_for(PowerZones::Keyboard)],
|
||||
},
|
||||
AuraDeviceType::ScsiExtDisk => todo!(),
|
||||
}
|
||||
}
|
||||
|
||||
pub fn to_bytes(&self, aura_type: AuraDeviceType) -> Vec<u8> {
|
||||
match aura_type {
|
||||
AuraDeviceType::LaptopPost2021 => self.new_to_bytes(),
|
||||
AuraDeviceType::LaptopPre2021 => self
|
||||
.states
|
||||
.first()
|
||||
.cloned()
|
||||
.unwrap_or_default()
|
||||
.old_to_bytes(),
|
||||
AuraDeviceType::LaptopTuf => self
|
||||
.states
|
||||
.first()
|
||||
.cloned()
|
||||
.unwrap_or_default()
|
||||
.tuf_to_bytes(),
|
||||
AuraDeviceType::Unknown => {
|
||||
warn!("Trying to create bytes for an unknown device");
|
||||
self.new_to_bytes()
|
||||
}
|
||||
AuraDeviceType::ScsiExtDisk => todo!(),
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// | Byte 1 | Byte 2 | Byte 3 | function | hex |
|
||||
/// |------------|------------|------------|----------|----------|
|
||||
/// | 0000, 0000 | 0000, 0000 | 0000, 0010 | Awake | 00,00,02 |
|
||||
/// | 0000, 1000 | 0000, 0000 | 0000, 0000 | Keyboard | 08,00,00 |
|
||||
/// | 0000, 0100 | 0000, 0101 | 0000, 0000 | Lightbar | 04,05,00 |
|
||||
/// | 1100, 0011 | 0001, 0010 | 0000, 1001 | Boot/Sht | c3,12,09 |
|
||||
/// | 0011, 0000 | 0000, 1000 | 0000, 0100 | Sleep | 30,08,04 |
|
||||
/// | 1111, 1111 | 0001, 1111 | 0000, 1111 | all on | |
|
||||
#[repr(u32)]
|
||||
enum OldAuraPower {
|
||||
Awake = 0x000002,
|
||||
Boot = 0xc31209,
|
||||
Sleep = 0x300804,
|
||||
Keyboard = 0x080000,
|
||||
Lightbar = 0x040500,
|
||||
}
|
||||
|
||||
impl BitOr<OldAuraPower> for OldAuraPower {
|
||||
type Output = u32;
|
||||
|
||||
fn bitor(self, rhs: OldAuraPower) -> Self::Output {
|
||||
self as u32 | rhs as u32
|
||||
}
|
||||
}
|
||||
|
||||
impl BitAnd<OldAuraPower> for OldAuraPower {
|
||||
type Output = u32;
|
||||
|
||||
fn bitand(self, rhs: OldAuraPower) -> Self::Output {
|
||||
self as u32 & rhs as u32
|
||||
}
|
||||
}
|
||||
|
||||
impl From<OldAuraPower> for u32 {
|
||||
fn from(a: OldAuraPower) -> Self {
|
||||
a as u32
|
||||
}
|
||||
}
|
||||
|
||||
#[cfg(test)]
|
||||
mod test {
|
||||
use crate::aura_detection::{LaptopLedData, PowerZones};
|
||||
use crate::keyboard::{AuraPowerState, LaptopAuraPower};
|
||||
use crate::AuraDeviceType;
|
||||
|
||||
#[test]
|
||||
fn check_0x1866_control_bytes() {
|
||||
let state = AuraPowerState {
|
||||
zone: PowerZones::Keyboard,
|
||||
awake: true,
|
||||
boot: false,
|
||||
sleep: false,
|
||||
shutdown: false,
|
||||
};
|
||||
let bytes = state.old_to_bytes();
|
||||
println!("{:08b}, {:08b}, {:08b}", bytes[0], bytes[1], bytes[2]);
|
||||
assert_eq!(bytes, [0x08, 0x00, 0x02, 0x00]);
|
||||
|
||||
let state = AuraPowerState {
|
||||
zone: PowerZones::Lightbar,
|
||||
awake: true,
|
||||
boot: false,
|
||||
sleep: false,
|
||||
shutdown: false,
|
||||
};
|
||||
let bytes = state.old_to_bytes();
|
||||
println!("{:08b}, {:08b}, {:08b}", bytes[0], bytes[1], bytes[2]);
|
||||
assert_eq!(bytes, [0x04, 0x05, 0x02, 0x00]);
|
||||
|
||||
let bytes = AuraPowerState {
|
||||
zone: PowerZones::Keyboard,
|
||||
awake: false,
|
||||
boot: false,
|
||||
sleep: true,
|
||||
shutdown: false,
|
||||
};
|
||||
let bytes = bytes.old_to_bytes();
|
||||
println!("{:08b}, {:08b}, {:08b}", bytes[0], bytes[1], bytes[2]);
|
||||
assert_eq!(bytes, [0x30, 0x08, 0x04, 0x00]);
|
||||
|
||||
let bytes = AuraPowerState {
|
||||
zone: PowerZones::Keyboard,
|
||||
awake: false,
|
||||
boot: true,
|
||||
sleep: false,
|
||||
shutdown: false,
|
||||
};
|
||||
let bytes = bytes.old_to_bytes();
|
||||
println!("{:08b}, {:08b}, {:08b}", bytes[0], bytes[1], bytes[2]);
|
||||
assert_eq!(bytes, [0xc3, 0x12, 0x09, 0x00]);
|
||||
|
||||
let power = AuraPowerState {
|
||||
zone: PowerZones::KeyboardAndLightbar,
|
||||
awake: true,
|
||||
boot: true,
|
||||
sleep: true,
|
||||
shutdown: false,
|
||||
};
|
||||
|
||||
let bytes = power.old_to_bytes();
|
||||
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(power: &LaptopAuraPower) -> String {
|
||||
let bytes = power.to_bytes(AuraDeviceType::LaptopPost2021);
|
||||
format!(
|
||||
"{:08b}, {:08b}, {:08b}, {:08b}",
|
||||
bytes[0], bytes[1], bytes[2], bytes[3]
|
||||
)
|
||||
}
|
||||
|
||||
let boot_logo_ = to_binary_string(&LaptopAuraPower {
|
||||
states: vec![AuraPowerState {
|
||||
zone: PowerZones::Logo,
|
||||
boot: true,
|
||||
..Default::default()
|
||||
}],
|
||||
});
|
||||
let boot_keyb_ = to_binary_string(&LaptopAuraPower {
|
||||
states: vec![AuraPowerState {
|
||||
zone: PowerZones::Keyboard,
|
||||
boot: true,
|
||||
..Default::default()
|
||||
}],
|
||||
});
|
||||
let sleep_logo = to_binary_string(&LaptopAuraPower {
|
||||
states: vec![AuraPowerState {
|
||||
zone: PowerZones::Logo,
|
||||
sleep: true,
|
||||
..Default::default()
|
||||
}],
|
||||
});
|
||||
let sleep_keyb = to_binary_string(&LaptopAuraPower {
|
||||
states: vec![AuraPowerState {
|
||||
zone: PowerZones::Keyboard,
|
||||
sleep: true,
|
||||
..Default::default()
|
||||
}],
|
||||
});
|
||||
let awake_logo = to_binary_string(&LaptopAuraPower {
|
||||
states: vec![AuraPowerState {
|
||||
zone: PowerZones::Logo,
|
||||
awake: true,
|
||||
..Default::default()
|
||||
}],
|
||||
});
|
||||
let awake_keyb = to_binary_string(&LaptopAuraPower {
|
||||
states: vec![AuraPowerState {
|
||||
zone: PowerZones::Keyboard,
|
||||
awake: true,
|
||||
..Default::default()
|
||||
}],
|
||||
});
|
||||
let shut_logo_ = to_binary_string(&LaptopAuraPower {
|
||||
states: vec![AuraPowerState {
|
||||
zone: PowerZones::Logo,
|
||||
shutdown: true,
|
||||
..Default::default()
|
||||
}],
|
||||
});
|
||||
let shut_keyb_ = to_binary_string(&LaptopAuraPower {
|
||||
states: vec![AuraPowerState {
|
||||
zone: PowerZones::Keyboard,
|
||||
shutdown: true,
|
||||
..Default::default()
|
||||
}],
|
||||
});
|
||||
let boot_bar__ = to_binary_string(&LaptopAuraPower {
|
||||
states: vec![AuraPowerState {
|
||||
zone: PowerZones::Lightbar,
|
||||
boot: true,
|
||||
..Default::default()
|
||||
}],
|
||||
});
|
||||
let awake_bar_ = to_binary_string(&LaptopAuraPower {
|
||||
states: vec![AuraPowerState {
|
||||
zone: PowerZones::Lightbar,
|
||||
awake: true,
|
||||
..Default::default()
|
||||
}],
|
||||
});
|
||||
let sleep_bar_ = to_binary_string(&LaptopAuraPower {
|
||||
states: vec![AuraPowerState {
|
||||
zone: PowerZones::Lightbar,
|
||||
sleep: true,
|
||||
..Default::default()
|
||||
}],
|
||||
});
|
||||
let shut_bar__ = to_binary_string(&LaptopAuraPower {
|
||||
states: vec![AuraPowerState {
|
||||
zone: PowerZones::Lightbar,
|
||||
shutdown: true,
|
||||
..Default::default()
|
||||
}],
|
||||
});
|
||||
let boot_lid__ = to_binary_string(&LaptopAuraPower {
|
||||
states: vec![AuraPowerState {
|
||||
zone: PowerZones::Lid,
|
||||
boot: true,
|
||||
..Default::default()
|
||||
}],
|
||||
});
|
||||
let awake_lid_ = to_binary_string(&LaptopAuraPower {
|
||||
states: vec![AuraPowerState {
|
||||
zone: PowerZones::Lid,
|
||||
awake: true,
|
||||
..Default::default()
|
||||
}],
|
||||
});
|
||||
let sleep_lid_ = to_binary_string(&LaptopAuraPower {
|
||||
states: vec![AuraPowerState {
|
||||
zone: PowerZones::Lid,
|
||||
sleep: true,
|
||||
..Default::default()
|
||||
}],
|
||||
});
|
||||
let shut_lid__ = to_binary_string(&LaptopAuraPower {
|
||||
states: vec![AuraPowerState {
|
||||
zone: PowerZones::Lid,
|
||||
shutdown: true,
|
||||
..Default::default()
|
||||
}],
|
||||
});
|
||||
let boot_rear_ = to_binary_string(&LaptopAuraPower {
|
||||
states: vec![AuraPowerState {
|
||||
zone: PowerZones::RearGlow,
|
||||
boot: true,
|
||||
..Default::default()
|
||||
}],
|
||||
});
|
||||
let awake_rear = to_binary_string(&LaptopAuraPower {
|
||||
states: vec![AuraPowerState {
|
||||
zone: PowerZones::RearGlow,
|
||||
awake: true,
|
||||
..Default::default()
|
||||
}],
|
||||
});
|
||||
let sleep_rear = to_binary_string(&LaptopAuraPower {
|
||||
states: vec![AuraPowerState {
|
||||
zone: PowerZones::RearGlow,
|
||||
sleep: true,
|
||||
..Default::default()
|
||||
}],
|
||||
});
|
||||
let shut_rear_ = to_binary_string(&LaptopAuraPower {
|
||||
states: vec![AuraPowerState {
|
||||
zone: PowerZones::RearGlow,
|
||||
shutdown: true,
|
||||
..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!(awake_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 = LaptopAuraPower::new(AuraDeviceType::LaptopPost2021, &LaptopLedData::default());
|
||||
let out = to_binary_string(&byte1);
|
||||
assert_eq!(out, "11111111, 00011110, 00001111, 00001111");
|
||||
}
|
||||
}
|
||||
@@ -1,25 +1,28 @@
|
||||
mod builtin_modes;
|
||||
use advanced::LedCode;
|
||||
pub use builtin_modes::*;
|
||||
// TODO: Generic builtin modes
|
||||
// TODO: Traits for finding device + writing generic modes
|
||||
// TODO: Traits for writing aura_sync
|
||||
// TODO: separate keyboard and laptop parts?
|
||||
|
||||
use std::fmt::Debug;
|
||||
|
||||
use serde::{Deserialize, Serialize};
|
||||
use typeshare::typeshare;
|
||||
#[cfg(feature = "dbus")]
|
||||
use zbus::zvariant::{OwnedValue, Type, Value};
|
||||
|
||||
/// A container of images/grids/gifs/pauses which can be iterated over to
|
||||
/// generate cool effects
|
||||
pub mod effects;
|
||||
|
||||
/// All handling for `RgbAddress`ing.
|
||||
pub mod advanced;
|
||||
/// Convert the `RgbAddress` to `&str` labels
|
||||
pub mod advanced_to_str;
|
||||
mod builtin_modes;
|
||||
pub use builtin_modes::*;
|
||||
|
||||
/// Helper for detecting what is available
|
||||
pub mod aura_detection;
|
||||
pub mod error;
|
||||
/// Helpers for consructing keyboard layouts for UI use and effects
|
||||
pub mod layouts;
|
||||
pub mod usb;
|
||||
|
||||
pub mod power;
|
||||
|
||||
mod deprecated;
|
||||
pub mod keyboard;
|
||||
|
||||
pub const LED_MSG_LEN: usize = 17;
|
||||
pub const VERSION: &str = env!("CARGO_PKG_VERSION");
|
||||
@@ -61,12 +64,44 @@ pub const ORANGE: Colour = Colour {
|
||||
};
|
||||
pub const GRADIENT: [Colour; 7] = [RED, VIOLET, BLUE, TEAL, GREEN, YELLOW, ORANGE];
|
||||
|
||||
#[derive(Debug, Clone, PartialEq, Eq, Default, serde::Deserialize, serde::Serialize)]
|
||||
pub enum AdvancedAuraType {
|
||||
/// A `None` will apply the effect to the whole keyboard via basic-static
|
||||
/// mode
|
||||
#[typeshare]
|
||||
#[cfg_attr(feature = "dbus", derive(Type, Value, OwnedValue))]
|
||||
#[derive(Clone, Copy, Debug, Default, PartialEq, Eq, Hash, Serialize, Deserialize)]
|
||||
pub enum AuraDeviceType {
|
||||
/// Most new laptops
|
||||
#[default]
|
||||
None,
|
||||
Zoned(Vec<LedCode>),
|
||||
PerKey,
|
||||
LaptopPost2021 = 0,
|
||||
LaptopPre2021 = 1,
|
||||
LaptopTuf = 2,
|
||||
ScsiExtDisk = 3,
|
||||
Unknown = 255,
|
||||
}
|
||||
|
||||
impl AuraDeviceType {
|
||||
pub fn is_old_laptop(&self) -> bool {
|
||||
*self == Self::LaptopPre2021
|
||||
}
|
||||
|
||||
pub fn is_tuf_laptop(&self) -> bool {
|
||||
*self == Self::LaptopTuf
|
||||
}
|
||||
|
||||
pub fn is_new_laptop(&self) -> bool {
|
||||
*self == Self::LaptopPost2021
|
||||
}
|
||||
|
||||
pub fn is_scsi(&self) -> bool {
|
||||
*self == Self::ScsiExtDisk
|
||||
}
|
||||
}
|
||||
|
||||
impl From<&str> for AuraDeviceType {
|
||||
fn from(s: &str) -> Self {
|
||||
match s.to_lowercase().trim_start_matches("0x") {
|
||||
"tuf" => AuraDeviceType::LaptopTuf,
|
||||
"1932" => AuraDeviceType::ScsiExtDisk,
|
||||
"1866" | "18c6" | "1869" | "1854" => Self::LaptopPre2021,
|
||||
_ => Self::LaptopPost2021,
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,344 +0,0 @@
|
||||
use std::fmt::Debug;
|
||||
|
||||
use serde::{Deserialize, Serialize};
|
||||
use typeshare::typeshare;
|
||||
#[cfg(feature = "dbus")]
|
||||
use zbus::zvariant::{OwnedValue, Type, Value};
|
||||
|
||||
use crate::aura_detection::PowerZones;
|
||||
|
||||
#[typeshare]
|
||||
#[cfg_attr(feature = "dbus", derive(Type, Value, OwnedValue))]
|
||||
#[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 {
|
||||
/// Defaults all to off
|
||||
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, Value, OwnedValue))]
|
||||
#[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");
|
||||
}
|
||||
@@ -1,19 +1,3 @@
|
||||
use std::fmt::Debug;
|
||||
use std::ops::{BitAnd, BitOr};
|
||||
|
||||
use serde::{Deserialize, Serialize};
|
||||
use typeshare::typeshare;
|
||||
#[cfg(feature = "dbus")]
|
||||
use zbus::zvariant::{OwnedValue, Type, Value};
|
||||
|
||||
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];
|
||||
pub const LED_INIT4: &str = "^ASUS Tech.Inc."; // ^ == 0x5e
|
||||
pub const LED_INIT5: [u8; 6] = [0x5e, 0x05, 0x20, 0x31, 0, 0x08];
|
||||
|
||||
// Only these two packets must be 17 bytes
|
||||
pub const LED_APPLY: [u8; 17] = [0x5d, 0xb4, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0];
|
||||
pub const LED_SET: [u8; 17] = [0x5d, 0xb5, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0];
|
||||
@@ -24,243 +8,3 @@ pub const fn aura_brightness_bytes(brightness: u8) -> [u8; 17] {
|
||||
0x5a, 0xba, 0xc5, 0xc4, brightness, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
|
||||
]
|
||||
}
|
||||
|
||||
#[typeshare]
|
||||
#[cfg_attr(
|
||||
feature = "dbus",
|
||||
derive(Type, Value, OwnedValue),
|
||||
zvariant(signature = "s")
|
||||
)]
|
||||
#[derive(Copy, Clone, PartialEq, Eq, Hash, Serialize, Deserialize, Default)]
|
||||
pub enum AuraDevice {
|
||||
Tuf = 0,
|
||||
X1854 = 1,
|
||||
X1869 = 2,
|
||||
X1866 = 3,
|
||||
X18c6 = 4,
|
||||
#[default]
|
||||
X19b6 = 5,
|
||||
X1a30 = 6,
|
||||
X1abe = 7,
|
||||
Unknown = 99,
|
||||
}
|
||||
|
||||
impl AuraDevice {
|
||||
pub fn is_tuf_style(&self) -> bool {
|
||||
matches!(self, AuraDevice::Tuf)
|
||||
}
|
||||
|
||||
pub fn is_old_style(&self) -> bool {
|
||||
!matches!(
|
||||
self,
|
||||
AuraDevice::Unknown
|
||||
| AuraDevice::Tuf
|
||||
| AuraDevice::X19b6
|
||||
| AuraDevice::X18c6
|
||||
| AuraDevice::X1a30
|
||||
| AuraDevice::X1abe
|
||||
)
|
||||
}
|
||||
|
||||
pub fn is_new_style(&self) -> bool {
|
||||
matches!(
|
||||
self,
|
||||
AuraDevice::X19b6 | AuraDevice::X18c6 | AuraDevice::X1a30 | AuraDevice::X1abe
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
impl From<AuraDevice> for &str {
|
||||
fn from(a: AuraDevice) -> Self {
|
||||
match a {
|
||||
AuraDevice::Tuf => "tuf",
|
||||
AuraDevice::X1854 => "1854",
|
||||
AuraDevice::X1869 => "1869",
|
||||
AuraDevice::X1866 => "1866",
|
||||
AuraDevice::X18c6 => "18c6",
|
||||
AuraDevice::X19b6 => "19b6",
|
||||
AuraDevice::X1a30 => "1a30",
|
||||
AuraDevice::X1abe => "1abe",
|
||||
AuraDevice::Unknown => "unknown",
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
impl From<&str> for AuraDevice {
|
||||
fn from(s: &str) -> Self {
|
||||
match s.to_lowercase().as_str() {
|
||||
"tuf" => AuraDevice::Tuf,
|
||||
"1866" | "0x1866" => AuraDevice::X1866,
|
||||
"18c6" | "0x18c6" => AuraDevice::X18c6,
|
||||
"1869" | "0x1869" => AuraDevice::X1869,
|
||||
"1854" | "0x1854" => AuraDevice::X1854,
|
||||
"19b6" | "0x19b6" => AuraDevice::X19b6,
|
||||
"1a30" | "0x1a30" => AuraDevice::X1a30,
|
||||
"1abe" | "0x1abe" => AuraDevice::X1abe,
|
||||
_ => AuraDevice::Unknown,
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
impl Debug for AuraDevice {
|
||||
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
|
||||
match self {
|
||||
Self::Tuf => write!(f, "Tuf"),
|
||||
Self::X1854 => write!(f, "0x1854"),
|
||||
Self::X1869 => write!(f, "0x1869"),
|
||||
Self::X1866 => write!(f, "0x1866"),
|
||||
Self::X18c6 => write!(f, "0x18c6"),
|
||||
Self::X19b6 => write!(f, "0x19B6"),
|
||||
Self::X1a30 => write!(f, "0x1A30"),
|
||||
Self::X1abe => write!(f, "0x1ABE"),
|
||||
Self::Unknown => write!(f, "Unknown"),
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// This struct is intended as a helper to pass args to generic dbus interface
|
||||
#[typeshare]
|
||||
#[cfg_attr(feature = "dbus", derive(Type, Value, OwnedValue))]
|
||||
#[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>,
|
||||
/// 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]
|
||||
#[cfg_attr(
|
||||
feature = "dbus",
|
||||
derive(Type, Value, OwnedValue),
|
||||
zvariant(signature = "u")
|
||||
)]
|
||||
#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, Serialize, Deserialize)]
|
||||
#[repr(u32)]
|
||||
pub enum AuraDevTuf {
|
||||
Boot = 0,
|
||||
Awake = 1,
|
||||
Sleep = 2,
|
||||
Keyboard = 3,
|
||||
}
|
||||
|
||||
impl AuraDevTuf {
|
||||
pub const fn dev_id() -> &'static str {
|
||||
"tuf"
|
||||
}
|
||||
}
|
||||
|
||||
/// # Bits for older 0x1866 keyboard model
|
||||
///
|
||||
/// Keybord and Lightbar require Awake, Boot and Sleep apply to both
|
||||
/// Keybord and Lightbar regardless of if either are enabled (or Awake is
|
||||
/// enabled)
|
||||
///
|
||||
/// | Byte 1 | Byte 2 | Byte 3 | function | hex |
|
||||
/// |------------|------------|------------|----------|----------|
|
||||
/// | 0000, 0000 | 0000, 0000 | 0000, 0010 | Awake | 00,00,02 |
|
||||
/// | 0000, 1000 | 0000, 0000 | 0000, 0000 | Keyboard | 08,00,00 |
|
||||
/// | 0000, 0100 | 0000, 0101 | 0000, 0000 | Lightbar | 04,05,00 |
|
||||
/// | 1100, 0011 | 0001, 0010 | 0000, 1001 | Boot/Sht | c3,12,09 |
|
||||
/// | 0011, 0000 | 0000, 1000 | 0000, 0100 | Sleep | 30,08,04 |
|
||||
/// | 1111, 1111 | 0001, 1111 | 0000, 1111 | all on | |
|
||||
#[typeshare]
|
||||
#[cfg_attr(
|
||||
feature = "dbus",
|
||||
derive(Type, Value, OwnedValue),
|
||||
zvariant(signature = "u")
|
||||
)]
|
||||
#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, Serialize, Deserialize)]
|
||||
#[repr(u32)]
|
||||
pub enum AuraDevRog1 {
|
||||
Awake = 0x000002,
|
||||
Keyboard = 0x080000,
|
||||
Lightbar = 0x040500,
|
||||
Boot = 0xc31209,
|
||||
Sleep = 0x300804,
|
||||
}
|
||||
|
||||
impl From<AuraDevRog1> for u32 {
|
||||
fn from(a: AuraDevRog1) -> Self {
|
||||
a as u32
|
||||
}
|
||||
}
|
||||
|
||||
impl AuraDevRog1 {
|
||||
pub fn to_bytes(control: &[Self]) -> [u8; 4] {
|
||||
let mut a: u32 = 0;
|
||||
for n in control {
|
||||
a |= *n as u32;
|
||||
}
|
||||
[
|
||||
((a & 0xff0000) >> 16) as u8,
|
||||
((a & 0xff00) >> 8) as u8,
|
||||
(a & 0xff) as u8,
|
||||
0x00,
|
||||
]
|
||||
}
|
||||
|
||||
pub const fn dev_id() -> &'static str {
|
||||
"0x1866"
|
||||
}
|
||||
}
|
||||
|
||||
impl BitOr<AuraDevRog1> for AuraDevRog1 {
|
||||
type Output = u32;
|
||||
|
||||
fn bitor(self, rhs: AuraDevRog1) -> Self::Output {
|
||||
self as u32 | rhs as u32
|
||||
}
|
||||
}
|
||||
|
||||
impl BitAnd<AuraDevRog1> for AuraDevRog1 {
|
||||
type Output = u32;
|
||||
|
||||
fn bitand(self, rhs: AuraDevRog1) -> Self::Output {
|
||||
self as u32 & rhs as u32
|
||||
}
|
||||
}
|
||||
|
||||
#[cfg(test)]
|
||||
mod tests {
|
||||
use super::AuraDevRog1;
|
||||
|
||||
#[test]
|
||||
fn check_0x1866_control_bytes() {
|
||||
let bytes = [AuraDevRog1::Keyboard, AuraDevRog1::Awake];
|
||||
let bytes = AuraDevRog1::to_bytes(&bytes);
|
||||
println!("{:08b}, {:08b}, {:08b}", bytes[0], bytes[1], bytes[2]);
|
||||
assert_eq!(bytes, [0x08, 0x00, 0x02, 0x00]);
|
||||
|
||||
let bytes = [AuraDevRog1::Lightbar, AuraDevRog1::Awake];
|
||||
let bytes = AuraDevRog1::to_bytes(&bytes);
|
||||
println!("{:08b}, {:08b}, {:08b}", bytes[0], bytes[1], bytes[2]);
|
||||
assert_eq!(bytes, [0x04, 0x05, 0x02, 0x00]);
|
||||
|
||||
let bytes = [AuraDevRog1::Sleep];
|
||||
let bytes = AuraDevRog1::to_bytes(&bytes);
|
||||
println!("{:08b}, {:08b}, {:08b}", bytes[0], bytes[1], bytes[2]);
|
||||
assert_eq!(bytes, [0x30, 0x08, 0x04, 0x00]);
|
||||
|
||||
let bytes = [AuraDevRog1::Boot];
|
||||
let bytes = AuraDevRog1::to_bytes(&bytes);
|
||||
println!("{:08b}, {:08b}, {:08b}", bytes[0], bytes[1], bytes[2]);
|
||||
assert_eq!(bytes, [0xc3, 0x12, 0x09, 0x00]);
|
||||
|
||||
let bytes = [
|
||||
AuraDevRog1::Keyboard,
|
||||
AuraDevRog1::Lightbar,
|
||||
AuraDevRog1::Awake,
|
||||
AuraDevRog1::Sleep,
|
||||
AuraDevRog1::Boot,
|
||||
];
|
||||
|
||||
let bytes = AuraDevRog1::to_bytes(&bytes);
|
||||
println!("{:08b}, {:08b}, {:08b}", bytes[0], bytes[1], bytes[2]);
|
||||
assert_eq!(bytes, [0xff, 0x1f, 0x000f, 0x00]);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -23,22 +23,12 @@ pub mod types;
|
||||
pub mod ui;
|
||||
pub mod update_and_notify;
|
||||
|
||||
#[cfg(feature = "mocking")]
|
||||
pub use mocking::RogDbusClientBlocking;
|
||||
use nix::sys::stat;
|
||||
use nix::unistd;
|
||||
#[cfg(not(feature = "mocking"))]
|
||||
pub use rog_dbus::RogDbusClientBlocking;
|
||||
use tempfile::TempDir;
|
||||
// use log::{error, info, warn};
|
||||
|
||||
pub const VERSION: &str = env!("CARGO_PKG_VERSION");
|
||||
|
||||
#[cfg(not(feature = "mocking"))]
|
||||
const DATA_DIR: &str = "/usr/share/rog-gui/";
|
||||
#[cfg(feature = "mocking")]
|
||||
const DATA_DIR: &str = env!("CARGO_MANIFEST_DIR");
|
||||
const BOARD_NAME: &str = "/sys/class/dmi/id/board_name";
|
||||
pub const APP_ICON_PATH: &str = "/usr/share/icons/hicolor/512x512/apps/rog-control-center.png";
|
||||
|
||||
pub fn print_versions() {
|
||||
@@ -89,7 +79,7 @@ pub fn on_tmp_dir_exists() -> Result<TempDir, std::io::Error> {
|
||||
ipc_file.write_all(&[SHOW_GUI, 0])?;
|
||||
// tiny sleep to give the app a chance to respond
|
||||
sleep(Duration::from_millis(10));
|
||||
ipc_file.read(&mut buf).ok();
|
||||
ipc_file.read_exact(&mut buf).ok();
|
||||
|
||||
// First entry is the actual state
|
||||
if buf[0] == SHOWING_GUI {
|
||||
|
||||
@@ -15,19 +15,28 @@ use rog_control_center::cli_options::CliStart;
|
||||
use rog_control_center::config::Config;
|
||||
use rog_control_center::error::Result;
|
||||
use rog_control_center::slint::ComponentHandle;
|
||||
use rog_control_center::system_state::{AuraCreation, SystemState};
|
||||
use rog_control_center::system_state::SystemState;
|
||||
use rog_control_center::tray::init_tray;
|
||||
use rog_control_center::ui::setup_window;
|
||||
use rog_control_center::update_and_notify::{start_notifications, EnabledNotifications};
|
||||
use rog_control_center::{
|
||||
get_ipc_file, on_tmp_dir_exists, print_versions, MainWindow, RogDbusClientBlocking, QUIT_APP,
|
||||
SHOWING_GUI, SHOW_GUI,
|
||||
get_ipc_file, on_tmp_dir_exists, print_versions, MainWindow, QUIT_APP, SHOWING_GUI, SHOW_GUI,
|
||||
};
|
||||
use tokio::runtime::Runtime;
|
||||
// use winit::monitor::VideoMode;
|
||||
// use winit::window::{Fullscreen, WindowLevel};
|
||||
|
||||
fn main() -> Result<()> {
|
||||
#[tokio::main]
|
||||
async fn main() -> Result<()> {
|
||||
let self_version = env!("CARGO_PKG_VERSION");
|
||||
let conn = zbus::blocking::Connection::system()?;
|
||||
let proxy = rog_dbus::zbus_platform::PlatformProxyBlocking::new(&conn)?;
|
||||
let asusd_version = proxy.version().unwrap();
|
||||
if asusd_version != self_version {
|
||||
println!("Version mismatch: asusctl = {self_version}, asusd = {asusd_version}");
|
||||
return Ok(());
|
||||
}
|
||||
|
||||
let dmi = DMIID::new().unwrap_or_default();
|
||||
let board_name = dmi.board_name;
|
||||
let prod_family = dmi.product_family;
|
||||
@@ -66,17 +75,9 @@ fn main() -> Result<()> {
|
||||
// Enter the runtime so that `tokio::spawn` is available immediately.
|
||||
let _enter = rt.enter();
|
||||
|
||||
let (dbus, _) = RogDbusClientBlocking::new()
|
||||
.map_err(|_| {
|
||||
// TODO: show an error window
|
||||
})
|
||||
.unwrap();
|
||||
|
||||
let supported_properties = dbus
|
||||
.proxies()
|
||||
.platform()
|
||||
.supported_properties()
|
||||
.unwrap_or_else(|_e| {
|
||||
let supported_properties = match proxy.supported_properties() {
|
||||
Ok(s) => s,
|
||||
Err(_e) => {
|
||||
// TODO: show an error window
|
||||
Vec::default()
|
||||
});
|
||||
@@ -91,24 +92,28 @@ fn main() -> Result<()> {
|
||||
if cli_parsed.height_fullscreen != 0 {
|
||||
config.fullscreen_height = cli_parsed.height_fullscreen;
|
||||
}
|
||||
config.write();
|
||||
} else if cli_parsed.windowed {
|
||||
config.start_fullscreen = false;
|
||||
config.write();
|
||||
}
|
||||
|
||||
if is_rog_ally {
|
||||
config.enable_notifications = false;
|
||||
config.enable_tray_icon = false;
|
||||
config.run_in_background = false;
|
||||
config.startup_in_background = false;
|
||||
}
|
||||
|
||||
if config.startup_in_background {
|
||||
config.run_in_background = true;
|
||||
config.write();
|
||||
} else {
|
||||
get_ipc_file().unwrap().write_all(&[SHOW_GUI, 0]).unwrap();
|
||||
}
|
||||
config.write();
|
||||
|
||||
let enabled_notifications = EnabledNotifications::tokio_mutex(&config);
|
||||
let aura_creation = AuraCreation::new(cli_parsed.board_name, cli_parsed.layout_viewing)?;
|
||||
|
||||
// TODO: config mutex to share config in various places
|
||||
let states = setup_page_state_and_notifs(aura_creation, &enabled_notifications, &config)?;
|
||||
let states = setup_page_state_and_notifs(&enabled_notifications, &config).await?;
|
||||
|
||||
let enable_tray_icon = config.enable_tray_icon;
|
||||
let startup_in_background = config.startup_in_background;
|
||||
@@ -207,17 +212,18 @@ fn main() -> Result<()> {
|
||||
Ok(())
|
||||
}
|
||||
|
||||
fn setup_page_state_and_notifs(
|
||||
aura_creation: AuraCreation,
|
||||
async fn setup_page_state_and_notifs(
|
||||
enabled_notifications: &Arc<Mutex<EnabledNotifications>>,
|
||||
config: &Config,
|
||||
) -> Result<Arc<Mutex<SystemState>>> {
|
||||
let page_states = Arc::new(Mutex::new(SystemState::new(
|
||||
aura_creation,
|
||||
let page_states = Arc::new(Mutex::new(
|
||||
SystemState::new(
|
||||
enabled_notifications.clone(),
|
||||
config.enable_tray_icon,
|
||||
config.run_in_background,
|
||||
)?));
|
||||
)
|
||||
.await?,
|
||||
));
|
||||
|
||||
start_notifications(config, &page_states, enabled_notifications)?;
|
||||
|
||||
@@ -254,8 +260,10 @@ fn setup_page_state_and_notifs(
|
||||
// IconData {
|
||||
// height,
|
||||
// width,
|
||||
// rgba,
|
||||
// }
|
||||
// rgba
|
||||
//
|
||||
//
|
||||
// / }
|
||||
// }
|
||||
|
||||
fn do_cli_help(parsed: &CliStart) -> bool {
|
||||
|
||||
@@ -1,190 +1,15 @@
|
||||
use std::collections::{BTreeMap, HashSet};
|
||||
use std::path::PathBuf;
|
||||
use std::sync::{Arc, Mutex};
|
||||
use std::time::SystemTime;
|
||||
|
||||
use log::{error, warn};
|
||||
use rog_anime::{Animations, DeviceState};
|
||||
use rog_aura::aura_detection::{LaptopLedData, LedSupportFile};
|
||||
use rog_aura::layouts::KeyLayout;
|
||||
use rog_aura::usb::AuraPowerDev;
|
||||
use rog_aura::{AuraEffect, AuraModeNum, LedBrightness};
|
||||
use rog_platform::platform::{GpuMode, ThrottlePolicy};
|
||||
use rog_profiles::fan_curve_set::CurveData;
|
||||
use rog_profiles::FanCurvePU;
|
||||
use log::error;
|
||||
use supergfxctl::pci_device::{GfxMode, GfxPower};
|
||||
#[cfg(not(feature = "mocking"))]
|
||||
use supergfxctl::zbus_proxy::DaemonProxyBlocking as GfxProxyBlocking;
|
||||
use supergfxctl::zbus_proxy::DaemonProxy as GfxProxy;
|
||||
use zbus::Connection;
|
||||
|
||||
use crate::error::Result;
|
||||
#[cfg(feature = "mocking")]
|
||||
use crate::mocking::DaemonProxyBlocking as GfxProxyBlocking;
|
||||
use crate::update_and_notify::EnabledNotifications;
|
||||
use crate::{RogDbusClientBlocking, BOARD_NAME, DATA_DIR};
|
||||
|
||||
#[derive(Clone, Debug, Default)]
|
||||
pub struct PlatformState {
|
||||
/// To be shared to a thread that checks notifications.
|
||||
/// It's a bit general in that it won't provide *what* was
|
||||
/// updated, so the full state needs refresh
|
||||
pub post_sound: Option<bool>,
|
||||
pub gpu_mux_mode: Option<GpuMode>,
|
||||
pub panel_overdrive: Option<bool>,
|
||||
pub mini_led_mode: Option<bool>,
|
||||
pub dgpu_disable: Option<bool>,
|
||||
pub egpu_enable: Option<bool>,
|
||||
pub throttle: Option<ThrottlePolicy>,
|
||||
pub charge_limit: Option<u8>,
|
||||
}
|
||||
|
||||
impl PlatformState {
|
||||
pub fn new(dbus: &RogDbusClientBlocking<'_>) -> Result<Self> {
|
||||
Ok(Self {
|
||||
post_sound: dbus.proxies().platform().boot_sound().ok(),
|
||||
gpu_mux_mode: dbus
|
||||
.proxies()
|
||||
.platform()
|
||||
.gpu_mux_mode()
|
||||
.map(GpuMode::from)
|
||||
.ok(),
|
||||
panel_overdrive: dbus.proxies().platform().panel_od().ok(),
|
||||
mini_led_mode: dbus.proxies().platform().mini_led_mode().ok(),
|
||||
// TODO: needs supergfx
|
||||
dgpu_disable: dbus.proxies().platform().dgpu_disable().ok(),
|
||||
egpu_enable: dbus.proxies().platform().egpu_enable().ok(),
|
||||
throttle: dbus.proxies().platform().throttle_thermal_policy().ok(),
|
||||
charge_limit: dbus
|
||||
.proxies()
|
||||
.platform()
|
||||
.charge_control_end_threshold()
|
||||
.ok(),
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
#[derive(Clone, Debug, Default)]
|
||||
pub struct FanCurvesState {
|
||||
pub show_curve: ThrottlePolicy,
|
||||
pub show_graph: FanCurvePU,
|
||||
pub curves: BTreeMap<ThrottlePolicy, Vec<CurveData>>,
|
||||
pub available_fans: HashSet<FanCurvePU>,
|
||||
// pub drag_delta: Vec2,
|
||||
}
|
||||
|
||||
impl FanCurvesState {
|
||||
pub fn new(dbus: &RogDbusClientBlocking<'_>) -> Result<Self> {
|
||||
let profiles = vec![
|
||||
ThrottlePolicy::Balanced,
|
||||
ThrottlePolicy::Quiet,
|
||||
ThrottlePolicy::Performance,
|
||||
];
|
||||
|
||||
let mut available_fans = HashSet::new();
|
||||
let mut curves: BTreeMap<ThrottlePolicy, Vec<CurveData>> = BTreeMap::new();
|
||||
for p in &profiles {
|
||||
if let Ok(curve) = dbus.proxies().fan_curves().fan_curve_data(*p) {
|
||||
if available_fans.is_empty() {
|
||||
for fan in &curve {
|
||||
available_fans.insert(fan.fan);
|
||||
}
|
||||
}
|
||||
curves.insert(*p, curve);
|
||||
} else {
|
||||
curves.insert(*p, Default::default());
|
||||
}
|
||||
}
|
||||
|
||||
let show_curve = dbus.proxies().platform().throttle_thermal_policy()?;
|
||||
|
||||
Ok(Self {
|
||||
show_curve,
|
||||
show_graph: FanCurvePU::CPU,
|
||||
curves,
|
||||
available_fans,
|
||||
// drag_delta: Vec2::default(),
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
#[derive(Clone, Debug, Default)]
|
||||
pub struct AuraState {
|
||||
pub current_mode: AuraModeNum,
|
||||
pub modes: BTreeMap<AuraModeNum, AuraEffect>,
|
||||
pub enabled: AuraPowerDev,
|
||||
/// Brightness from 0-3
|
||||
pub bright: LedBrightness,
|
||||
pub wave_red: [u8; 22],
|
||||
pub wave_green: [u8; 22],
|
||||
pub wave_blue: [u8; 22],
|
||||
}
|
||||
|
||||
impl AuraState {
|
||||
pub fn new(layout: &KeyLayout, dbus: &RogDbusClientBlocking<'_>) -> Result<Self> {
|
||||
Ok(Self {
|
||||
current_mode: if !layout.basic_modes().is_empty() {
|
||||
dbus.proxies().aura().led_mode().unwrap_or_default()
|
||||
} else {
|
||||
AuraModeNum::Static
|
||||
},
|
||||
|
||||
modes: if !layout.basic_modes().is_empty() {
|
||||
dbus.proxies().aura().all_mode_data().unwrap_or_default()
|
||||
} else {
|
||||
BTreeMap::new()
|
||||
},
|
||||
enabled: dbus.proxies().aura().led_power().unwrap_or_default(),
|
||||
bright: Default::default(),
|
||||
wave_red: [0u8; 22],
|
||||
wave_green: [0u8; 22],
|
||||
wave_blue: [0u8; 22],
|
||||
})
|
||||
}
|
||||
|
||||
/// Bump value in to the wave and surf all along.
|
||||
pub fn nudge_wave(&mut self, r: u8, g: u8, b: u8) {
|
||||
for i in (0..self.wave_red.len()).rev() {
|
||||
if i > 0 {
|
||||
self.wave_red[i] = self.wave_red[i - 1];
|
||||
self.wave_green[i] = self.wave_green[i - 1];
|
||||
self.wave_blue[i] = self.wave_blue[i - 1];
|
||||
}
|
||||
}
|
||||
self.wave_red[0] = r;
|
||||
self.wave_green[0] = g;
|
||||
self.wave_blue[0] = b;
|
||||
}
|
||||
}
|
||||
|
||||
#[derive(Clone, Debug, Default)]
|
||||
pub struct AnimeState {
|
||||
pub display_enabled: bool,
|
||||
pub display_brightness: u8,
|
||||
pub builtin_anims_enabled: bool,
|
||||
pub builtin_anims: Animations,
|
||||
}
|
||||
|
||||
impl AnimeState {
|
||||
pub fn new(dbus: &RogDbusClientBlocking<'_>) -> Result<Self> {
|
||||
let device_state = dbus.proxies().anime().device_state()?;
|
||||
Ok(Self {
|
||||
display_enabled: device_state.display_enabled,
|
||||
display_brightness: device_state.display_brightness as u8,
|
||||
builtin_anims_enabled: device_state.builtin_anims_enabled,
|
||||
builtin_anims: device_state.builtin_anims,
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
impl From<DeviceState> for AnimeState {
|
||||
fn from(dev: DeviceState) -> Self {
|
||||
Self {
|
||||
display_enabled: dev.display_enabled,
|
||||
display_brightness: dev.display_brightness as u8,
|
||||
builtin_anims_enabled: dev.builtin_anims_enabled,
|
||||
builtin_anims: dev.builtin_anims,
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#[derive(Clone, Debug)]
|
||||
pub struct GfxState {
|
||||
@@ -194,11 +19,11 @@ pub struct GfxState {
|
||||
}
|
||||
|
||||
impl GfxState {
|
||||
pub fn new(dbus: &GfxProxyBlocking<'_>) -> Result<Self> {
|
||||
pub async fn new(dbus: &GfxProxy<'_>) -> Result<Self> {
|
||||
Ok(Self {
|
||||
has_supergfx: dbus.mode().is_ok(),
|
||||
mode: dbus.mode().unwrap_or(GfxMode::None),
|
||||
power_status: dbus.power().unwrap_or(GfxPower::Unknown),
|
||||
has_supergfx: dbus.mode().await.is_ok(),
|
||||
mode: dbus.mode().await.unwrap_or(GfxMode::None),
|
||||
power_status: dbus.power().await.unwrap_or(GfxPower::Unknown),
|
||||
})
|
||||
}
|
||||
}
|
||||
@@ -213,115 +38,16 @@ impl Default for GfxState {
|
||||
}
|
||||
}
|
||||
|
||||
/// The keyboard layout, used for such things as per-key and zones
|
||||
#[derive(Clone, Debug)]
|
||||
pub struct AuraCreation {
|
||||
/// Specifically for testing the development of keyboard layouts (combined
|
||||
/// with `--layout-name` CLI option)
|
||||
pub layout_testing: Option<PathBuf>,
|
||||
pub layout_last_modified: SystemTime,
|
||||
pub keyboard_layout: KeyLayout,
|
||||
pub keyboard_layouts: Vec<PathBuf>,
|
||||
/// current index in to `self.keyboard_layouts`
|
||||
pub keyboard_layout_index: usize,
|
||||
}
|
||||
|
||||
impl AuraCreation {
|
||||
pub fn new(test_name: Option<String>, view_layout: bool) -> Result<Self> {
|
||||
let mut led_support = LaptopLedData::get_data();
|
||||
|
||||
let mut path = PathBuf::from(DATA_DIR);
|
||||
let mut layout_testing = None;
|
||||
let mut keyboard_layouts = Vec::new();
|
||||
|
||||
// Find and load a matching layout for laptop
|
||||
let mut board_name = std::fs::read_to_string(BOARD_NAME).map_err(|e| {
|
||||
println!("DOH! {BOARD_NAME}, {e}");
|
||||
e
|
||||
})?;
|
||||
|
||||
if test_name.is_some() || view_layout {
|
||||
if cfg!(feature = "mocking") {
|
||||
path.pop();
|
||||
path.push("rog-aura");
|
||||
path.push("data");
|
||||
}
|
||||
keyboard_layouts = KeyLayout::layout_files(path.clone()).unwrap();
|
||||
|
||||
if let Some(name) = test_name {
|
||||
if let Some(modes) = LedSupportFile::load_from_supoprt_db() {
|
||||
if let Some(data) = modes.matcher(&name) {
|
||||
led_support = data;
|
||||
}
|
||||
}
|
||||
board_name = name;
|
||||
for layout in &keyboard_layouts {
|
||||
if layout
|
||||
.file_name()
|
||||
.unwrap()
|
||||
.to_string_lossy()
|
||||
.contains(&led_support.layout_name.to_lowercase())
|
||||
{
|
||||
layout_testing = Some(layout.clone());
|
||||
}
|
||||
}
|
||||
} else {
|
||||
board_name = "GQ401QM".to_owned();
|
||||
};
|
||||
|
||||
if view_layout {
|
||||
layout_testing = Some(keyboard_layouts[0].clone());
|
||||
board_name = keyboard_layouts[0]
|
||||
.file_name()
|
||||
.unwrap()
|
||||
.to_string_lossy()
|
||||
.split_once('_')
|
||||
.unwrap()
|
||||
.0
|
||||
.to_owned();
|
||||
led_support.layout_name = board_name.clone();
|
||||
}
|
||||
}
|
||||
|
||||
let keyboard_layout = KeyLayout::find_layout(led_support, path)
|
||||
.map_err(|e| {
|
||||
println!("DERP! , {e}");
|
||||
})
|
||||
.unwrap_or_else(|_| {
|
||||
warn!("Did not find a keyboard layout matching {board_name}");
|
||||
KeyLayout::default_layout()
|
||||
});
|
||||
|
||||
Ok(Self {
|
||||
layout_testing,
|
||||
layout_last_modified: SystemTime::now(),
|
||||
keyboard_layout,
|
||||
keyboard_layouts,
|
||||
keyboard_layout_index: 0,
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
/// State stored from system daemons. This is shared with: tray, zbus
|
||||
/// notifications thread and the GUI app thread.
|
||||
pub struct SystemState {
|
||||
pub aura_creation: AuraCreation,
|
||||
//--
|
||||
pub enabled_notifications: Arc<Mutex<EnabledNotifications>>,
|
||||
/// Because much of the app state here is the same as
|
||||
/// `RogBiosSupportedFunctions` we can re-use that structure.
|
||||
pub bios: PlatformState,
|
||||
pub aura: AuraState,
|
||||
pub anime: AnimeState,
|
||||
pub fan_curves: FanCurvesState,
|
||||
pub gfx_state: GfxState,
|
||||
pub error: Option<String>,
|
||||
/// Specific field for the tray only so that we can know when it does need
|
||||
/// update. The tray should set this to false when done.
|
||||
pub tray_should_update: bool,
|
||||
pub app_should_update: bool,
|
||||
pub asus_dbus: RogDbusClientBlocking<'static>,
|
||||
pub gfx_dbus: GfxProxyBlocking<'static>,
|
||||
pub tray_enabled: bool,
|
||||
pub run_in_bg: bool,
|
||||
}
|
||||
@@ -329,47 +55,22 @@ pub struct SystemState {
|
||||
impl SystemState {
|
||||
/// Creates self, including the relevant dbus connections and proixies for
|
||||
/// internal use
|
||||
pub fn new(
|
||||
aura_creation: AuraCreation,
|
||||
pub async fn new(
|
||||
enabled_notifications: Arc<Mutex<EnabledNotifications>>,
|
||||
tray_enabled: bool,
|
||||
run_in_bg: bool,
|
||||
) -> Result<Self> {
|
||||
let (asus_dbus, conn) = RogDbusClientBlocking::new()?;
|
||||
let aura = AuraState::new(&aura_creation.keyboard_layout, &asus_dbus)
|
||||
.map_err(|e| {
|
||||
let e = format!("Could not get AuraState state: {e}");
|
||||
error!("{e}");
|
||||
})
|
||||
.unwrap_or_default();
|
||||
let conn = Connection::system().await?;
|
||||
|
||||
let gfx_dbus = GfxProxyBlocking::builder(&conn)
|
||||
let gfx_dbus = GfxProxy::builder(&conn)
|
||||
.destination(":org.supergfxctl.Daemon")?
|
||||
.build()
|
||||
.await
|
||||
.expect("Couldn't connect to supergfxd");
|
||||
Ok(Self {
|
||||
aura_creation,
|
||||
enabled_notifications,
|
||||
bios: PlatformState::new(&asus_dbus)
|
||||
.map_err(|e| {
|
||||
let e = format!("Could not get BiosState state: {e}");
|
||||
error!("{e}");
|
||||
})
|
||||
.unwrap_or_default(),
|
||||
aura,
|
||||
anime: AnimeState::new(&asus_dbus)
|
||||
.map_err(|e| {
|
||||
let e = format!("Could not get AnimeState state: {e}");
|
||||
error!("{e}");
|
||||
})
|
||||
.unwrap_or_default(),
|
||||
fan_curves: FanCurvesState::new(&asus_dbus)
|
||||
.map_err(|e| {
|
||||
let e = format!("Could not get FanCurvesState state: {e}");
|
||||
error!("{e}");
|
||||
})
|
||||
.unwrap_or_default(),
|
||||
gfx_state: GfxState::new(&gfx_dbus)
|
||||
.await
|
||||
.map_err(|e| {
|
||||
let e = format!("Could not get supergfxd state: {e}");
|
||||
error!("{e}");
|
||||
@@ -378,8 +79,6 @@ impl SystemState {
|
||||
error: None,
|
||||
tray_should_update: true,
|
||||
app_should_update: true,
|
||||
asus_dbus,
|
||||
gfx_dbus,
|
||||
tray_enabled,
|
||||
run_in_bg,
|
||||
})
|
||||
@@ -390,51 +89,3 @@ impl SystemState {
|
||||
self.app_should_update = true;
|
||||
}
|
||||
}
|
||||
|
||||
impl Default for SystemState {
|
||||
fn default() -> Self {
|
||||
let (asus_dbus, conn) = RogDbusClientBlocking::new().expect("Couldn't connect to asusd");
|
||||
let gfx_dbus = GfxProxyBlocking::builder(&conn)
|
||||
.build()
|
||||
.expect("Couldn't connect to supergfxd");
|
||||
|
||||
Self {
|
||||
aura_creation: AuraCreation {
|
||||
layout_testing: None,
|
||||
layout_last_modified: SystemTime::now(),
|
||||
keyboard_layout: KeyLayout::default_layout(),
|
||||
keyboard_layouts: Default::default(),
|
||||
keyboard_layout_index: 0,
|
||||
},
|
||||
enabled_notifications: Default::default(),
|
||||
bios: PlatformState {
|
||||
post_sound: Default::default(),
|
||||
gpu_mux_mode: None,
|
||||
charge_limit: Some(100),
|
||||
..Default::default()
|
||||
},
|
||||
aura: AuraState {
|
||||
current_mode: AuraModeNum::Static,
|
||||
modes: Default::default(),
|
||||
enabled: AuraPowerDev::default(),
|
||||
..Default::default()
|
||||
},
|
||||
anime: AnimeState::default(),
|
||||
fan_curves: FanCurvesState {
|
||||
..Default::default()
|
||||
},
|
||||
gfx_state: GfxState {
|
||||
has_supergfx: false,
|
||||
mode: GfxMode::None,
|
||||
power_status: GfxPower::Unknown,
|
||||
},
|
||||
error: Default::default(),
|
||||
tray_should_update: true,
|
||||
app_should_update: true,
|
||||
asus_dbus,
|
||||
gfx_dbus,
|
||||
tray_enabled: true,
|
||||
run_in_bg: true,
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -11,7 +11,7 @@ use std::time::Duration;
|
||||
|
||||
use betrayer::{Icon, Menu, MenuItem, TrayEvent, TrayIcon, TrayIconBuilder};
|
||||
use log::{debug, error, info, warn};
|
||||
use rog_platform::platform::{GpuMode, Properties};
|
||||
use rog_platform::platform::Properties;
|
||||
use supergfxctl::pci_device::{GfxMode, GfxPower};
|
||||
use supergfxctl::zbus_proxy::DaemonProxyBlocking as GfxProxy;
|
||||
use versions::Versioning;
|
||||
@@ -113,16 +113,7 @@ fn set_tray_icon_and_tip(lock: &SystemState, tray: &TrayIcon<TrayAction>, superg
|
||||
}
|
||||
};
|
||||
|
||||
let current_gpu_mode = if supergfx_active {
|
||||
lock.gfx_state.mode
|
||||
} else if let Some(mode) = lock.bios.gpu_mux_mode {
|
||||
match mode {
|
||||
GpuMode::Discrete => GfxMode::AsusMuxDgpu,
|
||||
_ => GfxMode::Hybrid,
|
||||
}
|
||||
} else {
|
||||
GfxMode::Hybrid
|
||||
};
|
||||
let current_gpu_mode = lock.gfx_state.mode;
|
||||
|
||||
tray.set_tooltip(format!(
|
||||
"ROG: gpu mode = {current_gpu_mode:?}, gpu power = {gpu_status:?}"
|
||||
@@ -137,9 +128,17 @@ pub fn init_tray(
|
||||
config: Arc<Mutex<Config>>,
|
||||
) {
|
||||
std::thread::spawn(move || {
|
||||
debug!("init_tray");
|
||||
let rog_blue = read_icon(&PathBuf::from("asus_notif_blue.png"));
|
||||
let rog_red = read_icon(&PathBuf::from("asus_notif_red.png"));
|
||||
|
||||
if let Ok(tray) = TrayIconBuilder::<TrayAction>::new()
|
||||
.with_icon(rog_red.clone())
|
||||
.with_tooltip(TRAY_LABEL)
|
||||
.with_menu(build_menu())
|
||||
.build(do_action)
|
||||
.map_err(|e| log::error!("Tray unable to be initialised: {e:?}"))
|
||||
{
|
||||
info!("Tray started");
|
||||
let rog_blue = read_icon(&PathBuf::from("asus_notif_blue.png"));
|
||||
let rog_green = read_icon(&PathBuf::from("asus_notif_green.png"));
|
||||
let rog_white = read_icon(&PathBuf::from("asus_notif_white.png"));
|
||||
let gpu_integrated = read_icon(&PathBuf::from("rog-control-center.png"));
|
||||
@@ -169,15 +168,8 @@ pub fn init_tray(
|
||||
}
|
||||
};
|
||||
|
||||
let tray = TrayIconBuilder::<TrayAction>::new()
|
||||
.with_icon(rog_red.clone())
|
||||
.with_tooltip(TRAY_LABEL)
|
||||
.with_menu(build_menu())
|
||||
.build(do_action)
|
||||
.unwrap();
|
||||
info!("Started ROGTray");
|
||||
loop {
|
||||
// let states = states.clone();
|
||||
if let Ok(mut lock) = states.lock() {
|
||||
if lock.tray_should_update {
|
||||
set_tray_icon_and_tip(&lock, &tray, supergfx_active);
|
||||
@@ -191,5 +183,6 @@ pub fn init_tray(
|
||||
}
|
||||
sleep(Duration::from_millis(50));
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@@ -1,3 +1,7 @@
|
||||
use crate::slint_generatedMainWindow::{
|
||||
AuraPowerState as SlintAuraPowerState, LaptopAuraPower as SlintLaptopAuraPower,
|
||||
};
|
||||
|
||||
impl From<rog_aura::AuraEffect> for crate::slint_generatedMainWindow::AuraEffect {
|
||||
fn from(m: rog_aura::AuraEffect) -> Self {
|
||||
Self {
|
||||
@@ -46,66 +50,20 @@ impl From<crate::slint_generatedMainWindow::AuraEffect> for rog_aura::AuraEffect
|
||||
}
|
||||
}
|
||||
|
||||
use rog_aura::power::KbAuraPowerState;
|
||||
use rog_aura::aura_detection::PowerZones;
|
||||
use rog_aura::keyboard::{AuraPowerState, LaptopAuraPower};
|
||||
use slint::{Model, ModelRc, RgbaColor};
|
||||
|
||||
use crate::slint_generatedMainWindow::AuraDevTuf as SlintAuraDevTuf;
|
||||
impl From<rog_aura::usb::AuraDevTuf> for SlintAuraDevTuf {
|
||||
fn from(value: rog_aura::usb::AuraDevTuf) -> Self {
|
||||
match value {
|
||||
rog_aura::usb::AuraDevTuf::Boot => SlintAuraDevTuf::Boot,
|
||||
rog_aura::usb::AuraDevTuf::Awake => SlintAuraDevTuf::Awake,
|
||||
rog_aura::usb::AuraDevTuf::Sleep => SlintAuraDevTuf::Sleep,
|
||||
rog_aura::usb::AuraDevTuf::Keyboard => SlintAuraDevTuf::Keyboard,
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
impl From<SlintAuraDevTuf> for rog_aura::usb::AuraDevTuf {
|
||||
fn from(value: SlintAuraDevTuf) -> Self {
|
||||
match value {
|
||||
SlintAuraDevTuf::Boot => rog_aura::usb::AuraDevTuf::Boot,
|
||||
SlintAuraDevTuf::Awake => rog_aura::usb::AuraDevTuf::Awake,
|
||||
SlintAuraDevTuf::Sleep => rog_aura::usb::AuraDevTuf::Sleep,
|
||||
SlintAuraDevTuf::Keyboard => rog_aura::usb::AuraDevTuf::Keyboard,
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
use crate::slint_generatedMainWindow::AuraDevRog1 as SlintAuraDevRog1;
|
||||
impl From<rog_aura::usb::AuraDevRog1> for SlintAuraDevRog1 {
|
||||
fn from(value: rog_aura::usb::AuraDevRog1) -> Self {
|
||||
match value {
|
||||
rog_aura::usb::AuraDevRog1::Awake => SlintAuraDevRog1::Awake,
|
||||
rog_aura::usb::AuraDevRog1::Keyboard => SlintAuraDevRog1::Keyboard,
|
||||
rog_aura::usb::AuraDevRog1::Lightbar => SlintAuraDevRog1::Lightbar,
|
||||
rog_aura::usb::AuraDevRog1::Boot => SlintAuraDevRog1::Boot,
|
||||
rog_aura::usb::AuraDevRog1::Sleep => SlintAuraDevRog1::Sleep,
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
impl From<SlintAuraDevRog1> for rog_aura::usb::AuraDevRog1 {
|
||||
fn from(value: SlintAuraDevRog1) -> Self {
|
||||
match value {
|
||||
SlintAuraDevRog1::Awake => rog_aura::usb::AuraDevRog1::Awake,
|
||||
SlintAuraDevRog1::Keyboard => rog_aura::usb::AuraDevRog1::Keyboard,
|
||||
SlintAuraDevRog1::Lightbar => rog_aura::usb::AuraDevRog1::Lightbar,
|
||||
SlintAuraDevRog1::Boot => rog_aura::usb::AuraDevRog1::Boot,
|
||||
SlintAuraDevRog1::Sleep => rog_aura::usb::AuraDevRog1::Sleep,
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
use crate::slint_generatedMainWindow::PowerZones as SlintPowerZones;
|
||||
impl From<rog_aura::aura_detection::PowerZones> for SlintPowerZones {
|
||||
fn from(value: rog_aura::aura_detection::PowerZones) -> Self {
|
||||
match value {
|
||||
rog_aura::aura_detection::PowerZones::Logo => SlintPowerZones::Logo,
|
||||
rog_aura::aura_detection::PowerZones::Keyboard => SlintPowerZones::Keyboard,
|
||||
rog_aura::aura_detection::PowerZones::Lightbar => SlintPowerZones::Lightbar,
|
||||
rog_aura::aura_detection::PowerZones::Lid => SlintPowerZones::Lid,
|
||||
rog_aura::aura_detection::PowerZones::RearGlow => SlintPowerZones::RearGlow,
|
||||
PowerZones::Logo => SlintPowerZones::Logo,
|
||||
PowerZones::Keyboard => SlintPowerZones::Keyboard,
|
||||
PowerZones::Lightbar => SlintPowerZones::Lightbar,
|
||||
PowerZones::Lid => SlintPowerZones::Lid,
|
||||
PowerZones::RearGlow => SlintPowerZones::RearGlow,
|
||||
PowerZones::KeyboardAndLightbar => todo!(),
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -118,134 +76,72 @@ impl From<SlintPowerZones> for rog_aura::aura_detection::PowerZones {
|
||||
SlintPowerZones::Lightbar => rog_aura::aura_detection::PowerZones::Lightbar,
|
||||
SlintPowerZones::Lid => rog_aura::aura_detection::PowerZones::Lid,
|
||||
SlintPowerZones::RearGlow => rog_aura::aura_detection::PowerZones::RearGlow,
|
||||
SlintPowerZones::KeyboardAndLightbar => {
|
||||
rog_aura::aura_detection::PowerZones::KeyboardAndLightbar
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
use crate::slint_generatedMainWindow::{
|
||||
AuraPower as SlintAuraPower, KbAuraPowerState as SlintKbAuraPowerState,
|
||||
};
|
||||
impl From<rog_aura::power::AuraPower> for SlintAuraPower {
|
||||
fn from(value: rog_aura::power::AuraPower) -> Self {
|
||||
impl From<SlintAuraPowerState> for AuraPowerState {
|
||||
fn from(value: SlintAuraPowerState) -> Self {
|
||||
Self {
|
||||
keyboard: SlintKbAuraPowerState {
|
||||
awake: value.keyboard.awake,
|
||||
boot: value.keyboard.boot,
|
||||
shutdown: value.keyboard.shutdown,
|
||||
sleep: value.keyboard.sleep,
|
||||
zone: value.keyboard.zone.into(),
|
||||
},
|
||||
lid: SlintKbAuraPowerState {
|
||||
awake: value.lid.awake,
|
||||
boot: value.lid.boot,
|
||||
shutdown: value.lid.shutdown,
|
||||
sleep: value.lid.sleep,
|
||||
zone: value.lid.zone.into(),
|
||||
},
|
||||
lightbar: SlintKbAuraPowerState {
|
||||
awake: value.lightbar.awake,
|
||||
boot: value.lightbar.boot,
|
||||
shutdown: value.lightbar.shutdown,
|
||||
sleep: value.lightbar.sleep,
|
||||
zone: value.lightbar.zone.into(),
|
||||
},
|
||||
logo: SlintKbAuraPowerState {
|
||||
awake: value.logo.awake,
|
||||
boot: value.logo.boot,
|
||||
shutdown: value.logo.shutdown,
|
||||
sleep: value.logo.sleep,
|
||||
zone: value.logo.zone.into(),
|
||||
},
|
||||
rear_glow: SlintKbAuraPowerState {
|
||||
awake: value.rear_glow.awake,
|
||||
boot: value.rear_glow.boot,
|
||||
shutdown: value.rear_glow.shutdown,
|
||||
sleep: value.rear_glow.sleep,
|
||||
zone: value.rear_glow.zone.into(),
|
||||
},
|
||||
zone: value.zone.into(),
|
||||
boot: value.boot.into(),
|
||||
awake: value.awake.into(),
|
||||
sleep: value.sleep.into(),
|
||||
shutdown: value.shutdown.into(),
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
impl From<SlintAuraPower> for rog_aura::power::AuraPower {
|
||||
fn from(value: SlintAuraPower) -> Self {
|
||||
Self {
|
||||
keyboard: KbAuraPowerState {
|
||||
awake: value.keyboard.awake,
|
||||
boot: value.keyboard.boot,
|
||||
shutdown: value.keyboard.shutdown,
|
||||
sleep: value.keyboard.sleep,
|
||||
zone: value.keyboard.zone.into(),
|
||||
},
|
||||
lid: KbAuraPowerState {
|
||||
awake: value.lid.awake,
|
||||
boot: value.lid.boot,
|
||||
shutdown: value.lid.shutdown,
|
||||
sleep: value.lid.sleep,
|
||||
zone: value.lid.zone.into(),
|
||||
},
|
||||
lightbar: KbAuraPowerState {
|
||||
awake: value.lightbar.awake,
|
||||
boot: value.lightbar.boot,
|
||||
shutdown: value.lightbar.shutdown,
|
||||
sleep: value.lightbar.sleep,
|
||||
zone: value.lightbar.zone.into(),
|
||||
},
|
||||
logo: KbAuraPowerState {
|
||||
awake: value.logo.awake,
|
||||
boot: value.logo.boot,
|
||||
shutdown: value.logo.shutdown,
|
||||
sleep: value.logo.sleep,
|
||||
zone: value.logo.zone.into(),
|
||||
},
|
||||
rear_glow: KbAuraPowerState {
|
||||
awake: value.rear_glow.awake,
|
||||
boot: value.rear_glow.boot,
|
||||
shutdown: value.rear_glow.shutdown,
|
||||
sleep: value.rear_glow.sleep,
|
||||
zone: value.rear_glow.zone.into(),
|
||||
},
|
||||
impl From<AuraPowerState> for SlintAuraPowerState {
|
||||
fn from(value: AuraPowerState) -> Self {
|
||||
let zone = value.zone.into();
|
||||
SlintAuraPowerState {
|
||||
boot: value.boot.into(),
|
||||
awake: value.awake.into(),
|
||||
sleep: value.sleep.into(),
|
||||
shutdown: value.shutdown.into(),
|
||||
zone,
|
||||
zone_name_idx: zone as i32,
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
use crate::slint_generatedMainWindow::AuraPowerDev as SlintAuraPowerDev;
|
||||
impl From<rog_aura::usb::AuraPowerDev> for SlintAuraPowerDev {
|
||||
fn from(value: rog_aura::usb::AuraPowerDev) -> Self {
|
||||
let tuf: Vec<SlintAuraDevTuf> = value
|
||||
.tuf
|
||||
.iter()
|
||||
.map(|n| SlintAuraDevTuf::from(*n))
|
||||
.collect();
|
||||
let old_rog: Vec<SlintAuraDevRog1> = value
|
||||
.old_rog
|
||||
.iter()
|
||||
.map(|n| SlintAuraDevRog1::from(*n))
|
||||
.collect();
|
||||
Self {
|
||||
tuf: ModelRc::from(tuf.as_slice()),
|
||||
old_rog: ModelRc::from(old_rog.as_slice()),
|
||||
rog: value.rog.into(),
|
||||
impl From<&AuraPowerState> for SlintAuraPowerState {
|
||||
fn from(value: &AuraPowerState) -> Self {
|
||||
let zone = value.zone.into();
|
||||
SlintAuraPowerState {
|
||||
boot: value.boot.into(),
|
||||
awake: value.awake.into(),
|
||||
sleep: value.sleep.into(),
|
||||
shutdown: value.shutdown.into(),
|
||||
zone,
|
||||
zone_name_idx: zone as i32,
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
impl From<SlintAuraPowerDev> for rog_aura::usb::AuraPowerDev {
|
||||
fn from(value: SlintAuraPowerDev) -> Self {
|
||||
let tuf: Vec<rog_aura::usb::AuraDevTuf> = value
|
||||
.tuf
|
||||
impl From<SlintLaptopAuraPower> for rog_aura::keyboard::LaptopAuraPower {
|
||||
fn from(value: SlintLaptopAuraPower) -> Self {
|
||||
let mut states = Vec::new();
|
||||
for state in value.states.iter() {
|
||||
states.push(state.into());
|
||||
}
|
||||
Self { states }
|
||||
}
|
||||
}
|
||||
|
||||
impl From<LaptopAuraPower> for SlintLaptopAuraPower {
|
||||
fn from(value: LaptopAuraPower) -> Self {
|
||||
let converted: Vec<SlintAuraPowerState> = value
|
||||
.states
|
||||
.iter()
|
||||
.map(rog_aura::usb::AuraDevTuf::from)
|
||||
.collect();
|
||||
let old_rog: Vec<rog_aura::usb::AuraDevRog1> = value
|
||||
.old_rog
|
||||
.iter()
|
||||
.map(rog_aura::usb::AuraDevRog1::from)
|
||||
.map(|s| SlintAuraPowerState::from(s))
|
||||
.collect();
|
||||
Self {
|
||||
tuf,
|
||||
old_rog,
|
||||
rog: value.rog.into(),
|
||||
states: ModelRc::from(converted.as_slice()),
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
use std::sync::{Arc, Mutex};
|
||||
|
||||
use rog_aura::usb::AuraPowerDev;
|
||||
use rog_aura::keyboard::LaptopAuraPower;
|
||||
use rog_dbus::zbus_aura::AuraProxy;
|
||||
use slint::{ComponentHandle, Model, RgbaColor, SharedString};
|
||||
|
||||
@@ -166,11 +166,11 @@ pub fn setup_aura_page(ui: &MainWindow, _states: Arc<Mutex<Config>>) {
|
||||
.on_set_led_power(move |power| {
|
||||
let handle_copy = handle_copy.clone();
|
||||
let proxy_copy = aura.clone();
|
||||
let power: AuraPowerDev = power.into();
|
||||
let power: LaptopAuraPower = power.into();
|
||||
tokio::spawn(async move {
|
||||
show_toast(
|
||||
"Anime builtin animations changed".into(),
|
||||
"Failed to set Anime builtin animations".into(),
|
||||
"Aura power settings changed".into(),
|
||||
"Failed to set Aura power settings".into(),
|
||||
handle_copy,
|
||||
proxy_copy.set_led_power(power).await,
|
||||
);
|
||||
|
||||
@@ -11,10 +11,8 @@ use std::time::Duration;
|
||||
|
||||
use log::{error, info, trace, warn};
|
||||
use notify_rust::{Hint, Notification, NotificationHandle, Urgency};
|
||||
use rog_dbus::zbus_anime::AnimeProxy;
|
||||
use rog_dbus::zbus_aura::AuraProxy;
|
||||
use rog_dbus::zbus_platform::PlatformProxy;
|
||||
use rog_platform::platform::{GpuMode, ThrottlePolicy};
|
||||
use rog_platform::platform::GpuMode;
|
||||
use serde::{Deserialize, Serialize};
|
||||
use supergfxctl::actions::UserActionRequired as GfxUserAction;
|
||||
use supergfxctl::pci_device::{GfxMode, GfxPower};
|
||||
@@ -31,45 +29,12 @@ const NOTIF_HEADER: &str = "ROG Control";
|
||||
static mut POWER_AC_CMD: Option<Command> = None;
|
||||
static mut POWER_BAT_CMD: Option<Command> = None;
|
||||
|
||||
#[derive(Debug, Clone, Deserialize, Serialize)]
|
||||
#[derive(Debug, Default, Clone, Deserialize, Serialize)]
|
||||
#[serde(default)]
|
||||
pub struct EnabledNotifications {
|
||||
pub receive_boot_sound_changed: bool,
|
||||
pub receive_panel_od_changed: bool,
|
||||
pub receive_mini_led_mode_changed: bool,
|
||||
pub receive_dgpu_disable_changed: bool,
|
||||
pub receive_egpu_enable_changed: bool,
|
||||
pub receive_gpu_mux_mode_changed: bool,
|
||||
pub receive_charge_control_end_threshold_changed: bool,
|
||||
pub receive_notify_mains_online: bool,
|
||||
pub receive_throttle_thermal_policy_changed: bool,
|
||||
pub receive_led_mode_data_changed: bool,
|
||||
/// Anime
|
||||
pub receive_power_states: bool,
|
||||
pub receive_notify_gfx: bool,
|
||||
pub receive_notify_gfx_status: bool,
|
||||
pub all_enabled: bool,
|
||||
}
|
||||
|
||||
impl Default for EnabledNotifications {
|
||||
fn default() -> Self {
|
||||
Self {
|
||||
receive_boot_sound_changed: false,
|
||||
receive_panel_od_changed: true,
|
||||
receive_mini_led_mode_changed: true,
|
||||
receive_dgpu_disable_changed: true,
|
||||
receive_egpu_enable_changed: true,
|
||||
receive_gpu_mux_mode_changed: true,
|
||||
receive_charge_control_end_threshold_changed: true,
|
||||
receive_notify_mains_online: false,
|
||||
receive_throttle_thermal_policy_changed: true,
|
||||
receive_led_mode_data_changed: true,
|
||||
receive_power_states: false,
|
||||
receive_notify_gfx: false,
|
||||
receive_notify_gfx_status: false,
|
||||
all_enabled: false,
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
impl EnabledNotifications {
|
||||
@@ -78,6 +43,18 @@ impl EnabledNotifications {
|
||||
}
|
||||
}
|
||||
|
||||
fn gpu_to_gfx(value: GpuMode) -> GfxMode {
|
||||
match value {
|
||||
GpuMode::Optimus => GfxMode::Hybrid,
|
||||
GpuMode::Integrated => GfxMode::Integrated,
|
||||
GpuMode::Egpu => GfxMode::AsusEgpu,
|
||||
GpuMode::Vfio => GfxMode::Vfio,
|
||||
GpuMode::Ultimate => GfxMode::AsusMuxDgpu,
|
||||
GpuMode::Error => GfxMode::None,
|
||||
GpuMode::NotSupported => GfxMode::None,
|
||||
}
|
||||
}
|
||||
|
||||
// TODO: drop the macro and use generics plus closure
|
||||
macro_rules! recv_notif {
|
||||
($proxy:ident,
|
||||
@@ -107,7 +84,7 @@ macro_rules! recv_notif {
|
||||
while let Some(e) = p.next().await {
|
||||
if let Ok(out) = e.args() {
|
||||
if let Ok(config) = notifs_enabled1.lock() {
|
||||
if config.all_enabled && config.$signal {
|
||||
if config.$signal {
|
||||
trace!("zbus signal {}", stringify!($signal));
|
||||
$notifier($msg, &out.$($out_arg)+()).ok();
|
||||
}
|
||||
@@ -124,49 +101,6 @@ macro_rules! recv_notif {
|
||||
};
|
||||
}
|
||||
|
||||
macro_rules! recv_changed {
|
||||
($proxy:ident,
|
||||
$signal:ident,
|
||||
$last_notif:ident,
|
||||
$notif_enabled:ident,
|
||||
$page_states:ident,
|
||||
($($args: tt)*),
|
||||
// ($($out_arg:tt)+),
|
||||
$msg:literal,
|
||||
$notifier:ident) => {
|
||||
|
||||
let notifs_enabled1 = $notif_enabled.clone();
|
||||
let page_states1 = $page_states.clone();
|
||||
|
||||
tokio::spawn(async move {
|
||||
let conn = zbus::Connection::system().await.map_err(|e| {
|
||||
log::error!("zbus signal: {}: {e}", stringify!($signal));
|
||||
e
|
||||
}).unwrap();
|
||||
let proxy = $proxy::new(&conn).await.map_err(|e| {
|
||||
log::error!("zbus signal: {}: {e}", stringify!($signal));
|
||||
e
|
||||
}).unwrap();
|
||||
info!("Started zbus signal thread: {}", stringify!($signal));
|
||||
while let Some(e) = proxy.$signal().await.next().await {
|
||||
if let Ok(out) = e.get().await {
|
||||
if let Ok(config) = notifs_enabled1.lock() {
|
||||
if config.all_enabled && config.$signal {
|
||||
trace!("zbus signal {}", stringify!($signal));
|
||||
$notifier($msg, &out).ok();
|
||||
}
|
||||
}
|
||||
if let Ok(mut lock) = page_states1.lock() {
|
||||
lock.$($args)+ = out.into();
|
||||
lock.set_notified();
|
||||
}
|
||||
}
|
||||
sleep(Duration::from_millis(500)).await;
|
||||
}
|
||||
});
|
||||
};
|
||||
}
|
||||
|
||||
pub fn start_notifications(
|
||||
config: &Config,
|
||||
page_states: &Arc<Mutex<SystemState>>,
|
||||
@@ -196,155 +130,6 @@ pub fn start_notifications(
|
||||
}
|
||||
}
|
||||
|
||||
// BIOS notif
|
||||
recv_changed!(
|
||||
PlatformProxy,
|
||||
receive_boot_sound_changed,
|
||||
last_notification,
|
||||
enabled_notifications,
|
||||
page_states,
|
||||
(bios.post_sound),
|
||||
"BIOS Post sound",
|
||||
do_notification
|
||||
);
|
||||
|
||||
recv_changed!(
|
||||
PlatformProxy,
|
||||
receive_panel_od_changed,
|
||||
last_notification,
|
||||
enabled_notifications,
|
||||
page_states,
|
||||
(bios.panel_overdrive),
|
||||
"Panel Overdrive enabled:",
|
||||
do_notification
|
||||
);
|
||||
|
||||
recv_changed!(
|
||||
PlatformProxy,
|
||||
receive_mini_led_mode_changed,
|
||||
last_notification,
|
||||
enabled_notifications,
|
||||
page_states,
|
||||
(bios.mini_led_mode),
|
||||
"MiniLED mode enabled:",
|
||||
do_notification
|
||||
);
|
||||
|
||||
recv_changed!(
|
||||
PlatformProxy,
|
||||
receive_dgpu_disable_changed,
|
||||
last_notification,
|
||||
enabled_notifications,
|
||||
page_states,
|
||||
(bios.dgpu_disable),
|
||||
"BIOS dGPU disabled",
|
||||
do_notification
|
||||
);
|
||||
|
||||
recv_changed!(
|
||||
PlatformProxy,
|
||||
receive_egpu_enable_changed,
|
||||
last_notification,
|
||||
enabled_notifications,
|
||||
page_states,
|
||||
(bios.egpu_enable),
|
||||
"BIOS eGPU enabled",
|
||||
do_notification
|
||||
);
|
||||
|
||||
// Charge notif
|
||||
recv_changed!(
|
||||
PlatformProxy,
|
||||
receive_charge_control_end_threshold_changed,
|
||||
last_notification,
|
||||
enabled_notifications,
|
||||
page_states,
|
||||
(bios.charge_limit),
|
||||
"Battery charge limit changed to",
|
||||
do_notification
|
||||
);
|
||||
|
||||
// Profile notif
|
||||
recv_changed!(
|
||||
PlatformProxy,
|
||||
receive_throttle_thermal_policy_changed,
|
||||
last_notification,
|
||||
enabled_notifications,
|
||||
page_states,
|
||||
(bios.throttle),
|
||||
"Profile changed to",
|
||||
do_thermal_notif
|
||||
);
|
||||
// notify!(do_thermal_notif(&out.profile), lock);
|
||||
|
||||
// LED notif
|
||||
recv_changed!(
|
||||
AuraProxy,
|
||||
receive_led_mode_data_changed,
|
||||
last_notification,
|
||||
enabled_notifications,
|
||||
page_states,
|
||||
(aura.current_mode),
|
||||
"Keyboard LED mode changed to",
|
||||
do_notification
|
||||
);
|
||||
|
||||
// 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 = AuraProxy::new(&conn)
|
||||
// .await
|
||||
// .map_err(|e| {
|
||||
// error!("zbus signal: receive_device_state: {e}");
|
||||
// e
|
||||
// })
|
||||
// .unwrap();
|
||||
// let p = proxy.receive_led_power_changed().await;
|
||||
// info!("Started zbus signal thread: receive_notify_power_states");
|
||||
// while let Some(e) = p.next().await {
|
||||
// if let Ok(out) = e.get().await {
|
||||
// if let Ok(mut lock) = page_states1.lock() {
|
||||
// lock.aura.enabled = out;
|
||||
// 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_device_state: {e}");
|
||||
e
|
||||
})
|
||||
.unwrap();
|
||||
if let Ok(mut p) = proxy.receive_notify_device_state().await {
|
||||
info!("Started zbus signal thread: receive_device_state");
|
||||
while let Some(e) = p.next().await {
|
||||
if let Ok(out) = e.args() {
|
||||
if let Ok(mut lock) = page_states1.lock() {
|
||||
lock.anime = out.data.into();
|
||||
}
|
||||
}
|
||||
}
|
||||
};
|
||||
});
|
||||
|
||||
let page_states1 = page_states.clone();
|
||||
tokio::spawn(async move {
|
||||
let conn = zbus::Connection::system()
|
||||
@@ -375,7 +160,7 @@ pub fn start_notifications(
|
||||
continue;
|
||||
}
|
||||
if let Ok(mut lock) = page_states1.lock() {
|
||||
lock.bios.gpu_mux_mode = Some(mode);
|
||||
lock.gfx_state.mode = gpu_to_gfx(mode);
|
||||
lock.set_notified();
|
||||
}
|
||||
do_mux_notification("Reboot required. BIOS GPU MUX mode set to", &mode).ok();
|
||||
@@ -397,7 +182,7 @@ pub fn start_notifications(
|
||||
if let Ok(status) = dev.get_runtime_status() {
|
||||
if status != GfxPower::Unknown && status != last_status {
|
||||
if let Ok(config) = notifs_enabled1.lock() {
|
||||
if config.all_enabled && config.receive_notify_gfx_status {
|
||||
if config.receive_notify_gfx_status {
|
||||
// Required check because status cycles through
|
||||
// active/unknown/suspended
|
||||
do_gpu_status_notif("dGPU status changed:", &status).ok();
|
||||
@@ -498,7 +283,7 @@ fn convert_gfx_mode(gfx: GfxMode) -> GpuMode {
|
||||
match gfx {
|
||||
GfxMode::Hybrid => GpuMode::Optimus,
|
||||
GfxMode::Integrated => GpuMode::Integrated,
|
||||
GfxMode::NvidiaNoModeset => GpuMode::Discrete,
|
||||
GfxMode::NvidiaNoModeset => GpuMode::Optimus,
|
||||
GfxMode::Vfio => GpuMode::Vfio,
|
||||
GfxMode::AsusEgpu => GpuMode::Egpu,
|
||||
GfxMode::AsusMuxDgpu => GpuMode::Ultimate,
|
||||
@@ -553,17 +338,6 @@ fn _ac_power_notification(message: &str, on: &bool) -> Result<NotificationHandle
|
||||
Ok(base_notification(message, &data).show()?)
|
||||
}
|
||||
|
||||
fn do_thermal_notif(message: &str, profile: &ThrottlePolicy) -> Result<NotificationHandle> {
|
||||
let icon = match profile {
|
||||
ThrottlePolicy::Balanced => "asus_notif_yellow",
|
||||
ThrottlePolicy::Performance => "asus_notif_red",
|
||||
ThrottlePolicy::Quiet => "asus_notif_green",
|
||||
};
|
||||
let profile: &str = (*profile).into();
|
||||
let mut notif = base_notification(message, &profile.to_uppercase());
|
||||
Ok(notif.icon(icon).show()?)
|
||||
}
|
||||
|
||||
fn do_gpu_status_notif(message: &str, data: &GfxPower) -> Result<NotificationHandle> {
|
||||
// eww
|
||||
let mut notif = base_notification(message, &<&str>::from(data).to_owned());
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
msgid ""
|
||||
msgstr ""
|
||||
"Project-Id-Version: PACKAGE VERSION\n"
|
||||
"POT-Creation-Date: 2024-03-23 01:29+0000\n"
|
||||
"POT-Creation-Date: 2024-04-09 09:23+0000\n"
|
||||
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
|
||||
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
|
||||
"Language-Team: LANGUAGE <LL@li.org>\n"
|
||||
@@ -237,51 +237,6 @@ msgctxt "PageAura"
|
||||
msgid "Power Settings"
|
||||
msgstr ""
|
||||
|
||||
#: rog-control-center/ui/pages/aura.slint:211 rog-control-center/ui/pages/aura.slint:369 rog-control-center/ui/pages/aura.slint:434
|
||||
msgctxt "PageAura"
|
||||
msgid "Keyboard"
|
||||
msgstr ""
|
||||
|
||||
#: rog-control-center/ui/pages/aura.slint:235
|
||||
msgctxt "PageAura"
|
||||
msgid "Lid Logo"
|
||||
msgstr ""
|
||||
|
||||
#: rog-control-center/ui/pages/aura.slint:259
|
||||
msgctxt "PageAura"
|
||||
msgid "Lightbar"
|
||||
msgstr ""
|
||||
|
||||
#: rog-control-center/ui/pages/aura.slint:283
|
||||
msgctxt "PageAura"
|
||||
msgid "Lid Zone"
|
||||
msgstr ""
|
||||
|
||||
#: rog-control-center/ui/pages/aura.slint:307
|
||||
msgctxt "PageAura"
|
||||
msgid "Rear Glow"
|
||||
msgstr ""
|
||||
|
||||
#: rog-control-center/ui/pages/aura.slint:375 rog-control-center/ui/pages/aura.slint:440
|
||||
msgctxt "PageAura"
|
||||
msgid "Boot"
|
||||
msgstr ""
|
||||
|
||||
#: rog-control-center/ui/pages/aura.slint:380 rog-control-center/ui/pages/aura.slint:445
|
||||
msgctxt "PageAura"
|
||||
msgid "Awake"
|
||||
msgstr ""
|
||||
|
||||
#: rog-control-center/ui/pages/aura.slint:385 rog-control-center/ui/pages/aura.slint:450
|
||||
msgctxt "PageAura"
|
||||
msgid "Sleep"
|
||||
msgstr ""
|
||||
|
||||
#: rog-control-center/ui/pages/aura.slint:390 rog-control-center/ui/pages/aura.slint:455
|
||||
msgctxt "PageAura"
|
||||
msgid "Shutdown"
|
||||
msgstr ""
|
||||
|
||||
#: rog-control-center/ui/pages/fans.slint:27
|
||||
msgctxt "FanTab"
|
||||
msgid "This fan is not avilable on this machine"
|
||||
@@ -487,162 +442,192 @@ msgctxt "PageSystem"
|
||||
msgid "Throttle Policy on AC"
|
||||
msgstr ""
|
||||
|
||||
#: rog-control-center/ui/types/aura_types.slint:69
|
||||
#: rog-control-center/ui/types/aura_types.slint:46
|
||||
msgctxt "Aura power zone"
|
||||
msgid "Logo"
|
||||
msgstr ""
|
||||
|
||||
#: rog-control-center/ui/types/aura_types.slint:47
|
||||
msgctxt "Aura power zone"
|
||||
msgid "Keyboard"
|
||||
msgstr ""
|
||||
|
||||
#: rog-control-center/ui/types/aura_types.slint:48
|
||||
msgctxt "Aura power zone"
|
||||
msgid "Lightbar"
|
||||
msgstr ""
|
||||
|
||||
#: rog-control-center/ui/types/aura_types.slint:49
|
||||
msgctxt "Aura power zone"
|
||||
msgid "Lid"
|
||||
msgstr ""
|
||||
|
||||
#: rog-control-center/ui/types/aura_types.slint:50
|
||||
msgctxt "Aura power zone"
|
||||
msgid "Rear Glow"
|
||||
msgstr ""
|
||||
|
||||
#: rog-control-center/ui/types/aura_types.slint:51
|
||||
msgctxt "Aura power zone"
|
||||
msgid "Keyboard and Lightbar"
|
||||
msgstr ""
|
||||
|
||||
#: rog-control-center/ui/types/aura_types.slint:54
|
||||
msgctxt "Aura brightness"
|
||||
msgid "Off"
|
||||
msgstr ""
|
||||
|
||||
#: rog-control-center/ui/types/aura_types.slint:70
|
||||
#: rog-control-center/ui/types/aura_types.slint:55
|
||||
msgctxt "Aura brightness"
|
||||
msgid "Low"
|
||||
msgstr ""
|
||||
|
||||
#: rog-control-center/ui/types/aura_types.slint:71
|
||||
#: rog-control-center/ui/types/aura_types.slint:56
|
||||
msgctxt "Aura brightness"
|
||||
msgid "Med"
|
||||
msgstr ""
|
||||
|
||||
#: rog-control-center/ui/types/aura_types.slint:72
|
||||
#: rog-control-center/ui/types/aura_types.slint:57
|
||||
msgctxt "Aura brightness"
|
||||
msgid "High"
|
||||
msgstr ""
|
||||
|
||||
#: rog-control-center/ui/types/aura_types.slint:77 rog-control-center/ui/types/aura_types.slint:92
|
||||
#: rog-control-center/ui/types/aura_types.slint:62 rog-control-center/ui/types/aura_types.slint:77
|
||||
msgctxt "Basic aura mode"
|
||||
msgid "Static"
|
||||
msgstr ""
|
||||
|
||||
#: rog-control-center/ui/types/aura_types.slint:78 rog-control-center/ui/types/aura_types.slint:93
|
||||
#: rog-control-center/ui/types/aura_types.slint:63 rog-control-center/ui/types/aura_types.slint:78
|
||||
msgctxt "Basic aura mode"
|
||||
msgid "Breathe"
|
||||
msgstr ""
|
||||
|
||||
#: rog-control-center/ui/types/aura_types.slint:79 rog-control-center/ui/types/aura_types.slint:94
|
||||
#: rog-control-center/ui/types/aura_types.slint:64 rog-control-center/ui/types/aura_types.slint:79
|
||||
msgctxt "Basic aura mode"
|
||||
msgid "Strobe"
|
||||
msgstr ""
|
||||
|
||||
#: rog-control-center/ui/types/aura_types.slint:80
|
||||
#: rog-control-center/ui/types/aura_types.slint:65
|
||||
msgctxt "Basic aura mode"
|
||||
msgid "Rainbow"
|
||||
msgstr ""
|
||||
|
||||
#: rog-control-center/ui/types/aura_types.slint:81
|
||||
#: rog-control-center/ui/types/aura_types.slint:66
|
||||
msgctxt "Basic aura mode"
|
||||
msgid "Star"
|
||||
msgstr ""
|
||||
|
||||
#: rog-control-center/ui/types/aura_types.slint:82
|
||||
#: rog-control-center/ui/types/aura_types.slint:67
|
||||
msgctxt "Basic aura mode"
|
||||
msgid "Rain"
|
||||
msgstr ""
|
||||
|
||||
#: rog-control-center/ui/types/aura_types.slint:83
|
||||
#: rog-control-center/ui/types/aura_types.slint:68
|
||||
msgctxt "Basic aura mode"
|
||||
msgid "Highlight"
|
||||
msgstr ""
|
||||
|
||||
#: rog-control-center/ui/types/aura_types.slint:84
|
||||
#: rog-control-center/ui/types/aura_types.slint:69
|
||||
msgctxt "Basic aura mode"
|
||||
msgid "Laser"
|
||||
msgstr ""
|
||||
|
||||
#: rog-control-center/ui/types/aura_types.slint:85
|
||||
#: rog-control-center/ui/types/aura_types.slint:70
|
||||
msgctxt "Basic aura mode"
|
||||
msgid "Ripple"
|
||||
msgstr ""
|
||||
|
||||
#: rog-control-center/ui/types/aura_types.slint:86
|
||||
#: rog-control-center/ui/types/aura_types.slint:71
|
||||
msgctxt "Basic aura mode"
|
||||
msgid "Nothing"
|
||||
msgstr ""
|
||||
|
||||
#: rog-control-center/ui/types/aura_types.slint:87
|
||||
#: rog-control-center/ui/types/aura_types.slint:72
|
||||
msgctxt "Basic aura mode"
|
||||
msgid "Pulse"
|
||||
msgstr ""
|
||||
|
||||
#: rog-control-center/ui/types/aura_types.slint:88
|
||||
#: rog-control-center/ui/types/aura_types.slint:73
|
||||
msgctxt "Basic aura mode"
|
||||
msgid "Comet"
|
||||
msgstr ""
|
||||
|
||||
#: rog-control-center/ui/types/aura_types.slint:89
|
||||
#: rog-control-center/ui/types/aura_types.slint:74
|
||||
msgctxt "Basic aura mode"
|
||||
msgid "Flash"
|
||||
msgstr ""
|
||||
|
||||
#: rog-control-center/ui/types/aura_types.slint:101
|
||||
#: rog-control-center/ui/types/aura_types.slint:86
|
||||
msgctxt "Aura zone"
|
||||
msgid "None"
|
||||
msgstr ""
|
||||
|
||||
#: rog-control-center/ui/types/aura_types.slint:102
|
||||
#: rog-control-center/ui/types/aura_types.slint:87
|
||||
msgctxt "Aura zone"
|
||||
msgid "Key1"
|
||||
msgstr ""
|
||||
|
||||
#: rog-control-center/ui/types/aura_types.slint:103
|
||||
#: rog-control-center/ui/types/aura_types.slint:88
|
||||
msgctxt "Aura zone"
|
||||
msgid "Key2"
|
||||
msgstr ""
|
||||
|
||||
#: rog-control-center/ui/types/aura_types.slint:104
|
||||
#: rog-control-center/ui/types/aura_types.slint:89
|
||||
msgctxt "Aura zone"
|
||||
msgid "Key3"
|
||||
msgstr ""
|
||||
|
||||
#: rog-control-center/ui/types/aura_types.slint:105
|
||||
#: rog-control-center/ui/types/aura_types.slint:90
|
||||
msgctxt "Aura zone"
|
||||
msgid "Key4"
|
||||
msgstr ""
|
||||
|
||||
#: rog-control-center/ui/types/aura_types.slint:106
|
||||
#: rog-control-center/ui/types/aura_types.slint:91
|
||||
msgctxt "Aura zone"
|
||||
msgid "Logo"
|
||||
msgstr ""
|
||||
|
||||
#: rog-control-center/ui/types/aura_types.slint:107
|
||||
#: rog-control-center/ui/types/aura_types.slint:92
|
||||
msgctxt "Aura zone"
|
||||
msgid "Lightbar Left"
|
||||
msgstr ""
|
||||
|
||||
#: rog-control-center/ui/types/aura_types.slint:108
|
||||
#: rog-control-center/ui/types/aura_types.slint:93
|
||||
msgctxt "Aura zone"
|
||||
msgid "Lightbar Right"
|
||||
msgstr ""
|
||||
|
||||
#: rog-control-center/ui/types/aura_types.slint:112
|
||||
#: rog-control-center/ui/types/aura_types.slint:97
|
||||
msgctxt "Aura direction"
|
||||
msgid "Right"
|
||||
msgstr ""
|
||||
|
||||
#: rog-control-center/ui/types/aura_types.slint:113
|
||||
#: rog-control-center/ui/types/aura_types.slint:98
|
||||
msgctxt "Aura direction"
|
||||
msgid "Left"
|
||||
msgstr ""
|
||||
|
||||
#: rog-control-center/ui/types/aura_types.slint:114
|
||||
#: rog-control-center/ui/types/aura_types.slint:99
|
||||
msgctxt "Aura direction"
|
||||
msgid "Up"
|
||||
msgstr ""
|
||||
|
||||
#: rog-control-center/ui/types/aura_types.slint:115
|
||||
#: rog-control-center/ui/types/aura_types.slint:100
|
||||
msgctxt "Aura direction"
|
||||
msgid "Down"
|
||||
msgstr ""
|
||||
|
||||
#: rog-control-center/ui/types/aura_types.slint:119
|
||||
#: rog-control-center/ui/types/aura_types.slint:104
|
||||
msgctxt "Aura speed"
|
||||
msgid "Low"
|
||||
msgstr ""
|
||||
|
||||
#: rog-control-center/ui/types/aura_types.slint:120
|
||||
#: rog-control-center/ui/types/aura_types.slint:105
|
||||
msgctxt "Aura speed"
|
||||
msgid "Medium"
|
||||
msgstr ""
|
||||
|
||||
#: rog-control-center/ui/types/aura_types.slint:121
|
||||
#: rog-control-center/ui/types/aura_types.slint:106
|
||||
msgctxt "Aura speed"
|
||||
msgid "High"
|
||||
msgstr ""
|
||||
|
||||
@@ -10,8 +10,8 @@ import { Node } from "widgets/graph.slint";
|
||||
export { Node }
|
||||
import { FanPageData, FanType, Profile } from "types/fan_types.slint";
|
||||
export { FanPageData, FanType, Profile }
|
||||
import { AuraPageData, AuraDevType, AuraDevTuf, AuraDevRog1, PowerZones, KbAuraPowerState, AuraPowerDev, AuraEffect } from "types/aura_types.slint";
|
||||
export { AuraPageData, AuraDevType, AuraDevTuf, AuraDevRog1, PowerZones, KbAuraPowerState, AuraPowerDev, AuraEffect }
|
||||
import { AuraPageData, AuraDevType, LaptopAuraPower, AuraPowerState, PowerZones, AuraEffect } from "types/aura_types.slint";
|
||||
export { AuraPageData, AuraDevType, LaptopAuraPower, AuraPowerState, PowerZones, AuraEffect }
|
||||
import { PageAppSettings, AppSettingsPageData } from "pages/app_settings.slint";
|
||||
|
||||
export { AppSize, AvailableSystemProperties, SystemPageData, AnimePageData, AppSettingsPageData }
|
||||
|
||||
@@ -2,7 +2,7 @@ import { SystemDropdown, RogItem, SystemToggle, SystemToggleVert } from "../widg
|
||||
import { Palette, Button, ComboBox, VerticalBox, GroupBox } from "std-widgets.slint";
|
||||
import { StyleMetrics, Slider, HorizontalBox, TextEdit, SpinBox, LineEdit, ScrollView } from "std-widgets.slint";
|
||||
import { ColourSlider } from "../widgets/colour_picker.slint";
|
||||
import { AuraPageData, AuraDevType, AuraDevTuf, AuraDevRog1, PowerZones, KbAuraPowerState, AuraPowerDev, AuraEffect } from "../types/aura_types.slint";
|
||||
import { AuraPageData, AuraDevType, PowerZones, LaptopAuraPower, AuraEffect } from "../types/aura_types.slint";
|
||||
import { AuraPowerGroup } from "../widgets/aura_power.slint";
|
||||
|
||||
export component PageAura inherits Rectangle {
|
||||
@@ -206,128 +206,31 @@ export component PageAura inherits Rectangle {
|
||||
padding: 30px;
|
||||
padding-top: 10px;
|
||||
spacing: 10px;
|
||||
for power in AuraPageData.supported_power_zones: gr := HorizontalLayout {
|
||||
if power == PowerZones.Keyboard: zone1 := AuraPowerGroup {
|
||||
group-title: @tr("Keyboard");
|
||||
boot_checked: AuraPageData.led_power.rog.keyboard.boot;
|
||||
boot_toggled => {
|
||||
AuraPageData.led_power.rog.keyboard.boot = zone1.boot_checked;
|
||||
AuraPageData.set_led_power(AuraPageData.led_power);
|
||||
}
|
||||
awake_checked: AuraPageData.led_power.rog.keyboard.awake;
|
||||
awake_toggled => {
|
||||
AuraPageData.led_power.rog.keyboard.awake = zone1.awake_checked;
|
||||
AuraPageData.set_led_power(AuraPageData.led_power);
|
||||
}
|
||||
sleep_checked: AuraPageData.led_power.rog.keyboard.sleep;
|
||||
sleep_toggled => {
|
||||
AuraPageData.led_power.rog.keyboard.sleep = zone1.sleep_checked;
|
||||
AuraPageData.set_led_power(AuraPageData.led_power);
|
||||
}
|
||||
shutdown_checked: AuraPageData.led_power.rog.keyboard.shutdown;
|
||||
shutdown_toggled => {
|
||||
AuraPageData.led_power.rog.keyboard.shutdown = zone1.shutdown_checked;
|
||||
AuraPageData.set_led_power(AuraPageData.led_power);
|
||||
}
|
||||
}
|
||||
|
||||
if power == PowerZones.Logo: zone2 := AuraPowerGroup {
|
||||
group-title: @tr("Lid Logo");
|
||||
boot_checked: AuraPageData.led_power.rog.logo.boot;
|
||||
for state[idx] in AuraPageData.led_power.states: zone := AuraPowerGroup {
|
||||
group-title: AuraPageData.power_zone_names[state.zone_name_idx];
|
||||
// TODO: use the zone name
|
||||
boot_checked: state.boot;
|
||||
boot_toggled => {
|
||||
AuraPageData.led_power.rog.logo.boot = zone2.boot_checked;
|
||||
AuraPageData.led_power.states[idx].boot = zone.boot_checked;
|
||||
AuraPageData.set_led_power(AuraPageData.led_power);
|
||||
}
|
||||
awake_checked: AuraPageData.led_power.rog.logo.awake;
|
||||
awake_checked: state.awake;
|
||||
awake_toggled => {
|
||||
AuraPageData.led_power.rog.logo.awake = zone2.awake_checked;
|
||||
AuraPageData.led_power.states[idx].awake = zone.awake_checked;
|
||||
AuraPageData.set_led_power(AuraPageData.led_power);
|
||||
}
|
||||
sleep_checked: AuraPageData.led_power.rog.logo.sleep;
|
||||
sleep_checked: state.sleep;
|
||||
sleep_toggled => {
|
||||
AuraPageData.led_power.rog.logo.sleep = zone2.sleep_checked;
|
||||
AuraPageData.led_power.states[idx].sleep = zone.sleep_checked;
|
||||
AuraPageData.set_led_power(AuraPageData.led_power);
|
||||
}
|
||||
shutdown_checked: AuraPageData.led_power.rog.logo.shutdown;
|
||||
shutdown_checked: state.shutdown;
|
||||
shutdown_toggled => {
|
||||
AuraPageData.led_power.rog.logo.shutdown = zone2.shutdown_checked;
|
||||
AuraPageData.led_power.states[idx].shutdown = zone.shutdown_checked;
|
||||
AuraPageData.set_led_power(AuraPageData.led_power);
|
||||
}
|
||||
}
|
||||
|
||||
if power == PowerZones.Lightbar: zone3 := AuraPowerGroup {
|
||||
group-title: @tr("Lightbar");
|
||||
boot_checked: AuraPageData.led_power.rog.lightbar.boot;
|
||||
boot_toggled => {
|
||||
AuraPageData.led_power.rog.lightbar.boot = zone3.boot_checked;
|
||||
AuraPageData.set_led_power(AuraPageData.led_power);
|
||||
}
|
||||
awake_checked: AuraPageData.led_power.rog.lightbar.awake;
|
||||
awake_toggled => {
|
||||
AuraPageData.led_power.rog.lightbar.awake = zone3.awake_checked;
|
||||
AuraPageData.set_led_power(AuraPageData.led_power);
|
||||
}
|
||||
sleep_checked: AuraPageData.led_power.rog.lightbar.sleep;
|
||||
sleep_toggled => {
|
||||
AuraPageData.led_power.rog.lightbar.sleep = zone3.sleep_checked;
|
||||
AuraPageData.set_led_power(AuraPageData.led_power);
|
||||
}
|
||||
shutdown_checked: AuraPageData.led_power.rog.lightbar.shutdown;
|
||||
shutdown_toggled => {
|
||||
AuraPageData.led_power.rog.lightbar.shutdown = zone3.shutdown_checked;
|
||||
AuraPageData.set_led_power(AuraPageData.led_power);
|
||||
}
|
||||
}
|
||||
|
||||
if power == PowerZones.Lid: zone4 := AuraPowerGroup {
|
||||
group-title: @tr("Lid Zone");
|
||||
boot_checked: AuraPageData.led_power.rog.lid.boot;
|
||||
boot_toggled => {
|
||||
AuraPageData.led_power.rog.lid.boot = zone4.boot_checked;
|
||||
AuraPageData.set_led_power(AuraPageData.led_power);
|
||||
}
|
||||
awake_checked: AuraPageData.led_power.rog.lid.awake;
|
||||
awake_toggled => {
|
||||
AuraPageData.led_power.rog.lid.awake = zone4.awake_checked;
|
||||
AuraPageData.set_led_power(AuraPageData.led_power);
|
||||
}
|
||||
sleep_checked: AuraPageData.led_power.rog.lid.sleep;
|
||||
sleep_toggled => {
|
||||
AuraPageData.led_power.rog.lid.sleep = zone4.sleep_checked;
|
||||
AuraPageData.set_led_power(AuraPageData.led_power);
|
||||
}
|
||||
shutdown_checked: AuraPageData.led_power.rog.lid.shutdown;
|
||||
shutdown_toggled => {
|
||||
AuraPageData.led_power.rog.lid.shutdown = zone4.shutdown_checked;
|
||||
AuraPageData.set_led_power(AuraPageData.led_power);
|
||||
}
|
||||
}
|
||||
|
||||
if power == PowerZones.RearGlow: zone5 := AuraPowerGroup {
|
||||
group-title: @tr("Rear Glow");
|
||||
boot_checked: AuraPageData.led_power.rog.rear-glow.boot;
|
||||
boot_toggled => {
|
||||
AuraPageData.led_power.rog.rear-glow.boot = zone5.boot_checked;
|
||||
AuraPageData.set_led_power(AuraPageData.led_power);
|
||||
}
|
||||
awake_checked: AuraPageData.led_power.rog.rear-glow.awake;
|
||||
awake_toggled => {
|
||||
AuraPageData.led_power.rog.rear-glow.awake = zone5.awake_checked;
|
||||
AuraPageData.set_led_power(AuraPageData.led_power);
|
||||
}
|
||||
sleep_checked: AuraPageData.led_power.rog.rear-glow.sleep;
|
||||
sleep_toggled => {
|
||||
AuraPageData.led_power.rog.rear-glow.sleep = zone5.sleep_checked;
|
||||
AuraPageData.set_led_power(AuraPageData.led_power);
|
||||
}
|
||||
shutdown_checked: AuraPageData.led_power.rog.rear-glow.shutdown;
|
||||
shutdown_toggled => {
|
||||
AuraPageData.led_power.rog.rear-glow.shutdown = zone5.shutdown_checked;
|
||||
AuraPageData.set_led_power(AuraPageData.led_power);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Button {
|
||||
@@ -341,134 +244,5 @@ export component PageAura inherits Rectangle {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if root.show_aura_power && AuraPageData.aura_type == AuraDevType.Old: Rectangle {
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
opacity: 1;
|
||||
ScrollView {
|
||||
VerticalLayout {
|
||||
padding: 30px;
|
||||
padding-top: 10px;
|
||||
spacing: 10px;
|
||||
|
||||
Text {
|
||||
text: "WIP: this is not complete and won't change keyboard state";
|
||||
}
|
||||
|
||||
Rectangle {
|
||||
border-radius: 20px;
|
||||
background: Palette.control-background;
|
||||
VerticalBox {
|
||||
spacing: 10px;
|
||||
alignment: LayoutAlignment.start;
|
||||
Text {
|
||||
font-size: 18px;
|
||||
color: Palette.control-foreground;
|
||||
horizontal-alignment: TextHorizontalAlignment.center;
|
||||
text: @tr("Keyboard");
|
||||
}
|
||||
|
||||
HorizontalBox {
|
||||
SystemToggleVert {
|
||||
max-height: 42px;
|
||||
text: @tr("Boot");
|
||||
}
|
||||
|
||||
SystemToggleVert {
|
||||
max-height: 42px;
|
||||
text: @tr("Awake");
|
||||
}
|
||||
|
||||
SystemToggleVert {
|
||||
max-height: 42px;
|
||||
text: @tr("Sleep");
|
||||
}
|
||||
|
||||
SystemToggleVert {
|
||||
max-height: 42px;
|
||||
text: @tr("Shutdown");
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Button {
|
||||
x: root.width - self.width - 6px;
|
||||
y: 6px;
|
||||
text: "X";
|
||||
height: 40px;
|
||||
clicked => {
|
||||
root.show_aura_power = false;
|
||||
root.show_fade_cover = false;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if root.show_aura_power && AuraPageData.aura_type == AuraDevType.Tuf: Rectangle {
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
opacity: 1;
|
||||
ScrollView {
|
||||
VerticalLayout {
|
||||
padding: 30px;
|
||||
padding-top: 10px;
|
||||
spacing: 10px;
|
||||
|
||||
Text {
|
||||
text: "WIP: this is not complete and won't change keyboard state";
|
||||
}
|
||||
|
||||
Rectangle {
|
||||
border-radius: 20px;
|
||||
background: Palette.control-background;
|
||||
VerticalBox {
|
||||
spacing: 10px;
|
||||
alignment: LayoutAlignment.start;
|
||||
Text {
|
||||
font-size: 18px;
|
||||
color: Palette.control-foreground;
|
||||
horizontal-alignment: TextHorizontalAlignment.center;
|
||||
text: @tr("Keyboard");
|
||||
}
|
||||
|
||||
HorizontalBox {
|
||||
SystemToggleVert {
|
||||
max-height: 42px;
|
||||
text: @tr("Boot");
|
||||
}
|
||||
|
||||
SystemToggleVert {
|
||||
max-height: 42px;
|
||||
text: @tr("Awake");
|
||||
}
|
||||
|
||||
SystemToggleVert {
|
||||
max-height: 42px;
|
||||
text: @tr("Sleep");
|
||||
}
|
||||
|
||||
SystemToggleVert {
|
||||
max-height: 42px;
|
||||
text: @tr("Shutdown");
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Button {
|
||||
x: root.width - self.width - 6px;
|
||||
y: 6px;
|
||||
text: "X";
|
||||
height: 40px;
|
||||
clicked => {
|
||||
root.show_aura_power = false;
|
||||
root.show_fade_cover = false;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
export enum AuraDevType {
|
||||
Tuf,
|
||||
Old,
|
||||
New,
|
||||
Old,
|
||||
Tuf,
|
||||
}
|
||||
|
||||
export struct AuraEffect {
|
||||
@@ -19,52 +19,37 @@ export struct AuraEffect {
|
||||
direction: int,
|
||||
}
|
||||
|
||||
export enum AuraDevTuf {
|
||||
Boot,
|
||||
Awake,
|
||||
Sleep,
|
||||
Keyboard,
|
||||
}
|
||||
|
||||
export enum AuraDevRog1 {
|
||||
Awake,
|
||||
Keyboard,
|
||||
Lightbar,
|
||||
Boot,
|
||||
Sleep,
|
||||
}
|
||||
|
||||
export enum PowerZones {
|
||||
Logo,
|
||||
Keyboard,
|
||||
Lightbar,
|
||||
Lid,
|
||||
RearGlow,
|
||||
KeyboardAndLightbar
|
||||
}
|
||||
|
||||
export struct KbAuraPowerState {
|
||||
export struct AuraPowerState {
|
||||
zone: PowerZones,
|
||||
zone_name_idx: int,
|
||||
boot: bool,
|
||||
awake: bool,
|
||||
sleep: bool,
|
||||
shutdown: bool,
|
||||
}
|
||||
|
||||
export struct AuraPower {
|
||||
keyboard: KbAuraPowerState,
|
||||
logo: KbAuraPowerState,
|
||||
lightbar: KbAuraPowerState,
|
||||
lid: KbAuraPowerState,
|
||||
rear_glow: KbAuraPowerState,
|
||||
}
|
||||
|
||||
export struct AuraPowerDev {
|
||||
tuf: [AuraDevTuf],
|
||||
old_rog: [AuraDevRog1],
|
||||
rog: AuraPower,
|
||||
export struct LaptopAuraPower {
|
||||
states: [AuraPowerState],
|
||||
}
|
||||
|
||||
export global AuraPageData {
|
||||
in-out property <[string]> power_zone_names: [
|
||||
@tr("Aura power zone" => "Logo"),
|
||||
@tr("Aura power zone" => "Keyboard"),
|
||||
@tr("Aura power zone" => "Lightbar"),
|
||||
@tr("Aura power zone" => "Lid"),
|
||||
@tr("Aura power zone" => "Rear Glow"),
|
||||
@tr("Aura power zone" => "Keyboard and Lightbar"),
|
||||
];
|
||||
in-out property <[string]> brightness_names: [
|
||||
@tr("Aura brightness" => "Off"),
|
||||
@tr("Aura brightness" => "Low"),
|
||||
@@ -158,6 +143,14 @@ export global AuraPageData {
|
||||
PowerZones.Lightbar,
|
||||
PowerZones.Logo
|
||||
];
|
||||
in-out property <AuraPowerDev> led_power;
|
||||
callback set_led_power(AuraPowerDev);
|
||||
in-out property <LaptopAuraPower> led_power: {
|
||||
states: [{
|
||||
zone: PowerZones.Keyboard,
|
||||
boot: true,
|
||||
awake: true,
|
||||
sleep: true,
|
||||
shutdown: true,
|
||||
}]
|
||||
};
|
||||
callback set_led_power(LaptopAuraPower);
|
||||
}
|
||||
|
||||
@@ -77,12 +77,12 @@ export component ColourSlider inherits VerticalLayout {
|
||||
callback external_colour_change();
|
||||
|
||||
external_colour_change => {
|
||||
if (root.final_colour.hue() < 0) {
|
||||
c1.value = (root.base_colours.length - 1) * ((root.final_colour.hue() + 360) / 360);
|
||||
if (root.final_colour.hue < 0) {
|
||||
c1.value = (root.base_colours.length - 1) * ((root.final_colour.hue + 360) / 360);
|
||||
} else {
|
||||
c1.value = (root.base_colours.length - 1) * (root.final_colour.hue() / 360);
|
||||
c1.value = (root.base_colours.length - 1) * (root.final_colour.hue / 360);
|
||||
}
|
||||
c2.value = root.base_shade.length - (root.base_shade.length * root.final_colour.brightness());
|
||||
c2.value = root.base_shade.length - (root.base_shade.length * root.final_colour.value);
|
||||
root.set_base_colour();
|
||||
}
|
||||
Rectangle {
|
||||
|
||||
@@ -6,125 +6,4 @@ pub mod zbus_fan_curves;
|
||||
pub mod zbus_platform;
|
||||
pub mod zbus_slash;
|
||||
|
||||
// use rog_anime::AnimePowerStates;
|
||||
// use rog_aura::{AuraEffect, LedPowerStates};
|
||||
// use rog_profiles::Profile;
|
||||
// use std::sync::mpsc::{channel, Receiver};
|
||||
use zbus::{blocking, Connection, Result};
|
||||
|
||||
pub const VERSION: &str = env!("CARGO_PKG_VERSION");
|
||||
|
||||
pub struct DbusProxiesBlocking<'a> {
|
||||
anime: zbus_anime::AnimeProxyBlocking<'a>,
|
||||
slash: zbus_slash::SlashProxyBlocking<'a>,
|
||||
led: zbus_aura::AuraProxyBlocking<'a>,
|
||||
profile: zbus_fan_curves::FanCurvesProxyBlocking<'a>,
|
||||
rog_bios: zbus_platform::PlatformProxyBlocking<'a>,
|
||||
}
|
||||
|
||||
impl<'a> DbusProxiesBlocking<'a> {
|
||||
#[inline]
|
||||
pub fn new() -> Result<(Self, blocking::Connection)> {
|
||||
let conn = blocking::Connection::system()?;
|
||||
|
||||
Ok((
|
||||
DbusProxiesBlocking {
|
||||
anime: zbus_anime::AnimeProxyBlocking::new(&conn)?,
|
||||
slash: zbus_slash::SlashProxyBlocking::new(&conn)?,
|
||||
led: zbus_aura::AuraProxyBlocking::new(&conn)?,
|
||||
profile: zbus_fan_curves::FanCurvesProxyBlocking::new(&conn)?,
|
||||
rog_bios: zbus_platform::PlatformProxyBlocking::new(&conn)?,
|
||||
},
|
||||
conn,
|
||||
))
|
||||
}
|
||||
|
||||
pub fn anime(&self) -> &zbus_anime::AnimeProxyBlocking<'a> {
|
||||
&self.anime
|
||||
}
|
||||
pub fn slash(&self) -> &zbus_slash::SlashProxyBlocking<'a> { &self.slash }
|
||||
pub fn aura(&self) -> &zbus_aura::AuraProxyBlocking<'a> {
|
||||
&self.led
|
||||
}
|
||||
pub fn fan_curves(&self) -> &zbus_fan_curves::FanCurvesProxyBlocking<'a> {
|
||||
&self.profile
|
||||
}
|
||||
pub fn platform(&self) -> &zbus_platform::PlatformProxyBlocking<'a> {
|
||||
&self.rog_bios
|
||||
}
|
||||
}
|
||||
|
||||
/// This is the main way to communicate with the DBUS interface
|
||||
pub struct RogDbusClientBlocking<'a> {
|
||||
proxies: DbusProxiesBlocking<'a>,
|
||||
}
|
||||
|
||||
impl<'a> RogDbusClientBlocking<'a> {
|
||||
#[inline]
|
||||
pub fn new() -> Result<(Self, blocking::Connection)> {
|
||||
let (proxies, conn) = DbusProxiesBlocking::new()?;
|
||||
Ok((RogDbusClientBlocking { proxies }, conn))
|
||||
}
|
||||
|
||||
pub fn proxies(&self) -> &DbusProxiesBlocking<'_> {
|
||||
&self.proxies
|
||||
}
|
||||
}
|
||||
|
||||
pub struct DbusProxies<'a> {
|
||||
anime: zbus_anime::AnimeProxy<'a>,
|
||||
slash: zbus_slash::SlashProxy<'a>,
|
||||
led: zbus_aura::AuraProxy<'a>,
|
||||
profile: zbus_fan_curves::FanCurvesProxy<'a>,
|
||||
rog_bios: zbus_platform::PlatformProxy<'a>,
|
||||
}
|
||||
|
||||
impl<'a> DbusProxies<'a> {
|
||||
#[inline]
|
||||
pub async fn new() -> Result<(DbusProxies<'a>, Connection)> {
|
||||
let conn = Connection::system().await?;
|
||||
|
||||
Ok((
|
||||
DbusProxies {
|
||||
anime: zbus_anime::AnimeProxy::new(&conn).await?,
|
||||
slash: zbus_slash::SlashProxy::new(&conn).await?,
|
||||
led: zbus_aura::AuraProxy::new(&conn).await?,
|
||||
profile: zbus_fan_curves::FanCurvesProxy::new(&conn).await?,
|
||||
rog_bios: zbus_platform::PlatformProxy::new(&conn).await?,
|
||||
},
|
||||
conn,
|
||||
))
|
||||
}
|
||||
|
||||
pub fn anime(&self) -> &zbus_anime::AnimeProxy<'a> { &self.anime }
|
||||
pub fn slash(&self) -> &zbus_slash::SlashProxy<'a> { &self.slash }
|
||||
|
||||
pub fn led(&self) -> &zbus_aura::AuraProxy<'a> {
|
||||
&self.led
|
||||
}
|
||||
|
||||
pub fn profile(&self) -> &zbus_fan_curves::FanCurvesProxy<'a> {
|
||||
&self.profile
|
||||
}
|
||||
|
||||
pub fn rog_bios(&self) -> &zbus_platform::PlatformProxy<'a> {
|
||||
&self.rog_bios
|
||||
}
|
||||
}
|
||||
|
||||
/// This is the main way to communicate with the DBUS interface
|
||||
pub struct RogDbusClient<'a> {
|
||||
proxies: DbusProxies<'a>,
|
||||
}
|
||||
|
||||
impl<'a> RogDbusClient<'a> {
|
||||
#[inline]
|
||||
pub async fn new() -> Result<(RogDbusClient<'a>, Connection)> {
|
||||
let (proxies, conn) = DbusProxies::new().await?;
|
||||
Ok((RogDbusClient { proxies }, conn))
|
||||
}
|
||||
|
||||
pub fn proxies(&self) -> &DbusProxies<'_> {
|
||||
&self.proxies
|
||||
}
|
||||
}
|
||||
|
||||
@@ -22,10 +22,9 @@
|
||||
|
||||
use std::collections::BTreeMap;
|
||||
|
||||
use rog_aura::advanced::UsbPackets;
|
||||
use rog_aura::aura_detection::PowerZones;
|
||||
use rog_aura::usb::{AuraDevice, AuraPowerDev};
|
||||
use rog_aura::{AuraEffect, AuraModeNum, AuraZone, LedBrightness};
|
||||
use rog_aura::keyboard::{LaptopAuraPower, UsbPackets};
|
||||
use rog_aura::{AuraDeviceType, AuraEffect, AuraModeNum, AuraZone, LedBrightness};
|
||||
use zbus::blocking::Connection;
|
||||
use zbus::{proxy, Result};
|
||||
|
||||
@@ -51,7 +50,7 @@ trait Aura {
|
||||
|
||||
/// DeviceType property
|
||||
#[zbus(property)]
|
||||
fn device_type(&self) -> zbus::Result<AuraDevice>;
|
||||
fn device_type(&self) -> zbus::Result<AuraDeviceType>;
|
||||
|
||||
/// LedMode property
|
||||
#[zbus(property)]
|
||||
@@ -67,9 +66,9 @@ trait Aura {
|
||||
|
||||
/// LedPower property
|
||||
#[zbus(property)]
|
||||
fn led_power(&self) -> zbus::Result<AuraPowerDev>;
|
||||
fn led_power(&self) -> zbus::Result<LaptopAuraPower>;
|
||||
#[zbus(property)]
|
||||
fn set_led_power(&self, value: AuraPowerDev) -> zbus::Result<()>;
|
||||
fn set_led_power(&self, value: LaptopAuraPower) -> zbus::Result<()>;
|
||||
|
||||
/// SupportedBrightness property
|
||||
#[zbus(property)]
|
||||
|
||||
@@ -30,6 +30,9 @@ use zbus::proxy;
|
||||
default_path = "/org/asuslinux"
|
||||
)]
|
||||
trait Platform {
|
||||
#[zbus(property)]
|
||||
fn version(&self) -> zbus::Result<String>;
|
||||
|
||||
/// NextThrottleThermalPolicy method
|
||||
fn next_throttle_thermal_policy(&self) -> zbus::Result<()>;
|
||||
|
||||
|
||||
@@ -1,23 +1,16 @@
|
||||
use std::error::Error;
|
||||
|
||||
use rog_aura::usb::AuraDevice;
|
||||
use rog_platform::hid_raw::HidRaw;
|
||||
|
||||
pub fn main() -> Result<(), Box<dyn Error>> {
|
||||
let mut usb_node = None;
|
||||
let prod = AuraDevice::X1abe;
|
||||
match HidRaw::new(prod.into()) {
|
||||
match HidRaw::new("1abe") {
|
||||
Ok(node) => {
|
||||
let id = node.prod_id().to_owned();
|
||||
usb_node = Some(node);
|
||||
println!(
|
||||
"Looked for keyboard controller 0x{}: Found",
|
||||
<&str>::from(prod)
|
||||
);
|
||||
println!("Looked for keyboard controller 0x{}: Found", id);
|
||||
}
|
||||
Err(err) => println!(
|
||||
"Looked for keyboard controller 0x{}: {err}",
|
||||
<&str>::from(prod)
|
||||
),
|
||||
Err(err) => println!("Looked for keyboard controller: {err}"),
|
||||
}
|
||||
|
||||
if usb_node.is_none() {
|
||||
|
||||
@@ -2,24 +2,17 @@ use std::error::Error;
|
||||
use std::thread::sleep;
|
||||
use std::time::Duration;
|
||||
|
||||
use rog_aura::usb::AuraDevice;
|
||||
use rog_platform::hid_raw::HidRaw;
|
||||
|
||||
pub fn main() -> Result<(), Box<dyn Error>> {
|
||||
let mut usb_node = None;
|
||||
let prod = AuraDevice::X1abe;
|
||||
match HidRaw::new(prod.into()) {
|
||||
match HidRaw::new("1abe") {
|
||||
Ok(node) => {
|
||||
let id = node.prod_id().to_owned();
|
||||
usb_node = Some(node);
|
||||
println!(
|
||||
"Looked for keyboard controller 0x{}: Found",
|
||||
<&str>::from(prod)
|
||||
);
|
||||
println!("Looked for keyboard controller 0x{}: Found", id);
|
||||
}
|
||||
Err(err) => println!(
|
||||
"Looked for keyboard controller 0x{}: {err}",
|
||||
<&str>::from(prod)
|
||||
),
|
||||
Err(err) => println!("Looked for keyboard controller: {err}"),
|
||||
}
|
||||
|
||||
if usb_node.is_none() {
|
||||
|
||||
@@ -1,23 +1,16 @@
|
||||
use std::error::Error;
|
||||
|
||||
use rog_aura::usb::AuraDevice;
|
||||
use rog_platform::hid_raw::HidRaw;
|
||||
|
||||
pub fn main() -> Result<(), Box<dyn Error>> {
|
||||
let mut usb_node = None;
|
||||
let prod = AuraDevice::X1abe;
|
||||
match HidRaw::new(prod.into()) {
|
||||
match HidRaw::new("1abe") {
|
||||
Ok(node) => {
|
||||
let id = node.prod_id().to_owned();
|
||||
usb_node = Some(node);
|
||||
println!(
|
||||
"Looked for keyboard controller 0x{}: Found",
|
||||
<&str>::from(prod)
|
||||
);
|
||||
println!("Looked for keyboard controller 0x{}: Found", id);
|
||||
}
|
||||
Err(err) => println!(
|
||||
"Looked for keyboard controller 0x{}: {err}",
|
||||
<&str>::from(prod)
|
||||
),
|
||||
Err(err) => println!("Looked for keyboard controller: {err}"),
|
||||
}
|
||||
|
||||
if usb_node.is_none() {
|
||||
|
||||
@@ -154,27 +154,25 @@ impl Default for RogPlatform {
|
||||
Serialize, Deserialize, Default, Type, Value, OwnedValue, Debug, PartialEq, Eq, Clone, Copy,
|
||||
)]
|
||||
pub enum GpuMode {
|
||||
Discrete = 0,
|
||||
Optimus = 1,
|
||||
Integrated = 2,
|
||||
Egpu = 3,
|
||||
Vfio = 4,
|
||||
Ultimate = 5,
|
||||
Optimus = 0,
|
||||
Integrated = 1,
|
||||
Egpu = 2,
|
||||
Vfio = 3,
|
||||
Ultimate = 4,
|
||||
#[default]
|
||||
Error = 6,
|
||||
NotSupported = 7,
|
||||
Error = 254,
|
||||
NotSupported = 255,
|
||||
}
|
||||
|
||||
impl From<u8> for GpuMode {
|
||||
fn from(v: u8) -> Self {
|
||||
match v {
|
||||
0 => GpuMode::Discrete,
|
||||
1 => GpuMode::Optimus,
|
||||
2 => GpuMode::Integrated,
|
||||
3 => GpuMode::Egpu,
|
||||
4 => GpuMode::Vfio,
|
||||
5 => GpuMode::Ultimate,
|
||||
6 => GpuMode::Error,
|
||||
0 => GpuMode::Optimus,
|
||||
1 => GpuMode::Integrated,
|
||||
2 => GpuMode::Egpu,
|
||||
3 => GpuMode::Vfio,
|
||||
4 => GpuMode::Ultimate,
|
||||
5 => GpuMode::Error,
|
||||
_ => GpuMode::NotSupported,
|
||||
}
|
||||
}
|
||||
@@ -189,7 +187,7 @@ impl From<GpuMode> for u8 {
|
||||
impl GpuMode {
|
||||
/// For writing to `gpu_mux_mode` attribute
|
||||
pub fn to_mux_attr(&self) -> u8 {
|
||||
if *self == Self::Discrete {
|
||||
if *self == Self::Ultimate {
|
||||
return 0;
|
||||
}
|
||||
1
|
||||
@@ -211,7 +209,7 @@ impl GpuMode {
|
||||
|
||||
pub fn from_mux(num: u8) -> Self {
|
||||
if num == 0 {
|
||||
return Self::Discrete;
|
||||
return Self::Ultimate;
|
||||
}
|
||||
Self::Optimus
|
||||
}
|
||||
@@ -236,7 +234,6 @@ impl GpuMode {
|
||||
impl Display for GpuMode {
|
||||
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
|
||||
match self {
|
||||
GpuMode::Discrete => write!(f, "Discrete"),
|
||||
GpuMode::Optimus => write!(f, "Optimus"),
|
||||
GpuMode::Integrated => write!(f, "Integrated"),
|
||||
GpuMode::Egpu => write!(f, "eGPU"),
|
||||
|
||||
@@ -14,6 +14,8 @@ use zbus::zvariant::{OwnedValue, Value};
|
||||
|
||||
pub const VERSION: &str = env!("CARGO_PKG_VERSION");
|
||||
|
||||
/// Use udev system to find the fan curve path/node which is labelled with
|
||||
/// "asus_custom_fan_curve" in the kernel
|
||||
pub fn find_fan_curve_node() -> Result<Device, ProfileError> {
|
||||
let mut enumerator = udev::Enumerator::new()?;
|
||||
enumerator.match_subsystem("hwmon")?;
|
||||
@@ -170,9 +172,7 @@ impl FanCurveProfiles {
|
||||
}
|
||||
|
||||
/// Write the curves for the selected profile to the device. If the curve is
|
||||
/// in the enabled list it will become active. If the curve is zeroed it
|
||||
/// will be initialised to a default read from the system.
|
||||
// TODO: Make this return an error if curve is zeroed
|
||||
/// in the enabled list it will become active.
|
||||
pub fn write_profile_curve_to_platform(
|
||||
&mut self,
|
||||
profile: ThrottlePolicy,
|
||||
|
||||
Reference in New Issue
Block a user