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

View File

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

View File

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

View File

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

View File

@@ -18,6 +18,12 @@ pub enum AuraPowerConfig {
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] {
@@ -101,7 +107,7 @@ impl From<&AuraPowerConfig> for AuraPowerDev {
}
}
#[derive(Deserialize, Serialize, Debug, Clone)]
#[derive(Deserialize, Serialize, Default, Debug, Clone)]
// #[serde(default)]
pub struct AuraConfig {
pub config_name: String,
@@ -116,7 +122,7 @@ pub struct AuraConfig {
impl AuraConfig {
/// Detect the keyboard type and load from default DB if data available
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())
}
}
@@ -142,10 +148,6 @@ impl StdConfig for AuraConfig {
impl StdConfigLoad for 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 {
// create a default config here
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 inotify::Inotify;
use log::info;
use log::{debug, info, warn};
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::{AuraEffect, Direction, LedBrightness, Speed, GRADIENT, LED_MSG_LEN};
use rog_platform::hid_raw::HidRaw;
@@ -59,84 +59,102 @@ pub struct CtrlKbdLed {
}
impl CtrlKbdLed {
pub fn new(data: LaptopLedData) -> Result<Self, RogError> {
let mut led_prod = AuraDevice::Unknown;
let mut usb_node = None;
for prod in ASUS_KEYBOARD_DEVICES {
match HidRaw::new(prod.into()) {
Ok(node) => {
led_prod = prod;
usb_node = Some(node);
info!(
"Looked for keyboard controller 0x{}: Found",
<&str>::from(prod)
);
break;
pub fn find_all(data: &LaptopLedData) -> Result<Vec<Self>, RogError> {
info!("Searching for all Aura devices");
let mut devices = Vec::new();
let mut found = HashSet::new(); // track and ensure we use only one hidraw per prod_id
let mut enumerator = udev::Enumerator::new().map_err(|err| {
warn!("{}", err);
err
})?;
enumerator.match_subsystem("hidraw").map_err(|err| {
warn!("{}", err);
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!(
"Looked for keyboard controller 0x{}: {err}",
<&str>::from(prod)
),
// 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;
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();
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)
Ok(devices)
}
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,
dbus_path: OwnedObjectPath,
data: LaptopLedData,
data: &LaptopLedData,
) -> Result<Self, RogError> {
let rgb_led = KeyboardLed::new()?;
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
let config = Self::init_config(prod_id, &data);
// let config = Self::init_config(prod_id, data);
let ctrl = CtrlKbdLed {
led_prod: prod_id,
led_node: LEDNode::Rog(rgb_led, device), /* on TUF this is the same as rgb_led /
* kd_brightness */
supported_data: data,
led_node: LEDNode::Rog(rgb_led, device),
supported_data: data.clone(),
per_key_mode_active: false,
config,
config: AuraConfig::default(),
dbus_path,
};
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
let mut config_init = AuraConfig::new_with(prod_id);
// config_init.set_filename(prod_id);
let mut config_loaded = config_init.clone().load();
config_loaded.set_filename(prod_id);
// update the initialised data with what we loaded from disk
for mode in &mut config_init.builtins {
// 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
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 rog_aura::aura_detection::LaptopLedData;
use rog_aura::usb::AuraDevice;
use rog_platform::hid_raw::HidRaw;
use tokio::sync::Mutex;
use tokio::task::spawn_blocking;
use udev::{Device, MonitorBuilder};
// use zbus::fdo::ObjectManager;
use zbus::object_server::SignalContext;
@@ -26,38 +26,31 @@ use crate::{CtrlTask, Reloadable};
pub struct AuraManager {
_connection: Connection,
_interfaces: Arc<Mutex<HashSet<OwnedObjectPath>>>,
}
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 data = LaptopLedData::get_data();
let mut interfaces = HashSet::new();
// Do the initial keyboard detection:
match CtrlKbdLed::new(data.clone()) {
Ok(ctrl) => {
let path = ctrl.dbus_path.clone();
let sig_ctx = CtrlAuraZbus::signal_context(&connection)?;
let sig_ctx2 = sig_ctx.clone();
let zbus = CtrlAuraZbus::new(ctrl, sig_ctx);
start_tasks(zbus, &mut connection, sig_ctx2, &path).await?;
}
Err(err) => {
error!("Keyboard control: {}", err);
}
let all = CtrlKbdLed::find_all(&data)?;
for ctrl in all {
let path = ctrl.dbus_path.clone();
interfaces.insert(path.clone()); // ensure we record the initial stuff
let sig_ctx = CtrlAuraZbus::signal_context(&connection)?;
let sig_ctx2 = sig_ctx.clone();
let zbus = CtrlAuraZbus::new(ctrl, sig_ctx);
start_tasks(zbus, connection.clone(), sig_ctx2, path).await?;
}
// connection.object_server().at("/org/asuslinux",
// ObjectManager).await.unwrap();
let manager = Self {
_connection: connection,
_interfaces: Default::default(),
};
// 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 poll = Poll::new()?;
let mut events = Events::with_capacity(1024);
@@ -65,46 +58,71 @@ impl AuraManager {
.register(&mut monitor, Token(0), Interest::READABLE)?;
loop {
poll.poll(&mut events, None).unwrap();
if poll.poll(&mut events, None).is_err() {
continue;
}
for event in monitor.iter() {
if let Some(parent) =
let parent = if let Some(parent) =
event.parent_with_subsystem_devtype("usb", "usb_device")?
{
let action = if let Some(action) = event.action() {
action
} else {
continue;
};
parent
} else {
continue;
};
if action == "remove" {
if let Some(path) = dbus_path_for_dev(parent.clone()) {
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>(())
});
}
let action = if let Some(action) = event.action() {
action
} else {
continue;
};
let id_product = if let Some(id_product) = parent.attribute_value("idProduct") {
id_product.to_string_lossy()
} else {
continue;
};
let path = if let Some(path) = dbus_path_for_dev(&parent) {
path
} 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 =
if let Some(id_product) = parent.attribute_value("idProduct") {
id_product
} else {
continue;
};
// Need to check the driver is asus to prevent using hid_generic
if let Some(p2) = event.parent() {
if let Some(driver) = p2.driver() {
// There is a tree of devices added so filter by driver
if driver != "asus" {
debug!("{id_product:?} driver was not asus, skipping");
continue;
}
} else {
@@ -112,50 +130,30 @@ impl AuraManager {
}
}
// try conversion to known idProduct
let aura_device = AuraDevice::from(id_product.to_str().unwrap());
if aura_device != AuraDevice::Unknown {
if action == "add" {
let dev_node = if let Some(dev_node) = event.devnode() {
dev_node
} else {
continue;
};
if let Ok(raw) = HidRaw::from_device(event.device())
.map_err(|e| error!("device path error: {e:?}"))
if let Some(dev_node) = event.devnode() {
if let Ok(raw) = HidRaw::from_device(event.device())
.map_err(|e| error!("device path error: {e:?}"))
{
if let Ok(mut ctrl) =
CtrlKbdLed::from_hidraw(raw, path.clone(), &data)
{
let path = if let Some(path) = dbus_path_for_dev(parent) {
path
} else {
continue;
};
if let Ok(ctrl) =
CtrlKbdLed::from_device(raw, path.clone(), data.clone())
{
info!("AuraManager found device at: {:?}", dev_node);
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
}
ctrl.config = CtrlKbdLed::init_config(aura_device, &data);
interfaces.insert(path.clone());
info!("AuraManager starting device at: {dev_node:?}, {path:?}");
let sig_ctx = CtrlAuraZbus::signal_context(&conn_copy)?;
let zbus = CtrlAuraZbus::new(ctrl, sig_ctx);
let sig_ctx = CtrlAuraZbus::signal_context(&conn_copy)?;
let conn_copy = conn_copy.clone();
tokio::spawn(async move {
start_tasks(zbus, conn_copy.clone(), sig_ctx, path).await
});
}
}
} 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)]
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") {
let id_product = id_product.to_string_lossy();
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(
mut zbus: CtrlAuraZbus,
connection: &mut Connection,
signal_ctx: SignalContext<'static>,
path: &ObjectPath<'static>,
connection: Connection,
_signal_ctx: SignalContext<'static>,
path: OwnedObjectPath,
) -> Result<(), RogError> {
let task = zbus.clone();
// let task = zbus.clone();
// let signal_ctx = signal_ctx.clone();
zbus.reload()
.await
.unwrap_or_else(|err| warn!("Controller error: {}", err));
connection
.object_server()
.at(&ObjectPath::from_str_unchecked(path), zbus)
.await
.unwrap();
task.create_tasks(signal_ctx).await.ok();
connection.object_server().at(path, zbus).await.unwrap();
// TODO: skip this until we keep handles to tasks so they can be killed
// task.create_tasks(signal_ctx).await
Ok(())
}

View File

@@ -210,23 +210,29 @@ impl CtrlTask for CtrlAuraZbus {
}
async fn create_tasks(&self, _: SignalContext<'static>) -> Result<(), RogError> {
let load_save = |start: bool, mut lock: MutexGuard<'_, CtrlKbdLed>| {
// If waking up
if !start {
info!("CtrlKbdLedTask reloading brightness and modes");
lock.led_node
.set_brightness(lock.config.brightness.into())
.map_err(|e| error!("CtrlKbdLedTask: {e}"))
.ok();
lock.write_current_config_mode()
.map_err(|e| error!("CtrlKbdLedTask: {e}"))
.ok();
} else if start {
Self::update_config(&mut lock)
.map_err(|e| error!("CtrlKbdLedTask: {e}"))
.ok();
}
};
let load_save =
|start: bool, mut lock: MutexGuard<'_, CtrlKbdLed>| -> Result<(), RogError> {
// If waking up
if !start {
info!("CtrlKbdLedTask reloading brightness and modes");
lock.led_node
.set_brightness(lock.config.brightness.into())
.map_err(|e| {
error!("CtrlKbdLedTask: {e}");
e
})?;
lock.write_current_config_mode().map_err(|e| {
error!("CtrlKbdLedTask: {e}");
e
})?;
} else if start {
Self::update_config(&mut lock).map_err(|e| {
error!("CtrlKbdLedTask: {e}");
e
})?;
}
Ok(())
};
let inner1 = self.0.clone();
let inner3 = self.0.clone();
@@ -235,14 +241,16 @@ impl CtrlTask for CtrlAuraZbus {
let inner1 = inner1.clone();
async move {
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| {
let inner3 = inner3.clone();
async move {
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| {
@@ -266,7 +274,8 @@ impl CtrlTask for CtrlAuraZbus {
.unwrap()
.for_each(|_| async {
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;

View File

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

View File

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

View File

@@ -719,6 +719,14 @@
advanced_type: None,
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",
layout_name: "ga401q",

View File

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

View File

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

View File

@@ -2,7 +2,7 @@
msgid ""
msgstr ""
"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"
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
"Language-Team: LANGUAGE <LL@li.org>\n"

View File

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