mirror of
https://gitlab.com/asus-linux/asusctl.git
synced 2026-02-06 00:15:04 +01:00
Cause great pain to self with cargo-deny + cargo-cranky
This commit is contained in:
@@ -1,27 +1,57 @@
|
|||||||
image: rust:latest
|
image: rust:latest
|
||||||
|
|
||||||
|
cache:
|
||||||
|
key: "$CI_JOB_NAME-$CI_COMMIT_REF_SLUG"
|
||||||
|
paths:
|
||||||
|
# Don't include `incremental` to save space
|
||||||
|
# Debug
|
||||||
|
- target/debug/build/
|
||||||
|
- target/debug/deps/
|
||||||
|
- target/debug/.fingerprint/
|
||||||
|
- target/debug/.cargo-lock
|
||||||
|
- target/debug/df_storyteller
|
||||||
|
# Release
|
||||||
|
- target/release/build/
|
||||||
|
- target/release/deps/
|
||||||
|
- target/release/.fingerprint/
|
||||||
|
- target/release/.cargo-lock
|
||||||
|
|
||||||
before_script:
|
before_script:
|
||||||
- apt-get update -qq && apt-get install -y -qq libudev-dev libgtk-3-dev
|
- apt-get update -qq && apt-get install -y -qq libudev-dev libgtk-3-dev
|
||||||
|
|
||||||
stages:
|
stages:
|
||||||
|
- format
|
||||||
|
- check
|
||||||
- test
|
- test
|
||||||
- build
|
- release
|
||||||
|
|
||||||
test:
|
format:
|
||||||
|
image: rust:latest
|
||||||
|
script:
|
||||||
|
- echo "nightly" > rust-toolchain
|
||||||
|
- rustup component add rustfmt
|
||||||
|
- cargo fmt --check
|
||||||
|
|
||||||
|
check:
|
||||||
script:
|
script:
|
||||||
- rustup component add clippy
|
- rustup component add clippy
|
||||||
- cargo check
|
- cargo check
|
||||||
- cargo clippy
|
# deny currently catches too much
|
||||||
|
#- cargo install cargo-deny && cargo deny
|
||||||
|
- cargo install cargo-cranky && cargo cranky
|
||||||
|
|
||||||
|
test:
|
||||||
|
script:
|
||||||
- cargo test
|
- cargo test
|
||||||
|
|
||||||
build:
|
release:
|
||||||
only:
|
only:
|
||||||
- main
|
- tags
|
||||||
script:
|
script:
|
||||||
- make && make vendor
|
- make && make vendor
|
||||||
artifacts:
|
artifacts:
|
||||||
paths:
|
paths:
|
||||||
- vendor_asus-nb-ctrl_*.tar.xz
|
- vendor_asusctl_*.tar.xz
|
||||||
- cargo-config
|
- cargo-config
|
||||||
|
|
||||||
variables:
|
variables:
|
||||||
|
|||||||
194
Cargo.lock
generated
194
Cargo.lock
generated
@@ -271,17 +271,6 @@ version = "0.1.8"
|
|||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "73b5e5f48b927f04e952dedc932f31995a65a0bf65ec971c74436e51bf6e970d"
|
checksum = "73b5e5f48b927f04e952dedc932f31995a65a0bf65ec971c74436e51bf6e970d"
|
||||||
|
|
||||||
[[package]]
|
|
||||||
name = "atty"
|
|
||||||
version = "0.2.14"
|
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
||||||
checksum = "d9b39be18770d11421cdb1b9947a45dd3f37e93092cbf377614828a319d5fee8"
|
|
||||||
dependencies = [
|
|
||||||
"hermit-abi",
|
|
||||||
"libc",
|
|
||||||
"winapi",
|
|
||||||
]
|
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "autocfg"
|
name = "autocfg"
|
||||||
version = "1.1.0"
|
version = "1.1.0"
|
||||||
@@ -398,7 +387,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
|
|||||||
checksum = "5bcf530afb40e45e14440701e5e996d7fd139e84a912a4d83a8d6a0fb3e58663"
|
checksum = "5bcf530afb40e45e14440701e5e996d7fd139e84a912a4d83a8d6a0fb3e58663"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"log",
|
"log",
|
||||||
"nix 0.25.0",
|
"nix 0.25.1",
|
||||||
"slotmap",
|
"slotmap",
|
||||||
"thiserror",
|
"thiserror",
|
||||||
"vec_map",
|
"vec_map",
|
||||||
@@ -870,7 +859,7 @@ dependencies = [
|
|||||||
"bytemuck",
|
"bytemuck",
|
||||||
"egui",
|
"egui",
|
||||||
"glow",
|
"glow",
|
||||||
"memoffset",
|
"memoffset 0.6.5",
|
||||||
"tracing",
|
"tracing",
|
||||||
"wasm-bindgen",
|
"wasm-bindgen",
|
||||||
"web-sys",
|
"web-sys",
|
||||||
@@ -930,12 +919,12 @@ dependencies = [
|
|||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "env_logger"
|
name = "env_logger"
|
||||||
version = "0.9.3"
|
version = "0.10.0"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "a12e6657c4c97ebab115a42dcee77225f7f482cdd841cf7088c657a42e9e00e7"
|
checksum = "85cdab6a89accf66733ad5a1693a4dcced6aeff64602b634530dd73c1f3ee9f0"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"atty",
|
|
||||||
"humantime",
|
"humantime",
|
||||||
|
"is-terminal",
|
||||||
"log",
|
"log",
|
||||||
"regex",
|
"regex",
|
||||||
"termcolor",
|
"termcolor",
|
||||||
@@ -955,6 +944,27 @@ dependencies = [
|
|||||||
"parking_lot",
|
"parking_lot",
|
||||||
]
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "errno"
|
||||||
|
version = "0.2.8"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "f639046355ee4f37944e44f60642c6f3a7efa3cf6b78c78a0d989a8ce6c396a1"
|
||||||
|
dependencies = [
|
||||||
|
"errno-dragonfly",
|
||||||
|
"libc",
|
||||||
|
"winapi",
|
||||||
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "errno-dragonfly"
|
||||||
|
version = "0.1.2"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "aa68f1b12764fab894d2755d2518754e71b4fd80ecfb822714a1206c2aab39bf"
|
||||||
|
dependencies = [
|
||||||
|
"cc",
|
||||||
|
"libc",
|
||||||
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "error-code"
|
name = "error-code"
|
||||||
version = "2.3.1"
|
version = "2.3.1"
|
||||||
@@ -996,7 +1006,7 @@ version = "0.3.4"
|
|||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "1e1c54951450cbd39f3dbcf1005ac413b49487dabf18a720ad2383eccfeffb92"
|
checksum = "1e1c54951450cbd39f3dbcf1005ac413b49487dabf18a720ad2383eccfeffb92"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"memoffset",
|
"memoffset 0.6.5",
|
||||||
"rustc_version",
|
"rustc_version",
|
||||||
]
|
]
|
||||||
|
|
||||||
@@ -1265,9 +1275,9 @@ dependencies = [
|
|||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "gif"
|
name = "gif"
|
||||||
version = "0.11.4"
|
version = "0.12.0"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "3edd93c6756b4dfaf2709eafcc345ba2636565295c198a9cfbf75fa5e3e00b06"
|
checksum = "80792593675e051cf94a4b111980da2ba60d4a83e43e0048c5693baab3977045"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"color_quant",
|
"color_quant",
|
||||||
"weezl",
|
"weezl",
|
||||||
@@ -1555,6 +1565,15 @@ dependencies = [
|
|||||||
"libc",
|
"libc",
|
||||||
]
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "hermit-abi"
|
||||||
|
version = "0.2.6"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "ee512640fe35acbfb4bb779db6f0d80704c2cacfa2e39b601ef3e3f47d1ae4c7"
|
||||||
|
dependencies = [
|
||||||
|
"libc",
|
||||||
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "hex"
|
name = "hex"
|
||||||
version = "0.4.3"
|
version = "0.4.3"
|
||||||
@@ -1617,6 +1636,28 @@ dependencies = [
|
|||||||
"web-sys",
|
"web-sys",
|
||||||
]
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "io-lifetimes"
|
||||||
|
version = "1.0.3"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "46112a93252b123d31a119a8d1a1ac19deac4fac6e0e8b0df58f0d4e5870e63c"
|
||||||
|
dependencies = [
|
||||||
|
"libc",
|
||||||
|
"windows-sys 0.42.0",
|
||||||
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "is-terminal"
|
||||||
|
version = "0.4.1"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "927609f78c2913a6f6ac3c27a4fe87f43e2a35367c0c4b0f8265e8f49a104330"
|
||||||
|
dependencies = [
|
||||||
|
"hermit-abi 0.2.6",
|
||||||
|
"io-lifetimes",
|
||||||
|
"rustix",
|
||||||
|
"windows-sys 0.42.0",
|
||||||
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "itoa"
|
name = "itoa"
|
||||||
version = "1.0.4"
|
version = "1.0.4"
|
||||||
@@ -1726,6 +1767,12 @@ dependencies = [
|
|||||||
"vcpkg",
|
"vcpkg",
|
||||||
]
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "linux-raw-sys"
|
||||||
|
version = "0.1.3"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "8f9f08d8963a6c613f4b1a78f4f4a4dbfadf8e6545b2d72861731e4858b8b47f"
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "lock_api"
|
name = "lock_api"
|
||||||
version = "0.4.9"
|
version = "0.4.9"
|
||||||
@@ -1801,6 +1848,15 @@ dependencies = [
|
|||||||
"autocfg",
|
"autocfg",
|
||||||
]
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "memoffset"
|
||||||
|
version = "0.7.1"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "5de893c32cde5f383baa4c04c5d6dbdd735cfd4a794b0debdb2bb1b421da5ff4"
|
||||||
|
dependencies = [
|
||||||
|
"autocfg",
|
||||||
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "micromath"
|
name = "micromath"
|
||||||
version = "1.1.1"
|
version = "1.1.1"
|
||||||
@@ -1904,46 +1960,50 @@ dependencies = [
|
|||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "nix"
|
name = "nix"
|
||||||
version = "0.24.2"
|
version = "0.24.3"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "195cdbc1741b8134346d515b3a56a1c94b0912758009cfd53f99ea0f57b065fc"
|
checksum = "fa52e972a9a719cecb6864fb88568781eb706bac2cd1d4f04a648542dbf78069"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"bitflags",
|
"bitflags",
|
||||||
"cfg-if",
|
"cfg-if",
|
||||||
"libc",
|
"libc",
|
||||||
"memoffset",
|
"memoffset 0.6.5",
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "nix"
|
name = "nix"
|
||||||
version = "0.25.0"
|
version = "0.25.1"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "e322c04a9e3440c327fca7b6c8a63e6890a32fa2ad689db972425f07e0d22abb"
|
checksum = "f346ff70e7dbfd675fe90590b92d59ef2de15a8779ae305ebcbfd3f0caf59be4"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"autocfg",
|
"autocfg",
|
||||||
"bitflags",
|
"bitflags",
|
||||||
"cfg-if",
|
"cfg-if",
|
||||||
"libc",
|
"libc",
|
||||||
"memoffset",
|
"memoffset 0.6.5",
|
||||||
"pin-utils",
|
"pin-utils",
|
||||||
]
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "nix"
|
||||||
|
version = "0.26.1"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "46a58d1d356c6597d08cde02c2f09d785b09e28711837b1ed667dc652c08a694"
|
||||||
|
dependencies = [
|
||||||
|
"bitflags",
|
||||||
|
"cfg-if",
|
||||||
|
"libc",
|
||||||
|
"memoffset 0.7.1",
|
||||||
|
"pin-utils",
|
||||||
|
"static_assertions",
|
||||||
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "nohash-hasher"
|
name = "nohash-hasher"
|
||||||
version = "0.2.0"
|
version = "0.2.0"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "2bf50223579dc7cdcfb3bfcacf7069ff68243f8c363f62ffa99cf000a6b9c451"
|
checksum = "2bf50223579dc7cdcfb3bfcacf7069ff68243f8c363f62ffa99cf000a6b9c451"
|
||||||
|
|
||||||
[[package]]
|
|
||||||
name = "nom"
|
|
||||||
version = "6.1.2"
|
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
||||||
checksum = "e7413f999671bd4745a7b624bd370a569fb6bc574b23c83a3c5ed2e453f3d5e2"
|
|
||||||
dependencies = [
|
|
||||||
"memchr",
|
|
||||||
"version_check",
|
|
||||||
]
|
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "nom"
|
name = "nom"
|
||||||
version = "7.1.1"
|
version = "7.1.1"
|
||||||
@@ -1980,7 +2040,7 @@ version = "1.14.0"
|
|||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "f6058e64324c71e02bc2b150e4f3bc8286db6c83092132ffa3f6b1eab0f9def5"
|
checksum = "f6058e64324c71e02bc2b150e4f3bc8286db6c83092132ffa3f6b1eab0f9def5"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"hermit-abi",
|
"hermit-abi 0.1.19",
|
||||||
"libc",
|
"libc",
|
||||||
]
|
]
|
||||||
|
|
||||||
@@ -2048,9 +2108,9 @@ checksum = "86f0b0d4bf799edbc74508c1e8bf170ff5f41238e5f8225603ca7caaae2b7860"
|
|||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "ordered-stream"
|
name = "ordered-stream"
|
||||||
version = "0.1.1"
|
version = "0.1.2"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "034ce384018b245e8d8424bbe90577fbd91a533be74107e465e3474eb2285eef"
|
checksum = "01ca8c99d73c6e92ac1358f9f692c22c0bfd9c4701fa086f5d365c0d4ea818ea"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"futures-core",
|
"futures-core",
|
||||||
"pin-project-lite",
|
"pin-project-lite",
|
||||||
@@ -2136,9 +2196,9 @@ checksum = "478c572c3d73181ff3c2539045f6eb99e5491218eae919370993b890cdbdd98e"
|
|||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "pest"
|
name = "pest"
|
||||||
version = "2.5.0"
|
version = "2.5.1"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "5f400b0f7905bf702f9f3dc3df5a121b16c54e9e8012c082905fdf09a931861a"
|
checksum = "cc8bed3549e0f9b0a2a78bf7c0018237a2cdf085eecbbc048e52612438e4e9d0"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"thiserror",
|
"thiserror",
|
||||||
"ucd-trie",
|
"ucd-trie",
|
||||||
@@ -2378,7 +2438,7 @@ dependencies = [
|
|||||||
"gtk",
|
"gtk",
|
||||||
"libappindicator",
|
"libappindicator",
|
||||||
"log",
|
"log",
|
||||||
"nix 0.25.0",
|
"nix 0.26.1",
|
||||||
"notify-rust",
|
"notify-rust",
|
||||||
"png_pong",
|
"png_pong",
|
||||||
"rog_anime",
|
"rog_anime",
|
||||||
@@ -2445,7 +2505,7 @@ dependencies = [
|
|||||||
"serde",
|
"serde",
|
||||||
"serde_derive",
|
"serde_derive",
|
||||||
"sysfs-class",
|
"sysfs-class",
|
||||||
"udev",
|
"udev 0.7.0",
|
||||||
"zbus",
|
"zbus",
|
||||||
]
|
]
|
||||||
|
|
||||||
@@ -2455,7 +2515,7 @@ version = "4.5.2"
|
|||||||
dependencies = [
|
dependencies = [
|
||||||
"serde",
|
"serde",
|
||||||
"serde_derive",
|
"serde_derive",
|
||||||
"udev",
|
"udev 0.7.0",
|
||||||
"zbus",
|
"zbus",
|
||||||
]
|
]
|
||||||
|
|
||||||
@@ -2478,6 +2538,20 @@ dependencies = [
|
|||||||
"semver",
|
"semver",
|
||||||
]
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "rustix"
|
||||||
|
version = "0.36.4"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "cb93e85278e08bb5788653183213d3a60fc242b10cb9be96586f5a73dcb67c23"
|
||||||
|
dependencies = [
|
||||||
|
"bitflags",
|
||||||
|
"errno",
|
||||||
|
"io-lifetimes",
|
||||||
|
"libc",
|
||||||
|
"linux-raw-sys",
|
||||||
|
"windows-sys 0.42.0",
|
||||||
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "ryu"
|
name = "ryu"
|
||||||
version = "1.0.11"
|
version = "1.0.11"
|
||||||
@@ -2683,7 +2757,7 @@ dependencies = [
|
|||||||
"lazy_static",
|
"lazy_static",
|
||||||
"log",
|
"log",
|
||||||
"memmap2",
|
"memmap2",
|
||||||
"nix 0.24.2",
|
"nix 0.24.3",
|
||||||
"pkg-config",
|
"pkg-config",
|
||||||
"wayland-client",
|
"wayland-client",
|
||||||
"wayland-cursor",
|
"wayland-cursor",
|
||||||
@@ -2777,7 +2851,7 @@ dependencies = [
|
|||||||
"serde_derive",
|
"serde_derive",
|
||||||
"serde_json",
|
"serde_json",
|
||||||
"tokio",
|
"tokio",
|
||||||
"udev",
|
"udev 0.6.3",
|
||||||
"zbus",
|
"zbus",
|
||||||
"zvariant",
|
"zvariant",
|
||||||
"zvariant_derive",
|
"zvariant_derive",
|
||||||
@@ -2913,12 +2987,11 @@ dependencies = [
|
|||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "tinybmp"
|
name = "tinybmp"
|
||||||
version = "0.3.3"
|
version = "0.4.0"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "44873aee48dd30712dc2610209902a78b9033a0148ac03c6c3e73e4ca2f49838"
|
checksum = "0e959c507975d768a226a08227d56791f6e60bddcf714ad7ef67ae2d20bae743"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"embedded-graphics",
|
"embedded-graphics",
|
||||||
"nom 6.1.2",
|
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
@@ -3033,6 +3106,17 @@ dependencies = [
|
|||||||
"pkg-config",
|
"pkg-config",
|
||||||
]
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "udev"
|
||||||
|
version = "0.7.0"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "4ebdbbd670373442a12fe9ef7aeb53aec4147a5a27a00bbc3ab639f08f48191a"
|
||||||
|
dependencies = [
|
||||||
|
"libc",
|
||||||
|
"libudev-sys",
|
||||||
|
"pkg-config",
|
||||||
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "uds_windows"
|
name = "uds_windows"
|
||||||
version = "1.0.2"
|
version = "1.0.2"
|
||||||
@@ -3203,7 +3287,7 @@ dependencies = [
|
|||||||
"bitflags",
|
"bitflags",
|
||||||
"downcast-rs",
|
"downcast-rs",
|
||||||
"libc",
|
"libc",
|
||||||
"nix 0.24.2",
|
"nix 0.24.3",
|
||||||
"scoped-tls",
|
"scoped-tls",
|
||||||
"wayland-commons",
|
"wayland-commons",
|
||||||
"wayland-scanner",
|
"wayland-scanner",
|
||||||
@@ -3216,7 +3300,7 @@ version = "0.29.5"
|
|||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "8691f134d584a33a6606d9d717b95c4fa20065605f798a3f350d78dced02a902"
|
checksum = "8691f134d584a33a6606d9d717b95c4fa20065605f798a3f350d78dced02a902"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"nix 0.24.2",
|
"nix 0.24.3",
|
||||||
"once_cell",
|
"once_cell",
|
||||||
"smallvec",
|
"smallvec",
|
||||||
"wayland-sys",
|
"wayland-sys",
|
||||||
@@ -3228,7 +3312,7 @@ version = "0.29.5"
|
|||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "6865c6b66f13d6257bef1cd40cbfe8ef2f150fb8ebbdb1e8e873455931377661"
|
checksum = "6865c6b66f13d6257bef1cd40cbfe8ef2f150fb8ebbdb1e8e873455931377661"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"nix 0.24.2",
|
"nix 0.24.3",
|
||||||
"wayland-client",
|
"wayland-client",
|
||||||
"xcursor",
|
"xcursor",
|
||||||
]
|
]
|
||||||
@@ -3567,7 +3651,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
|
|||||||
checksum = "592b4883219f345e712b3209c62654ebda0bb50887f330cbd018d0f654bfd507"
|
checksum = "592b4883219f345e712b3209c62654ebda0bb50887f330cbd018d0f654bfd507"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"gethostname",
|
"gethostname",
|
||||||
"nix 0.24.2",
|
"nix 0.24.3",
|
||||||
"winapi",
|
"winapi",
|
||||||
"winapi-wsapoll",
|
"winapi-wsapoll",
|
||||||
"x11rb-protocol",
|
"x11rb-protocol",
|
||||||
@@ -3579,7 +3663,7 @@ version = "0.10.0"
|
|||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "56b245751c0ac9db0e006dc812031482784e434630205a93c73cfefcaabeac67"
|
checksum = "56b245751c0ac9db0e006dc812031482784e434630205a93c73cfefcaabeac67"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"nix 0.24.2",
|
"nix 0.24.3",
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
@@ -3588,7 +3672,7 @@ version = "0.3.4"
|
|||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "463705a63313cd4301184381c5e8042f0a7e9b4bb63653f216311d4ae74690b7"
|
checksum = "463705a63313cd4301184381c5e8042f0a7e9b4bb63653f216311d4ae74690b7"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"nom 7.1.1",
|
"nom",
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
@@ -3620,7 +3704,7 @@ dependencies = [
|
|||||||
"futures-sink",
|
"futures-sink",
|
||||||
"futures-util",
|
"futures-util",
|
||||||
"hex",
|
"hex",
|
||||||
"nix 0.25.0",
|
"nix 0.25.1",
|
||||||
"once_cell",
|
"once_cell",
|
||||||
"ordered-stream",
|
"ordered-stream",
|
||||||
"rand",
|
"rand",
|
||||||
|
|||||||
@@ -20,19 +20,19 @@ serde_json = "^1.0"
|
|||||||
toml = "^0.5.9"
|
toml = "^0.5.9"
|
||||||
|
|
||||||
log = "^0.4"
|
log = "^0.4"
|
||||||
env_logger = "^0.9.3"
|
env_logger = "^0.10.0"
|
||||||
|
|
||||||
glam = { version = "^0.22", features = ["serde"] }
|
glam = { version = "^0.22", features = ["serde"] }
|
||||||
gumdrop = "^0.8"
|
gumdrop = "^0.8"
|
||||||
udev = "^0.6"
|
udev = "^0.7"
|
||||||
rusb = "^0.9"
|
rusb = "^0.9"
|
||||||
sysfs-class = "^0.1.3"
|
sysfs-class = "^0.1.3"
|
||||||
inotify = "^0.10.0"
|
inotify = "^0.10.0"
|
||||||
|
|
||||||
png_pong = "^0.8"
|
png_pong = "^0.8"
|
||||||
pix = "^0.13"
|
pix = "^0.13"
|
||||||
tinybmp = "^0.3"
|
tinybmp = "^0.4.0"
|
||||||
gif = "^0.11"
|
gif = "^0.12.0"
|
||||||
|
|
||||||
notify-rust = { git = "https://github.com/flukejones/notify-rust.git", default-features = false, features = ["z"] }
|
notify-rust = { git = "https://github.com/flukejones/notify-rust.git", default-features = false, features = ["z"] }
|
||||||
|
|
||||||
|
|||||||
121
Cranky.toml
Normal file
121
Cranky.toml
Normal file
@@ -0,0 +1,121 @@
|
|||||||
|
# https://github.com/ericseppanen/cargo-cranky
|
||||||
|
# cargo install cargo-cranky && cargo cranky
|
||||||
|
|
||||||
|
warn = [
|
||||||
|
"clippy::all",
|
||||||
|
"clippy::await_holding_lock",
|
||||||
|
"clippy::bool_to_int_with_if",
|
||||||
|
"clippy::char_lit_as_u8",
|
||||||
|
"clippy::checked_conversions",
|
||||||
|
"clippy::dbg_macro",
|
||||||
|
"clippy::debug_assert_with_mut_call",
|
||||||
|
"clippy::disallowed_methods",
|
||||||
|
"clippy::disallowed_script_idents",
|
||||||
|
"clippy::doc_link_with_quotes",
|
||||||
|
"clippy::doc_markdown",
|
||||||
|
"clippy::empty_enum",
|
||||||
|
"clippy::enum_glob_use",
|
||||||
|
"clippy::equatable_if_let",
|
||||||
|
"clippy::exit",
|
||||||
|
"clippy::expl_impl_clone_on_copy",
|
||||||
|
"clippy::explicit_deref_methods",
|
||||||
|
"clippy::explicit_into_iter_loop",
|
||||||
|
"clippy::explicit_iter_loop",
|
||||||
|
"clippy::fallible_impl_from",
|
||||||
|
"clippy::filter_map_next",
|
||||||
|
"clippy::flat_map_option",
|
||||||
|
"clippy::float_cmp_const",
|
||||||
|
"clippy::fn_params_excessive_bools",
|
||||||
|
"clippy::fn_to_numeric_cast_any",
|
||||||
|
"clippy::from_iter_instead_of_collect",
|
||||||
|
"clippy::if_let_mutex",
|
||||||
|
"clippy::implicit_clone",
|
||||||
|
"clippy::imprecise_flops",
|
||||||
|
"clippy::index_refutable_slice",
|
||||||
|
"clippy::inefficient_to_string",
|
||||||
|
"clippy::invalid_upcast_comparisons",
|
||||||
|
"clippy::iter_not_returning_iterator",
|
||||||
|
"clippy::iter_on_empty_collections",
|
||||||
|
"clippy::iter_on_single_items",
|
||||||
|
"clippy::large_digit_groups",
|
||||||
|
"clippy::large_stack_arrays",
|
||||||
|
"clippy::large_types_passed_by_value",
|
||||||
|
"clippy::let_unit_value",
|
||||||
|
"clippy::linkedlist",
|
||||||
|
"clippy::lossy_float_literal",
|
||||||
|
"clippy::macro_use_imports",
|
||||||
|
"clippy::manual_assert",
|
||||||
|
"clippy::manual_instant_elapsed",
|
||||||
|
"clippy::manual_ok_or",
|
||||||
|
"clippy::manual_string_new",
|
||||||
|
"clippy::map_err_ignore",
|
||||||
|
"clippy::map_flatten",
|
||||||
|
"clippy::map_unwrap_or",
|
||||||
|
"clippy::match_on_vec_items",
|
||||||
|
"clippy::match_same_arms",
|
||||||
|
"clippy::match_wild_err_arm",
|
||||||
|
"clippy::match_wildcard_for_single_variants",
|
||||||
|
"clippy::mem_forget",
|
||||||
|
"clippy::mismatched_target_os",
|
||||||
|
"clippy::mismatching_type_param_order",
|
||||||
|
"clippy::missing_enforced_import_renames",
|
||||||
|
# "clippy::missing_errors_doc",
|
||||||
|
"clippy::missing_safety_doc",
|
||||||
|
"clippy::mut_mut",
|
||||||
|
"clippy::mutex_integer",
|
||||||
|
"clippy::needless_borrow",
|
||||||
|
"clippy::needless_continue",
|
||||||
|
"clippy::needless_for_each",
|
||||||
|
"clippy::needless_pass_by_value",
|
||||||
|
"clippy::negative_feature_names",
|
||||||
|
"clippy::nonstandard_macro_braces",
|
||||||
|
"clippy::option_option",
|
||||||
|
"clippy::path_buf_push_overwrite",
|
||||||
|
"clippy::ptr_as_ptr",
|
||||||
|
"clippy::rc_mutex",
|
||||||
|
"clippy::ref_option_ref",
|
||||||
|
"clippy::rest_pat_in_fully_bound_structs",
|
||||||
|
"clippy::same_functions_in_if_condition",
|
||||||
|
"clippy::semicolon_if_nothing_returned",
|
||||||
|
"clippy::single_match_else",
|
||||||
|
"clippy::str_to_string",
|
||||||
|
"clippy::string_add_assign",
|
||||||
|
"clippy::string_add",
|
||||||
|
"clippy::string_lit_as_bytes",
|
||||||
|
"clippy::string_to_string",
|
||||||
|
"clippy::todo",
|
||||||
|
"clippy::trailing_empty_array",
|
||||||
|
"clippy::trait_duplication_in_bounds",
|
||||||
|
"clippy::unimplemented",
|
||||||
|
"clippy::unnecessary_wraps",
|
||||||
|
"clippy::unnested_or_patterns",
|
||||||
|
"clippy::unused_peekable",
|
||||||
|
"clippy::unused_rounding",
|
||||||
|
# "clippy::unused_self",
|
||||||
|
"clippy::useless_transmute",
|
||||||
|
"clippy::verbose_file_reads",
|
||||||
|
"clippy::zero_sized_map_values",
|
||||||
|
"elided_lifetimes_in_paths",
|
||||||
|
"future_incompatible",
|
||||||
|
"nonstandard_style",
|
||||||
|
"rust_2018_idioms",
|
||||||
|
"rust_2021_prelude_collisions",
|
||||||
|
"rustdoc::missing_crate_level_docs",
|
||||||
|
"semicolon_in_expressions_from_macros",
|
||||||
|
"trivial_numeric_casts",
|
||||||
|
"unused_extern_crates",
|
||||||
|
"unused_import_braces",
|
||||||
|
"unused_lifetimes",
|
||||||
|
]
|
||||||
|
|
||||||
|
allow = [
|
||||||
|
# TODO(emilk): enable more lints
|
||||||
|
"clippy::cloned_instead_of_copied",
|
||||||
|
"clippy::derive_partial_eq_without_eq",
|
||||||
|
"clippy::type_complexity",
|
||||||
|
"clippy::undocumented_unsafe_blocks",
|
||||||
|
"trivial_casts",
|
||||||
|
"unsafe_op_in_unsafe_fn", # `unsafe_op_in_unsafe_fn` may become the default in future Rust versions: https://github.com/rust-lang/rust/issues/71668
|
||||||
|
"unused_qualifications",
|
||||||
|
]
|
||||||
|
|
||||||
2
Makefile
2
Makefile
@@ -1,4 +1,4 @@
|
|||||||
VERSION := $(shell grep -Pm1 'version = "(\d.\d.\d)"' daemon/Cargo.toml | cut -d'"' -f2)
|
VERSION := $(shell /usr/bin/grep -Pm1 'version = "(\d.\d.\d)"' Cargo.toml | cut -d'"' -f2)
|
||||||
|
|
||||||
INSTALL = install
|
INSTALL = install
|
||||||
INSTALL_PROGRAM = ${INSTALL} -D -m 0755
|
INSTALL_PROGRAM = ${INSTALL} -D -m 0755
|
||||||
|
|||||||
@@ -1,5 +1,6 @@
|
|||||||
[package]
|
[package]
|
||||||
name = "asusctl"
|
name = "asusctl"
|
||||||
|
license = "MPL-2.0"
|
||||||
authors = ["Luke D Jones <luke@ljones.dev>"]
|
authors = ["Luke D Jones <luke@ljones.dev>"]
|
||||||
edition = "2021"
|
edition = "2021"
|
||||||
version.workspace = true
|
version.workspace = true
|
||||||
|
|||||||
@@ -105,7 +105,7 @@ impl ToString for LedBrightness {
|
|||||||
Some(0x02) => "high",
|
Some(0x02) => "high",
|
||||||
_ => "unknown",
|
_ => "unknown",
|
||||||
};
|
};
|
||||||
s.to_string()
|
s.to_owned()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -134,9 +134,9 @@ fn do_parsed(
|
|||||||
Some(CliCommand::LedPow2(pow)) => handle_led_power2(dbus, &supported.keyboard_led, pow)?,
|
Some(CliCommand::LedPow2(pow)) => handle_led_power2(dbus, &supported.keyboard_led, pow)?,
|
||||||
Some(CliCommand::Profile(cmd)) => handle_profile(dbus, &supported.platform_profile, cmd)?,
|
Some(CliCommand::Profile(cmd)) => handle_profile(dbus, &supported.platform_profile, cmd)?,
|
||||||
Some(CliCommand::FanCurve(cmd)) => {
|
Some(CliCommand::FanCurve(cmd)) => {
|
||||||
handle_fan_curve(dbus, &supported.platform_profile, cmd)?
|
handle_fan_curve(dbus, &supported.platform_profile, cmd)?;
|
||||||
}
|
}
|
||||||
Some(CliCommand::Graphics(_)) => do_gfx()?,
|
Some(CliCommand::Graphics(_)) => do_gfx(),
|
||||||
Some(CliCommand::Anime(cmd)) => handle_anime(dbus, &supported.anime_ctrl, cmd)?,
|
Some(CliCommand::Anime(cmd)) => handle_anime(dbus, &supported.anime_ctrl, cmd)?,
|
||||||
Some(CliCommand::Bios(cmd)) => handle_bios_option(dbus, &supported.rog_bios_ctrl, cmd)?,
|
Some(CliCommand::Bios(cmd)) => handle_bios_option(dbus, &supported.rog_bios_ctrl, cmd)?,
|
||||||
None => {
|
None => {
|
||||||
@@ -214,14 +214,13 @@ fn do_parsed(
|
|||||||
Ok(())
|
Ok(())
|
||||||
}
|
}
|
||||||
|
|
||||||
fn do_gfx() -> Result<(), Box<dyn std::error::Error>> {
|
fn do_gfx() {
|
||||||
println!("Please use supergfxctl for graphics switching. supergfxctl is the result of making asusctl graphics switching generic so all laptops can use it");
|
println!("Please use supergfxctl for graphics switching. supergfxctl is the result of making asusctl graphics switching generic so all laptops can use it");
|
||||||
println!("This command will be removed in future");
|
println!("This command will be removed in future");
|
||||||
Ok(())
|
|
||||||
}
|
}
|
||||||
|
|
||||||
fn handle_anime(
|
fn handle_anime(
|
||||||
dbus: &RogDbusClientBlocking,
|
dbus: &RogDbusClientBlocking<'_>,
|
||||||
_supported: &AnimeSupportedFunctions,
|
_supported: &AnimeSupportedFunctions,
|
||||||
cmd: &AnimeCommand,
|
cmd: &AnimeCommand,
|
||||||
) -> Result<(), Box<dyn std::error::Error>> {
|
) -> Result<(), Box<dyn std::error::Error>> {
|
||||||
@@ -237,14 +236,14 @@ fn handle_anime(
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
if let Some(anime_turn) = cmd.enable {
|
if let Some(anime_turn) = cmd.enable {
|
||||||
dbus.proxies().anime().set_on_off(anime_turn)?
|
dbus.proxies().anime().set_on_off(anime_turn)?;
|
||||||
}
|
}
|
||||||
if let Some(anime_boot) = cmd.boot_enable {
|
if let Some(anime_boot) = cmd.boot_enable {
|
||||||
dbus.proxies().anime().set_boot_on_off(anime_boot)?
|
dbus.proxies().anime().set_boot_on_off(anime_boot)?;
|
||||||
}
|
}
|
||||||
if let Some(bright) = cmd.brightness {
|
if let Some(bright) = cmd.brightness {
|
||||||
verify_brightness(bright);
|
verify_brightness(bright);
|
||||||
dbus.proxies().anime().set_brightness(bright)?
|
dbus.proxies().anime().set_brightness(bright)?;
|
||||||
}
|
}
|
||||||
if cmd.clear {
|
if cmd.clear {
|
||||||
let anime_type = get_anime_type()?;
|
let anime_type = get_anime_type()?;
|
||||||
@@ -381,7 +380,7 @@ fn verify_brightness(brightness: f32) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
fn handle_led_mode(
|
fn handle_led_mode(
|
||||||
dbus: &RogDbusClientBlocking,
|
dbus: &RogDbusClientBlocking<'_>,
|
||||||
supported: &LedSupportedFunctions,
|
supported: &LedSupportedFunctions,
|
||||||
mode: &LedModeCommand,
|
mode: &LedModeCommand,
|
||||||
) -> Result<(), Box<dyn std::error::Error>> {
|
) -> Result<(), Box<dyn std::error::Error>> {
|
||||||
@@ -438,7 +437,7 @@ fn handle_led_mode(
|
|||||||
}
|
}
|
||||||
|
|
||||||
fn handle_led_power1(
|
fn handle_led_power1(
|
||||||
dbus: &RogDbusClientBlocking,
|
dbus: &RogDbusClientBlocking<'_>,
|
||||||
supported: &LedSupportedFunctions,
|
supported: &LedSupportedFunctions,
|
||||||
power: &LedPowerCommand1,
|
power: &LedPowerCommand1,
|
||||||
) -> Result<(), Box<dyn std::error::Error>> {
|
) -> Result<(), Box<dyn std::error::Error>> {
|
||||||
@@ -473,7 +472,7 @@ fn handle_led_power1(
|
|||||||
}
|
}
|
||||||
|
|
||||||
fn handle_led_power_1_do_1866(
|
fn handle_led_power_1_do_1866(
|
||||||
dbus: &RogDbusClientBlocking,
|
dbus: &RogDbusClientBlocking<'_>,
|
||||||
power: &LedPowerCommand1,
|
power: &LedPowerCommand1,
|
||||||
) -> Result<(), Box<dyn std::error::Error>> {
|
) -> Result<(), Box<dyn std::error::Error>> {
|
||||||
let mut enabled: Vec<AuraDev1866> = Vec::new();
|
let mut enabled: Vec<AuraDev1866> = Vec::new();
|
||||||
@@ -513,7 +512,7 @@ fn handle_led_power_1_do_1866(
|
|||||||
}
|
}
|
||||||
|
|
||||||
fn handle_led_power_1_do_tuf(
|
fn handle_led_power_1_do_tuf(
|
||||||
dbus: &RogDbusClientBlocking,
|
dbus: &RogDbusClientBlocking<'_>,
|
||||||
power: &LedPowerCommand1,
|
power: &LedPowerCommand1,
|
||||||
) -> Result<(), Box<dyn std::error::Error>> {
|
) -> Result<(), Box<dyn std::error::Error>> {
|
||||||
let mut enabled: Vec<AuraDevTuf> = Vec::new();
|
let mut enabled: Vec<AuraDevTuf> = Vec::new();
|
||||||
@@ -552,7 +551,7 @@ fn handle_led_power_1_do_tuf(
|
|||||||
}
|
}
|
||||||
|
|
||||||
fn handle_led_power2(
|
fn handle_led_power2(
|
||||||
dbus: &RogDbusClientBlocking,
|
dbus: &RogDbusClientBlocking<'_>,
|
||||||
supported: &LedSupportedFunctions,
|
supported: &LedSupportedFunctions,
|
||||||
power: &LedPowerCommand2,
|
power: &LedPowerCommand2,
|
||||||
) -> Result<(), Box<dyn std::error::Error>> {
|
) -> Result<(), Box<dyn std::error::Error>> {
|
||||||
@@ -564,8 +563,8 @@ fn handle_led_power2(
|
|||||||
println!("Commands available");
|
println!("Commands available");
|
||||||
|
|
||||||
if let Some(cmdlist) = LedPowerCommand2::command_list() {
|
if let Some(cmdlist) = LedPowerCommand2::command_list() {
|
||||||
let commands: Vec<String> = cmdlist.lines().map(|s| s.to_string()).collect();
|
let commands: Vec<String> = cmdlist.lines().map(|s| s.to_owned()).collect();
|
||||||
for command in commands.iter() {
|
for command in &commands {
|
||||||
println!("{}", command);
|
println!("{}", command);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -581,7 +580,7 @@ fn handle_led_power2(
|
|||||||
}
|
}
|
||||||
|
|
||||||
if supported.prod_id != AuraDevice::X19B6 {
|
if supported.prod_id != AuraDevice::X19B6 {
|
||||||
println!("This option applies only to keyboards with product ID 0x19b6")
|
println!("This option applies only to keyboards with product ID 0x19b6");
|
||||||
}
|
}
|
||||||
|
|
||||||
let mut enabled: Vec<AuraDev19b6> = Vec::new();
|
let mut enabled: Vec<AuraDev19b6> = Vec::new();
|
||||||
@@ -646,7 +645,7 @@ fn handle_led_power2(
|
|||||||
}
|
}
|
||||||
|
|
||||||
fn handle_profile(
|
fn handle_profile(
|
||||||
dbus: &RogDbusClientBlocking,
|
dbus: &RogDbusClientBlocking<'_>,
|
||||||
supported: &PlatformProfileFunctions,
|
supported: &PlatformProfileFunctions,
|
||||||
cmd: &ProfileCommand,
|
cmd: &ProfileCommand,
|
||||||
) -> Result<(), Box<dyn std::error::Error>> {
|
) -> Result<(), Box<dyn std::error::Error>> {
|
||||||
@@ -687,7 +686,7 @@ fn handle_profile(
|
|||||||
}
|
}
|
||||||
|
|
||||||
fn handle_fan_curve(
|
fn handle_fan_curve(
|
||||||
dbus: &RogDbusClientBlocking,
|
dbus: &RogDbusClientBlocking<'_>,
|
||||||
supported: &PlatformProfileFunctions,
|
supported: &PlatformProfileFunctions,
|
||||||
cmd: &FanCurveCommand,
|
cmd: &FanCurveCommand,
|
||||||
) -> Result<(), Box<dyn std::error::Error>> {
|
) -> Result<(), Box<dyn std::error::Error>> {
|
||||||
@@ -749,7 +748,7 @@ fn handle_fan_curve(
|
|||||||
}
|
}
|
||||||
|
|
||||||
fn handle_bios_option(
|
fn handle_bios_option(
|
||||||
dbus: &RogDbusClientBlocking,
|
dbus: &RogDbusClientBlocking<'_>,
|
||||||
supported: &RogBiosSupportedFunctions,
|
supported: &RogBiosSupportedFunctions,
|
||||||
cmd: &BiosCommand,
|
cmd: &BiosCommand,
|
||||||
) -> Result<(), Box<dyn std::error::Error>> {
|
) -> Result<(), Box<dyn std::error::Error>> {
|
||||||
@@ -764,10 +763,7 @@ fn handle_bios_option(
|
|||||||
{
|
{
|
||||||
println!("Missing arg or command\n");
|
println!("Missing arg or command\n");
|
||||||
|
|
||||||
let usage: Vec<String> = BiosCommand::usage()
|
let usage: Vec<String> = BiosCommand::usage().lines().map(|s| s.to_owned()).collect();
|
||||||
.lines()
|
|
||||||
.map(|s| s.to_string())
|
|
||||||
.collect();
|
|
||||||
|
|
||||||
for line in usage.iter().filter(|line| {
|
for line in usage.iter().filter(|line| {
|
||||||
line.contains("sound") && supported.post_sound
|
line.contains("sound") && supported.post_sound
|
||||||
|
|||||||
@@ -1,5 +1,6 @@
|
|||||||
[package]
|
[package]
|
||||||
name = "daemon-user"
|
name = "daemon-user"
|
||||||
|
license = "MPL-2.0"
|
||||||
version.workspace = true
|
version.workspace = true
|
||||||
authors = ["Luke D Jones <luke@ljones.dev>"]
|
authors = ["Luke D Jones <luke@ljones.dev>"]
|
||||||
edition = "2021"
|
edition = "2021"
|
||||||
|
|||||||
@@ -103,7 +103,7 @@ impl<'a> CtrlAnimeInner<'static> {
|
|||||||
.write(output)
|
.write(output)
|
||||||
.map_err(|e| AnimeError::Dbus(format!("{}", e)))
|
.map_err(|e| AnimeError::Dbus(format!("{}", e)))
|
||||||
.map(|_| false)
|
.map(|_| false)
|
||||||
})?;
|
});
|
||||||
}
|
}
|
||||||
ActionData::Image(image) => {
|
ActionData::Image(image) => {
|
||||||
self.client
|
self.client
|
||||||
@@ -124,10 +124,10 @@ impl<'a> CtrlAnimeInner<'static> {
|
|||||||
sleep(Duration::from_millis(1));
|
sleep(Duration::from_millis(1));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
ActionData::AudioEq => {}
|
ActionData::AudioEq
|
||||||
ActionData::SystemInfo => {}
|
| ActionData::SystemInfo
|
||||||
ActionData::TimeDate => {}
|
| ActionData::TimeDate
|
||||||
ActionData::Matrix => {}
|
| ActionData::Matrix => {}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -143,7 +143,7 @@ pub struct CtrlAnime<'a> {
|
|||||||
inner_early_return: Arc<AtomicBool>,
|
inner_early_return: Arc<AtomicBool>,
|
||||||
}
|
}
|
||||||
|
|
||||||
impl<'a> CtrlAnime<'static> {
|
impl CtrlAnime<'static> {
|
||||||
pub fn new(
|
pub fn new(
|
||||||
config: Arc<Mutex<UserAnimeConfig>>,
|
config: Arc<Mutex<UserAnimeConfig>>,
|
||||||
inner: Arc<Mutex<CtrlAnimeInner<'static>>>,
|
inner: Arc<Mutex<CtrlAnimeInner<'static>>>,
|
||||||
@@ -185,7 +185,7 @@ impl CtrlAnime<'static> {
|
|||||||
pub fn insert_asus_gif(
|
pub fn insert_asus_gif(
|
||||||
&mut self,
|
&mut self,
|
||||||
index: u32,
|
index: u32,
|
||||||
file: String,
|
file: &str,
|
||||||
time: Timer,
|
time: Timer,
|
||||||
brightness: f32,
|
brightness: f32,
|
||||||
) -> zbus::fdo::Result<String> {
|
) -> zbus::fdo::Result<String> {
|
||||||
@@ -223,7 +223,7 @@ impl CtrlAnime<'static> {
|
|||||||
pub fn insert_image_gif(
|
pub fn insert_image_gif(
|
||||||
&mut self,
|
&mut self,
|
||||||
index: u32,
|
index: u32,
|
||||||
file: String,
|
file: &str,
|
||||||
scale: f32,
|
scale: f32,
|
||||||
angle: f32,
|
angle: f32,
|
||||||
xy: (f32, f32),
|
xy: (f32, f32),
|
||||||
@@ -269,7 +269,7 @@ impl CtrlAnime<'static> {
|
|||||||
pub fn insert_image(
|
pub fn insert_image(
|
||||||
&mut self,
|
&mut self,
|
||||||
index: u32,
|
index: u32,
|
||||||
file: String,
|
file: &str,
|
||||||
scale: f32,
|
scale: f32,
|
||||||
angle: f32,
|
angle: f32,
|
||||||
xy: (f32, f32),
|
xy: (f32, f32),
|
||||||
|
|||||||
@@ -13,7 +13,7 @@ pub enum Error {
|
|||||||
|
|
||||||
impl fmt::Display for Error {
|
impl fmt::Display for Error {
|
||||||
// This trait requires `fmt` with this exact signature.
|
// This trait requires `fmt` with this exact signature.
|
||||||
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
|
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
|
||||||
match self {
|
match self {
|
||||||
Error::Io(err) => write!(f, "Failed to open: {}", err),
|
Error::Io(err) => write!(f, "Failed to open: {}", err),
|
||||||
Error::ConfigLoadFail => write!(f, "Failed to load user config"),
|
Error::ConfigLoadFail => write!(f, "Failed to load user config"),
|
||||||
|
|||||||
@@ -114,7 +114,7 @@ impl ConfigLoadSave<UserAnimeConfig> for UserAnimeConfig {
|
|||||||
impl Default for UserAnimeConfig {
|
impl Default for UserAnimeConfig {
|
||||||
fn default() -> Self {
|
fn default() -> Self {
|
||||||
Self {
|
Self {
|
||||||
name: "default".to_string(),
|
name: "default".to_owned(),
|
||||||
anime: vec![
|
anime: vec![
|
||||||
ActionLoader::AsusImage {
|
ActionLoader::AsusImage {
|
||||||
file: "/usr/share/asusd/anime/custom/diagonal-template.png".into(),
|
file: "/usr/share/asusd/anime/custom/diagonal-template.png".into(),
|
||||||
@@ -233,7 +233,7 @@ impl Default for UserAuraConfig {
|
|||||||
seq.push(key);
|
seq.push(key);
|
||||||
|
|
||||||
Self {
|
Self {
|
||||||
name: "default".to_string(),
|
name: "default".to_owned(),
|
||||||
aura: seq,
|
aura: seq,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -251,8 +251,8 @@ pub struct UserConfig {
|
|||||||
impl UserConfig {
|
impl UserConfig {
|
||||||
pub fn new() -> Self {
|
pub fn new() -> Self {
|
||||||
Self {
|
Self {
|
||||||
active_anime: Some("anime-default".to_string()),
|
active_anime: Some("anime-default".to_owned()),
|
||||||
active_aura: Some("aura-default".to_string()),
|
active_aura: Some("aura-default".to_owned()),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
[package]
|
[package]
|
||||||
name = "daemon"
|
name = "daemon"
|
||||||
version.workspace = true
|
|
||||||
license = "MPL-2.0"
|
license = "MPL-2.0"
|
||||||
|
version.workspace = true
|
||||||
readme = "README.md"
|
readme = "README.md"
|
||||||
authors = ["Luke <luke@ljones.dev>"]
|
authors = ["Luke <luke@ljones.dev>"]
|
||||||
repository = "https://gitlab.com/asus-linux/asus-nb-ctrl"
|
repository = "https://gitlab.com/asus-linux/asus-nb-ctrl"
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
pub mod config;
|
pub mod config;
|
||||||
/// Implements CtrlTask, Reloadable, ZbusRun
|
/// Implements `CtrlTask`, Reloadable, `ZbusRun`
|
||||||
pub mod trait_impls;
|
pub mod trait_impls;
|
||||||
|
|
||||||
use self::config::{AnimeConfig, AnimeConfigCached};
|
use self::config::{AnimeConfig, AnimeConfigCached};
|
||||||
@@ -62,7 +62,7 @@ impl CtrlAnime {
|
|||||||
/// one running - so the thread uses atomics to signal run/exit.
|
/// one running - so the thread uses atomics to signal run/exit.
|
||||||
///
|
///
|
||||||
/// Because this also writes to the usb device, other write tries (display only) *must*
|
/// Because this also writes to the usb device, other write tries (display only) *must*
|
||||||
/// get the mutex lock and set the thread_exit atomic.
|
/// get the mutex lock and set the `thread_exit` atomic.
|
||||||
fn run_thread(inner: Arc<Mutex<CtrlAnime>>, actions: Vec<ActionData>, mut once: bool) {
|
fn run_thread(inner: Arc<Mutex<CtrlAnime>>, actions: Vec<ActionData>, mut once: bool) {
|
||||||
if actions.is_empty() {
|
if actions.is_empty() {
|
||||||
warn!("AniMe system actions was empty");
|
warn!("AniMe system actions was empty");
|
||||||
@@ -106,13 +106,13 @@ impl CtrlAnime {
|
|||||||
|
|
||||||
'main: loop {
|
'main: loop {
|
||||||
thread_running.store(true, Ordering::SeqCst);
|
thread_running.store(true, Ordering::SeqCst);
|
||||||
for action in actions.iter() {
|
for action in &actions {
|
||||||
if thread_exit.load(Ordering::SeqCst) {
|
if thread_exit.load(Ordering::SeqCst) {
|
||||||
break 'main;
|
break 'main;
|
||||||
}
|
}
|
||||||
match action {
|
match action {
|
||||||
ActionData::Animation(frames) => {
|
ActionData::Animation(frames) => {
|
||||||
if let Err(err) = rog_anime::run_animation(frames, &|frame| {
|
rog_anime::run_animation(frames, &|frame| {
|
||||||
if thread_exit.load(Ordering::Acquire) {
|
if thread_exit.load(Ordering::Acquire) {
|
||||||
info!("rog-anime: frame-loop was asked to exit");
|
info!("rog-anime: frame-loop was asked to exit");
|
||||||
return Ok(true); // Do safe exit
|
return Ok(true); // Do safe exit
|
||||||
@@ -130,15 +130,14 @@ impl CtrlAnime {
|
|||||||
.ok();
|
.ok();
|
||||||
false // Don't exit yet
|
false // Don't exit yet
|
||||||
})
|
})
|
||||||
.map(Ok)
|
.map_or_else(
|
||||||
.unwrap_or_else(|| {
|
|| {
|
||||||
warn!("rog_anime::run_animation:callback failed");
|
warn!("rog_anime::run_animation:callback failed");
|
||||||
Err(AnimeError::NoFrames)
|
Err(AnimeError::NoFrames)
|
||||||
})
|
},
|
||||||
}) {
|
Ok,
|
||||||
warn!("rog_anime::run_animation:Animation {}", err);
|
)
|
||||||
break 'main;
|
});
|
||||||
};
|
|
||||||
}
|
}
|
||||||
ActionData::Image(image) => {
|
ActionData::Image(image) => {
|
||||||
once = false;
|
once = false;
|
||||||
@@ -149,10 +148,10 @@ impl CtrlAnime {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
ActionData::Pause(duration) => sleep(*duration),
|
ActionData::Pause(duration) => sleep(*duration),
|
||||||
ActionData::AudioEq => {}
|
ActionData::AudioEq
|
||||||
ActionData::SystemInfo => {}
|
| ActionData::SystemInfo
|
||||||
ActionData::TimeDate => {}
|
| ActionData::TimeDate
|
||||||
ActionData::Matrix => {}
|
| ActionData::Matrix => {}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if thread_exit.load(Ordering::SeqCst) {
|
if thread_exit.load(Ordering::SeqCst) {
|
||||||
@@ -194,7 +193,7 @@ impl CtrlAnime {
|
|||||||
*led = bright as u8;
|
*led = bright as u8;
|
||||||
}
|
}
|
||||||
let data = AnimePacketType::try_from(buffer)?;
|
let data = AnimePacketType::try_from(buffer)?;
|
||||||
for row in data.iter() {
|
for row in &data {
|
||||||
self.node.write_bytes(row)?;
|
self.node.write_bytes(row)?;
|
||||||
}
|
}
|
||||||
self.node.write_bytes(&pkt_for_flush())?;
|
self.node.write_bytes(&pkt_for_flush())?;
|
||||||
|
|||||||
@@ -47,7 +47,7 @@ impl CtrlAnimeZbus {
|
|||||||
let mut lock = self.0.lock().await;
|
let mut lock = self.0.lock().await;
|
||||||
let mut bright = bright;
|
let mut bright = bright;
|
||||||
if bright < 0.0 {
|
if bright < 0.0 {
|
||||||
bright = 0.0
|
bright = 0.0;
|
||||||
} else if bright > 1.0 {
|
} else if bright > 1.0 {
|
||||||
bright = 1.0;
|
bright = 1.0;
|
||||||
}
|
}
|
||||||
@@ -149,7 +149,7 @@ impl crate::CtrlTask for CtrlAnimeZbus {
|
|||||||
|
|
||||||
async fn create_tasks(&self, _: SignalContext<'static>) -> Result<(), RogError> {
|
async fn create_tasks(&self, _: SignalContext<'static>) -> Result<(), RogError> {
|
||||||
let run_action =
|
let run_action =
|
||||||
|start: bool, lock: MutexGuard<CtrlAnime>, inner: Arc<Mutex<CtrlAnime>>| {
|
|start: bool, lock: MutexGuard<'_, CtrlAnime>, inner: Arc<Mutex<CtrlAnime>>| {
|
||||||
if start {
|
if start {
|
||||||
info!("CtrlAnimeTask running sleep animation");
|
info!("CtrlAnimeTask running sleep animation");
|
||||||
CtrlAnime::run_thread(inner, lock.cache.shutdown.clone(), true);
|
CtrlAnime::run_thread(inner, lock.cache.shutdown.clone(), true);
|
||||||
|
|||||||
@@ -43,7 +43,8 @@ impl ProfileConfig {
|
|||||||
"Could not deserialise {}.\nWill rename to {}-old and recreate config",
|
"Could not deserialise {}.\nWill rename to {}-old and recreate config",
|
||||||
config_path, config_path
|
config_path, config_path
|
||||||
);
|
);
|
||||||
let cfg_old = config_path.clone() + "-old";
|
let mut cfg_old = config_path.clone();
|
||||||
|
cfg_old.push_str("-old");
|
||||||
std::fs::rename(config_path.clone(), cfg_old).unwrap_or_else(|err| {
|
std::fs::rename(config_path.clone(), cfg_old).unwrap_or_else(|err| {
|
||||||
panic!(
|
panic!(
|
||||||
"Could not rename. Please remove {} then restart service: Error {}",
|
"Could not rename. Please remove {} then restart service: Error {}",
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
pub mod config;
|
pub mod config;
|
||||||
pub mod controller;
|
pub mod controller;
|
||||||
/// Implements CtrlTask, Reloadable, ZbusRun
|
/// Implements `CtrlTask`, Reloadable, `ZbusRun`
|
||||||
pub mod trait_impls;
|
pub mod trait_impls;
|
||||||
|
|||||||
@@ -32,7 +32,7 @@ impl ProfileZbus {
|
|||||||
return Ok(profiles);
|
return Ok(profiles);
|
||||||
}
|
}
|
||||||
Err(Error::Failed(
|
Err(Error::Failed(
|
||||||
"Failed to get all profile details".to_string(),
|
"Failed to get all profile details".to_owned(),
|
||||||
))
|
))
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -85,9 +85,9 @@ impl ProfileZbus {
|
|||||||
let mut ctrl = self.0.lock().await;
|
let mut ctrl = self.0.lock().await;
|
||||||
ctrl.config.read();
|
ctrl.config.read();
|
||||||
if let Some(curves) = &ctrl.config.fan_curves {
|
if let Some(curves) = &ctrl.config.fan_curves {
|
||||||
return Ok(curves.get_enabled_curve_profiles().to_vec());
|
return Ok(curves.get_enabled_curve_profiles());
|
||||||
}
|
}
|
||||||
Err(Error::Failed(UNSUPPORTED_MSG.to_string()))
|
Err(Error::Failed(UNSUPPORTED_MSG.to_owned()))
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Set a profile fan curve enabled status. Will also activate a fan curve if in the
|
/// Set a profile fan curve enabled status. Will also activate a fan curve if in the
|
||||||
@@ -109,7 +109,7 @@ impl ProfileZbus {
|
|||||||
ctrl.save_config();
|
ctrl.save_config();
|
||||||
Ok(())
|
Ok(())
|
||||||
} else {
|
} else {
|
||||||
Err(Error::Failed(UNSUPPORTED_MSG.to_string()))
|
Err(Error::Failed(UNSUPPORTED_MSG.to_owned()))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -121,7 +121,7 @@ impl ProfileZbus {
|
|||||||
let curve = curves.get_fan_curves_for(profile);
|
let curve = curves.get_fan_curves_for(profile);
|
||||||
return Ok(curve.clone());
|
return Ok(curve.clone());
|
||||||
}
|
}
|
||||||
Err(Error::Failed(UNSUPPORTED_MSG.to_string()))
|
Err(Error::Failed(UNSUPPORTED_MSG.to_owned()))
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Set the fan curve for the specified profile.
|
/// Set the fan curve for the specified profile.
|
||||||
@@ -134,7 +134,7 @@ impl ProfileZbus {
|
|||||||
.save_fan_curve(curve, profile)
|
.save_fan_curve(curve, profile)
|
||||||
.map_err(|err| zbus::fdo::Error::Failed(err.to_string()))?;
|
.map_err(|err| zbus::fdo::Error::Failed(err.to_string()))?;
|
||||||
} else {
|
} else {
|
||||||
return Err(Error::Failed(UNSUPPORTED_MSG.to_string()));
|
return Err(Error::Failed(UNSUPPORTED_MSG.to_owned()));
|
||||||
}
|
}
|
||||||
ctrl.write_profile_curve_to_platform()
|
ctrl.write_profile_curve_to_platform()
|
||||||
.map_err(|e| warn!("Profile::set_profile, {}", e))
|
.map_err(|e| warn!("Profile::set_profile, {}", e))
|
||||||
|
|||||||
@@ -37,7 +37,7 @@ pub enum RogError {
|
|||||||
|
|
||||||
impl fmt::Display for RogError {
|
impl fmt::Display for RogError {
|
||||||
// This trait requires `fmt` with this exact signature.
|
// This trait requires `fmt` with this exact signature.
|
||||||
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
|
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
|
||||||
match self {
|
match self {
|
||||||
RogError::ParseVendor => write!(f, "Parse gfx vendor error"),
|
RogError::ParseVendor => write!(f, "Parse gfx vendor error"),
|
||||||
RogError::ParseLed => write!(f, "Parse LED error"),
|
RogError::ParseLed => write!(f, "Parse LED error"),
|
||||||
@@ -51,7 +51,7 @@ impl fmt::Display for RogError {
|
|||||||
RogError::DoTask(deets) => write!(f, "Task error: {}", deets),
|
RogError::DoTask(deets) => write!(f, "Task error: {}", deets),
|
||||||
RogError::MissingFunction(deets) => write!(f, "Missing functionality: {}", deets),
|
RogError::MissingFunction(deets) => write!(f, "Missing functionality: {}", deets),
|
||||||
RogError::MissingLedBrightNode(path, error) => write!(f, "Led node at {} is missing, please check you have the required patch or dkms module installed: {}", path, error),
|
RogError::MissingLedBrightNode(path, error) => write!(f, "Led node at {} is missing, please check you have the required patch or dkms module installed: {}", path, error),
|
||||||
RogError::ReloadFail(deets) => write!(f, "Task error: {}", deets),
|
RogError::ReloadFail(deets) => write!(f, "Reload error: {}", deets),
|
||||||
RogError::Profiles(deets) => write!(f, "Profile error: {}", deets),
|
RogError::Profiles(deets) => write!(f, "Profile error: {}", deets),
|
||||||
RogError::Initramfs(detail) => write!(f, "Initiramfs error: {}", detail),
|
RogError::Initramfs(detail) => write!(f, "Initiramfs error: {}", detail),
|
||||||
RogError::Modprobe(detail) => write!(f, "Modprobe error: {}", detail),
|
RogError::Modprobe(detail) => write!(f, "Modprobe error: {}", detail),
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
#![deny(unused_must_use)]
|
#![deny(unused_must_use)]
|
||||||
/// Configuration loading, saving
|
/// Configuration loading, saving
|
||||||
pub mod config;
|
pub mod config;
|
||||||
/// Control of AniMe matrix display
|
/// Control of anime matrix display
|
||||||
pub mod ctrl_anime;
|
pub mod ctrl_anime;
|
||||||
/// Keyboard LED brightness control, RGB, and LED display modes
|
/// Keyboard LED brightness control, RGB, and LED display modes
|
||||||
pub mod ctrl_aura;
|
pub mod ctrl_aura;
|
||||||
|
|||||||
69
deny.toml
Normal file
69
deny.toml
Normal file
@@ -0,0 +1,69 @@
|
|||||||
|
# https://embarkstudios.github.io/cargo-deny/
|
||||||
|
|
||||||
|
targets = [
|
||||||
|
{ triple = "aarch64-apple-darwin" },
|
||||||
|
{ triple = "aarch64-linux-android" },
|
||||||
|
{ triple = "wasm32-unknown-unknown" },
|
||||||
|
{ triple = "x86_64-apple-darwin" },
|
||||||
|
{ triple = "x86_64-pc-windows-msvc" },
|
||||||
|
{ triple = "x86_64-unknown-linux-gnu" },
|
||||||
|
{ triple = "x86_64-unknown-linux-musl" },
|
||||||
|
]
|
||||||
|
|
||||||
|
[advisories]
|
||||||
|
vulnerability = "deny"
|
||||||
|
unmaintained = "warn"
|
||||||
|
yanked = "deny"
|
||||||
|
ignore = [
|
||||||
|
"RUSTSEC-2020-0071", # https://rustsec.org/advisories/RUSTSEC-2020-0071 - chrono/time: Potential segfault in the time crate
|
||||||
|
"RUSTSEC-2020-0159", # https://rustsec.org/advisories/RUSTSEC-2020-0159 - chrono/time: Potential segfault in localtime_r invocations
|
||||||
|
"RUSTSEC-2021-0127", # https://rustsec.org/advisories/RUSTSEC-2021-0127 - https://github.com/bheisler/criterion.rs/issues/534
|
||||||
|
]
|
||||||
|
|
||||||
|
[bans]
|
||||||
|
multiple-versions = "deny"
|
||||||
|
wildcards = "allow" # at least until https://github.com/EmbarkStudios/cargo-deny/issues/241 is fixed
|
||||||
|
deny = [
|
||||||
|
{ name = "openssl" }, # prefer rustls
|
||||||
|
{ name = "openssl-sys" }, # prefer rustls
|
||||||
|
]
|
||||||
|
|
||||||
|
skip-tree = [
|
||||||
|
{ name = "criterion" }, # dev-dependency
|
||||||
|
{ name = "glium" }, # legacy crate, lots of old dependencies
|
||||||
|
{ name = "rfd" }, # example dependency
|
||||||
|
{ name = "three-d" }, # example dependency
|
||||||
|
]
|
||||||
|
|
||||||
|
|
||||||
|
[licenses]
|
||||||
|
unlicensed = "deny"
|
||||||
|
allow-osi-fsf-free = "neither"
|
||||||
|
confidence-threshold = 0.92 # We want really high confidence when inferring licenses from text
|
||||||
|
copyleft = "deny"
|
||||||
|
allow = [
|
||||||
|
"Apache-2.0", # https://tldrlegal.com/license/apache-license-2.0-(apache-2.0)
|
||||||
|
"BSD-2-Clause", # https://tldrlegal.com/license/bsd-2-clause-license-(freebsd)
|
||||||
|
"BSD-3-Clause", # https://tldrlegal.com/license/bsd-3-clause-license-(revised)
|
||||||
|
"BSL-1.0", # https://tldrlegal.com/license/boost-software-license-1.0-explained
|
||||||
|
"CC0-1.0", # https://creativecommons.org/publicdomain/zero/1.0/
|
||||||
|
"ISC", # https://tldrlegal.com/license/-isc-license
|
||||||
|
"LicenseRef-UFL-1.0", # https://tldrlegal.com/license/ubuntu-font-license,-1.0 - no official SPDX, see https://github.com/emilk/egui/issues/2321
|
||||||
|
"MIT", # https://tldrlegal.com/license/mit-license
|
||||||
|
"MPL-2.0", # https://www.mozilla.org/en-US/MPL/2.0/FAQ/ - see Q11
|
||||||
|
"OFL-1.1", # https://spdx.org/licenses/OFL-1.1.html
|
||||||
|
"OpenSSL", # https://www.openssl.org/source/license.html
|
||||||
|
"Unicode-DFS-2016", # https://spdx.org/licenses/Unicode-DFS-2016.html
|
||||||
|
"Zlib", # https://tldrlegal.com/license/zlib-libpng-license-(zlib)
|
||||||
|
]
|
||||||
|
|
||||||
|
[[licenses.clarify]]
|
||||||
|
name = "webpki"
|
||||||
|
expression = "ISC"
|
||||||
|
license-files = [{ path = "LICENSE", hash = 0x001c7e6c }]
|
||||||
|
|
||||||
|
[[licenses.clarify]]
|
||||||
|
name = "ring"
|
||||||
|
expression = "MIT AND ISC AND OpenSSL"
|
||||||
|
license-files = [{ path = "LICENSE", hash = 0xbd0eed23 }]
|
||||||
|
|
||||||
@@ -1,7 +1,7 @@
|
|||||||
[package]
|
[package]
|
||||||
name = "rog_anime"
|
name = "rog_anime"
|
||||||
version.workspace = true
|
|
||||||
license = "MPL-2.0"
|
license = "MPL-2.0"
|
||||||
|
version.workspace = true
|
||||||
readme = "README.md"
|
readme = "README.md"
|
||||||
authors = ["Luke <luke@ljones.dev>"]
|
authors = ["Luke <luke@ljones.dev>"]
|
||||||
repository = "https://gitlab.com/asus-linux/asus-nb-ctrl"
|
repository = "https://gitlab.com/asus-linux/asus-nb-ctrl"
|
||||||
|
|||||||
@@ -47,8 +47,7 @@ impl AnimeType {
|
|||||||
/// The width of diagonal images
|
/// The width of diagonal images
|
||||||
pub fn width(&self) -> usize {
|
pub fn width(&self) -> usize {
|
||||||
match self {
|
match self {
|
||||||
AnimeType::GA401 => 74,
|
AnimeType::GA401 | AnimeType::GA402 => 74,
|
||||||
AnimeType::GA402 => 74,
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -103,8 +102,8 @@ impl AnimeDataBuffer {
|
|||||||
|
|
||||||
/// Create from a vector of bytes
|
/// Create from a vector of bytes
|
||||||
///
|
///
|
||||||
/// # Panics
|
/// # Errors
|
||||||
/// Will panic if the vector length is not `ANIME_DATA_LEN`
|
/// Will error if the vector length is not `ANIME_DATA_LEN`
|
||||||
#[inline]
|
#[inline]
|
||||||
pub fn from_vec(anime: AnimeType, data: Vec<u8>) -> Result<Self> {
|
pub fn from_vec(anime: AnimeType, data: Vec<u8>) -> Result<Self> {
|
||||||
if data.len() != anime.data_length() {
|
if data.len() != anime.data_length() {
|
||||||
@@ -147,10 +146,7 @@ impl TryFrom<AnimeDataBuffer> for AnimePacketType {
|
|||||||
/// This runs the animations as a blocking loop by using the `callback` to write data
|
/// This runs the animations as a blocking loop by using the `callback` to write data
|
||||||
///
|
///
|
||||||
/// If `callback` is `Ok(true)` then `run_animation` will exit the animation loop early.
|
/// If `callback` is `Ok(true)` then `run_animation` will exit the animation loop early.
|
||||||
pub fn run_animation(
|
pub fn run_animation(frames: &AnimeGif, callback: &dyn Fn(AnimeDataBuffer) -> Result<bool>) {
|
||||||
frames: &AnimeGif,
|
|
||||||
callback: &dyn Fn(AnimeDataBuffer) -> Result<bool>,
|
|
||||||
) -> Result<()> {
|
|
||||||
let mut count = 0;
|
let mut count = 0;
|
||||||
let start = Instant::now();
|
let start = Instant::now();
|
||||||
|
|
||||||
@@ -215,9 +211,10 @@ pub fn run_animation(
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// TODO: Log this error
|
||||||
if matches!(callback(output), Ok(true)) {
|
if matches!(callback(output), Ok(true)) {
|
||||||
info!("rog-anime: frame-loop callback asked to exit early");
|
info!("rog-anime: frame-loop callback asked to exit early");
|
||||||
return Ok(());
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if timed && Instant::now().duration_since(start) > run_time {
|
if timed && Instant::now().duration_since(start) > run_time {
|
||||||
@@ -232,5 +229,4 @@ pub fn run_animation(
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
Ok(())
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -52,39 +52,43 @@ impl AnimeDiagonal {
|
|||||||
|
|
||||||
let mut matrix = AnimeDiagonal::new(anime_type, duration);
|
let mut matrix = AnimeDiagonal::new(anime_type, duration);
|
||||||
|
|
||||||
match raster {
|
match &raster {
|
||||||
png_pong::PngRaster::Gray8(ras) => {
|
png_pong::PngRaster::Gray8(ras) => {
|
||||||
Self::pixels_from_8bit(ras, &mut matrix, bright, true)
|
Self::pixels_from_8bit(ras, &mut matrix, bright, true);
|
||||||
}
|
}
|
||||||
png_pong::PngRaster::Graya8(ras) => {
|
png_pong::PngRaster::Graya8(ras) => {
|
||||||
Self::pixels_from_8bit(ras, &mut matrix, bright, true)
|
Self::pixels_from_8bit(ras, &mut matrix, bright, true);
|
||||||
}
|
}
|
||||||
png_pong::PngRaster::Rgb8(ras) => {
|
png_pong::PngRaster::Rgb8(ras) => {
|
||||||
Self::pixels_from_8bit(ras, &mut matrix, bright, false)
|
Self::pixels_from_8bit(ras, &mut matrix, bright, false);
|
||||||
}
|
}
|
||||||
png_pong::PngRaster::Rgba8(ras) => {
|
png_pong::PngRaster::Rgba8(ras) => {
|
||||||
Self::pixels_from_8bit(ras, &mut matrix, bright, false)
|
Self::pixels_from_8bit(ras, &mut matrix, bright, false);
|
||||||
}
|
}
|
||||||
png_pong::PngRaster::Gray16(ras) => {
|
png_pong::PngRaster::Gray16(ras) => {
|
||||||
Self::pixels_from_16bit(ras, &mut matrix, bright, true)
|
Self::pixels_from_16bit(ras, &mut matrix, bright, true);
|
||||||
}
|
}
|
||||||
png_pong::PngRaster::Rgb16(ras) => {
|
png_pong::PngRaster::Rgb16(ras) => {
|
||||||
Self::pixels_from_16bit(ras, &mut matrix, bright, false)
|
Self::pixels_from_16bit(ras, &mut matrix, bright, false);
|
||||||
}
|
}
|
||||||
png_pong::PngRaster::Graya16(ras) => {
|
png_pong::PngRaster::Graya16(ras) => {
|
||||||
Self::pixels_from_16bit(ras, &mut matrix, bright, true)
|
Self::pixels_from_16bit(ras, &mut matrix, bright, true);
|
||||||
}
|
}
|
||||||
png_pong::PngRaster::Rgba16(ras) => {
|
png_pong::PngRaster::Rgba16(ras) => {
|
||||||
Self::pixels_from_16bit(ras, &mut matrix, bright, false)
|
Self::pixels_from_16bit(ras, &mut matrix, bright, false);
|
||||||
}
|
}
|
||||||
_ => return Err(AnimeError::Format),
|
png_pong::PngRaster::Palette(..) => return Err(AnimeError::Format),
|
||||||
};
|
};
|
||||||
|
|
||||||
Ok(matrix)
|
Ok(matrix)
|
||||||
}
|
}
|
||||||
|
|
||||||
fn pixels_from_8bit<P>(ras: pix::Raster<P>, matrix: &mut AnimeDiagonal, bright: f32, grey: bool)
|
fn pixels_from_8bit<P>(
|
||||||
where
|
ras: &pix::Raster<P>,
|
||||||
|
matrix: &mut AnimeDiagonal,
|
||||||
|
bright: f32,
|
||||||
|
grey: bool,
|
||||||
|
) where
|
||||||
P: pix::el::Pixel<Chan = pix::chan::Ch8>,
|
P: pix::el::Pixel<Chan = pix::chan::Ch8>,
|
||||||
{
|
{
|
||||||
let width = ras.width();
|
let width = ras.width();
|
||||||
@@ -105,7 +109,7 @@ impl AnimeDiagonal {
|
|||||||
}
|
}
|
||||||
|
|
||||||
fn pixels_from_16bit<P>(
|
fn pixels_from_16bit<P>(
|
||||||
ras: pix::Raster<P>,
|
ras: &pix::Raster<P>,
|
||||||
matrix: &mut AnimeDiagonal,
|
matrix: &mut AnimeDiagonal,
|
||||||
bright: f32,
|
bright: f32,
|
||||||
grey: bool,
|
grey: bool,
|
||||||
@@ -136,7 +140,7 @@ impl AnimeDiagonal {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Do conversion from the nested Vec in AnimeMatrix to the two required
|
/// Do conversion from the nested Vec in `AnimeMatrix` to the two required
|
||||||
/// packets suitable for sending over USB
|
/// packets suitable for sending over USB
|
||||||
fn to_ga401_packets(&self) -> Result<AnimeDataBuffer> {
|
fn to_ga401_packets(&self) -> Result<AnimeDataBuffer> {
|
||||||
let mut buf = vec![0u8; AnimeType::GA401.data_length()];
|
let mut buf = vec![0u8; AnimeType::GA401.data_length()];
|
||||||
|
|||||||
@@ -26,7 +26,7 @@ pub enum AnimeError {
|
|||||||
|
|
||||||
impl fmt::Display for AnimeError {
|
impl fmt::Display for AnimeError {
|
||||||
#[inline]
|
#[inline]
|
||||||
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
|
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
|
||||||
match self {
|
match self {
|
||||||
AnimeError::NoFrames => write!(f, "No frames in PNG"),
|
AnimeError::NoFrames => write!(f, "No frames in PNG"),
|
||||||
AnimeError::Io(e) => write!(f, "Could not open: {}", e),
|
AnimeError::Io(e) => write!(f, "Could not open: {}", e),
|
||||||
|
|||||||
@@ -93,7 +93,7 @@ impl AnimeGrid {
|
|||||||
impl TryFrom<AnimeGrid> for AnimeDataBuffer {
|
impl TryFrom<AnimeGrid> for AnimeDataBuffer {
|
||||||
type Error = AnimeError;
|
type Error = AnimeError;
|
||||||
|
|
||||||
/// Do conversion from the nested Vec in AniMeMatrix to the two required
|
/// Do conversion from the nested Vec in anime matrix to the two required
|
||||||
/// packets suitable for sending over USB
|
/// packets suitable for sending over USB
|
||||||
fn try_from(anime: AnimeGrid) -> Result<Self> {
|
fn try_from(anime: AnimeGrid) -> Result<Self> {
|
||||||
let mut buf = vec![0u8; anime.anime_type.data_length()];
|
let mut buf = vec![0u8; anime.anime_type.data_length()];
|
||||||
|
|||||||
@@ -30,7 +30,7 @@ impl Default for Pixel {
|
|||||||
/// is to be used to sample an image and set the LED brightness.
|
/// is to be used to sample an image and set the LED brightness.
|
||||||
///
|
///
|
||||||
/// The position of the Led in `LedPositions` determines the placement in the final
|
/// The position of the Led in `LedPositions` determines the placement in the final
|
||||||
/// data packets when written to the AniMe.
|
/// data packets when written to the `AniMe`.
|
||||||
#[derive(Debug, Clone, Copy, PartialEq)]
|
#[derive(Debug, Clone, Copy, PartialEq)]
|
||||||
pub struct Led(f32, f32, u8);
|
pub struct Led(f32, f32, u8);
|
||||||
|
|
||||||
@@ -58,7 +58,7 @@ impl Led {
|
|||||||
|
|
||||||
/// Container of `Led`, each of which specifies a position within the image
|
/// Container of `Led`, each of which specifies a position within the image
|
||||||
/// The main use of this is to position and sample colours for the final image
|
/// The main use of this is to position and sample colours for the final image
|
||||||
/// to show on AniMe
|
/// to show on `AniMe`
|
||||||
pub struct AnimeImage {
|
pub struct AnimeImage {
|
||||||
pub scale: Vec2,
|
pub scale: Vec2,
|
||||||
/// Angle in radians
|
/// Angle in radians
|
||||||
@@ -294,8 +294,8 @@ impl AnimeImage {
|
|||||||
let x0 = led_from_px.mul_vec3(pos + Vec3::new(0.0, -0.5, 0.0));
|
let x0 = led_from_px.mul_vec3(pos + Vec3::new(0.0, -0.5, 0.0));
|
||||||
|
|
||||||
const GROUP: [f32; 4] = [0.0, 0.5, 1.0, 1.5];
|
const GROUP: [f32; 4] = [0.0, 0.5, 1.0, 1.5];
|
||||||
for u in GROUP.iter() {
|
for u in &GROUP {
|
||||||
for v in GROUP.iter() {
|
for v in &GROUP {
|
||||||
let sample = x0 + *u * du + *v * dv;
|
let sample = x0 + *u * du + *v * dv;
|
||||||
|
|
||||||
let x = sample.x as i32;
|
let x = sample.x as i32;
|
||||||
@@ -399,7 +399,7 @@ impl AnimeImage {
|
|||||||
let png_pong::Step { raster, delay: _ } = decoder.last().ok_or(AnimeError::NoFrames)??;
|
let png_pong::Step { raster, delay: _ } = decoder.last().ok_or(AnimeError::NoFrames)??;
|
||||||
|
|
||||||
let width;
|
let width;
|
||||||
let pixels = match raster {
|
let pixels = match &raster {
|
||||||
png_pong::PngRaster::Gray8(ras) => {
|
png_pong::PngRaster::Gray8(ras) => {
|
||||||
width = ras.width();
|
width = ras.width();
|
||||||
Self::pixels_from_8bit(ras, true)
|
Self::pixels_from_8bit(ras, true)
|
||||||
@@ -432,7 +432,7 @@ impl AnimeImage {
|
|||||||
width = ras.width();
|
width = ras.width();
|
||||||
Self::pixels_from_16bit(ras, false)
|
Self::pixels_from_16bit(ras, false)
|
||||||
}
|
}
|
||||||
_ => return Err(AnimeError::Format),
|
png_pong::PngRaster::Palette(..) => return Err(AnimeError::Format),
|
||||||
};
|
};
|
||||||
|
|
||||||
let mut matrix = AnimeImage::new(
|
let mut matrix = AnimeImage::new(
|
||||||
@@ -449,7 +449,7 @@ impl AnimeImage {
|
|||||||
Ok(matrix)
|
Ok(matrix)
|
||||||
}
|
}
|
||||||
|
|
||||||
fn pixels_from_8bit<P>(ras: pix::Raster<P>, grey: bool) -> Vec<Pixel>
|
fn pixels_from_8bit<P>(ras: &pix::Raster<P>, grey: bool) -> Vec<Pixel>
|
||||||
where
|
where
|
||||||
P: pix::el::Pixel<Chan = pix::chan::Ch8>,
|
P: pix::el::Pixel<Chan = pix::chan::Ch8>,
|
||||||
{
|
{
|
||||||
@@ -468,7 +468,7 @@ impl AnimeImage {
|
|||||||
.collect()
|
.collect()
|
||||||
}
|
}
|
||||||
|
|
||||||
fn pixels_from_16bit<P>(ras: pix::Raster<P>, grey: bool) -> Vec<Pixel>
|
fn pixels_from_16bit<P>(ras: &pix::Raster<P>, grey: bool) -> Vec<Pixel>
|
||||||
where
|
where
|
||||||
P: pix::el::Pixel<Chan = pix::chan::Ch16>,
|
P: pix::el::Pixel<Chan = pix::chan::Ch16>,
|
||||||
{
|
{
|
||||||
@@ -491,7 +491,7 @@ impl AnimeImage {
|
|||||||
impl TryFrom<&AnimeImage> for AnimeDataBuffer {
|
impl TryFrom<&AnimeImage> for AnimeDataBuffer {
|
||||||
type Error = AnimeError;
|
type Error = AnimeError;
|
||||||
|
|
||||||
/// Do conversion from the nested Vec in AnimeDataBuffer to the two required
|
/// Do conversion from the nested Vec in `AnimeDataBuffer` to the two required
|
||||||
/// packets suitable for sending over USB
|
/// packets suitable for sending over USB
|
||||||
fn try_from(leds: &AnimeImage) -> Result<Self> {
|
fn try_from(leds: &AnimeImage) -> Result<Self> {
|
||||||
let mut l: Vec<u8> = leds
|
let mut l: Vec<u8> = leds
|
||||||
|
|||||||
@@ -7,11 +7,11 @@ pub use data::*;
|
|||||||
mod grid;
|
mod grid;
|
||||||
pub use grid::*;
|
pub use grid::*;
|
||||||
|
|
||||||
/// Transform a PNG image for displaying on AniMe matrix display
|
/// Transform a PNG image for displaying on `AniMe` matrix display
|
||||||
mod image;
|
mod image;
|
||||||
pub use image::*;
|
pub use image::*;
|
||||||
|
|
||||||
/// A grid of data that is intended to be read out and displayed on the ANiMe as
|
/// A grid of data that is intended to be read out and displayed on the `AniMe` as
|
||||||
/// a diagonal
|
/// a diagonal
|
||||||
mod diagonal;
|
mod diagonal;
|
||||||
pub use diagonal::*;
|
pub use diagonal::*;
|
||||||
|
|||||||
@@ -7,7 +7,7 @@ use crate::{
|
|||||||
error::Result, AnimTime, AnimeDataBuffer, AnimeDiagonal, AnimeGif, AnimeImage, AnimeType,
|
error::Result, AnimTime, AnimeDataBuffer, AnimeDiagonal, AnimeGif, AnimeImage, AnimeType,
|
||||||
};
|
};
|
||||||
|
|
||||||
/// All the possible AniMe actions that can be used. This enum is intended to be
|
/// All the possible `AniMe` actions that can be used. This enum is intended to be
|
||||||
/// a helper for loading up `ActionData`.
|
/// a helper for loading up `ActionData`.
|
||||||
#[derive(Debug, Clone, Deserialize, Serialize)]
|
#[derive(Debug, Clone, Deserialize, Serialize)]
|
||||||
pub enum ActionLoader {
|
pub enum ActionLoader {
|
||||||
@@ -44,7 +44,7 @@ pub enum ActionLoader {
|
|||||||
Pause(Duration),
|
Pause(Duration),
|
||||||
}
|
}
|
||||||
|
|
||||||
/// All the possible AniMe actions that can be used. The enum is intended to be
|
/// All the possible `AniMe` actions that can be used. The enum is intended to be
|
||||||
/// used in a array allowing the user to cycle through a series of actions.
|
/// used in a array allowing the user to cycle through a series of actions.
|
||||||
#[derive(Debug, Clone, Deserialize, Serialize)]
|
#[derive(Debug, Clone, Deserialize, Serialize)]
|
||||||
pub enum ActionData {
|
pub enum ActionData {
|
||||||
@@ -194,7 +194,7 @@ impl Sequences {
|
|||||||
None
|
None
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn iter(&self) -> ActionIterator {
|
pub fn iter(&self) -> ActionIterator<'_> {
|
||||||
ActionIterator {
|
ActionIterator {
|
||||||
actions: self,
|
actions: self,
|
||||||
next_idx: 0,
|
next_idx: 0,
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
//! Utils for writing to the AniMe USB device
|
//! Utils for writing to the `AniMe` USB device
|
||||||
//!
|
//!
|
||||||
//! Use of the device requires a few steps:
|
//! Use of the device requires a few steps:
|
||||||
//! 1. Initialise the device by writing the two packets from `get_init_packets()`
|
//! 1. Initialise the device by writing the two packets from `get_init_packets()`
|
||||||
@@ -63,7 +63,7 @@ pub const fn pkt_for_flush() -> [u8; PACKET_SIZE] {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/// Get the packet required for setting the device to on, on boot. Requires
|
/// Get the packet required for setting the device to on, on boot. Requires
|
||||||
/// pkt_for_apply()` to be written after.
|
/// `pkt_for_apply()` to be written after.
|
||||||
#[inline]
|
#[inline]
|
||||||
pub const fn pkt_for_set_boot(status: bool) -> [u8; PACKET_SIZE] {
|
pub const fn pkt_for_set_boot(status: bool) -> [u8; PACKET_SIZE] {
|
||||||
let mut pkt = [0; PACKET_SIZE];
|
let mut pkt = [0; PACKET_SIZE];
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
[package]
|
[package]
|
||||||
name = "rog_aura"
|
name = "rog_aura"
|
||||||
version.workspace = true
|
|
||||||
license = "MPL-2.0"
|
license = "MPL-2.0"
|
||||||
|
version.workspace = true
|
||||||
readme = "README.md"
|
readme = "README.md"
|
||||||
authors = ["Luke <luke@ljones.dev>"]
|
authors = ["Luke <luke@ljones.dev>"]
|
||||||
repository = "https://gitlab.com/asus-linux/asusctl"
|
repository = "https://gitlab.com/asus-linux/asusctl"
|
||||||
|
|||||||
@@ -25,7 +25,6 @@ impl From<u32> for LedBrightness {
|
|||||||
match bright {
|
match bright {
|
||||||
0 => LedBrightness::Off,
|
0 => LedBrightness::Off,
|
||||||
1 => LedBrightness::Low,
|
1 => LedBrightness::Low,
|
||||||
2 => LedBrightness::Med,
|
|
||||||
3 => LedBrightness::High,
|
3 => LedBrightness::High,
|
||||||
_ => LedBrightness::Med,
|
_ => LedBrightness::Med,
|
||||||
}
|
}
|
||||||
@@ -179,21 +178,7 @@ impl Display for AuraModeNum {
|
|||||||
|
|
||||||
impl From<AuraModeNum> for String {
|
impl From<AuraModeNum> for String {
|
||||||
fn from(mode: AuraModeNum) -> Self {
|
fn from(mode: AuraModeNum) -> Self {
|
||||||
match mode {
|
<&str>::from(&mode).to_owned()
|
||||||
AuraModeNum::Static => "Static",
|
|
||||||
AuraModeNum::Breathe => "Breathe",
|
|
||||||
AuraModeNum::Strobe => "Strobe",
|
|
||||||
AuraModeNum::Rainbow => "Rainbow",
|
|
||||||
AuraModeNum::Star => "Stars",
|
|
||||||
AuraModeNum::Rain => "Rain",
|
|
||||||
AuraModeNum::Highlight => "Highlight",
|
|
||||||
AuraModeNum::Laser => "Laser",
|
|
||||||
AuraModeNum::Ripple => "Ripple",
|
|
||||||
AuraModeNum::Pulse => "Pulse",
|
|
||||||
AuraModeNum::Comet => "Comet",
|
|
||||||
AuraModeNum::Flash => "Flash",
|
|
||||||
}
|
|
||||||
.to_string()
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -218,7 +203,6 @@ impl From<&AuraModeNum> for &str {
|
|||||||
impl From<&str> for AuraModeNum {
|
impl From<&str> for AuraModeNum {
|
||||||
fn from(mode: &str) -> Self {
|
fn from(mode: &str) -> Self {
|
||||||
match mode {
|
match mode {
|
||||||
"Static" => AuraModeNum::Static,
|
|
||||||
"Breathe" => AuraModeNum::Breathe,
|
"Breathe" => AuraModeNum::Breathe,
|
||||||
"Strobe" => AuraModeNum::Strobe,
|
"Strobe" => AuraModeNum::Strobe,
|
||||||
"Rainbow" => AuraModeNum::Rainbow,
|
"Rainbow" => AuraModeNum::Rainbow,
|
||||||
@@ -238,7 +222,6 @@ impl From<&str> for AuraModeNum {
|
|||||||
impl From<u8> for AuraModeNum {
|
impl From<u8> for AuraModeNum {
|
||||||
fn from(mode: u8) -> Self {
|
fn from(mode: u8) -> Self {
|
||||||
match mode {
|
match mode {
|
||||||
0 => AuraModeNum::Static,
|
|
||||||
1 => AuraModeNum::Breathe,
|
1 => AuraModeNum::Breathe,
|
||||||
2 => AuraModeNum::Strobe,
|
2 => AuraModeNum::Strobe,
|
||||||
3 => AuraModeNum::Rainbow,
|
3 => AuraModeNum::Rainbow,
|
||||||
@@ -284,22 +267,14 @@ impl FromStr for AuraZone {
|
|||||||
fn from_str(s: &str) -> Result<Self, Self::Err> {
|
fn from_str(s: &str) -> Result<Self, Self::Err> {
|
||||||
let s = s.to_lowercase();
|
let s = s.to_lowercase();
|
||||||
match s.to_ascii_lowercase().as_str() {
|
match s.to_ascii_lowercase().as_str() {
|
||||||
"0" => Ok(AuraZone::None),
|
"0" | "none" => Ok(AuraZone::None),
|
||||||
"none" => Ok(AuraZone::None),
|
"1" | "one" => Ok(AuraZone::Key1),
|
||||||
"1" => Ok(AuraZone::Key1),
|
"2" | "two" => Ok(AuraZone::Key2),
|
||||||
"one" => Ok(AuraZone::Key1),
|
"3" | "three" => Ok(AuraZone::Key3),
|
||||||
"2" => Ok(AuraZone::Key2),
|
"4" | "four" => Ok(AuraZone::Key4),
|
||||||
"two" => Ok(AuraZone::Key2),
|
"5" | "logo" => Ok(AuraZone::Logo),
|
||||||
"3" => Ok(AuraZone::Key3),
|
"6" | "lightbar-left" => Ok(AuraZone::BarLeft),
|
||||||
"three" => Ok(AuraZone::Key3),
|
"7" | "lightbar-right" => Ok(AuraZone::BarRight),
|
||||||
"4" => Ok(AuraZone::Key4),
|
|
||||||
"four" => Ok(AuraZone::Key4),
|
|
||||||
"5" => Ok(AuraZone::Logo),
|
|
||||||
"logo" => Ok(AuraZone::Logo),
|
|
||||||
"6" => Ok(AuraZone::BarLeft),
|
|
||||||
"lightbar-left" => Ok(AuraZone::BarLeft),
|
|
||||||
"7" => Ok(AuraZone::BarRight),
|
|
||||||
"lightbar-right" => Ok(AuraZone::BarRight),
|
|
||||||
_ => Err(Error::ParseSpeed),
|
_ => Err(Error::ParseSpeed),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -395,18 +370,20 @@ impl AuraEffect {
|
|||||||
/// factory mode accepts only one colour.
|
/// factory mode accepts only one colour.
|
||||||
pub const fn allowed_parameters(mode: AuraModeNum) -> AuraParameters {
|
pub const fn allowed_parameters(mode: AuraModeNum) -> AuraParameters {
|
||||||
match mode {
|
match mode {
|
||||||
AuraModeNum::Static => AuraParameters::new(true, true, false, false, false),
|
AuraModeNum::Static
|
||||||
|
| AuraModeNum::Highlight
|
||||||
|
| AuraModeNum::Pulse
|
||||||
|
| AuraModeNum::Comet
|
||||||
|
| AuraModeNum::Flash => AuraParameters::new(true, true, false, false, false),
|
||||||
AuraModeNum::Breathe => AuraParameters::new(true, true, true, true, false),
|
AuraModeNum::Breathe => AuraParameters::new(true, true, true, true, false),
|
||||||
AuraModeNum::Strobe => AuraParameters::new(true, false, false, true, false),
|
AuraModeNum::Strobe | AuraModeNum::Rain => {
|
||||||
|
AuraParameters::new(true, false, false, true, false)
|
||||||
|
}
|
||||||
AuraModeNum::Rainbow => AuraParameters::new(true, false, false, true, true),
|
AuraModeNum::Rainbow => AuraParameters::new(true, false, false, true, true),
|
||||||
AuraModeNum::Star => AuraParameters::new(true, true, true, true, true),
|
AuraModeNum::Star => AuraParameters::new(true, true, true, true, true),
|
||||||
AuraModeNum::Rain => AuraParameters::new(true, false, false, true, false),
|
AuraModeNum::Laser | AuraModeNum::Ripple => {
|
||||||
AuraModeNum::Highlight => AuraParameters::new(true, true, false, false, false),
|
AuraParameters::new(true, true, false, true, false)
|
||||||
AuraModeNum::Laser => AuraParameters::new(true, true, false, true, false),
|
}
|
||||||
AuraModeNum::Ripple => AuraParameters::new(true, true, false, true, false),
|
|
||||||
AuraModeNum::Pulse => AuraParameters::new(true, true, false, false, false),
|
|
||||||
AuraModeNum::Comet => AuraParameters::new(true, true, false, false, false),
|
|
||||||
AuraModeNum::Flash => AuraParameters::new(true, true, false, false, false),
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -13,7 +13,7 @@ pub enum Error {
|
|||||||
|
|
||||||
impl fmt::Display for Error {
|
impl fmt::Display for Error {
|
||||||
// This trait requires `fmt` with this exact signature.
|
// This trait requires `fmt` with this exact signature.
|
||||||
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
|
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
|
||||||
match self {
|
match self {
|
||||||
Error::ParseColour => write!(f, "Could not parse colour"),
|
Error::ParseColour => write!(f, "Could not parse colour"),
|
||||||
Error::ParseSpeed => write!(f, "Could not parse speed"),
|
Error::ParseSpeed => write!(f, "Could not parse speed"),
|
||||||
|
|||||||
@@ -139,17 +139,17 @@ impl From<&Key> for &str {
|
|||||||
Key::MediaStop => "Media Stop",
|
Key::MediaStop => "Media Stop",
|
||||||
Key::MediaNext => "Media Next",
|
Key::MediaNext => "Media Next",
|
||||||
Key::MediaPrev => "Media Previous",
|
Key::MediaPrev => "Media Previous",
|
||||||
Key::NormalBlank => "",
|
Key::NormalBlank
|
||||||
Key::NormalSpacer => "",
|
| Key::NormalSpacer
|
||||||
Key::FuncBlank => "",
|
| Key::FuncBlank
|
||||||
Key::FuncSpacer => "",
|
| Key::FuncSpacer
|
||||||
Key::ArrowBlank => "",
|
| Key::ArrowBlank
|
||||||
Key::ArrowSpacer => "",
|
| Key::ArrowSpacer
|
||||||
Key::ArrowRegularBlank => "",
|
| Key::ArrowRegularBlank
|
||||||
Key::ArrowRegularSpacer => "",
|
| Key::ArrowRegularSpacer
|
||||||
Key::ArrowSplitBlank => "",
|
| Key::ArrowSplitBlank
|
||||||
Key::ArrowSplitSpacer => "",
|
| Key::ArrowSplitSpacer
|
||||||
Key::RowEndSpacer => "",
|
| Key::RowEndSpacer => "",
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -203,17 +203,22 @@ pub enum KeyShape {
|
|||||||
impl KeyShape {
|
impl KeyShape {
|
||||||
pub const fn width(&self) -> f32 {
|
pub const fn width(&self) -> f32 {
|
||||||
match self {
|
match self {
|
||||||
Self::Tilde => 0.8,
|
Self::Tilde | Self::Arrow => 0.8,
|
||||||
Self::Normal => 1.0,
|
Self::Normal
|
||||||
Self::NormalBlank => 1.0,
|
| Self::NormalBlank
|
||||||
Self::NormalSpacer => 1.0,
|
| Self::NormalSpacer
|
||||||
Self::Func => 1.0,
|
| Self::Func
|
||||||
Self::FuncBlank => 1.0,
|
| Self::FuncBlank
|
||||||
|
| Self::Space5
|
||||||
|
| Self::ArrowBlank
|
||||||
|
| Self::ArrowSpacer
|
||||||
|
| Self::ArrowSplit
|
||||||
|
| Self::ArrowSplitBlank
|
||||||
|
| Self::ArrowSplitSpacer => 1.0,
|
||||||
Self::FuncSpacer => 0.6,
|
Self::FuncSpacer => 0.6,
|
||||||
Self::Space => 5.0,
|
Self::Space => 5.0,
|
||||||
Self::Space5 => 1.0,
|
|
||||||
Self::LCtrlMed => 1.1,
|
Self::LCtrlMed => 1.1,
|
||||||
Self::LShift => 2.0,
|
Self::LShift | Self::Backspace => 2.0,
|
||||||
Self::LShift3 => 0.67,
|
Self::LShift3 => 0.67,
|
||||||
Self::RShift => 2.8,
|
Self::RShift => 2.8,
|
||||||
Self::RshiftSmall => 1.8,
|
Self::RshiftSmall => 1.8,
|
||||||
@@ -222,12 +227,9 @@ impl KeyShape {
|
|||||||
Self::Return3 => 0.7333,
|
Self::Return3 => 0.7333,
|
||||||
Self::Tab => 1.4,
|
Self::Tab => 1.4,
|
||||||
Self::Caps => 1.6,
|
Self::Caps => 1.6,
|
||||||
Self::Backspace => 2.0,
|
|
||||||
Self::Backspace3 => 0.666,
|
Self::Backspace3 => 0.666,
|
||||||
Self::ArrowRegularBlank | Self::ArrowRegularSpacer => 0.7,
|
Self::ArrowRegularBlank | Self::ArrowRegularSpacer => 0.7,
|
||||||
Self::Arrow => 0.8,
|
|
||||||
Self::ArrowBlank | Self::ArrowSpacer => 1.0,
|
|
||||||
Self::ArrowSplit | Self::ArrowSplitBlank | Self::ArrowSplitSpacer => 1.0,
|
|
||||||
Self::RowEndSpacer => 0.1,
|
Self::RowEndSpacer => 0.1,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -6,7 +6,7 @@ impl KeyLayout {
|
|||||||
pub fn g513_layout() -> Self {
|
pub fn g513_layout() -> Self {
|
||||||
Self {
|
Self {
|
||||||
matches: vec!["G513".into()],
|
matches: vec!["G513".into()],
|
||||||
locale: "US".to_string(),
|
locale: "US".to_owned(),
|
||||||
rows: vec![
|
rows: vec![
|
||||||
KeyRow::new(
|
KeyRow::new(
|
||||||
0.8,
|
0.8,
|
||||||
|
|||||||
@@ -5,7 +5,7 @@ impl KeyLayout {
|
|||||||
pub fn ga401_layout() -> Self {
|
pub fn ga401_layout() -> Self {
|
||||||
Self {
|
Self {
|
||||||
matches: vec!["GA401".into(), "GA402".into()],
|
matches: vec!["GA401".into(), "GA402".into()],
|
||||||
locale: "US".to_string(),
|
locale: "US".to_owned(),
|
||||||
rows: vec![
|
rows: vec![
|
||||||
KeyRow::new(
|
KeyRow::new(
|
||||||
0.8,
|
0.8,
|
||||||
|
|||||||
@@ -5,7 +5,7 @@ impl KeyLayout {
|
|||||||
pub fn gx502_layout() -> Self {
|
pub fn gx502_layout() -> Self {
|
||||||
Self {
|
Self {
|
||||||
matches: vec!["GX502".into(), "GU502".into()],
|
matches: vec!["GX502".into(), "GU502".into()],
|
||||||
locale: "US".to_string(),
|
locale: "US".to_owned(),
|
||||||
rows: vec![
|
rows: vec![
|
||||||
KeyRow::new(
|
KeyRow::new(
|
||||||
0.8,
|
0.8,
|
||||||
|
|||||||
@@ -43,7 +43,7 @@ impl KeyLayout {
|
|||||||
|
|
||||||
pub fn matches(&self, board_name: &str) -> bool {
|
pub fn matches(&self, board_name: &str) -> bool {
|
||||||
let board = board_name.to_ascii_uppercase();
|
let board = board_name.to_ascii_uppercase();
|
||||||
for tmp in self.matches.iter() {
|
for tmp in &self.matches {
|
||||||
if board.contains(tmp.as_str()) {
|
if board.contains(tmp.as_str()) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
@@ -91,7 +91,7 @@ impl KeyRow {
|
|||||||
Self { height, row }
|
Self { height, row }
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn row(&self) -> Iter<Key> {
|
pub fn row(&self) -> Iter<'_, Key> {
|
||||||
self.row.iter()
|
self.row.iter()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -43,8 +43,7 @@ impl ZonedColourArray {
|
|||||||
|
|
||||||
pub fn rgb_for_zone(&mut self, zone: PerZone) -> &mut [u8] {
|
pub fn rgb_for_zone(&mut self, zone: PerZone) -> &mut [u8] {
|
||||||
match zone {
|
match zone {
|
||||||
PerZone::None => &mut self.0[9..=11],
|
PerZone::None | PerZone::KeyboardLeft => &mut self.0[9..=11],
|
||||||
PerZone::KeyboardLeft => &mut self.0[9..=11],
|
|
||||||
PerZone::KeyboardCenterLeft => &mut self.0[12..=14],
|
PerZone::KeyboardCenterLeft => &mut self.0[12..=14],
|
||||||
PerZone::KeyboardCenterRight => &mut self.0[15..=17],
|
PerZone::KeyboardCenterRight => &mut self.0[15..=17],
|
||||||
PerZone::KeyboardRight => &mut self.0[18..=20],
|
PerZone::KeyboardRight => &mut self.0[18..=20],
|
||||||
|
|||||||
@@ -9,7 +9,7 @@ use serde_derive::{Deserialize, Serialize};
|
|||||||
// static mut RNDINDEX: usize = 0;
|
// static mut RNDINDEX: usize = 0;
|
||||||
static mut PRNDINDEX: usize = 0;
|
static mut PRNDINDEX: usize = 0;
|
||||||
|
|
||||||
/// Pseudo random table ripped straight out of Room4Doom
|
/// Pseudo random table ripped straight out of room4doom
|
||||||
pub const RNDTABLE: [i32; 256] = [
|
pub const RNDTABLE: [i32; 256] = [
|
||||||
0, 8, 109, 220, 222, 241, 149, 107, 75, 248, 254, 140, 16, 66, 74, 21, 211, 47, 80, 242, 154,
|
0, 8, 109, 220, 222, 241, 149, 107, 75, 248, 254, 140, 16, 66, 74, 21, 211, 47, 80, 242, 154,
|
||||||
27, 205, 128, 161, 89, 77, 36, 95, 110, 85, 48, 212, 140, 211, 249, 22, 79, 200, 50, 28, 188,
|
27, 205, 128, 161, 89, 77, 36, 95, 110, 85, 48, 212, 140, 211, 249, 22, 79, 200, 50, 28, 188,
|
||||||
@@ -88,7 +88,7 @@ impl Sequences {
|
|||||||
}
|
}
|
||||||
|
|
||||||
pub fn next_state(&mut self, layout: &KeyLayout) {
|
pub fn next_state(&mut self, layout: &KeyLayout) {
|
||||||
for effect in self.0.iter_mut() {
|
for effect in &mut self.0 {
|
||||||
effect.next_state(layout);
|
effect.next_state(layout);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -97,7 +97,7 @@ impl Sequences {
|
|||||||
let mut keys = KeyColourArray::new();
|
let mut keys = KeyColourArray::new();
|
||||||
let mut zones = ZonedColourArray::new();
|
let mut zones = ZonedColourArray::new();
|
||||||
let mut is_per_key = false;
|
let mut is_per_key = false;
|
||||||
for effect in self.0.iter() {
|
for effect in &self.0 {
|
||||||
match effect.get_led_type() {
|
match effect.get_led_type() {
|
||||||
LedType::Key(key) => {
|
LedType::Key(key) => {
|
||||||
is_per_key = true;
|
is_per_key = true;
|
||||||
|
|||||||
@@ -36,14 +36,10 @@ impl From<&str> for AuraDevice {
|
|||||||
fn from(s: &str) -> Self {
|
fn from(s: &str) -> Self {
|
||||||
match s.to_lowercase().as_str() {
|
match s.to_lowercase().as_str() {
|
||||||
"tuf" => AuraDevice::Tuf,
|
"tuf" => AuraDevice::Tuf,
|
||||||
"1866" => AuraDevice::X1866,
|
"1866" | "0x1866" => AuraDevice::X1866,
|
||||||
"1869" => AuraDevice::X1869,
|
"1869" | "0x1869" => AuraDevice::X1869,
|
||||||
"1854" => AuraDevice::X1854,
|
"1854" | "0x1854" => AuraDevice::X1854,
|
||||||
"19b6" => AuraDevice::X19B6,
|
"19b6" | "0x19b6" => AuraDevice::X19B6,
|
||||||
"0x1866" => AuraDevice::X1866,
|
|
||||||
"0x1869" => AuraDevice::X1869,
|
|
||||||
"0x1854" => AuraDevice::X1854,
|
|
||||||
"0x19b6" => AuraDevice::X19B6,
|
|
||||||
_ => AuraDevice::Unknown,
|
_ => AuraDevice::Unknown,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -108,9 +104,9 @@ impl From<AuraDev1866> for u32 {
|
|||||||
impl AuraDev1866 {
|
impl AuraDev1866 {
|
||||||
pub fn to_bytes(control: &[Self]) -> [u8; 3] {
|
pub fn to_bytes(control: &[Self]) -> [u8; 3] {
|
||||||
let mut a: u32 = 0;
|
let mut a: u32 = 0;
|
||||||
control.iter().for_each(|n| {
|
for n in control {
|
||||||
a |= *n as u32;
|
a |= *n as u32;
|
||||||
});
|
}
|
||||||
[
|
[
|
||||||
((a & 0xff0000) >> 16) as u8,
|
((a & 0xff0000) >> 16) as u8,
|
||||||
((a & 0xff00) >> 8) as u8,
|
((a & 0xff00) >> 8) as u8,
|
||||||
@@ -197,9 +193,9 @@ impl From<AuraDev19b6> for u32 {
|
|||||||
impl AuraDev19b6 {
|
impl AuraDev19b6 {
|
||||||
pub fn to_bytes(control: &[Self]) -> [u8; 3] {
|
pub fn to_bytes(control: &[Self]) -> [u8; 3] {
|
||||||
let mut a: u32 = 0;
|
let mut a: u32 = 0;
|
||||||
control.iter().for_each(|n| {
|
for n in control {
|
||||||
a |= *n as u32;
|
a |= *n as u32;
|
||||||
});
|
}
|
||||||
[
|
[
|
||||||
(a & 0xff) as u8,
|
(a & 0xff) as u8,
|
||||||
((a & 0xff00) >> 8) as u8,
|
((a & 0xff00) >> 8) as u8,
|
||||||
|
|||||||
@@ -1,5 +1,6 @@
|
|||||||
[package]
|
[package]
|
||||||
name = "rog-control-center"
|
name = "rog-control-center"
|
||||||
|
license = "MPL-2.0"
|
||||||
version.workspace = true
|
version.workspace = true
|
||||||
authors = ["Luke D. Jones <luke@ljones.dev>"]
|
authors = ["Luke D. Jones <luke@ljones.dev>"]
|
||||||
edition = "2021"
|
edition = "2021"
|
||||||
@@ -13,7 +14,7 @@ eframe= { git = "https://github.com/flukejones/egui" }
|
|||||||
#eframe= { git = "https://github.com/emilk/egui", default-features = false, features = ["dark-light", "default_fonts", "wgpu"] }
|
#eframe= { git = "https://github.com/emilk/egui", default-features = false, features = ["dark-light", "default_fonts", "wgpu"] }
|
||||||
|
|
||||||
libappindicator = "0.7" # Tray icon
|
libappindicator = "0.7" # Tray icon
|
||||||
gtk = "0.15"
|
gtk = "0.15.5"
|
||||||
|
|
||||||
daemon = { path = "../daemon" }
|
daemon = { path = "../daemon" }
|
||||||
rog_anime = { path = "../rog-anime" }
|
rog_anime = { path = "../rog-anime" }
|
||||||
@@ -38,5 +39,5 @@ notify-rust.workspace = true
|
|||||||
|
|
||||||
png_pong.workspace = true
|
png_pong.workspace = true
|
||||||
|
|
||||||
nix = "^0.25"
|
nix = "^0.26.1"
|
||||||
tempfile = "3.3.0"
|
tempfile = "3.3.0"
|
||||||
|
|||||||
@@ -15,7 +15,7 @@ pub enum Error {
|
|||||||
|
|
||||||
impl fmt::Display for Error {
|
impl fmt::Display for Error {
|
||||||
// This trait requires `fmt` with this exact signature.
|
// This trait requires `fmt` with this exact signature.
|
||||||
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
|
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
|
||||||
match self {
|
match self {
|
||||||
Error::Io(err) => write!(f, "Failed to open: {}", err),
|
Error::Io(err) => write!(f, "Failed to open: {}", err),
|
||||||
Error::Nix(err) => write!(f, "Error: {}", err),
|
Error::Nix(err) => write!(f, "Error: {}", err),
|
||||||
|
|||||||
@@ -206,7 +206,7 @@ fn load_icon() -> IconData {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
error!("Missing {APP_ICON_PATH}")
|
error!("Missing {APP_ICON_PATH}");
|
||||||
}
|
}
|
||||||
|
|
||||||
IconData {
|
IconData {
|
||||||
|
|||||||
@@ -397,9 +397,9 @@ where
|
|||||||
|
|
||||||
fn ac_power_notification(message: &str, on: &bool) -> Result<NotificationHandle> {
|
fn ac_power_notification(message: &str, on: &bool) -> Result<NotificationHandle> {
|
||||||
let data = if *on {
|
let data = if *on {
|
||||||
"plugged".to_string()
|
"plugged".to_owned()
|
||||||
} else {
|
} else {
|
||||||
"unplugged".to_string()
|
"unplugged".to_owned()
|
||||||
};
|
};
|
||||||
Ok(base_notification(message, &data).show()?)
|
Ok(base_notification(message, &data).show()?)
|
||||||
}
|
}
|
||||||
@@ -417,13 +417,12 @@ fn do_thermal_notif(message: &str, profile: &Profile) -> Result<NotificationHand
|
|||||||
|
|
||||||
fn do_gpu_status_notif(message: &str, data: &GfxPower) -> Result<NotificationHandle> {
|
fn do_gpu_status_notif(message: &str, data: &GfxPower) -> Result<NotificationHandle> {
|
||||||
// eww
|
// eww
|
||||||
let mut notif = base_notification(message, &<&str>::from(data).to_string());
|
let mut notif = base_notification(message, &<&str>::from(data).to_owned());
|
||||||
let icon = match data {
|
let icon = match data {
|
||||||
GfxPower::Active => "asus_notif_red",
|
|
||||||
GfxPower::Suspended => "asus_notif_blue",
|
GfxPower::Suspended => "asus_notif_blue",
|
||||||
GfxPower::Off => "asus_notif_green",
|
GfxPower::Off => "asus_notif_green",
|
||||||
GfxPower::AsusDisabled => "asus_notif_white",
|
GfxPower::AsusDisabled => "asus_notif_white",
|
||||||
GfxPower::AsusMuxDiscreet => "asus_notif_red",
|
GfxPower::AsusMuxDiscreet | GfxPower::Active => "asus_notif_red",
|
||||||
GfxPower::Unknown => "gpu-integrated",
|
GfxPower::Unknown => "gpu-integrated",
|
||||||
};
|
};
|
||||||
notif.icon(icon);
|
notif.icon(icon);
|
||||||
@@ -452,7 +451,7 @@ where
|
|||||||
Ok(())
|
Ok(())
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Actual GpuMode unused as data is never correct until switched by reboot
|
/// Actual `GpuMode` unused as data is never correct until switched by reboot
|
||||||
fn do_mux_notification(message: &str, _: &GpuMode) -> Result<NotificationHandle> {
|
fn do_mux_notification(message: &str, _: &GpuMode) -> Result<NotificationHandle> {
|
||||||
let mut notif = base_notification(message, &"");
|
let mut notif = base_notification(message, &"");
|
||||||
notif.urgency(Urgency::Critical);
|
notif.urgency(Urgency::Critical);
|
||||||
|
|||||||
@@ -30,7 +30,7 @@ impl RogApp {
|
|||||||
supported: &SupportedFunctions,
|
supported: &SupportedFunctions,
|
||||||
profiles: &mut ProfilesState,
|
profiles: &mut ProfilesState,
|
||||||
curves: &mut FanCurvesState,
|
curves: &mut FanCurvesState,
|
||||||
dbus: &RogDbusClientBlocking,
|
dbus: &RogDbusClientBlocking<'_>,
|
||||||
do_error: &mut Option<String>,
|
do_error: &mut Option<String>,
|
||||||
ui: &mut Ui,
|
ui: &mut Ui,
|
||||||
) {
|
) {
|
||||||
@@ -62,7 +62,7 @@ impl RogApp {
|
|||||||
};
|
};
|
||||||
|
|
||||||
profiles.list.sort();
|
profiles.list.sort();
|
||||||
for f in profiles.list.iter() {
|
for f in &profiles.list {
|
||||||
item(*f, curves, curves.enabled.contains(f));
|
item(*f, curves, curves.enabled.contains(f));
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|||||||
@@ -27,7 +27,7 @@ pub struct BiosState {
|
|||||||
}
|
}
|
||||||
|
|
||||||
impl BiosState {
|
impl BiosState {
|
||||||
pub fn new(supported: &SupportedFunctions, dbus: &RogDbusClientBlocking) -> Result<Self> {
|
pub fn new(supported: &SupportedFunctions, dbus: &RogDbusClientBlocking<'_>) -> Result<Self> {
|
||||||
Ok(Self {
|
Ok(Self {
|
||||||
post_sound: if supported.rog_bios_ctrl.post_sound {
|
post_sound: if supported.rog_bios_ctrl.post_sound {
|
||||||
dbus.proxies().rog_bios().post_boot_sound()? != 0
|
dbus.proxies().rog_bios().post_boot_sound()? != 0
|
||||||
@@ -58,7 +58,7 @@ pub struct ProfilesState {
|
|||||||
}
|
}
|
||||||
|
|
||||||
impl ProfilesState {
|
impl ProfilesState {
|
||||||
pub fn new(supported: &SupportedFunctions, dbus: &RogDbusClientBlocking) -> Result<Self> {
|
pub fn new(supported: &SupportedFunctions, dbus: &RogDbusClientBlocking<'_>) -> Result<Self> {
|
||||||
Ok(Self {
|
Ok(Self {
|
||||||
list: if supported.platform_profile.platform_profile {
|
list: if supported.platform_profile.platform_profile {
|
||||||
let mut list = dbus.proxies().profile().profiles()?;
|
let mut list = dbus.proxies().profile().profiles()?;
|
||||||
@@ -86,26 +86,25 @@ pub struct FanCurvesState {
|
|||||||
}
|
}
|
||||||
|
|
||||||
impl FanCurvesState {
|
impl FanCurvesState {
|
||||||
pub fn new(supported: &SupportedFunctions, dbus: &RogDbusClientBlocking) -> Result<Self> {
|
pub fn new(supported: &SupportedFunctions, dbus: &RogDbusClientBlocking<'_>) -> Result<Self> {
|
||||||
let profiles = if supported.platform_profile.platform_profile {
|
let profiles = if supported.platform_profile.platform_profile {
|
||||||
dbus.proxies().profile().profiles()?
|
dbus.proxies().profile().profiles()?
|
||||||
} else {
|
} else {
|
||||||
vec![Profile::Balanced, Profile::Quiet, Profile::Performance]
|
vec![Profile::Balanced, Profile::Quiet, Profile::Performance]
|
||||||
};
|
};
|
||||||
let enabled = if supported.platform_profile.fan_curves {
|
let enabled = if supported.platform_profile.fan_curves {
|
||||||
HashSet::from_iter(
|
dbus.proxies()
|
||||||
dbus.proxies()
|
.profile()
|
||||||
.profile()
|
.enabled_fan_profiles()?
|
||||||
.enabled_fan_profiles()?
|
.iter()
|
||||||
.iter()
|
.cloned()
|
||||||
.cloned(),
|
.collect::<HashSet<_>>()
|
||||||
)
|
|
||||||
} else {
|
} else {
|
||||||
HashSet::from([Profile::Balanced, Profile::Quiet, Profile::Performance])
|
HashSet::from([Profile::Balanced, Profile::Quiet, Profile::Performance])
|
||||||
};
|
};
|
||||||
|
|
||||||
let mut curves: BTreeMap<Profile, FanCurveSet> = BTreeMap::new();
|
let mut curves: BTreeMap<Profile, FanCurveSet> = BTreeMap::new();
|
||||||
profiles.iter().for_each(|p| {
|
for p in &profiles {
|
||||||
if supported.platform_profile.fan_curves {
|
if supported.platform_profile.fan_curves {
|
||||||
if let Ok(curve) = dbus.proxies().profile().fan_curve_data(*p) {
|
if let Ok(curve) = dbus.proxies().profile().fan_curve_data(*p) {
|
||||||
curves.insert(*p, curve);
|
curves.insert(*p, curve);
|
||||||
@@ -118,7 +117,7 @@ impl FanCurvesState {
|
|||||||
curve.gpu.temp = [20, 30, 40, 50, 70, 80, 90, 100];
|
curve.gpu.temp = [20, 30, 40, 50, 70, 80, 90, 100];
|
||||||
curves.insert(*p, curve);
|
curves.insert(*p, curve);
|
||||||
}
|
}
|
||||||
});
|
}
|
||||||
|
|
||||||
let show_curve = if supported.platform_profile.fan_curves {
|
let show_curve = if supported.platform_profile.fan_curves {
|
||||||
dbus.proxies().profile().active_profile()?
|
dbus.proxies().profile().active_profile()?
|
||||||
@@ -149,7 +148,7 @@ pub struct AuraState {
|
|||||||
}
|
}
|
||||||
|
|
||||||
impl AuraState {
|
impl AuraState {
|
||||||
pub fn new(supported: &SupportedFunctions, dbus: &RogDbusClientBlocking) -> Result<Self> {
|
pub fn new(supported: &SupportedFunctions, dbus: &RogDbusClientBlocking<'_>) -> Result<Self> {
|
||||||
Ok(Self {
|
Ok(Self {
|
||||||
current_mode: if !supported.keyboard_led.stock_led_modes.is_empty() {
|
current_mode: if !supported.keyboard_led.stock_led_modes.is_empty() {
|
||||||
dbus.proxies().led().led_mode().unwrap_or_default()
|
dbus.proxies().led().led_mode().unwrap_or_default()
|
||||||
@@ -198,7 +197,7 @@ pub struct AnimeState {
|
|||||||
}
|
}
|
||||||
|
|
||||||
impl AnimeState {
|
impl AnimeState {
|
||||||
pub fn new(supported: &SupportedFunctions, dbus: &RogDbusClientBlocking) -> Result<Self> {
|
pub fn new(supported: &SupportedFunctions, dbus: &RogDbusClientBlocking<'_>) -> Result<Self> {
|
||||||
Ok(Self {
|
Ok(Self {
|
||||||
boot: if supported.anime_ctrl.0 {
|
boot: if supported.anime_ctrl.0 {
|
||||||
dbus.proxies().anime().boot_enabled()?
|
dbus.proxies().anime().boot_enabled()?
|
||||||
@@ -224,7 +223,7 @@ pub struct GfxState {
|
|||||||
}
|
}
|
||||||
|
|
||||||
impl GfxState {
|
impl GfxState {
|
||||||
pub fn new(_supported: &SupportedFunctions, dbus: &GfxProxyBlocking) -> Result<Self> {
|
pub fn new(_supported: &SupportedFunctions, dbus: &GfxProxyBlocking<'_>) -> Result<Self> {
|
||||||
Ok(Self {
|
Ok(Self {
|
||||||
mode: dbus.mode()?,
|
mode: dbus.mode()?,
|
||||||
power_status: dbus.power()?,
|
power_status: dbus.power()?,
|
||||||
@@ -239,7 +238,7 @@ pub struct PowerState {
|
|||||||
}
|
}
|
||||||
|
|
||||||
impl PowerState {
|
impl PowerState {
|
||||||
pub fn new(_supported: &SupportedFunctions, dbus: &RogDbusClientBlocking) -> Result<Self> {
|
pub fn new(_supported: &SupportedFunctions, dbus: &RogDbusClientBlocking<'_>) -> Result<Self> {
|
||||||
Ok(Self {
|
Ok(Self {
|
||||||
charge_limit: dbus.proxies().charge().charge_control_end_threshold()?,
|
charge_limit: dbus.proxies().charge().charge_control_end_threshold()?,
|
||||||
ac_power: dbus.proxies().charge().mains_online()?,
|
ac_power: dbus.proxies().charge().mains_online()?,
|
||||||
|
|||||||
@@ -128,13 +128,18 @@ impl ROGTray {
|
|||||||
self.menu.show_all();
|
self.menu.show_all();
|
||||||
}
|
}
|
||||||
|
|
||||||
fn add_radio_sub_menu(&mut self, header_label: &str, active_label: &str, sub_menu: RadioGroup) {
|
fn add_radio_sub_menu(
|
||||||
|
&mut self,
|
||||||
|
header_label: &str,
|
||||||
|
active_label: &str,
|
||||||
|
sub_menu: &RadioGroup,
|
||||||
|
) {
|
||||||
let header_item = gtk::MenuItem::with_label(header_label);
|
let header_item = gtk::MenuItem::with_label(header_label);
|
||||||
header_item.show_all();
|
header_item.show_all();
|
||||||
self.menu.add(&header_item);
|
self.menu.add(&header_item);
|
||||||
|
|
||||||
let menu = gtk::Menu::new();
|
let menu = gtk::Menu::new();
|
||||||
for item in sub_menu.0.iter() {
|
for item in &sub_menu.0 {
|
||||||
if let Some(label) = item.label() {
|
if let Some(label) = item.label() {
|
||||||
item.set_active(label == active_label);
|
item.set_active(label == active_label);
|
||||||
} else {
|
} else {
|
||||||
@@ -197,7 +202,7 @@ impl ROGTray {
|
|||||||
}
|
}
|
||||||
|
|
||||||
fn _set_status(&mut self, status: AppIndicatorStatus) {
|
fn _set_status(&mut self, status: AppIndicatorStatus) {
|
||||||
self.tray.set_status(status)
|
self.tray.set_status(status);
|
||||||
}
|
}
|
||||||
|
|
||||||
fn menu_add_base(&mut self) {
|
fn menu_add_base(&mut self) {
|
||||||
@@ -319,13 +324,13 @@ impl ROGTray {
|
|||||||
}
|
}
|
||||||
|
|
||||||
let active = match current_mode {
|
let active = match current_mode {
|
||||||
GfxMode::AsusMuxDiscreet => "Discreet".to_string(),
|
GfxMode::AsusMuxDiscreet => "Discreet".to_owned(),
|
||||||
_ => current_mode.to_string(),
|
_ => current_mode.to_string(),
|
||||||
};
|
};
|
||||||
self.add_radio_sub_menu(
|
self.add_radio_sub_menu(
|
||||||
&format!("GPU Mode: {current_mode}"),
|
&format!("GPU Mode: {current_mode}"),
|
||||||
active.as_str(),
|
active.as_str(),
|
||||||
gpu_menu,
|
&gpu_menu,
|
||||||
);
|
);
|
||||||
|
|
||||||
debug!("ROGTray: appended gpu menu");
|
debug!("ROGTray: appended gpu menu");
|
||||||
@@ -408,11 +413,12 @@ pub fn init_tray(
|
|||||||
debug!("ROGTray: rebuilt menus due to state change");
|
debug!("ROGTray: rebuilt menus due to state change");
|
||||||
|
|
||||||
match lock.gfx_state.power_status {
|
match lock.gfx_state.power_status {
|
||||||
GfxPower::Active => tray.set_icon("asus_notif_red"),
|
|
||||||
GfxPower::Suspended => tray.set_icon("asus_notif_blue"),
|
GfxPower::Suspended => tray.set_icon("asus_notif_blue"),
|
||||||
GfxPower::Off => tray.set_icon("asus_notif_green"),
|
GfxPower::Off => tray.set_icon("asus_notif_green"),
|
||||||
GfxPower::AsusDisabled => tray.set_icon("asus_notif_white"),
|
GfxPower::AsusDisabled => tray.set_icon("asus_notif_white"),
|
||||||
GfxPower::AsusMuxDiscreet => tray.set_icon("asus_notif_red"),
|
GfxPower::AsusMuxDiscreet | GfxPower::Active => {
|
||||||
|
tray.set_icon("asus_notif_red")
|
||||||
|
}
|
||||||
GfxPower::Unknown => tray.set_icon("gpu-integrated"),
|
GfxPower::Unknown => tray.set_icon("gpu-integrated"),
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -12,7 +12,7 @@ pub fn aura_power_group(supported: &SupportedFunctions, states: &mut SystemState
|
|||||||
|
|
||||||
match supported.keyboard_led.prod_id {
|
match supported.keyboard_led.prod_id {
|
||||||
AuraDevice::X1854 | AuraDevice::X1869 | AuraDevice::X1866 => {
|
AuraDevice::X1854 | AuraDevice::X1869 | AuraDevice::X1866 => {
|
||||||
aura_power1(supported, states, ui)
|
aura_power1(supported, states, ui);
|
||||||
}
|
}
|
||||||
AuraDevice::X19B6 => aura_power2(supported, states, ui),
|
AuraDevice::X19B6 => aura_power2(supported, states, ui),
|
||||||
AuraDevice::Tuf => aura_power1(supported, states, ui),
|
AuraDevice::Tuf => aura_power1(supported, states, ui),
|
||||||
|
|||||||
@@ -11,7 +11,7 @@ pub fn fan_graphs(
|
|||||||
supported: &SupportedFunctions,
|
supported: &SupportedFunctions,
|
||||||
profiles: &mut ProfilesState,
|
profiles: &mut ProfilesState,
|
||||||
curves: &mut FanCurvesState,
|
curves: &mut FanCurvesState,
|
||||||
dbus: &RogDbusClientBlocking,
|
dbus: &RogDbusClientBlocking<'_>,
|
||||||
do_error: &mut Option<String>,
|
do_error: &mut Option<String>,
|
||||||
ui: &mut Ui,
|
ui: &mut Ui,
|
||||||
) {
|
) {
|
||||||
@@ -36,7 +36,7 @@ pub fn fan_graphs(
|
|||||||
};
|
};
|
||||||
|
|
||||||
ui.horizontal_wrapped(|ui| {
|
ui.horizontal_wrapped(|ui| {
|
||||||
for a in curves.curves.iter() {
|
for a in &curves.curves {
|
||||||
item(*a.0, ui);
|
item(*a.0, ui);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
@@ -57,8 +57,8 @@ pub fn fan_graphs(
|
|||||||
[x, y]
|
[x, y]
|
||||||
});
|
});
|
||||||
|
|
||||||
let line = Line::new(PlotPoints::from_iter(points.clone())).width(2.0);
|
let line = Line::new(points.clone().collect::<PlotPoints>()).width(2.0);
|
||||||
let points = Points::new(PlotPoints::from_iter(points)).radius(3.0);
|
let points = Points::new(points.collect::<PlotPoints>()).radius(3.0);
|
||||||
|
|
||||||
Plot::new("fan_curves")
|
Plot::new("fan_curves")
|
||||||
.view_aspect(1.666)
|
.view_aspect(1.666)
|
||||||
@@ -107,7 +107,7 @@ pub fn fan_graphs(
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
plot_ui.line(line);
|
plot_ui.line(line);
|
||||||
plot_ui.points(points)
|
plot_ui.points(points);
|
||||||
});
|
});
|
||||||
|
|
||||||
let mut set = false;
|
let mut set = false;
|
||||||
|
|||||||
@@ -17,7 +17,7 @@ pub fn platform_profile(states: &mut SystemState, ui: &mut Ui) {
|
|||||||
};
|
};
|
||||||
|
|
||||||
ui.horizontal_wrapped(|ui| {
|
ui.horizontal_wrapped(|ui| {
|
||||||
for a in states.profiles.list.iter() {
|
for a in &states.profiles.list {
|
||||||
item(*a, ui);
|
item(*a, ui);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
@@ -46,7 +46,7 @@ pub fn rog_bios_group(supported: &SupportedFunctions, states: &mut SystemState,
|
|||||||
.asus_dbus
|
.asus_dbus
|
||||||
.proxies()
|
.proxies()
|
||||||
.charge()
|
.charge()
|
||||||
.set_charge_control_end_threshold(states.power_state.charge_limit as u8)
|
.set_charge_control_end_threshold(states.power_state.charge_limit)
|
||||||
.map_err(|err| {
|
.map_err(|err| {
|
||||||
states.error = Some(err.to_string());
|
states.error = Some(err.to_string());
|
||||||
})
|
})
|
||||||
|
|||||||
@@ -81,7 +81,7 @@ impl<'a> RogDbusClientBlocking<'a> {
|
|||||||
Ok((RogDbusClientBlocking { proxies }, conn))
|
Ok((RogDbusClientBlocking { proxies }, conn))
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn proxies(&self) -> &DbusProxiesBlocking {
|
pub fn proxies(&self) -> &DbusProxiesBlocking<'_> {
|
||||||
&self.proxies
|
&self.proxies
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -150,7 +150,7 @@ impl<'a> RogDbusClient<'a> {
|
|||||||
Ok((RogDbusClient { proxies }, conn))
|
Ok((RogDbusClient { proxies }, conn))
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn proxies(&self) -> &DbusProxies {
|
pub fn proxies(&self) -> &DbusProxies<'_> {
|
||||||
&self.proxies
|
&self.proxies
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,5 +1,6 @@
|
|||||||
[package]
|
[package]
|
||||||
name = "rog_platform"
|
name = "rog_platform"
|
||||||
|
license = "MPL-2.0"
|
||||||
version.workspace = true
|
version.workspace = true
|
||||||
edition = "2021"
|
edition = "2021"
|
||||||
|
|
||||||
|
|||||||
@@ -23,7 +23,7 @@ pub enum PlatformError {
|
|||||||
|
|
||||||
impl fmt::Display for PlatformError {
|
impl fmt::Display for PlatformError {
|
||||||
// This trait requires `fmt` with this exact signature.
|
// This trait requires `fmt` with this exact signature.
|
||||||
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
|
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
|
||||||
match self {
|
match self {
|
||||||
PlatformError::ParseVendor => write!(f, "Parse gfx vendor error"),
|
PlatformError::ParseVendor => write!(f, "Parse gfx vendor error"),
|
||||||
PlatformError::ParseNum => write!(f, "Parse number error"),
|
PlatformError::ParseNum => write!(f, "Parse number error"),
|
||||||
|
|||||||
@@ -19,7 +19,7 @@ pub const VERSION: &str = env!("CARGO_PKG_VERSION");
|
|||||||
|
|
||||||
pub(crate) fn to_device(sys_path: &Path) -> Result<Device> {
|
pub(crate) fn to_device(sys_path: &Path) -> Result<Device> {
|
||||||
Device::from_syspath(sys_path)
|
Device::from_syspath(sys_path)
|
||||||
.map_err(|e| PlatformError::Udev("Couldn't transform syspath to device".to_string(), e))
|
.map_err(|e| PlatformError::Udev("Couldn't transform syspath to device".to_owned(), e))
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn has_attr(device: &Device, attr_name: &str) -> bool {
|
pub fn has_attr(device: &Device, attr_name: &str) -> bool {
|
||||||
@@ -39,7 +39,7 @@ pub fn read_attr_bool(device: &Device, attr_name: &str) -> Result<bool> {
|
|||||||
}
|
}
|
||||||
return Ok(true);
|
return Ok(true);
|
||||||
}
|
}
|
||||||
Err(PlatformError::AttrNotFound(attr_name.to_string()))
|
Err(PlatformError::AttrNotFound(attr_name.to_owned()))
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn write_attr_bool(device: &mut Device, attr: &str, value: bool) -> Result<()> {
|
pub fn write_attr_bool(device: &mut Device, attr: &str, value: bool) -> Result<()> {
|
||||||
@@ -53,7 +53,7 @@ pub fn read_attr_u8(device: &Device, attr_name: &str) -> Result<u8> {
|
|||||||
let tmp = value.to_string_lossy();
|
let tmp = value.to_string_lossy();
|
||||||
return tmp.parse::<u8>().map_err(|_| PlatformError::ParseNum);
|
return tmp.parse::<u8>().map_err(|_| PlatformError::ParseNum);
|
||||||
}
|
}
|
||||||
Err(PlatformError::AttrNotFound(attr_name.to_string()))
|
Err(PlatformError::AttrNotFound(attr_name.to_owned()))
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn write_attr_u8(device: &mut Device, attr: &str, value: u8) -> Result<()> {
|
pub fn write_attr_u8(device: &mut Device, attr: &str, value: u8) -> Result<()> {
|
||||||
@@ -71,7 +71,7 @@ pub fn read_attr_u8_array(device: &Device, attr_name: &str) -> Result<Vec<u8>> {
|
|||||||
.collect();
|
.collect();
|
||||||
return Ok(tmp);
|
return Ok(tmp);
|
||||||
}
|
}
|
||||||
Err(PlatformError::AttrNotFound(attr_name.to_string()))
|
Err(PlatformError::AttrNotFound(attr_name.to_owned()))
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn write_attr_u8_array(device: &mut Device, attr: &str, values: &[u8]) -> Result<()> {
|
pub fn write_attr_u8_array(device: &mut Device, attr: &str, values: &[u8]) -> Result<()> {
|
||||||
|
|||||||
@@ -11,12 +11,12 @@ use crate::{
|
|||||||
};
|
};
|
||||||
|
|
||||||
/// The "platform" device provides access to things like:
|
/// The "platform" device provides access to things like:
|
||||||
/// - dgpu_disable
|
/// - `dgpu_disable`
|
||||||
/// - egpu_enable
|
/// - `egpu_enable`
|
||||||
/// - panel_od
|
/// - `panel_od`
|
||||||
/// - gpu_mux
|
/// - `gpu_mux`
|
||||||
/// - keyboard_mode, set keyboard RGB mode and speed
|
/// - `keyboard_mode`, set keyboard RGB mode and speed
|
||||||
/// - keyboard_state, set keyboard power states
|
/// - `keyboard_state`, set keyboard power states
|
||||||
#[derive(Debug, PartialEq, Eq, PartialOrd, Clone)]
|
#[derive(Debug, PartialEq, Eq, PartialOrd, Clone)]
|
||||||
pub struct AsusPlatform {
|
pub struct AsusPlatform {
|
||||||
path: PathBuf,
|
path: PathBuf,
|
||||||
|
|||||||
@@ -9,12 +9,12 @@ use crate::{
|
|||||||
};
|
};
|
||||||
|
|
||||||
/// The "platform" device provides access to things like:
|
/// The "platform" device provides access to things like:
|
||||||
/// - dgpu_disable
|
/// - `dgpu_disable`
|
||||||
/// - egpu_enable
|
/// - `egpu_enable`
|
||||||
/// - panel_od
|
/// - `panel_od`
|
||||||
/// - gpu_mux
|
/// - `gpu_mux`
|
||||||
/// - keyboard_mode, set keyboard RGB mode and speed
|
/// - `keyboard_mode`, set keyboard RGB mode and speed
|
||||||
/// - keyboard_state, set keyboard power states
|
/// - `keyboard_state`, set keyboard power states
|
||||||
#[derive(Debug, PartialEq, Eq, PartialOrd, Clone)]
|
#[derive(Debug, PartialEq, Eq, PartialOrd, Clone)]
|
||||||
pub struct AsusPower {
|
pub struct AsusPower {
|
||||||
mains: PathBuf,
|
mains: PathBuf,
|
||||||
|
|||||||
@@ -11,7 +11,7 @@ impl USBRaw {
|
|||||||
for device in rusb::devices()?.iter() {
|
for device in rusb::devices()?.iter() {
|
||||||
let device_desc = device.device_descriptor()?;
|
let device_desc = device.device_descriptor()?;
|
||||||
if device_desc.vendor_id() == 0x0b05 && device_desc.product_id() == id_product {
|
if device_desc.vendor_id() == 0x0b05 && device_desc.product_id() == id_product {
|
||||||
let handle = Self::get_dev_handle(device)?;
|
let handle = Self::get_dev_handle(&device)?;
|
||||||
return Ok(Self(handle));
|
return Ok(Self(handle));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -23,7 +23,7 @@ impl USBRaw {
|
|||||||
}
|
}
|
||||||
|
|
||||||
fn get_dev_handle(
|
fn get_dev_handle(
|
||||||
device: Device<rusb::GlobalContext>,
|
device: &Device<rusb::GlobalContext>,
|
||||||
) -> Result<DeviceHandle<rusb::GlobalContext>> {
|
) -> Result<DeviceHandle<rusb::GlobalContext>> {
|
||||||
// We don't expect this ID to ever change
|
// We don't expect this ID to ever change
|
||||||
let mut device = device.open()?;
|
let mut device = device.open()?;
|
||||||
|
|||||||
@@ -1,5 +1,6 @@
|
|||||||
[package]
|
[package]
|
||||||
name = "rog_profiles"
|
name = "rog_profiles"
|
||||||
|
license = "MPL-2.0"
|
||||||
version.workspace = true
|
version.workspace = true
|
||||||
authors = ["Luke D. Jones <luke@ljones.dev>"]
|
authors = ["Luke D. Jones <luke@ljones.dev>"]
|
||||||
edition = "2021"
|
edition = "2021"
|
||||||
|
|||||||
Reference in New Issue
Block a user