Merge from main

This commit is contained in:
jochen@g14
2024-03-30 18:44:15 +01:00
15 changed files with 536 additions and 467 deletions

221
Cargo.lock generated
View File

@@ -245,7 +245,7 @@ dependencies = [
"async-lock 3.3.0", "async-lock 3.3.0",
"async-task", "async-task",
"concurrent-queue", "concurrent-queue",
"fastrand 2.0.1", "fastrand 2.0.2",
"futures-lite 2.3.0", "futures-lite 2.3.0",
"slab", "slab",
] ]
@@ -305,7 +305,7 @@ dependencies = [
"futures-io", "futures-io",
"futures-lite 2.3.0", "futures-lite 2.3.0",
"parking", "parking",
"polling 3.5.0", "polling 3.6.0",
"rustix 0.38.32", "rustix 0.38.32",
"slab", "slab",
"tracing", "tracing",
@@ -386,7 +386,7 @@ checksum = "30c5ef0ede93efbf733c1a727f3b6b5a1060bbedd5600183e66f6e4be4af0ec5"
dependencies = [ dependencies = [
"proc-macro2", "proc-macro2",
"quote", "quote",
"syn 2.0.53", "syn 2.0.55",
] ]
[[package]] [[package]]
@@ -415,13 +415,13 @@ checksum = "fbb36e985947064623dbd357f727af08ffd077f93d696782f3c56365fa2e2799"
[[package]] [[package]]
name = "async-trait" name = "async-trait"
version = "0.1.78" version = "0.1.79"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "461abc97219de0eaaf81fe3ef974a540158f3d079c2ab200f891f1a2ef201e85" checksum = "a507401cad91ec6a857ed5513a2073c82a9b9048762b885bb98655b306964681"
dependencies = [ dependencies = [
"proc-macro2", "proc-macro2",
"quote", "quote",
"syn 2.0.53", "syn 2.0.55",
] ]
[[package]] [[package]]
@@ -439,14 +439,14 @@ dependencies = [
"derive_utils", "derive_utils",
"proc-macro2", "proc-macro2",
"quote", "quote",
"syn 2.0.53", "syn 2.0.55",
] ]
[[package]] [[package]]
name = "autocfg" name = "autocfg"
version = "1.1.0" version = "1.2.0"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "d468802bab17cbc0cc575e9b053f41e72aa36bfa6b7f55e3529ffa43161b97fa" checksum = "f1fdabc7756949593fe60f30ec81974b613357de856987752631dea1e3394c80"
[[package]] [[package]]
name = "az" name = "az"
@@ -456,9 +456,9 @@ checksum = "7b7e4c2464d97fe331d41de9d5db0def0a96f4d823b8b32a2efd503578988973"
[[package]] [[package]]
name = "backtrace" name = "backtrace"
version = "0.3.69" version = "0.3.71"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "2089b7e3f35b9dd2d0ed921ead4f6d318c27680d4a5bd167b3ee120edb105837" checksum = "26b05800d2e817c8b3b4b54abd461726265fa9789ae34330622f2db9ee696f9d"
dependencies = [ dependencies = [
"addr2line", "addr2line",
"cc", "cc",
@@ -513,7 +513,7 @@ dependencies = [
"regex", "regex",
"rustc-hash", "rustc-hash",
"shlex", "shlex",
"syn 2.0.53", "syn 2.0.55",
"which", "which",
] ]
@@ -581,7 +581,7 @@ dependencies = [
"async-channel 2.2.0", "async-channel 2.2.0",
"async-lock 3.3.0", "async-lock 3.3.0",
"async-task", "async-task",
"fastrand 2.0.1", "fastrand 2.0.2",
"futures-io", "futures-io",
"futures-lite 2.3.0", "futures-lite 2.3.0",
"piper", "piper",
@@ -596,9 +596,9 @@ checksum = "7ff69b9dd49fd426c69a0db9fc04dd934cdb6645ff000864d98f7e2af8830eaa"
[[package]] [[package]]
name = "by_address" name = "by_address"
version = "1.1.0" version = "1.2.0"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "bf8dba2868114ed769a1f2590fc9ae5eb331175b44313b6c9b922f8f7ca813d0" checksum = "e7e9330396d4065c0788ac665e5ba4857c4744f5ff4239b6f06493aca55e0e08"
[[package]] [[package]]
name = "bytemuck" name = "bytemuck"
@@ -617,7 +617,7 @@ checksum = "4da9a32f3fed317401fa3c862968128267c3106685286e15d5aaa3d7389c2f60"
dependencies = [ dependencies = [
"proc-macro2", "proc-macro2",
"quote", "quote",
"syn 2.0.53", "syn 2.0.55",
] ]
[[package]] [[package]]
@@ -628,9 +628,9 @@ checksum = "1fd0f2584146f6f2ef48085050886acf353beff7305ebd1ae69500e27c67f64b"
[[package]] [[package]]
name = "bytes" name = "bytes"
version = "1.5.0" version = "1.6.0"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "a2bd12c1caf447e69cd4528f47f94d203fd2582878ecb9e9465484c4148a8223" checksum = "514de17de45fdb8dc022b1a7975556c53c86f9f0aa5f534b98977b171857c2c9"
[[package]] [[package]]
name = "calloop" name = "calloop"
@@ -640,7 +640,7 @@ checksum = "fba7adb4dd5aa98e5553510223000e7148f621165ec5f9acd7113f6ca4995298"
dependencies = [ dependencies = [
"bitflags 2.5.0", "bitflags 2.5.0",
"log", "log",
"polling 3.5.0", "polling 3.6.0",
"rustix 0.38.32", "rustix 0.38.32",
"slab", "slab",
"thiserror", "thiserror",
@@ -826,7 +826,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "f76990911f2267d837d9d0ad060aa63aaad170af40904b29461734c339030d4d" checksum = "f76990911f2267d837d9d0ad060aa63aaad170af40904b29461734c339030d4d"
dependencies = [ dependencies = [
"quote", "quote",
"syn 2.0.53", "syn 2.0.55",
] ]
[[package]] [[package]]
@@ -854,7 +854,7 @@ dependencies = [
[[package]] [[package]]
name = "const-field-offset" name = "const-field-offset"
version = "0.1.5" version = "0.1.5"
source = "git+https://github.com/flukejones/sixtyfps.git?branch=asusctl#692020898223a29efbb597e18864841c6eb45d77" source = "git+https://github.com/flukejones/sixtyfps.git?branch=feat/color_hsv#d73de5db8ac10b0b46a1c28c85722902dcf70d30"
dependencies = [ dependencies = [
"const-field-offset-macro", "const-field-offset-macro",
"field-offset", "field-offset",
@@ -863,11 +863,11 @@ dependencies = [
[[package]] [[package]]
name = "const-field-offset-macro" name = "const-field-offset-macro"
version = "0.1.5" version = "0.1.5"
source = "git+https://github.com/flukejones/sixtyfps.git?branch=asusctl#692020898223a29efbb597e18864841c6eb45d77" source = "git+https://github.com/flukejones/sixtyfps.git?branch=feat/color_hsv#d73de5db8ac10b0b46a1c28c85722902dcf70d30"
dependencies = [ dependencies = [
"proc-macro2", "proc-macro2",
"quote", "quote",
"syn 2.0.53", "syn 2.0.55",
] ]
[[package]] [[package]]
@@ -1033,7 +1033,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "ad291aa74992b9b7a7e88c38acbbf6ad7e107f1d90ee8775b7bc1fc3394f485c" checksum = "ad291aa74992b9b7a7e88c38acbbf6ad7e107f1d90ee8775b7bc1fc3394f485c"
dependencies = [ dependencies = [
"quote", "quote",
"syn 2.0.53", "syn 2.0.55",
] ]
[[package]] [[package]]
@@ -1089,7 +1089,7 @@ checksum = "61bb5a1014ce6dfc2a378578509abe775a5aa06bff584a547555d9efdb81b926"
dependencies = [ dependencies = [
"proc-macro2", "proc-macro2",
"quote", "quote",
"syn 2.0.53", "syn 2.0.55",
] ]
[[package]] [[package]]
@@ -1277,7 +1277,7 @@ checksum = "5c785274071b1b420972453b306eeca06acf4633829db4223b58a2a8c5953bc4"
dependencies = [ dependencies = [
"proc-macro2", "proc-macro2",
"quote", "quote",
"syn 2.0.53", "syn 2.0.55",
] ]
[[package]] [[package]]
@@ -1404,9 +1404,9 @@ dependencies = [
[[package]] [[package]]
name = "fastrand" name = "fastrand"
version = "2.0.1" version = "2.0.2"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "25cbce373ec4653f1a01a31e8a5e5ec0c622dc27ff9c4e6606eefef5cbbed4a5" checksum = "658bd65b1cf4c852a3cc96f18a8ce7b5640f6b703f905c7d74532294c2a63984"
[[package]] [[package]]
name = "fdeflate" name = "fdeflate"
@@ -1445,7 +1445,7 @@ version = "0.3.6"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "38e2275cc4e4fc009b0669731a1e5ab7ebf11f469eaede2bab9309a5b4d6057f" checksum = "38e2275cc4e4fc009b0669731a1e5ab7ebf11f469eaede2bab9309a5b4d6057f"
dependencies = [ dependencies = [
"memoffset 0.9.0", "memoffset 0.9.1",
"rustc_version", "rustc_version",
] ]
@@ -1555,7 +1555,7 @@ checksum = "1a5c6c585bc94aaf2c7b51dd4c2ba22680844aba4c687be581871a6f518c5742"
dependencies = [ dependencies = [
"proc-macro2", "proc-macro2",
"quote", "quote",
"syn 2.0.53", "syn 2.0.55",
] ]
[[package]] [[package]]
@@ -1606,7 +1606,7 @@ version = "2.3.0"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "52527eb5074e35e9339c6b4e8d12600c7128b68fb25dcb9fa9dec18f7c25f3a5" checksum = "52527eb5074e35e9339c6b4e8d12600c7128b68fb25dcb9fa9dec18f7c25f3a5"
dependencies = [ dependencies = [
"fastrand 2.0.1", "fastrand 2.0.2",
"futures-core", "futures-core",
"futures-io", "futures-io",
"parking", "parking",
@@ -1931,7 +1931,7 @@ checksum = "9a3a5bfb195931eeb336b2a7b4d761daec841b97f947d34394601737a7bba5e4"
[[package]] [[package]]
name = "i-slint-backend-linuxkms" name = "i-slint-backend-linuxkms"
version = "1.5.1" version = "1.5.1"
source = "git+https://github.com/flukejones/sixtyfps.git?branch=asusctl#692020898223a29efbb597e18864841c6eb45d77" source = "git+https://github.com/flukejones/sixtyfps.git?branch=feat/color_hsv#d73de5db8ac10b0b46a1c28c85722902dcf70d30"
dependencies = [ dependencies = [
"calloop", "calloop",
"drm", "drm",
@@ -1951,7 +1951,7 @@ dependencies = [
[[package]] [[package]]
name = "i-slint-backend-qt" name = "i-slint-backend-qt"
version = "1.5.1" version = "1.5.1"
source = "git+https://github.com/flukejones/sixtyfps.git?branch=asusctl#692020898223a29efbb597e18864841c6eb45d77" source = "git+https://github.com/flukejones/sixtyfps.git?branch=feat/color_hsv#d73de5db8ac10b0b46a1c28c85722902dcf70d30"
dependencies = [ dependencies = [
"const-field-offset", "const-field-offset",
"i-slint-common", "i-slint-common",
@@ -1963,7 +1963,7 @@ dependencies = [
[[package]] [[package]]
name = "i-slint-backend-selector" name = "i-slint-backend-selector"
version = "1.5.1" version = "1.5.1"
source = "git+https://github.com/flukejones/sixtyfps.git?branch=asusctl#692020898223a29efbb597e18864841c6eb45d77" source = "git+https://github.com/flukejones/sixtyfps.git?branch=feat/color_hsv#d73de5db8ac10b0b46a1c28c85722902dcf70d30"
dependencies = [ dependencies = [
"cfg-if", "cfg-if",
"i-slint-backend-linuxkms", "i-slint-backend-linuxkms",
@@ -1976,7 +1976,7 @@ dependencies = [
[[package]] [[package]]
name = "i-slint-backend-winit" name = "i-slint-backend-winit"
version = "1.5.1" version = "1.5.1"
source = "git+https://github.com/flukejones/sixtyfps.git?branch=asusctl#692020898223a29efbb597e18864841c6eb45d77" source = "git+https://github.com/flukejones/sixtyfps.git?branch=feat/color_hsv#d73de5db8ac10b0b46a1c28c85722902dcf70d30"
dependencies = [ dependencies = [
"bytemuck", "bytemuck",
"cfg-if", "cfg-if",
@@ -2009,7 +2009,7 @@ dependencies = [
[[package]] [[package]]
name = "i-slint-common" name = "i-slint-common"
version = "1.5.1" version = "1.5.1"
source = "git+https://github.com/flukejones/sixtyfps.git?branch=asusctl#692020898223a29efbb597e18864841c6eb45d77" source = "git+https://github.com/flukejones/sixtyfps.git?branch=feat/color_hsv#d73de5db8ac10b0b46a1c28c85722902dcf70d30"
dependencies = [ dependencies = [
"cfg-if", "cfg-if",
"derive_more", "derive_more",
@@ -2020,7 +2020,7 @@ dependencies = [
[[package]] [[package]]
name = "i-slint-compiler" name = "i-slint-compiler"
version = "1.5.1" version = "1.5.1"
source = "git+https://github.com/flukejones/sixtyfps.git?branch=asusctl#692020898223a29efbb597e18864841c6eb45d77" source = "git+https://github.com/flukejones/sixtyfps.git?branch=feat/color_hsv#d73de5db8ac10b0b46a1c28c85722902dcf70d30"
dependencies = [ dependencies = [
"by_address", "by_address",
"codemap", "codemap",
@@ -2049,7 +2049,7 @@ dependencies = [
[[package]] [[package]]
name = "i-slint-core" name = "i-slint-core"
version = "1.5.1" version = "1.5.1"
source = "git+https://github.com/flukejones/sixtyfps.git?branch=asusctl#692020898223a29efbb597e18864841c6eb45d77" source = "git+https://github.com/flukejones/sixtyfps.git?branch=feat/color_hsv#d73de5db8ac10b0b46a1c28c85722902dcf70d30"
dependencies = [ dependencies = [
"auto_enums", "auto_enums",
"bytemuck", "bytemuck",
@@ -2073,6 +2073,7 @@ dependencies = [
"pin-project", "pin-project",
"pin-weak", "pin-weak",
"portable-atomic", "portable-atomic",
"raw-window-handle 0.6.0",
"resvg", "resvg",
"rgb", "rgb",
"rustybuzz 0.13.0", "rustybuzz 0.13.0",
@@ -2093,16 +2094,16 @@ dependencies = [
[[package]] [[package]]
name = "i-slint-core-macros" name = "i-slint-core-macros"
version = "1.5.1" version = "1.5.1"
source = "git+https://github.com/flukejones/sixtyfps.git?branch=asusctl#692020898223a29efbb597e18864841c6eb45d77" source = "git+https://github.com/flukejones/sixtyfps.git?branch=feat/color_hsv#d73de5db8ac10b0b46a1c28c85722902dcf70d30"
dependencies = [ dependencies = [
"quote", "quote",
"syn 2.0.53", "syn 2.0.55",
] ]
[[package]] [[package]]
name = "i-slint-renderer-femtovg" name = "i-slint-renderer-femtovg"
version = "1.5.1" version = "1.5.1"
source = "git+https://github.com/flukejones/sixtyfps.git?branch=asusctl#692020898223a29efbb597e18864841c6eb45d77" source = "git+https://github.com/flukejones/sixtyfps.git?branch=feat/color_hsv#d73de5db8ac10b0b46a1c28c85722902dcf70d30"
dependencies = [ dependencies = [
"cfg-if", "cfg-if",
"const-field-offset", "const-field-offset",
@@ -2133,7 +2134,7 @@ dependencies = [
[[package]] [[package]]
name = "i-slint-renderer-skia" name = "i-slint-renderer-skia"
version = "1.5.1" version = "1.5.1"
source = "git+https://github.com/flukejones/sixtyfps.git?branch=asusctl#692020898223a29efbb597e18864841c6eb45d77" source = "git+https://github.com/flukejones/sixtyfps.git?branch=feat/color_hsv#d73de5db8ac10b0b46a1c28c85722902dcf70d30"
dependencies = [ dependencies = [
"bytemuck", "bytemuck",
"cfg-if", "cfg-if",
@@ -2160,7 +2161,7 @@ dependencies = [
"softbuffer", "softbuffer",
"unicode-segmentation", "unicode-segmentation",
"vtable", "vtable",
"windows 0.52.0", "windows 0.54.0",
] ]
[[package]] [[package]]
@@ -2239,9 +2240,9 @@ checksum = "44feda355f4159a7c757171a77de25daf6411e217b4cabd03bd6650690468126"
[[package]] [[package]]
name = "indexmap" name = "indexmap"
version = "2.2.5" version = "2.2.6"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "7b0b929d511467233429c45a44ac1dcaa21ba0f5ba11e4879e6ed28ddb4f9df4" checksum = "168fb715dda47215e360912c096649d23d58bf392ac62f73919e831745e40f26"
dependencies = [ dependencies = [
"equivalent", "equivalent",
"hashbrown", "hashbrown",
@@ -2349,9 +2350,9 @@ dependencies = [
[[package]] [[package]]
name = "itoa" name = "itoa"
version = "1.0.10" version = "1.0.11"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "b1a46d1a171d865aa5f83f92695765caa047a9b4cbae2cbf37dbd613a793fd4c" checksum = "49f1f14873335454500d59611f1cf4a4b0f786f9ac11f4312a78e4cf2566695b"
[[package]] [[package]]
name = "jni" name = "jni"
@@ -2716,9 +2717,9 @@ dependencies = [
[[package]] [[package]]
name = "memoffset" name = "memoffset"
version = "0.9.0" version = "0.9.1"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "5a634b1c61a95585bd15607c6ab0c4e5b226e695ff2800ba0cdccddf208c406c" checksum = "488016bfae457b036d996092f6cb448677611ce4449e970ceaf42695203f218a"
dependencies = [ dependencies = [
"autocfg", "autocfg",
] ]
@@ -2844,7 +2845,7 @@ dependencies = [
"bitflags 2.5.0", "bitflags 2.5.0",
"cfg-if", "cfg-if",
"libc", "libc",
"memoffset 0.9.0", "memoffset 0.9.1",
] ]
[[package]] [[package]]
@@ -2912,7 +2913,7 @@ dependencies = [
"proc-macro-crate 3.1.0", "proc-macro-crate 3.1.0",
"proc-macro2", "proc-macro2",
"quote", "quote",
"syn 2.0.53", "syn 2.0.55",
] ]
[[package]] [[package]]
@@ -3087,7 +3088,7 @@ checksum = "2f38a4412a78282e09a2cf38d195ea5420d15ba0602cb375210efbc877243965"
dependencies = [ dependencies = [
"proc-macro2", "proc-macro2",
"quote", "quote",
"syn 2.0.53", "syn 2.0.55",
] ]
[[package]] [[package]]
@@ -3115,7 +3116,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "668d31b1c4eba19242f2088b2bf3316b82ca31082a8335764db4e083db7485d4" checksum = "668d31b1c4eba19242f2088b2bf3316b82ca31082a8335764db4e083db7485d4"
dependencies = [ dependencies = [
"atomic-waker", "atomic-waker",
"fastrand 2.0.1", "fastrand 2.0.2",
"futures-io", "futures-io",
] ]
@@ -3172,12 +3173,13 @@ dependencies = [
[[package]] [[package]]
name = "polling" name = "polling"
version = "3.5.0" version = "3.6.0"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "24f040dee2588b4963afb4e420540439d126f73fdacf4a9c486a96d840bac3c9" checksum = "e0c976a60b2d7e99d6f229e414670a9b85d13ac305cc6d1e9c134de58c5aaaf6"
dependencies = [ dependencies = [
"cfg-if", "cfg-if",
"concurrent-queue", "concurrent-queue",
"hermit-abi",
"pin-project-lite", "pin-project-lite",
"rustix 0.38.32", "rustix 0.38.32",
"tracing", "tracing",
@@ -3207,12 +3209,12 @@ checksum = "5b40af805b3121feab8a3c29f04d8ad262fa8e0561883e7653e024ae4479e6de"
[[package]] [[package]]
name = "prettyplease" name = "prettyplease"
version = "0.2.16" version = "0.2.17"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "a41cf62165e97c7f814d2221421dbb9afcbcdb0a88068e5ea206e19951c2cbb5" checksum = "8d3928fb5db768cb86f891ff014f0144589297e3c6a1aba6ed7cecfdace270c7"
dependencies = [ dependencies = [
"proc-macro2", "proc-macro2",
"syn 2.0.53", "syn 2.0.55",
] ]
[[package]] [[package]]
@@ -3323,9 +3325,9 @@ checksum = "42a9830a0e1b9fb145ebb365b8bc4ccd75f290f98c0247deafbbe2c75cefb544"
[[package]] [[package]]
name = "rayon" name = "rayon"
version = "1.9.0" version = "1.10.0"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "e4963ed1bc86e4f3ee217022bd855b297cef07fb9eac5dfa1f788b220b49b3bd" checksum = "b418a60154510ca1a002a752ca9714984e21e4241e804d32555251faf8b78ffa"
dependencies = [ dependencies = [
"either", "either",
"rayon-core", "rayon-core",
@@ -3372,9 +3374,9 @@ dependencies = [
[[package]] [[package]]
name = "regex" name = "regex"
version = "1.10.3" version = "1.10.4"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "b62dbe01f0b06f9d8dc7d49e05a0785f153b00b2c227856282f671e0318c9b15" checksum = "c117dbdfde9c8308975b6a18d71f3f385c89461f7b3fb054288ecf2a2058ba4c"
dependencies = [ dependencies = [
"aho-corasick", "aho-corasick",
"memchr", "memchr",
@@ -3395,9 +3397,9 @@ dependencies = [
[[package]] [[package]]
name = "regex-syntax" name = "regex-syntax"
version = "0.8.2" version = "0.8.3"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "c08c74e62047bb2de4ff487b251e4a92e24f48745648451635cec7d591162d9f" checksum = "adad44e29e4c806119491a7f06f03de4d1af22c3a680dd47f1e6e179439d1f56"
[[package]] [[package]]
name = "resvg" name = "resvg"
@@ -3585,7 +3587,7 @@ checksum = "32a58fa8a7ccff2aec4f39cc45bf5f985cec7125ab271cf681c279fd00192b49"
dependencies = [ dependencies = [
"countme", "countme",
"hashbrown", "hashbrown",
"memoffset 0.9.0", "memoffset 0.9.1",
"rustc-hash", "rustc-hash",
"text-size", "text-size",
] ]
@@ -3784,14 +3786,14 @@ checksum = "7eb0b34b42edc17f6b7cac84a52a1c5f0e1bb2227e997ca9011ea3dd34e8610b"
dependencies = [ dependencies = [
"proc-macro2", "proc-macro2",
"quote", "quote",
"syn 2.0.53", "syn 2.0.55",
] ]
[[package]] [[package]]
name = "serde_json" name = "serde_json"
version = "1.0.114" version = "1.0.115"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "c5f09b1bd632ef549eaa9f60a1f8de742bdbc698e6cee2095fc84dde5f549ae0" checksum = "12dc5c46daa8e9fdf4f5e71b6cf9a53f2487da0e86e55808e2d35539666497dd"
dependencies = [ dependencies = [
"itoa", "itoa",
"ryu", "ryu",
@@ -3806,7 +3808,7 @@ checksum = "0b2e6b945e9d3df726b65d6ee24060aff8e3533d431f677a9695db04eff9dfdb"
dependencies = [ dependencies = [
"proc-macro2", "proc-macro2",
"quote", "quote",
"syn 2.0.53", "syn 2.0.55",
] ]
[[package]] [[package]]
@@ -3867,9 +3869,9 @@ checksum = "38b58827f4464d87d377d175e90bf58eb00fd8716ff0a62f80356b5e61555d0d"
[[package]] [[package]]
name = "skia-bindings" name = "skia-bindings"
version = "0.71.0" version = "0.72.0"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "e66af11d51ceb6a2b4d71fc195bfbf6f647259dd2459cf40c59d2ea5905c85db" checksum = "ace7c5359ccb009880e65958eaf1e2fa68ee19ada6931300c2f1942f84abf2c3"
dependencies = [ dependencies = [
"bindgen", "bindgen",
"cc", "cc",
@@ -3884,14 +3886,14 @@ dependencies = [
[[package]] [[package]]
name = "skia-safe" name = "skia-safe"
version = "0.71.0" version = "0.72.0"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "19f16277b362e6c6374ac9bb2d4fd561f5f58b80a1729989d5d79b33ccc92ced" checksum = "f0a4a3df502b317456a34df181ac67a7a6443b0f2e4b883ac220dba1dcb3ce38"
dependencies = [ dependencies = [
"bitflags 2.5.0", "bitflags 2.5.0",
"lazy_static", "lazy_static",
"skia-bindings", "skia-bindings",
"windows 0.52.0", "windows 0.54.0",
] ]
[[package]] [[package]]
@@ -3906,7 +3908,7 @@ dependencies = [
[[package]] [[package]]
name = "slint" name = "slint"
version = "1.5.1" version = "1.5.1"
source = "git+https://github.com/flukejones/sixtyfps.git?branch=asusctl#692020898223a29efbb597e18864841c6eb45d77" source = "git+https://github.com/flukejones/sixtyfps.git?branch=feat/color_hsv#d73de5db8ac10b0b46a1c28c85722902dcf70d30"
dependencies = [ dependencies = [
"const-field-offset", "const-field-offset",
"i-slint-backend-selector", "i-slint-backend-selector",
@@ -3922,7 +3924,7 @@ dependencies = [
[[package]] [[package]]
name = "slint-build" name = "slint-build"
version = "1.5.1" version = "1.5.1"
source = "git+https://github.com/flukejones/sixtyfps.git?branch=asusctl#692020898223a29efbb597e18864841c6eb45d77" source = "git+https://github.com/flukejones/sixtyfps.git?branch=feat/color_hsv#d73de5db8ac10b0b46a1c28c85722902dcf70d30"
dependencies = [ dependencies = [
"i-slint-compiler", "i-slint-compiler",
"spin_on", "spin_on",
@@ -3933,7 +3935,7 @@ dependencies = [
[[package]] [[package]]
name = "slint-macros" name = "slint-macros"
version = "1.5.1" version = "1.5.1"
source = "git+https://github.com/flukejones/sixtyfps.git?branch=asusctl#692020898223a29efbb597e18864841c6eb45d77" source = "git+https://github.com/flukejones/sixtyfps.git?branch=feat/color_hsv#d73de5db8ac10b0b46a1c28c85722902dcf70d30"
dependencies = [ dependencies = [
"i-slint-compiler", "i-slint-compiler",
"proc-macro2", "proc-macro2",
@@ -4049,7 +4051,7 @@ dependencies = [
"cfg_aliases 0.1.1", "cfg_aliases 0.1.1",
"cocoa", "cocoa",
"core-graphics", "core-graphics",
"fastrand 2.0.1", "fastrand 2.0.2",
"foreign-types", "foreign-types",
"js-sys", "js-sys",
"log", "log",
@@ -4126,7 +4128,7 @@ dependencies = [
"proc-macro2", "proc-macro2",
"quote", "quote",
"rustversion", "rustversion",
"syn 2.0.53", "syn 2.0.55",
] ]
[[package]] [[package]]
@@ -4167,9 +4169,9 @@ dependencies = [
[[package]] [[package]]
name = "syn" name = "syn"
version = "2.0.53" version = "2.0.55"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "7383cd0e49fff4b6b90ca5670bfd3e9d6a733b3f90c686605aa7eec8c4996032" checksum = "002a1b3dbf967edfafc32655d0f377ab0bb7b994aa1d32c8cc7e9b8bf3ebb8f0"
dependencies = [ dependencies = [
"proc-macro2", "proc-macro2",
"quote", "quote",
@@ -4209,9 +4211,9 @@ dependencies = [
[[package]] [[package]]
name = "temp-dir" name = "temp-dir"
version = "0.1.12" version = "0.1.13"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "dd16aa9ffe15fe021c6ee3766772132c6e98dfa395a167e16864f61a9cfb71d6" checksum = "1f227968ec00f0e5322f9b8173c7a0cbcff6181a0a5b28e9892491c286277231"
[[package]] [[package]]
name = "tempfile" name = "tempfile"
@@ -4220,7 +4222,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "85b77fafb263dd9d05cbeac119526425676db3784113aa9295c88498cbf8bff1" checksum = "85b77fafb263dd9d05cbeac119526425676db3784113aa9295c88498cbf8bff1"
dependencies = [ dependencies = [
"cfg-if", "cfg-if",
"fastrand 2.0.1", "fastrand 2.0.2",
"rustix 0.38.32", "rustix 0.38.32",
"windows-sys 0.52.0", "windows-sys 0.52.0",
] ]
@@ -4257,7 +4259,7 @@ checksum = "c61f3ba182994efc43764a46c018c347bc492c79f024e705f46567b418f6d4f7"
dependencies = [ dependencies = [
"proc-macro2", "proc-macro2",
"quote", "quote",
"syn 2.0.53", "syn 2.0.55",
] ]
[[package]] [[package]]
@@ -4376,7 +4378,7 @@ checksum = "5b8a1e28f2deaa14e508979454cb3a223b10b938b45af148bc0986de36f1923b"
dependencies = [ dependencies = [
"proc-macro2", "proc-macro2",
"quote", "quote",
"syn 2.0.53", "syn 2.0.55",
] ]
[[package]] [[package]]
@@ -4463,7 +4465,7 @@ checksum = "34704c8d6ebcbc939824180af020566b01a7c01f80641264eba0999f6c2b6be7"
dependencies = [ dependencies = [
"proc-macro2", "proc-macro2",
"quote", "quote",
"syn 2.0.53", "syn 2.0.55",
] ]
[[package]] [[package]]
@@ -4506,7 +4508,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "ecce25dea8aeaadc44909f4c1226d22d84512fccd07d22447ecbad176bc09545" checksum = "ecce25dea8aeaadc44909f4c1226d22d84512fccd07d22447ecbad176bc09545"
dependencies = [ dependencies = [
"quote", "quote",
"syn 2.0.53", "syn 2.0.55",
] ]
[[package]] [[package]]
@@ -4539,7 +4541,7 @@ version = "1.1.0"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "89daebc3e6fd160ac4aa9fc8b3bf71e1f74fbf92367ae71fb83a037e8bf164b9" checksum = "89daebc3e6fd160ac4aa9fc8b3bf71e1f74fbf92367ae71fb83a037e8bf164b9"
dependencies = [ dependencies = [
"memoffset 0.9.0", "memoffset 0.9.1",
"tempfile", "tempfile",
"winapi", "winapi",
] ]
@@ -4708,7 +4710,7 @@ dependencies = [
[[package]] [[package]]
name = "vtable" name = "vtable"
version = "0.2.0" version = "0.2.0"
source = "git+https://github.com/flukejones/sixtyfps.git?branch=asusctl#692020898223a29efbb597e18864841c6eb45d77" source = "git+https://github.com/flukejones/sixtyfps.git?branch=feat/color_hsv#d73de5db8ac10b0b46a1c28c85722902dcf70d30"
dependencies = [ dependencies = [
"const-field-offset", "const-field-offset",
"portable-atomic", "portable-atomic",
@@ -4719,11 +4721,11 @@ dependencies = [
[[package]] [[package]]
name = "vtable-macro" name = "vtable-macro"
version = "0.2.0" version = "0.2.0"
source = "git+https://github.com/flukejones/sixtyfps.git?branch=asusctl#692020898223a29efbb597e18864841c6eb45d77" source = "git+https://github.com/flukejones/sixtyfps.git?branch=feat/color_hsv#d73de5db8ac10b0b46a1c28c85722902dcf70d30"
dependencies = [ dependencies = [
"proc-macro2", "proc-macro2",
"quote", "quote",
"syn 2.0.53", "syn 2.0.55",
] ]
[[package]] [[package]]
@@ -4769,7 +4771,7 @@ dependencies = [
"once_cell", "once_cell",
"proc-macro2", "proc-macro2",
"quote", "quote",
"syn 2.0.53", "syn 2.0.55",
"wasm-bindgen-shared", "wasm-bindgen-shared",
] ]
@@ -4803,7 +4805,7 @@ checksum = "e94f17b526d0a461a191c78ea52bbce64071ed5c04c9ffe424dcb38f74171bb7"
dependencies = [ dependencies = [
"proc-macro2", "proc-macro2",
"quote", "quote",
"syn 2.0.53", "syn 2.0.55",
"wasm-bindgen-backend", "wasm-bindgen-backend",
"wasm-bindgen-shared", "wasm-bindgen-shared",
] ]
@@ -5031,6 +5033,16 @@ dependencies = [
"windows-targets 0.52.4", "windows-targets 0.52.4",
] ]
[[package]]
name = "windows"
version = "0.54.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "9252e5725dbed82865af151df558e754e4a3c2c30818359eb17465f1346a1b49"
dependencies = [
"windows-core 0.54.0",
"windows-targets 0.52.4",
]
[[package]] [[package]]
name = "windows-core" name = "windows-core"
version = "0.51.1" version = "0.51.1"
@@ -5049,6 +5061,25 @@ dependencies = [
"windows-targets 0.52.4", "windows-targets 0.52.4",
] ]
[[package]]
name = "windows-core"
version = "0.54.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "12661b9c89351d684a50a8a643ce5f608e20243b9fb84687800163429f161d65"
dependencies = [
"windows-result",
"windows-targets 0.52.4",
]
[[package]]
name = "windows-result"
version = "0.1.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "cd19df78e5168dfb0aedc343d1d1b8d422ab2db6756d2dc3fef75035402a3f64"
dependencies = [
"windows-targets 0.52.4",
]
[[package]] [[package]]
name = "windows-sys" name = "windows-sys"
version = "0.45.0" version = "0.45.0"
@@ -5607,7 +5638,7 @@ checksum = "9ce1b18ccd8e73a9321186f97e46f9f04b778851177567b1975109d26a08d2a6"
dependencies = [ dependencies = [
"proc-macro2", "proc-macro2",
"quote", "quote",
"syn 2.0.53", "syn 2.0.55",
] ]
[[package]] [[package]]

View File

@@ -106,7 +106,7 @@ fn check_service(name: &str) -> bool {
false false
} }
fn find_aura_iface() -> Result<AuraProxyBlocking<'static>, Box<dyn std::error::Error>> { fn find_aura_iface() -> Result<Vec<AuraProxyBlocking<'static>>, Box<dyn std::error::Error>> {
let conn = zbus::blocking::Connection::system().unwrap(); let conn = zbus::blocking::Connection::system().unwrap();
let f = zbus::blocking::fdo::ObjectManagerProxy::new(&conn, "org.asuslinux.Daemon", "/org") let f = zbus::blocking::fdo::ObjectManagerProxy::new(&conn, "org.asuslinux.Daemon", "/org")
.unwrap(); .unwrap();
@@ -126,11 +126,17 @@ fn find_aura_iface() -> Result<AuraProxyBlocking<'static>, Box<dyn std::error::E
println!("Multiple aura devices found: {aura_paths:?}"); println!("Multiple aura devices found: {aura_paths:?}");
println!("TODO: enable selection"); println!("TODO: enable selection");
} }
if let Some(path) = aura_paths.first() { if !aura_paths.is_empty() {
return Ok(AuraProxyBlocking::builder(&conn) let mut ctrl = Vec::new();
.path(path.clone())? for path in aura_paths {
.destination("org.asuslinux.Daemon")? ctrl.push(
.build()?); AuraProxyBlocking::builder(&conn)
.path(path.clone())?
.destination("org.asuslinux.Daemon")?
.build()?,
);
}
return Ok(ctrl);
} }
Err("No Aura interface".into()) Err("No Aura interface".into())
@@ -166,7 +172,12 @@ fn do_parsed(
println!(); println!();
if let Some(cmdlist) = CliStart::command_list() { if let Some(cmdlist) = CliStart::command_list() {
let dev_type = if let Ok(proxy) = find_aura_iface() { let dev_type = if let Ok(proxy) = find_aura_iface() {
proxy.device_type().unwrap_or(AuraDevice::Unknown) // TODO: commands on all?
proxy
.first()
.unwrap()
.device_type()
.unwrap_or(AuraDevice::Unknown)
} else { } else {
AuraDevice::Unknown AuraDevice::Unknown
}; };
@@ -196,12 +207,14 @@ fn do_parsed(
if let Some(brightness) = &parsed.kbd_bright { if let Some(brightness) = &parsed.kbd_bright {
if let Ok(aura) = find_aura_iface() { if let Ok(aura) = find_aura_iface() {
match brightness.level() { for aura in aura.iter() {
None => { match brightness.level() {
let level = aura.brightness()?; None => {
println!("Current keyboard led brightness: {level:?}"); let level = aura.brightness()?;
println!("Current keyboard led brightness: {level:?}");
}
Some(level) => aura.set_brightness(rog_aura::LedBrightness::from(level))?,
} }
Some(level) => aura.set_brightness(rog_aura::LedBrightness::from(level))?,
} }
} else { } else {
println!("No aura interface found"); println!("No aura interface found");
@@ -210,8 +223,10 @@ fn do_parsed(
if parsed.next_kbd_bright { if parsed.next_kbd_bright {
if let Ok(aura) = find_aura_iface() { if let Ok(aura) = find_aura_iface() {
let brightness = aura.brightness()?; for aura in aura.iter() {
aura.set_brightness(brightness.next())?; let brightness = aura.brightness()?;
aura.set_brightness(brightness.next())?;
}
} else { } else {
println!("No aura interface found"); println!("No aura interface found");
} }
@@ -219,8 +234,10 @@ fn do_parsed(
if parsed.prev_kbd_bright { if parsed.prev_kbd_bright {
if let Ok(aura) = find_aura_iface() { if let Ok(aura) = find_aura_iface() {
let brightness = aura.brightness()?; for aura in aura.iter() {
aura.set_brightness(brightness.prev())?; let brightness = aura.brightness()?;
aura.set_brightness(brightness.prev())?;
}
} else { } else {
println!("No aura interface found"); println!("No aura interface found");
} }
@@ -233,10 +250,11 @@ fn do_parsed(
supported_properties supported_properties
); );
if let Ok(aura) = find_aura_iface() { if let Ok(aura) = find_aura_iface() {
let bright = aura.supported_brightness()?; // TODO: multiple RGB check
let modes = aura.supported_basic_modes()?; let bright = aura.first().unwrap().supported_brightness()?;
let zones = aura.supported_basic_zones()?; let modes = aura.first().unwrap().supported_basic_modes()?;
let power = aura.supported_power_zones()?; let zones = aura.first().unwrap().supported_basic_zones()?;
let power = aura.first().unwrap().supported_power_zones()?;
println!("Supported Keyboard Brightness:\n{:#?}", bright); println!("Supported Keyboard Brightness:\n{:#?}", bright);
println!("Supported Aura Modes:\n{:#?}", modes); println!("Supported Aura Modes:\n{:#?}", modes);
println!("Supported Aura Zones:\n{:#?}", zones); println!("Supported Aura Zones:\n{:#?}", zones);
@@ -501,14 +519,9 @@ fn handle_slash(
} }
fn handle_led_mode( fn handle_led_mode(
aura: &AuraProxyBlocking, aura: &[AuraProxyBlocking],
mode: &LedModeCommand, mode: &LedModeCommand,
) -> Result<(), Box<dyn std::error::Error>> { ) -> Result<(), Box<dyn std::error::Error>> {
// if !supported.contains(&AURA_ZBUS_NAME.to_string()) {
// println!("This laptop does not support power options");
// return Err(PlatformError::NotSupported.into());
// }
if mode.command.is_none() && !mode.prev_mode && !mode.next_mode { if mode.command.is_none() && !mode.prev_mode && !mode.next_mode {
if !mode.help { if !mode.help {
println!("Missing arg or command\n"); println!("Missing arg or command\n");
@@ -518,7 +531,8 @@ fn handle_led_mode(
if let Some(cmdlist) = LedModeCommand::command_list() { if let Some(cmdlist) = LedModeCommand::command_list() {
let commands: Vec<String> = cmdlist.lines().map(|s| s.to_owned()).collect(); let commands: Vec<String> = cmdlist.lines().map(|s| s.to_owned()).collect();
let modes = aura.supported_basic_modes()?; // TODO: multiple rgb check
let modes = aura.first().unwrap().supported_basic_modes()?;
for command in commands.iter().filter(|command| { for command in commands.iter().filter(|command| {
for mode in &modes { for mode in &modes {
if command if command
@@ -547,68 +561,72 @@ fn handle_led_mode(
return Ok(()); return Ok(());
} }
if mode.next_mode { if mode.next_mode {
let mode = aura.led_mode()?; for aura in aura {
let modes = aura.supported_basic_modes()?; let mode = aura.led_mode()?;
let mut pos = modes.iter().position(|m| *m == mode).unwrap() + 1; let modes = aura.supported_basic_modes()?;
if pos >= modes.len() { let mut pos = modes.iter().position(|m| *m == mode).unwrap() + 1;
pos = 0; if pos >= modes.len() {
pos = 0;
}
aura.set_led_mode(modes[pos])?;
} }
aura.set_led_mode(modes[pos])?;
} else if mode.prev_mode { } else if mode.prev_mode {
let mode = aura.led_mode()?; for aura in aura {
let modes = aura.supported_basic_modes()?; let mode = aura.led_mode()?;
let mut pos = modes.iter().position(|m| *m == mode).unwrap(); let modes = aura.supported_basic_modes()?;
if pos == 0 { let mut pos = modes.iter().position(|m| *m == mode).unwrap();
pos = modes.len() - 1; if pos == 0 {
} else { pos = modes.len() - 1;
pos -= 1; } else {
pos -= 1;
}
aura.set_led_mode(modes[pos])?;
} }
aura.set_led_mode(modes[pos])?;
} else if let Some(mode) = mode.command.as_ref() { } else if let Some(mode) = mode.command.as_ref() {
if mode.help_requested() { if mode.help_requested() {
println!("{}", mode.self_usage()); println!("{}", mode.self_usage());
return Ok(()); return Ok(());
} }
aura.set_led_mode_data(<AuraEffect>::from(mode))?; for aura in aura {
aura.set_led_mode_data(<AuraEffect>::from(mode))?;
}
} }
Ok(()) Ok(())
} }
fn handle_led_power1( fn handle_led_power1(
aura: &AuraProxyBlocking, aura: &[AuraProxyBlocking],
power: &LedPowerCommand1, power: &LedPowerCommand1,
) -> Result<(), Box<dyn std::error::Error>> { ) -> Result<(), Box<dyn std::error::Error>> {
// if !supported.contains(&AURA_ZBUS_NAME.to_string()) { for aura in aura {
// println!("This laptop does not support power options"); let dev_type = aura.device_type()?;
// return Err(PlatformError::NotSupported.into()); if !dev_type.is_old_style() && !dev_type.is_tuf_style() {
// } println!("This option applies only to keyboards 2021+");
let dev_type = aura.device_type()?;
if !dev_type.is_old_style() && !dev_type.is_tuf_style() {
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()
{
if !power.help {
println!("Missing arg or command\n");
} }
println!("{}\n", power.self_usage());
return Ok(());
}
if dev_type.is_old_style() { if power.awake.is_none()
handle_led_power_1_do_1866(aura, power)?; && power.sleep.is_none()
return Ok(()); && power.boot.is_none()
} && power.keyboard.is_none()
&& power.lightbar.is_none()
{
if !power.help {
println!("Missing arg or command\n");
}
println!("{}\n", power.self_usage());
return Ok(());
}
if dev_type.is_tuf_style() { if dev_type.is_old_style() {
handle_led_power_1_do_tuf(aura, power)?; handle_led_power_1_do_1866(aura, power)?;
return Ok(()); 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"); println!("These options are for keyboards of product ID 0x1866 or TUF only");
@@ -642,7 +660,8 @@ fn handle_led_power_1_do_1866(
old_rog: enabled, old_rog: enabled,
..Default::default() ..Default::default()
}; };
aura.set_led_power(data)?; // TODO: verify this
aura.set_led_power(data.clone())?; // TODO: verify this
Ok(()) Ok(())
} }
@@ -673,67 +692,66 @@ fn handle_led_power_1_do_tuf(
tuf: enabled, tuf: enabled,
..Default::default() ..Default::default()
}; };
aura.set_led_power(data)?; // TODO: verify this aura.set_led_power(data.clone())?; // TODO: verify this
Ok(()) Ok(())
} }
fn handle_led_power2( fn handle_led_power2(
aura: &AuraProxyBlocking, aura: &[AuraProxyBlocking],
power: &LedPowerCommand2, power: &LedPowerCommand2,
) -> Result<(), Box<dyn std::error::Error>> { ) -> Result<(), Box<dyn std::error::Error>> {
// if !supported.contains(&AURA_ZBUS_NAME.to_string()) { for aura in aura {
// println!("This laptop does not support power options"); let dev_type = aura.device_type()?;
// return Err(PlatformError::NotSupported.into()); if !dev_type.is_new_style() {
// } println!("This option applies only to keyboards 2021+");
let dev_type = aura.device_type()?; continue;
if !dev_type.is_new_style() {
println!("This option applies only to keyboards 2021+");
}
if power.command().is_none() {
if !power.help {
println!("Missing arg or command\n");
} }
println!("{}\n", power.self_usage());
println!("Commands available");
if let Some(cmdlist) = LedPowerCommand2::command_list() { if power.command().is_none() {
let commands: Vec<String> = cmdlist.lines().map(|s| s.to_owned()).collect(); if !power.help {
for command in &commands { println!("Missing arg or command\n");
println!("{}", command);
} }
} println!("{}\n", power.self_usage());
println!("Commands available");
println!("\nHelp can also be requested on commands, e.g: boot --help"); if let Some(cmdlist) = LedPowerCommand2::command_list() {
return Ok(()); let commands: Vec<String> = cmdlist.lines().map(|s| s.to_owned()).collect();
} for command in &commands {
println!("{}", command);
}
}
if let Some(pow) = power.command.as_ref() { println!("\nHelp can also be requested on commands, e.g: boot --help");
if pow.help_requested() {
println!("{}", pow.self_usage());
return Ok(()); return Ok(());
} }
let set = |power: &mut KbAuraPowerState, set_to: &AuraPowerStates| { if let Some(pow) = power.command.as_ref() {
power.boot = set_to.boot; if pow.help_requested() {
power.awake = set_to.awake; println!("{}", pow.self_usage());
power.sleep = set_to.sleep; return Ok(());
power.shutdown = set_to.shutdown;
};
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.set_led_power(enabled)?; 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 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.set_led_power(enabled)?;
}
} }
Ok(()) Ok(())

View File

@@ -27,6 +27,7 @@ inotify.workspace = true
mio.workspace = true mio.workspace = true
tokio.workspace = true tokio.workspace = true
# console-subscriber = "0.2.0"
# cli and logging # cli and logging
log.workspace = true log.workspace = true

View File

@@ -68,7 +68,7 @@ impl CtrlAnime {
let node = if usb.is_some() { let node = if usb.is_some() {
unsafe { Node::Usb(usb.unwrap_unchecked()) } unsafe { Node::Usb(usb.unwrap_unchecked()) }
} else if hid.is_some() { } else if hid.is_some() {
unsafe { Node::Hid(hid.unwrap_unchecked().0) } unsafe { Node::Hid(hid.unwrap_unchecked()) }
} else { } else {
return Err(RogError::Anime(AnimeError::NoDevice)); return Err(RogError::Anime(AnimeError::NoDevice));
}; };

View File

@@ -18,6 +18,12 @@ pub enum AuraPowerConfig {
AuraDevRog2(AuraPower), AuraDevRog2(AuraPower),
} }
impl Default for AuraPowerConfig {
fn default() -> Self {
Self::AuraDevTuf(HashSet::default())
}
}
impl AuraPowerConfig { impl AuraPowerConfig {
/// Invalid for TUF laptops /// Invalid for TUF laptops
pub fn to_bytes(control: &Self) -> [u8; 4] { pub fn to_bytes(control: &Self) -> [u8; 4] {
@@ -101,7 +107,7 @@ impl From<&AuraPowerConfig> for AuraPowerDev {
} }
} }
#[derive(Deserialize, Serialize, Debug, Clone)] #[derive(Deserialize, Serialize, Default, Debug, Clone)]
// #[serde(default)] // #[serde(default)]
pub struct AuraConfig { pub struct AuraConfig {
pub config_name: String, pub config_name: String,
@@ -116,7 +122,7 @@ pub struct AuraConfig {
impl AuraConfig { impl AuraConfig {
/// Detect the keyboard type and load from default DB if data available /// Detect the keyboard type and load from default DB if data available
pub fn new_with(prod_id: AuraDevice) -> Self { pub fn new_with(prod_id: AuraDevice) -> Self {
info!("creating new AuraConfig"); info!("Setting up AuraConfig for {prod_id:?}");
Self::from_default_support(prod_id, &LaptopLedData::get_data()) Self::from_default_support(prod_id, &LaptopLedData::get_data())
} }
} }
@@ -142,10 +148,6 @@ impl StdConfig for AuraConfig {
impl StdConfigLoad for AuraConfig {} impl StdConfigLoad for AuraConfig {}
impl AuraConfig { impl AuraConfig {
pub fn set_filename(&mut self, prod_id: AuraDevice) {
self.config_name = format!("aura_{prod_id:?}.ron");
}
pub fn from_default_support(prod_id: AuraDevice, support_data: &LaptopLedData) -> Self { pub fn from_default_support(prod_id: AuraDevice, support_data: &LaptopLedData) -> Self {
// create a default config here // create a default config here
let enabled = if prod_id.is_new_style() { let enabled = if prod_id.is_new_style() {

View File

@@ -1,10 +1,10 @@
use std::collections::BTreeMap; use std::collections::{BTreeMap, HashSet};
use config_traits::{StdConfig, StdConfigLoad}; use config_traits::{StdConfig, StdConfigLoad};
use inotify::Inotify; use inotify::Inotify;
use log::info; use log::{debug, info, warn};
use rog_aura::advanced::{LedUsbPackets, UsbPackets}; use rog_aura::advanced::{LedUsbPackets, UsbPackets};
use rog_aura::aura_detection::{LaptopLedData, ASUS_KEYBOARD_DEVICES}; use rog_aura::aura_detection::LaptopLedData;
use rog_aura::usb::{AuraDevice, LED_APPLY, LED_SET}; use rog_aura::usb::{AuraDevice, LED_APPLY, LED_SET};
use rog_aura::{AuraEffect, Direction, LedBrightness, Speed, GRADIENT, LED_MSG_LEN}; use rog_aura::{AuraEffect, Direction, LedBrightness, Speed, GRADIENT, LED_MSG_LEN};
use rog_platform::hid_raw::HidRaw; use rog_platform::hid_raw::HidRaw;
@@ -59,84 +59,102 @@ pub struct CtrlKbdLed {
} }
impl CtrlKbdLed { impl CtrlKbdLed {
pub fn new(data: LaptopLedData) -> Result<Self, RogError> { pub fn find_all(data: &LaptopLedData) -> Result<Vec<Self>, RogError> {
let mut led_prod = AuraDevice::Unknown; info!("Searching for all Aura devices");
let mut usb_node = None; let mut devices = Vec::new();
for prod in ASUS_KEYBOARD_DEVICES { let mut found = HashSet::new(); // track and ensure we use only one hidraw per prod_id
match HidRaw::new(prod.into()) {
Ok(node) => { let mut enumerator = udev::Enumerator::new().map_err(|err| {
led_prod = prod; warn!("{}", err);
usb_node = Some(node); err
info!( })?;
"Looked for keyboard controller 0x{}: Found",
<&str>::from(prod) enumerator.match_subsystem("hidraw").map_err(|err| {
); warn!("{}", err);
break; err
})?;
for end_point in enumerator.scan_devices()? {
// usb_device gives us a product and vendor ID
if let Some(usb_device) =
end_point.parent_with_subsystem_devtype("usb", "usb_device")?
{
// The asus_wmi driver latches MCU that controls the USB endpoints
if let Some(parent) = end_point.parent() {
if let Some(driver) = parent.driver() {
// There is a tree of devices added so filter by driver
if driver != "asus" {
continue;
}
} else {
continue;
}
} }
Err(err) => info!( // Device is something like 002, while its parent is the MCU
"Looked for keyboard controller 0x{}: {err}", // Think of it like the device is an endpoint of the USB device attached
<&str>::from(prod) let mut aura_dev = AuraDevice::Unknown;
), 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) {
log::debug!("Unknown or invalid device: {usb_id:?}, skipping");
continue;
}
found.insert(aura_dev);
}
let dev_node = if let Some(dev_node) = usb_device.devnode() {
dev_node
} else {
debug!("Device has no devnode, skipping");
continue;
};
info!("AuraControl found device at: {:?}", dev_node);
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);
devices.push(dev);
} }
} }
info!("Found {} Aura devices", devices.len());
let mut dbus_path = Default::default(); Ok(devices)
let rgb_led = KeyboardLed::new()?;
let led_node = if let Some(rog) = usb_node {
info!("Found ROG USB keyboard");
dbus_path = dbus_path_for_dev(rog.1).unwrap_or_default();
LEDNode::Rog(rgb_led, rog.0)
} else if rgb_led.has_kbd_rgb_mode() {
info!("Found TUF keyboard");
LEDNode::KbdLed(rgb_led.clone())
} else {
return Err(RogError::NoAuraKeyboard);
// LEDNode::None
};
// New loads data from the DB also
let config = Self::init_config(led_prod, &data);
let ctrl = CtrlKbdLed {
led_prod,
led_node, // on TUF this is the same as rgb_led / kd_brightness
supported_data: data,
per_key_mode_active: false,
config,
dbus_path,
};
Ok(ctrl)
} }
pub fn from_device( /// The generated data from this function has a default config. This config
/// should be overwritten. The reason for the default config is because
/// of async issues between this and udev/hidraw
pub fn from_hidraw(
device: HidRaw, device: HidRaw,
dbus_path: OwnedObjectPath, dbus_path: OwnedObjectPath,
data: LaptopLedData, data: &LaptopLedData,
) -> Result<Self, RogError> { ) -> Result<Self, RogError> {
let rgb_led = KeyboardLed::new()?; let rgb_led = KeyboardLed::new()?;
let prod_id = AuraDevice::from(device.prod_id()); let prod_id = AuraDevice::from(device.prod_id());
if prod_id == AuraDevice::Unknown {
log::error!("{} is AuraDevice::Unknown", device.prod_id());
return Err(RogError::NoAuraNode);
}
// New loads data from the DB also // New loads data from the DB also
let config = Self::init_config(prod_id, &data); // let config = Self::init_config(prod_id, data);
let ctrl = CtrlKbdLed { let ctrl = CtrlKbdLed {
led_prod: prod_id, led_prod: prod_id,
led_node: LEDNode::Rog(rgb_led, device), /* on TUF this is the same as rgb_led / led_node: LEDNode::Rog(rgb_led, device),
* kd_brightness */ supported_data: data.clone(),
supported_data: data,
per_key_mode_active: false, per_key_mode_active: false,
config, config: AuraConfig::default(),
dbus_path, dbus_path,
}; };
Ok(ctrl) Ok(ctrl)
} }
fn init_config(prod_id: AuraDevice, supported_basic_modes: &LaptopLedData) -> AuraConfig { pub fn init_config(prod_id: AuraDevice, supported_basic_modes: &LaptopLedData) -> AuraConfig {
// New loads data from the DB also // New loads data from the DB also
let mut config_init = AuraConfig::new_with(prod_id); let mut config_init = AuraConfig::new_with(prod_id);
// config_init.set_filename(prod_id); // config_init.set_filename(prod_id);
let mut config_loaded = config_init.clone().load(); let mut config_loaded = config_init.clone().load();
config_loaded.set_filename(prod_id);
// update the initialised data with what we loaded from disk // update the initialised data with what we loaded from disk
for mode in &mut config_init.builtins { for mode in &mut config_init.builtins {
// update init values from loaded values if they exist // update init values from loaded values if they exist

View File

@@ -5,14 +5,14 @@
// - If udev sees device removed then remove the zbus path // - If udev sees device removed then remove the zbus path
use std::collections::HashSet; use std::collections::HashSet;
use std::sync::Arc; use std::time::Duration;
use log::{error, info, warn}; use log::{debug, error, info, warn};
use mio::{Events, Interest, Poll, Token}; use mio::{Events, Interest, Poll, Token};
use rog_aura::aura_detection::LaptopLedData; use rog_aura::aura_detection::LaptopLedData;
use rog_aura::usb::AuraDevice; use rog_aura::usb::AuraDevice;
use rog_platform::hid_raw::HidRaw; use rog_platform::hid_raw::HidRaw;
use tokio::sync::Mutex; use tokio::task::spawn_blocking;
use udev::{Device, MonitorBuilder}; use udev::{Device, MonitorBuilder};
// use zbus::fdo::ObjectManager; // use zbus::fdo::ObjectManager;
use zbus::object_server::SignalContext; use zbus::object_server::SignalContext;
@@ -26,38 +26,31 @@ use crate::{CtrlTask, Reloadable};
pub struct AuraManager { pub struct AuraManager {
_connection: Connection, _connection: Connection,
_interfaces: Arc<Mutex<HashSet<OwnedObjectPath>>>,
} }
impl AuraManager { impl AuraManager {
pub async fn new(mut connection: Connection) -> Result<Self, RogError> { pub async fn new(connection: Connection) -> Result<Self, RogError> {
let conn_copy = connection.clone(); let conn_copy = connection.clone();
let data = LaptopLedData::get_data(); let data = LaptopLedData::get_data();
let mut interfaces = HashSet::new();
// Do the initial keyboard detection: // Do the initial keyboard detection:
match CtrlKbdLed::new(data.clone()) { let all = CtrlKbdLed::find_all(&data)?;
Ok(ctrl) => { for ctrl in all {
let path = ctrl.dbus_path.clone(); let path = ctrl.dbus_path.clone();
let sig_ctx = CtrlAuraZbus::signal_context(&connection)?; interfaces.insert(path.clone()); // ensure we record the initial stuff
let sig_ctx2 = sig_ctx.clone(); let sig_ctx = CtrlAuraZbus::signal_context(&connection)?;
let zbus = CtrlAuraZbus::new(ctrl, sig_ctx); let sig_ctx2 = sig_ctx.clone();
start_tasks(zbus, &mut connection, sig_ctx2, &path).await?; let zbus = CtrlAuraZbus::new(ctrl, sig_ctx);
} start_tasks(zbus, connection.clone(), sig_ctx2, path).await?;
Err(err) => {
error!("Keyboard control: {}", err);
}
} }
// connection.object_server().at("/org/asuslinux",
// ObjectManager).await.unwrap();
let manager = Self { let manager = Self {
_connection: connection, _connection: connection,
_interfaces: Default::default(),
}; };
// detect all plugged in aura devices (eventually) // detect all plugged in aura devices (eventually)
tokio::spawn(async move { spawn_blocking(move || {
let mut monitor = MonitorBuilder::new()?.match_subsystem("hidraw")?.listen()?; let mut monitor = MonitorBuilder::new()?.match_subsystem("hidraw")?.listen()?;
let mut poll = Poll::new()?; let mut poll = Poll::new()?;
let mut events = Events::with_capacity(1024); let mut events = Events::with_capacity(1024);
@@ -65,46 +58,71 @@ impl AuraManager {
.register(&mut monitor, Token(0), Interest::READABLE)?; .register(&mut monitor, Token(0), Interest::READABLE)?;
loop { loop {
poll.poll(&mut events, None).unwrap(); if poll.poll(&mut events, None).is_err() {
continue;
}
for event in monitor.iter() { for event in monitor.iter() {
if let Some(parent) = let parent = if let Some(parent) =
event.parent_with_subsystem_devtype("usb", "usb_device")? event.parent_with_subsystem_devtype("usb", "usb_device")?
{ {
let action = if let Some(action) = event.action() { parent
action } else {
} else { continue;
continue; };
};
if action == "remove" { let action = if let Some(action) = event.action() {
if let Some(path) = dbus_path_for_dev(parent.clone()) { action
info!("AuraManager removing: {path:?}"); } else {
let conn_copy = conn_copy.clone(); continue;
tokio::spawn(async move { };
let res = conn_copy
.object_server() let id_product = if let Some(id_product) = parent.attribute_value("idProduct") {
.remove::<CtrlAuraZbus, _>(&path) id_product.to_string_lossy()
.await } else {
.map_err(|e| { continue;
error!("Failed to remove {path:?}, {e:?}"); };
e
})?; let path = if let Some(path) = dbus_path_for_dev(&parent) {
info!("AuraManager removed: {path:?}, {res}"); path
Ok::<(), RogError>(()) } else {
}); continue;
} };
let aura_device = AuraDevice::from(&*id_product);
if aura_device == AuraDevice::Unknown {
warn!("idProduct:{id_product:?} is unknown, not using");
continue;
}
if action == "remove" {
if interfaces.remove(&path) {
info!("AuraManager removing: {path:?}");
let conn_copy = conn_copy.clone();
tokio::spawn(async move {
let res = conn_copy
.object_server()
.remove::<CtrlAuraZbus, _>(&path)
.await
.map_err(|e| {
error!("Failed to remove {path:?}, {e:?}");
e
})?;
info!("AuraManager removed: {path:?}, {res}");
Ok::<(), RogError>(())
});
}
} else if action == "add" {
if interfaces.contains(&path) {
debug!("Already a ctrl at {path:?}");
continue;
} }
let id_product = // Need to check the driver is asus to prevent using hid_generic
if let Some(id_product) = parent.attribute_value("idProduct") {
id_product
} else {
continue;
};
if let Some(p2) = event.parent() { if let Some(p2) = event.parent() {
if let Some(driver) = p2.driver() { if let Some(driver) = p2.driver() {
// There is a tree of devices added so filter by driver // There is a tree of devices added so filter by driver
if driver != "asus" { if driver != "asus" {
debug!("{id_product:?} driver was not asus, skipping");
continue; continue;
} }
} else { } else {
@@ -112,50 +130,30 @@ impl AuraManager {
} }
} }
// try conversion to known idProduct if let Some(dev_node) = event.devnode() {
let aura_device = AuraDevice::from(id_product.to_str().unwrap()); if let Ok(raw) = HidRaw::from_device(event.device())
if aura_device != AuraDevice::Unknown { .map_err(|e| error!("device path error: {e:?}"))
if action == "add" { {
let dev_node = if let Some(dev_node) = event.devnode() { if let Ok(mut ctrl) =
dev_node CtrlKbdLed::from_hidraw(raw, path.clone(), &data)
} else {
continue;
};
if let Ok(raw) = HidRaw::from_device(event.device())
.map_err(|e| error!("device path error: {e:?}"))
{ {
let path = if let Some(path) = dbus_path_for_dev(parent) { ctrl.config = CtrlKbdLed::init_config(aura_device, &data);
path interfaces.insert(path.clone());
} else { info!("AuraManager starting device at: {dev_node:?}, {path:?}");
continue; let sig_ctx = CtrlAuraZbus::signal_context(&conn_copy)?;
}; let zbus = CtrlAuraZbus::new(ctrl, sig_ctx);
if let Ok(ctrl) = let sig_ctx = CtrlAuraZbus::signal_context(&conn_copy)?;
CtrlKbdLed::from_device(raw, path.clone(), data.clone()) let conn_copy = conn_copy.clone();
{ tokio::spawn(async move {
info!("AuraManager found device at: {:?}", dev_node); start_tasks(zbus, conn_copy.clone(), sig_ctx, path).await
let mut conn_copy = conn_copy.clone(); });
//
tokio::spawn(async move {
let sig_ctx = CtrlAuraZbus::signal_context(&conn_copy)?;
let zbus = CtrlAuraZbus::new(ctrl, sig_ctx);
// Now add it to device list
let sig_ctx = CtrlAuraZbus::signal_context(&conn_copy)?;
start_tasks(zbus, &mut conn_copy, sig_ctx, &path)
.await?;
Ok::<(), RogError>(())
}); // Can't get result from here due to
// MonitorSocket
}
} }
} }
} else {
warn!("idProduct:{id_product:?} is unknown, not using")
} }
} };
} }
} }
// Required for return type on tokio::spawn // Required for return type on spawn
#[allow(unreachable_code)] #[allow(unreachable_code)]
Ok::<(), RogError>(()) Ok::<(), RogError>(())
}); });
@@ -163,7 +161,7 @@ impl AuraManager {
} }
} }
pub(crate) fn dbus_path_for_dev(parent: Device) -> Option<OwnedObjectPath> { pub(crate) fn dbus_path_for_dev(parent: &Device) -> Option<OwnedObjectPath> {
if let Some(id_product) = parent.attribute_value("idProduct") { if let Some(id_product) = parent.attribute_value("idProduct") {
let id_product = id_product.to_string_lossy(); let id_product = id_product.to_string_lossy();
let path = if let Some(devnum) = parent.attribute_value("devnum") { let path = if let Some(devnum) = parent.attribute_value("devnum") {
@@ -184,20 +182,17 @@ pub(crate) fn dbus_path_for_dev(parent: Device) -> Option<OwnedObjectPath> {
async fn start_tasks( async fn start_tasks(
mut zbus: CtrlAuraZbus, mut zbus: CtrlAuraZbus,
connection: &mut Connection, connection: Connection,
signal_ctx: SignalContext<'static>, _signal_ctx: SignalContext<'static>,
path: &ObjectPath<'static>, path: OwnedObjectPath,
) -> Result<(), RogError> { ) -> Result<(), RogError> {
let task = zbus.clone(); // let task = zbus.clone();
// let signal_ctx = signal_ctx.clone();
zbus.reload() zbus.reload()
.await .await
.unwrap_or_else(|err| warn!("Controller error: {}", err)); .unwrap_or_else(|err| warn!("Controller error: {}", err));
connection.object_server().at(path, zbus).await.unwrap();
connection // TODO: skip this until we keep handles to tasks so they can be killed
.object_server() // task.create_tasks(signal_ctx).await
.at(&ObjectPath::from_str_unchecked(path), zbus)
.await
.unwrap();
task.create_tasks(signal_ctx).await.ok();
Ok(()) Ok(())
} }

View File

@@ -210,23 +210,29 @@ impl CtrlTask for CtrlAuraZbus {
} }
async fn create_tasks(&self, _: SignalContext<'static>) -> Result<(), RogError> { async fn create_tasks(&self, _: SignalContext<'static>) -> Result<(), RogError> {
let load_save = |start: bool, mut lock: MutexGuard<'_, CtrlKbdLed>| { let load_save =
// If waking up |start: bool, mut lock: MutexGuard<'_, CtrlKbdLed>| -> Result<(), RogError> {
if !start { // If waking up
info!("CtrlKbdLedTask reloading brightness and modes"); if !start {
lock.led_node info!("CtrlKbdLedTask reloading brightness and modes");
.set_brightness(lock.config.brightness.into()) lock.led_node
.map_err(|e| error!("CtrlKbdLedTask: {e}")) .set_brightness(lock.config.brightness.into())
.ok(); .map_err(|e| {
lock.write_current_config_mode() error!("CtrlKbdLedTask: {e}");
.map_err(|e| error!("CtrlKbdLedTask: {e}")) e
.ok(); })?;
} else if start { lock.write_current_config_mode().map_err(|e| {
Self::update_config(&mut lock) error!("CtrlKbdLedTask: {e}");
.map_err(|e| error!("CtrlKbdLedTask: {e}")) e
.ok(); })?;
} } else if start {
}; Self::update_config(&mut lock).map_err(|e| {
error!("CtrlKbdLedTask: {e}");
e
})?;
}
Ok(())
};
let inner1 = self.0.clone(); let inner1 = self.0.clone();
let inner3 = self.0.clone(); let inner3 = self.0.clone();
@@ -235,14 +241,16 @@ impl CtrlTask for CtrlAuraZbus {
let inner1 = inner1.clone(); let inner1 = inner1.clone();
async move { async move {
let lock = inner1.lock().await; let lock = inner1.lock().await;
load_save(sleeping, lock); load_save(sleeping, lock).unwrap(); // unwrap as we want to
// bomb out of the task
} }
}, },
move |_shutting_down| { move |_shutting_down| {
let inner3 = inner3.clone(); let inner3 = inner3.clone();
async move { async move {
let lock = inner3.lock().await; let lock = inner3.lock().await;
load_save(false, lock); load_save(false, lock).unwrap(); // unwrap as we want to
// bomb out of the task
} }
}, },
move |_lid_closed| { move |_lid_closed| {
@@ -266,7 +274,8 @@ impl CtrlTask for CtrlAuraZbus {
.unwrap() .unwrap()
.for_each(|_| async { .for_each(|_| async {
if let Some(lock) = ctrl2.try_lock() { if let Some(lock) = ctrl2.try_lock() {
load_save(true, lock); load_save(true, lock).unwrap(); // unwrap as we want to
// bomb out of the task
} }
}) })
.await; .await;

View File

@@ -30,7 +30,7 @@ macro_rules! platform_get_value {
$self.platform $self.platform
.get() .get()
.map_err(|err| { .map_err(|err| {
warn!("RogPlatform: {}: {}", $prop_name, err); warn!("{}: {}", $prop_name, err);
FdoErr::Failed(format!("RogPlatform: {}: {}", $prop_name, err)) FdoErr::Failed(format!("RogPlatform: {}: {}", $prop_name, err))
}) })
}) })
@@ -381,7 +381,7 @@ impl CtrlPlatform {
#[zbus(property)] #[zbus(property)]
fn gpu_mux_mode(&self) -> Result<u8, FdoErr> { fn gpu_mux_mode(&self) -> Result<u8, FdoErr> {
self.platform.get_gpu_mux_mode().map_err(|err| { self.platform.get_gpu_mux_mode().map_err(|err| {
warn!("RogPlatform: set_gpu_mux_mode {err}"); warn!("get_gpu_mux_mode {err}");
FdoErr::NotSupported("RogPlatform: set_gpu_mux_mode not supported".to_owned()) FdoErr::NotSupported("RogPlatform: set_gpu_mux_mode not supported".to_owned())
}) })
} }
@@ -390,7 +390,7 @@ impl CtrlPlatform {
async fn set_gpu_mux_mode(&mut self, mode: u8) -> Result<(), FdoErr> { async fn set_gpu_mux_mode(&mut self, mode: u8) -> Result<(), FdoErr> {
if self.platform.has_gpu_mux_mode() { if self.platform.has_gpu_mux_mode() {
self.set_gfx_mode(mode.into()).map_err(|err| { self.set_gfx_mode(mode.into()).map_err(|err| {
warn!("RogPlatform: set_gpu_mux_mode {}", err); warn!("set_gpu_mux_mode {}", err);
FdoErr::Failed(format!("RogPlatform: set_gpu_mux_mode: {err}")) FdoErr::Failed(format!("RogPlatform: set_gpu_mux_mode: {err}"))
})?; })?;
self.config.lock().await.write(); self.config.lock().await.write();
@@ -420,7 +420,7 @@ impl CtrlPlatform {
self.platform self.platform
.set_throttle_thermal_policy(policy.into()) .set_throttle_thermal_policy(policy.into())
.map_err(|err| { .map_err(|err| {
warn!("RogPlatform: throttle_thermal_policy {}", err); warn!("throttle_thermal_policy {}", err);
FdoErr::Failed(format!("RogPlatform: throttle_thermal_policy: {err}")) FdoErr::Failed(format!("RogPlatform: throttle_thermal_policy: {err}"))
})?; })?;
Ok(self.throttle_thermal_policy_changed(&ctxt).await?) Ok(self.throttle_thermal_policy_changed(&ctxt).await?)
@@ -448,7 +448,7 @@ impl CtrlPlatform {
self.platform self.platform
.set_throttle_thermal_policy(policy.into()) .set_throttle_thermal_policy(policy.into())
.map_err(|err| { .map_err(|err| {
warn!("RogPlatform: throttle_thermal_policy {}", err); warn!("throttle_thermal_policy {}", err);
FdoErr::Failed(format!("RogPlatform: throttle_thermal_policy: {err}")) FdoErr::Failed(format!("RogPlatform: throttle_thermal_policy: {err}"))
}) })
} else { } else {

View File

@@ -21,6 +21,7 @@ use asusd::ctrl_slash::trait_impls::CtrlSlashZbus;
#[tokio::main] #[tokio::main]
async fn main() -> Result<(), Box<dyn std::error::Error>> { async fn main() -> Result<(), Box<dyn std::error::Error>> {
// console_subscriber::init();
let mut logger = env_logger::Builder::new(); let mut logger = env_logger::Builder::new();
logger logger
.parse_default_env() .parse_default_env()

View File

@@ -719,6 +719,14 @@
advanced_type: None, advanced_type: None,
power_zones: [Keyboard], power_zones: [Keyboard],
), ),
(
board_name: "GZ301Z",
layout_name: "ga401q",
basic_modes: [Static, Breathe, Pulse],
basic_zones: [],
advanced_type: None,
power_zones: [Keyboard],
),
( (
board_name: "RC71L", board_name: "RC71L",
layout_name: "ga401q", layout_name: "ga401q",

View File

@@ -31,7 +31,7 @@ pub const fn aura_brightness_bytes(brightness: u8) -> [u8; 17] {
derive(Type, Value, OwnedValue), derive(Type, Value, OwnedValue),
zvariant(signature = "s") zvariant(signature = "s")
)] )]
#[derive(Copy, Clone, PartialEq, Eq, Serialize, Deserialize, Default)] #[derive(Copy, Clone, PartialEq, Eq, Hash, Serialize, Deserialize, Default)]
pub enum AuraDevice { pub enum AuraDevice {
Tuf = 0, Tuf = 0,
X1854 = 1, X1854 = 1,

View File

@@ -46,14 +46,14 @@ versions.workspace = true
nix = "^0.26.1" nix = "^0.26.1"
tempfile = "3.3.0" tempfile = "3.3.0"
i-slint-backend-selector = { git = "https://github.com/flukejones/sixtyfps.git", branch = "asusctl" } i-slint-backend-selector = { git = "https://github.com/flukejones/sixtyfps.git", branch = "feat/color_hsv" }
i-slint-core = { git = "https://github.com/flukejones/sixtyfps.git", branch = "asusctl" } i-slint-core = { git = "https://github.com/flukejones/sixtyfps.git", branch = "feat/color_hsv" }
i-slint-backend-winit = { git = "https://github.com/flukejones/sixtyfps.git", branch = "asusctl" } i-slint-backend-winit = { git = "https://github.com/flukejones/sixtyfps.git", branch = "feat/color_hsv" }
winit = "*" winit = "*"
[dependencies.slint] [dependencies.slint]
git = "https://github.com/flukejones/sixtyfps.git" git = "https://github.com/flukejones/sixtyfps.git"
branch = "asusctl" branch = "feat/color_hsv"
default-features = false default-features = false
features = [ features = [
"std", "std",
@@ -66,7 +66,7 @@ features = [
[build-dependencies.slint-build] [build-dependencies.slint-build]
git = "https://github.com/flukejones/sixtyfps.git" git = "https://github.com/flukejones/sixtyfps.git"
branch = "asusctl" branch = "feat/color_hsv"
[dev-dependencies] [dev-dependencies]
cargo-husky.workspace = true cargo-husky.workspace = true

View File

@@ -2,7 +2,7 @@
msgid "" msgid ""
msgstr "" msgstr ""
"Project-Id-Version: PACKAGE VERSION\n" "Project-Id-Version: PACKAGE VERSION\n"
"POT-Creation-Date: 2024-03-30 17:12+0000\n" "POT-Creation-Date: 2024-03-30 17:43+0000\n"
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n" "Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
"Language-Team: LANGUAGE <LL@li.org>\n" "Language-Team: LANGUAGE <LL@li.org>\n"

View File

@@ -1,22 +1,28 @@
use std::cell::UnsafeCell; use std::cell::RefCell;
use std::fs::OpenOptions; use std::fs::{File, OpenOptions};
use std::io::Write; use std::io::Write;
use std::path::{Path, PathBuf}; use std::path::PathBuf;
use log::{info, warn}; use log::{info, warn};
use udev::Device; use udev::Device;
use crate::error::{PlatformError, Result}; use crate::error::{PlatformError, Result};
/// A USB device that utilizes hidraw for I/O
#[derive(Debug)] #[derive(Debug)]
pub struct HidRaw { pub struct HidRaw {
devfs_path: UnsafeCell<PathBuf>, /// The path to the `/dev/<name>` of the device
devfs_path: PathBuf,
/// The sysfs path
syspath: PathBuf, syspath: PathBuf,
/// The product ID. The vendor ID is not kept
prod_id: String, prod_id: String,
/// Retaining a handle to the file for the duration of `HidRaw`
file: RefCell<File>,
} }
impl HidRaw { impl HidRaw {
pub fn new(id_product: &str) -> Result<(Self, Device)> { pub fn new(id_product: &str) -> Result<Self> {
let mut enumerator = udev::Enumerator::new().map_err(|err| { let mut enumerator = udev::Enumerator::new().map_err(|err| {
warn!("{}", err); warn!("{}", err);
PlatformError::Udev("enumerator failed".into(), err) PlatformError::Udev("enumerator failed".into(), err)
@@ -27,47 +33,44 @@ impl HidRaw {
PlatformError::Udev("match_subsystem failed".into(), err) PlatformError::Udev("match_subsystem failed".into(), err)
})?; })?;
for device in enumerator for endpoint in enumerator
.scan_devices() .scan_devices()
.map_err(|e| PlatformError::IoPath("enumerator".to_owned(), e))? .map_err(|e| PlatformError::IoPath("enumerator".to_owned(), e))?
{ {
if let Some(parent_device) = device if let Some(usb_device) = endpoint
.parent_with_subsystem_devtype("usb", "usb_device") .parent_with_subsystem_devtype("usb", "usb_device")
.map_err(|e| { .map_err(|e| {
PlatformError::IoPath(device.devpath().to_string_lossy().to_string(), e) PlatformError::IoPath(endpoint.devpath().to_string_lossy().to_string(), e)
})? { })?
if let Some(parent) = parent_device.attribute_value("idProduct") { {
if parent == id_product { if let Some(parent_id) = usb_device.attribute_value("idProduct") {
if let Some(dev_node) = device.devnode() { if parent_id == id_product {
if let Some(dev_node) = endpoint.devnode() {
info!("Using device at: {:?} for hidraw control", dev_node); info!("Using device at: {:?} for hidraw control", dev_node);
return Ok(( return Ok(Self {
Self { file: RefCell::new(OpenOptions::new().write(true).open(dev_node)?),
devfs_path: UnsafeCell::new(dev_node.to_owned()), devfs_path: dev_node.to_owned(),
prod_id: id_product.to_string(), prod_id: id_product.to_string(),
syspath: device.syspath().into(), syspath: endpoint.syspath().into(),
}, });
parent_device,
));
} }
} }
} }
} else { } else {
// Try to see if there is a virtual device created with uhid for testing // Try to see if there is a virtual device created with uhid for testing
let dev_path = device.devpath().to_string_lossy(); let dev_path = endpoint.devpath().to_string_lossy();
if dev_path.contains("virtual") && dev_path.contains(&id_product.to_uppercase()) { if dev_path.contains("virtual") && dev_path.contains(&id_product.to_uppercase()) {
if let Some(dev_node) = device.devnode() { if let Some(dev_node) = endpoint.devnode() {
info!( info!(
"Using device at: {:?} for <TODO: label control> control", "Using device at: {:?} for <TODO: label control> control",
dev_node dev_node
); );
return Ok(( return Ok(Self {
Self { file: RefCell::new(OpenOptions::new().write(true).open(dev_node)?),
devfs_path: UnsafeCell::new(dev_node.to_owned()), devfs_path: dev_node.to_owned(),
prod_id: id_product.to_string(), prod_id: id_product.to_string(),
syspath: device.syspath().into(), syspath: endpoint.syspath().into(),
}, });
device,
));
} }
} }
} }
@@ -78,6 +81,7 @@ impl HidRaw {
))) )))
} }
/// Make `HidRaw` device from a udev device
pub fn from_device(device: Device) -> Result<Self> { pub fn from_device(device: Device) -> Result<Self> {
if let Some(parent) = device if let Some(parent) = device
.parent_with_subsystem_devtype("usb", "usb_device") .parent_with_subsystem_devtype("usb", "usb_device")
@@ -86,7 +90,8 @@ impl HidRaw {
if let Some(dev_node) = device.devnode() { if let Some(dev_node) = device.devnode() {
if let Some(id_product) = parent.attribute_value("idProduct") { if let Some(id_product) = parent.attribute_value("idProduct") {
return Ok(Self { return Ok(Self {
devfs_path: UnsafeCell::new(dev_node.to_owned()), file: RefCell::new(OpenOptions::new().write(true).open(dev_node)?),
devfs_path: dev_node.to_owned(),
prod_id: id_product.to_string_lossy().into(), prod_id: id_product.to_string_lossy().into(),
syspath: device.syspath().into(), syspath: device.syspath().into(),
}); });
@@ -102,41 +107,22 @@ impl HidRaw {
&self.prod_id &self.prod_id
} }
pub fn devfs_path(&self) -> PathBuf { /// Write an array of raw bytes to the device using the hidraw interface
unsafe { &*(self.devfs_path.get()) }.clone()
}
pub fn syspath(&self) -> &Path {
&self.syspath
}
pub fn write_bytes(&self, message: &[u8]) -> Result<()> { pub fn write_bytes(&self, message: &[u8]) -> Result<()> {
let mut path = unsafe { &*(self.devfs_path.get()) }; if let Ok(mut file) = self.file.try_borrow_mut() {
let mut file = match OpenOptions::new().write(true).open(path) { // let mut file = self.file.borrow_mut();
Ok(f) => f, // TODO: re-get the file if error?
Err(e) => { file.write_all(message).map_err(|e| {
warn!( PlatformError::IoPath(self.devfs_path.to_string_lossy().to_string(), e)
"write_bytes failed for {:?}, trying again: {e}", })?;
self.devfs_path }
); Ok(())
unsafe {
*(self.devfs_path.get()) =
(*(Self::new(&self.prod_id)?.0.devfs_path.get())).clone();
path = &mut *(self.devfs_path.get());
}
OpenOptions::new()
.write(true)
.open(path)
.map_err(|e| PlatformError::IoPath(path.to_string_lossy().to_string(), e))?
}
};
file.write_all(message)
.map_err(|e| PlatformError::IoPath(path.to_string_lossy().to_string(), e))
} }
/// This method was added for certain devices like AniMe to prevent them
/// waking the laptop
pub fn set_wakeup_disabled(&self) -> Result<()> { pub fn set_wakeup_disabled(&self) -> Result<()> {
let path = unsafe { &*(self.devfs_path.get()) }; let mut dev = Device::from_syspath(&self.syspath)?;
let mut dev = Device::from_syspath(path)?;
Ok(dev.set_attribute_value("power/wakeup", "disabled")?) Ok(dev.set_attribute_value("power/wakeup", "disabled")?)
} }
} }