mirror of
https://gitlab.com/asus-linux/asusctl.git
synced 2026-02-06 00:15:04 +01:00
Compare commits
20 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 4cdb06959b | |||
| 781ad30eb5 | |||
| 84d056f2ed | |||
| 3a2f2c99f4 | |||
| cddff32757 | |||
| 1b427c6c07 | |||
| 6ba645f727 | |||
| 772538bc8a | |||
| 855d4dc701 | |||
| 3095e181eb | |||
| ee020085f8 | |||
| b70137eec8 | |||
| aa4d79c6f5 | |||
| ab8393a807 | |||
| b8c83a1a72 | |||
| 8cee0e6735 | |||
| c482208d3c | |||
| 708712e00a | |||
| 25ee250542 | |||
| b921b68c57 |
@@ -0,0 +1,26 @@
|
|||||||
|
image: rustdocker/rust:stable
|
||||||
|
|
||||||
|
before_script:
|
||||||
|
- apt-get update -qq && apt-get install -y -qq libdbus-1-dev libclang-dev libudev-dev
|
||||||
|
|
||||||
|
stages:
|
||||||
|
- test
|
||||||
|
- build
|
||||||
|
|
||||||
|
test:
|
||||||
|
script:
|
||||||
|
- cargo check #+nightly check --features "clippy"
|
||||||
|
|
||||||
|
build:
|
||||||
|
only:
|
||||||
|
- next
|
||||||
|
script:
|
||||||
|
- make && make vendor
|
||||||
|
artifacts:
|
||||||
|
paths:
|
||||||
|
- vendor_asus-nb-ctrl_*.tar.xz
|
||||||
|
- cargo-config
|
||||||
|
|
||||||
|
variables:
|
||||||
|
GIT_SUBMODULE_STRATEGY: normal
|
||||||
|
|
||||||
@@ -6,6 +6,26 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
|||||||
|
|
||||||
## [Unreleased]
|
## [Unreleased]
|
||||||
|
|
||||||
|
# [1.1.2] - 2020-09-10
|
||||||
|
### Changed
|
||||||
|
- Bump rog-fan-curve to new versiont o support GA401IV
|
||||||
|
|
||||||
|
# [1.1.1] - 2020-09-10
|
||||||
|
### Changed
|
||||||
|
- Correction to AMD turbo setting
|
||||||
|
|
||||||
|
# [1.1.0] - 2020-09-10
|
||||||
|
### Changed
|
||||||
|
- Uses string instead of debug print for some errors
|
||||||
|
- Add interface num arg for LED controller (should help support
|
||||||
|
older laptops better)
|
||||||
|
- Some slightly better error messages
|
||||||
|
- Fix an idiotic mistake in `for i in 0..2.. if i > 0` -_-
|
||||||
|
- Remove "unsupported" warning on laptop ctrl
|
||||||
|
- Silence warning about AniMe not existing
|
||||||
|
- Adjust the turbo-toggle CLI arg
|
||||||
|
- Version bump for new release with fancurves
|
||||||
|
|
||||||
## [1.0.2] - 2020-08-13
|
## [1.0.2] - 2020-08-13
|
||||||
### Changed
|
### Changed
|
||||||
- Bugfixes to led brightness watcher
|
- Bugfixes to led brightness watcher
|
||||||
|
|||||||
Generated
+64
-138
@@ -2,9 +2,9 @@
|
|||||||
# It is not intended for manual editing.
|
# It is not intended for manual editing.
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "adler32"
|
name = "adler32"
|
||||||
version = "1.1.0"
|
version = "1.2.0"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "567b077b825e468cc974f0020d4082ee6e03132512f207ef1a02fd5d00d1f32d"
|
checksum = "aae1277d39aeec15cb388266ecc24b11c80469deae6067e17a1a7aa9e5c1f234"
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "aho-corasick"
|
name = "aho-corasick"
|
||||||
@@ -17,10 +17,11 @@ dependencies = [
|
|||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "asus-nb"
|
name = "asus-nb"
|
||||||
version = "0.15.0"
|
version = "1.1.0"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"dbus",
|
"dbus",
|
||||||
"gumdrop",
|
"gumdrop",
|
||||||
|
"rog_fan_curve",
|
||||||
"serde",
|
"serde",
|
||||||
"serde_derive",
|
"serde_derive",
|
||||||
"serde_json",
|
"serde_json",
|
||||||
@@ -30,7 +31,7 @@ dependencies = [
|
|||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "asus-nb-ctrl"
|
name = "asus-nb-ctrl"
|
||||||
version = "1.0.2"
|
version = "1.1.2"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"asus-nb",
|
"asus-nb",
|
||||||
"async-trait",
|
"async-trait",
|
||||||
@@ -40,6 +41,7 @@ dependencies = [
|
|||||||
"gumdrop",
|
"gumdrop",
|
||||||
"intel-pstate",
|
"intel-pstate",
|
||||||
"log",
|
"log",
|
||||||
|
"rog_fan_curve",
|
||||||
"rusb",
|
"rusb",
|
||||||
"serde",
|
"serde",
|
||||||
"serde_derive",
|
"serde_derive",
|
||||||
@@ -52,9 +54,9 @@ dependencies = [
|
|||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "async-trait"
|
name = "async-trait"
|
||||||
version = "0.1.36"
|
version = "0.1.40"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "a265e3abeffdce30b2e26b7a11b222fe37c6067404001b434101457d0385eb92"
|
checksum = "687c230d85c0a52504709705fc8a53e4a692b83a2184f03dae73e38e1e93a783"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"proc-macro2",
|
"proc-macro2",
|
||||||
"quote",
|
"quote",
|
||||||
@@ -72,21 +74,6 @@ dependencies = [
|
|||||||
"winapi 0.3.9",
|
"winapi 0.3.9",
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
|
||||||
name = "bit-set"
|
|
||||||
version = "0.5.2"
|
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
||||||
checksum = "6e11e16035ea35e4e5997b393eacbf6f63983188f7a2ad25bfb13465f5ad59de"
|
|
||||||
dependencies = [
|
|
||||||
"bit-vec",
|
|
||||||
]
|
|
||||||
|
|
||||||
[[package]]
|
|
||||||
name = "bit-vec"
|
|
||||||
version = "0.6.2"
|
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
||||||
checksum = "5f0dc55f2d8a1a85650ac47858bb001b4c0dd73d79e3c455a842925e68d29cd3"
|
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "bitflags"
|
name = "bitflags"
|
||||||
version = "1.2.1"
|
version = "1.2.1"
|
||||||
@@ -95,18 +82,15 @@ checksum = "cf1de2fe8c75bc145a2f577add951f8134889b4795d47466a54a5c846d691693"
|
|||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "bytes"
|
name = "bytes"
|
||||||
version = "0.5.5"
|
version = "0.5.6"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "118cf036fbb97d0816e3c34b2d7a1e8cfc60f68fcf63d550ddbe9bd5f59c213b"
|
checksum = "0e4cec68f03f32e44924783795810fa50a7035d8c8ebe78580ad7e6c703fba38"
|
||||||
dependencies = [
|
|
||||||
"loom",
|
|
||||||
]
|
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "cc"
|
name = "cc"
|
||||||
version = "1.0.56"
|
version = "1.0.59"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "77c1f1d60091c1b73e2b1f4560ab419204b178e625fa945ded7b660becd2bd46"
|
checksum = "66120af515773fb005778dc07c261bd201ec8ce50bd6e7144c927753fe013381"
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "cfg-if"
|
name = "cfg-if"
|
||||||
@@ -136,11 +120,12 @@ dependencies = [
|
|||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "dbus-tokio"
|
name = "dbus-tokio"
|
||||||
version = "0.5.1"
|
version = "0.5.2"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "641f98f32585b8a8cc5d88c6c55a8f6cdf60740baab17c57d59b9b662c73f522"
|
checksum = "baaf99ea9b8296ba0db293cad28c51d788e690c47ebe9974b864354b258a636a"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"dbus",
|
"dbus",
|
||||||
|
"libc",
|
||||||
"mio",
|
"mio",
|
||||||
"tokio",
|
"tokio",
|
||||||
]
|
]
|
||||||
@@ -174,9 +159,9 @@ dependencies = [
|
|||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "filetime"
|
name = "filetime"
|
||||||
version = "0.2.10"
|
version = "0.2.12"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "affc17579b132fc2461adf7c575cc6e8b134ebca52c51f5411388965227dc695"
|
checksum = "3ed85775dcc68644b5c950ac06a2b23768d3bc9390464151aaf27136998dcf9e"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"cfg-if",
|
"cfg-if",
|
||||||
"libc",
|
"libc",
|
||||||
@@ -301,19 +286,6 @@ dependencies = [
|
|||||||
"slab",
|
"slab",
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
|
||||||
name = "generator"
|
|
||||||
version = "0.6.21"
|
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
||||||
checksum = "add72f17bb81521258fcc8a7a3245b1e184e916bfbe34f0ea89558f440df5c68"
|
|
||||||
dependencies = [
|
|
||||||
"cc",
|
|
||||||
"libc",
|
|
||||||
"log",
|
|
||||||
"rustc_version",
|
|
||||||
"winapi 0.3.9",
|
|
||||||
]
|
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "gumdrop"
|
name = "gumdrop"
|
||||||
version = "0.8.0"
|
version = "0.8.0"
|
||||||
@@ -336,9 +308,9 @@ dependencies = [
|
|||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "hermit-abi"
|
name = "hermit-abi"
|
||||||
version = "0.1.14"
|
version = "0.1.15"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "b9586eedd4ce6b3c498bc3b4dd92fc9f11166aa908a914071953768066c67909"
|
checksum = "3deed196b6e7f9e44a2ae8d94225d80302d81208b1bb673fd21fe634645c85a9"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"libc",
|
"libc",
|
||||||
]
|
]
|
||||||
@@ -395,9 +367,9 @@ checksum = "e2abad23fbc42b3700f2f279844dc832adb2b2eb069b2df918f455c4e18cc646"
|
|||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "libc"
|
name = "libc"
|
||||||
version = "0.2.71"
|
version = "0.2.77"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "9457b06509d27052635f90d6466700c65095fdf75409b3fbdd903e988b886f49"
|
checksum = "f2f96b10ec2560088a8e76961b00d47107b3a625fecb76dedb29ee7ccbf98235"
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "libdbus-sys"
|
name = "libdbus-sys"
|
||||||
@@ -446,24 +418,13 @@ dependencies = [
|
|||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "log"
|
name = "log"
|
||||||
version = "0.4.8"
|
version = "0.4.11"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "14b6052be84e6b71ab17edffc2eeabf5c2c3ae1fdb464aae35ac50c67a44e1f7"
|
checksum = "4fabed175da42fed1fa0746b0ea71f412aa9d35e76e95e59b192c64b9dc2bf8b"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"cfg-if",
|
"cfg-if",
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
|
||||||
name = "loom"
|
|
||||||
version = "0.3.4"
|
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
||||||
checksum = "4ecc775857611e1df29abba5c41355cdf540e7e9d4acfdf0f355eefee82330b7"
|
|
||||||
dependencies = [
|
|
||||||
"cfg-if",
|
|
||||||
"generator",
|
|
||||||
"scoped-tls",
|
|
||||||
]
|
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "memchr"
|
name = "memchr"
|
||||||
version = "2.3.3"
|
version = "2.3.3"
|
||||||
@@ -503,9 +464,9 @@ dependencies = [
|
|||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "net2"
|
name = "net2"
|
||||||
version = "0.2.34"
|
version = "0.2.35"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "2ba7c918ac76704fb42afcbbb43891e72731f3dcca3bef2a19786297baf14af7"
|
checksum = "3ebc3ec692ed7c9a255596c67808dee269f64655d8baf7b4f0638e51ba1d6853"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"cfg-if",
|
"cfg-if",
|
||||||
"libc",
|
"libc",
|
||||||
@@ -540,24 +501,24 @@ checksum = "e521b6adefa0b2c1fa5d2abdf9a5216288686fe6146249215d884c0e5ab320b0"
|
|||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "once_cell"
|
name = "once_cell"
|
||||||
version = "1.4.0"
|
version = "1.4.1"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "0b631f7e854af39a1739f401cf34a8a013dfe09eac4fa4dba91e9768bd28168d"
|
checksum = "260e51e7efe62b592207e9e13a68e43692a7a279171d6ba57abd208bf23645ad"
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "pin-project"
|
name = "pin-project"
|
||||||
version = "0.4.22"
|
version = "0.4.23"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "12e3a6cdbfe94a5e4572812a0201f8c0ed98c1c452c7b8563ce2276988ef9c17"
|
checksum = "ca4433fff2ae79342e497d9f8ee990d174071408f28f726d6d83af93e58e48aa"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"pin-project-internal",
|
"pin-project-internal",
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "pin-project-internal"
|
name = "pin-project-internal"
|
||||||
version = "0.4.22"
|
version = "0.4.23"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "6a0ffd45cf79d88737d7cc85bfd5d2894bee1139b356e616fe85dc389c61aaf7"
|
checksum = "2c0e815c3ee9a031fdf5af21c10aa17c573c9c6a566328d99e3936c34e36461f"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"proc-macro2",
|
"proc-macro2",
|
||||||
"quote",
|
"quote",
|
||||||
@@ -578,15 +539,15 @@ checksum = "8b870d8c151b6f2fb93e84a13146138f05d02ed11c7e7c54f8826aaaf7c9f184"
|
|||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "pkg-config"
|
name = "pkg-config"
|
||||||
version = "0.3.17"
|
version = "0.3.18"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "05da548ad6865900e60eaba7f589cc0783590a92e940c26953ff81ddbab2d677"
|
checksum = "d36492546b6af1463394d46f0c834346f31548646f6ba10849802c9c9a27ac33"
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "proc-macro-error"
|
name = "proc-macro-error"
|
||||||
version = "1.0.3"
|
version = "1.0.4"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "fc175e9777c3116627248584e8f8b3e2987405cabe1c0adf7d1dd28f09dc7880"
|
checksum = "da25490ff9892aab3fcf7c36f08cfb902dd3e71ca0f9f9517bea02a73a5ce38c"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"proc-macro-error-attr",
|
"proc-macro-error-attr",
|
||||||
"proc-macro2",
|
"proc-macro2",
|
||||||
@@ -597,22 +558,20 @@ dependencies = [
|
|||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "proc-macro-error-attr"
|
name = "proc-macro-error-attr"
|
||||||
version = "1.0.3"
|
version = "1.0.4"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "3cc9795ca17eb581285ec44936da7fc2335a3f34f2ddd13118b6f4d515435c50"
|
checksum = "a1be40180e52ecc98ad80b184934baf3d0d29f979574e439af5a55274b35f869"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"proc-macro2",
|
"proc-macro2",
|
||||||
"quote",
|
"quote",
|
||||||
"syn",
|
|
||||||
"syn-mid",
|
|
||||||
"version_check",
|
"version_check",
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "proc-macro-hack"
|
name = "proc-macro-hack"
|
||||||
version = "0.5.16"
|
version = "0.5.18"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "7e0456befd48169b9f13ef0f0ad46d492cf9d2dbb918bcf38e01eed4ce3ec5e4"
|
checksum = "99c605b9a0adc77b7211c6b1f722dcb613d68d66859a44f3d485a6da332b0598"
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "proc-macro-nested"
|
name = "proc-macro-nested"
|
||||||
@@ -622,9 +581,9 @@ checksum = "eba180dafb9038b050a4c280019bbedf9f2467b61e5d892dcad585bb57aadc5a"
|
|||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "proc-macro2"
|
name = "proc-macro2"
|
||||||
version = "1.0.18"
|
version = "1.0.21"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "beae6331a816b1f65d04c45b078fd8e6c93e8071771f41b8163255bbd8d7c8fa"
|
checksum = "36e28516df94f3dd551a587da5357459d9b36d945a7c37c3557928c1c2ff2a2c"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"unicode-xid",
|
"unicode-xid",
|
||||||
]
|
]
|
||||||
@@ -646,9 +605,9 @@ dependencies = [
|
|||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "redox_syscall"
|
name = "redox_syscall"
|
||||||
version = "0.1.56"
|
version = "0.1.57"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "2439c63f3f6139d1b57529d16bc3b8bb855230c8efcc5d3a896c8bea7c3b1e84"
|
checksum = "41cc0f7e4d5d4544e8861606a285bb08d3e70712ccc7d2b84d7c0ccfaf4b05ce"
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "regex"
|
name = "regex"
|
||||||
@@ -675,23 +634,22 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
|
|||||||
checksum = "cabe4fa914dec5870285fa7f71f602645da47c486e68486d2b4ceb4a343e90ac"
|
checksum = "cabe4fa914dec5870285fa7f71f602645da47c486e68486d2b4ceb4a343e90ac"
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "rusb"
|
name = "rog_fan_curve"
|
||||||
version = "0.6.0"
|
version = "0.1.5"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "884a9ee2c66cdb5ca6c5243ea91cdbba9865506792c3d175d1ad8de8bb0ea64a"
|
checksum = "b9d3867a0df47bf57c6eebe8b2fb3c2e5c09586a23c715cd7963c2f090c9983f"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"bit-set",
|
"serde",
|
||||||
"libc",
|
|
||||||
"libusb1-sys",
|
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "rustc_version"
|
name = "rusb"
|
||||||
version = "0.2.3"
|
version = "0.6.3"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "138e3e0acb6c9fb258b19b67cb8abd63c00679d2851805ea151465464fe9030a"
|
checksum = "327ba984f811d7e34f52f08b5745911ce89c432e1098879f2f8288c76a88aa0c"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"semver",
|
"libc",
|
||||||
|
"libusb1-sys",
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
@@ -711,38 +669,17 @@ version = "1.0.5"
|
|||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "71d301d4193d031abdd79ff7e3dd721168a9572ef3fe51a1517aba235bd8f86e"
|
checksum = "71d301d4193d031abdd79ff7e3dd721168a9572ef3fe51a1517aba235bd8f86e"
|
||||||
|
|
||||||
[[package]]
|
|
||||||
name = "scoped-tls"
|
|
||||||
version = "0.1.2"
|
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
||||||
checksum = "332ffa32bf586782a3efaeb58f127980944bbc8c4d6913a86107ac2a5ab24b28"
|
|
||||||
|
|
||||||
[[package]]
|
|
||||||
name = "semver"
|
|
||||||
version = "0.9.0"
|
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
||||||
checksum = "1d7eb9ef2c18661902cc47e535f9bc51b78acd254da71d375c2f6720d9a40403"
|
|
||||||
dependencies = [
|
|
||||||
"semver-parser",
|
|
||||||
]
|
|
||||||
|
|
||||||
[[package]]
|
|
||||||
name = "semver-parser"
|
|
||||||
version = "0.7.0"
|
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
||||||
checksum = "388a1df253eca08550bef6c72392cfe7c30914bf41df5269b68cbd6ff8f570a3"
|
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "serde"
|
name = "serde"
|
||||||
version = "1.0.114"
|
version = "1.0.115"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "5317f7588f0a5078ee60ef675ef96735a1442132dc645eb1d12c018620ed8cd3"
|
checksum = "e54c9a88f2da7238af84b5101443f0c0d0a3bbdc455e34a5c9497b1903ed55d5"
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "serde_derive"
|
name = "serde_derive"
|
||||||
version = "1.0.114"
|
version = "1.0.115"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "2a0be94b04690fbaed37cddffc5c134bf537c8e3329d53e982fe04c374978f8e"
|
checksum = "609feed1d0a73cc36a0182a840a9b37b4a82f0b1150369f0536a9e3f2a31dc48"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"proc-macro2",
|
"proc-macro2",
|
||||||
"quote",
|
"quote",
|
||||||
@@ -751,9 +688,9 @@ dependencies = [
|
|||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "serde_json"
|
name = "serde_json"
|
||||||
version = "1.0.56"
|
version = "1.0.57"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "3433e879a558dde8b5e8feb2a04899cf34fdde1fafb894687e52105fc1162ac3"
|
checksum = "164eacbdb13512ec2745fb09d51fd5b22b0d65ed294a1dcf7285a360c80a675c"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"itoa",
|
"itoa",
|
||||||
"ryu",
|
"ryu",
|
||||||
@@ -779,26 +716,15 @@ dependencies = [
|
|||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "syn"
|
name = "syn"
|
||||||
version = "1.0.33"
|
version = "1.0.40"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "e8d5d96e8cbb005d6959f119f773bfaebb5684296108fb32600c00cde305b2cd"
|
checksum = "963f7d3cc59b59b9325165add223142bbf1df27655d07789f109896d353d8350"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"proc-macro2",
|
"proc-macro2",
|
||||||
"quote",
|
"quote",
|
||||||
"unicode-xid",
|
"unicode-xid",
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
|
||||||
name = "syn-mid"
|
|
||||||
version = "0.5.0"
|
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
||||||
checksum = "7be3539f6c128a931cf19dcee741c1af532c7fd387baa739c03dd2e96479338a"
|
|
||||||
dependencies = [
|
|
||||||
"proc-macro2",
|
|
||||||
"quote",
|
|
||||||
"syn",
|
|
||||||
]
|
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "synstructure"
|
name = "synstructure"
|
||||||
version = "0.12.4"
|
version = "0.12.4"
|
||||||
@@ -828,9 +754,9 @@ checksum = "f764005d11ee5f36500a149ace24e00e3da98b0158b3e2d53a7495660d3f4d60"
|
|||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "tar"
|
name = "tar"
|
||||||
version = "0.4.29"
|
version = "0.4.30"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "c8a4c1d0bee3230179544336c15eefb563cf0302955d962e456542323e8c2e8a"
|
checksum = "489997b7557e9a43e192c527face4feacc78bfbe6eed67fd55c4c9e381cba290"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"filetime",
|
"filetime",
|
||||||
"libc",
|
"libc",
|
||||||
@@ -867,9 +793,9 @@ dependencies = [
|
|||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "tokio"
|
name = "tokio"
|
||||||
version = "0.2.21"
|
version = "0.2.22"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "d099fa27b9702bed751524694adbe393e18b36b204da91eb1cbbbbb4a5ee2d58"
|
checksum = "5d34ca54d84bf2b5b4d7d31e901a8464f7b60ac145a284fba25ceb801f2ddccd"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"bytes",
|
"bytes",
|
||||||
"fnv",
|
"fnv",
|
||||||
|
|||||||
@@ -14,6 +14,7 @@ SRC = Cargo.toml Cargo.lock Makefile $(shell find -type f -wholename '**/src/*.r
|
|||||||
BIN_C=asusctl
|
BIN_C=asusctl
|
||||||
BIN_D=asusd
|
BIN_D=asusd
|
||||||
LEDCONFIG=asusd-ledmodes.toml
|
LEDCONFIG=asusd-ledmodes.toml
|
||||||
|
VERSION:=$(shell grep -Pm1 'version = "(\d.\d.\d)"' asus-nb-ctrl/Cargo.toml | cut -d'"' -f2)
|
||||||
|
|
||||||
DEBUG ?= 0
|
DEBUG ?= 0
|
||||||
ifeq ($(DEBUG),0)
|
ifeq ($(DEBUG),0)
|
||||||
@@ -56,11 +57,14 @@ vendor:
|
|||||||
mkdir -p .cargo
|
mkdir -p .cargo
|
||||||
cargo vendor | head -n -1 > .cargo/config
|
cargo vendor | head -n -1 > .cargo/config
|
||||||
echo 'directory = "vendor"' >> .cargo/config
|
echo 'directory = "vendor"' >> .cargo/config
|
||||||
tar pcfJ vendor.tar.xz vendor
|
mv .cargo/config ./cargo-config
|
||||||
|
rm -rf .cargo
|
||||||
|
tar pcfJ vendor_asus-nb-ctrl_$(VERSION).tar.xz vendor
|
||||||
rm -rf vendor
|
rm -rf vendor
|
||||||
|
|
||||||
target/release/$(BIN_D): $(SRC)
|
target/release/$(BIN_D): $(SRC)
|
||||||
ifeq ($(VENDORED),1)
|
ifeq ($(VENDORED),1)
|
||||||
tar pxf vendor.tar.xz
|
@echo "version = $(VERSION)"
|
||||||
|
tar pxf vendor_asus-nb-ctrl_$(VERSION).tar.xz
|
||||||
endif
|
endif
|
||||||
cargo build $(ARGS)
|
cargo build $(ARGS)
|
||||||
|
|||||||
@@ -3,7 +3,8 @@
|
|||||||
**NOTICE:**
|
**NOTICE:**
|
||||||
|
|
||||||
This program requires the kernel patch in `./kernel-patch/` to be applied.
|
This program requires the kernel patch in `./kernel-patch/` to be applied.
|
||||||
As of 04/08/2020 these have been submitted to lkml.
|
As of 04/08/2020 these have been submitted to lkml. Alternatively you may
|
||||||
|
use the dkms module for 'hid-asus-rog` from one of the repositories [here](https://download.opensuse.org/repositories/home:/luke_nukem:/asus/).
|
||||||
|
|
||||||
The patch enables the following in kernel:
|
The patch enables the following in kernel:
|
||||||
|
|
||||||
@@ -118,6 +119,12 @@ For editing the `/etc/asusd/asusd-ledmodes.toml`, the LED Mode numbers are as fo
|
|||||||
|
|
||||||
## Installing
|
## Installing
|
||||||
|
|
||||||
|
Packaging and auto-builds are available [here](https://build.opensuse.org/package/show/home:luke_nukem:asus/asus-nb-ctrl)
|
||||||
|
|
||||||
|
Download repositories are available [here](https://download.opensuse.org/repositories/home:/luke_nukem:/asus/)
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
Run `make` then `sudo make install` then reboot.
|
Run `make` then `sudo make install` then reboot.
|
||||||
|
|
||||||
The default init method is to use the udev rule, this ensures that the service is
|
The default init method is to use the udev rule, this ensures that the service is
|
||||||
@@ -190,6 +197,25 @@ Optional arguments:
|
|||||||
|
|
||||||
Available commands:
|
Available commands:
|
||||||
led-mode Set the keyboard lighting from built-in modes
|
led-mode Set the keyboard lighting from built-in modes
|
||||||
|
profile Create and configure profiles
|
||||||
|
|
||||||
|
$ asusctl profile --help
|
||||||
|
Usage: asusctl profile [OPTIONS]
|
||||||
|
|
||||||
|
Positional arguments:
|
||||||
|
profile
|
||||||
|
|
||||||
|
Optional arguments:
|
||||||
|
-h, --help print help message
|
||||||
|
-c, --create create the profile if it doesn't exist
|
||||||
|
-t, --turbo enable cpu turbo (AMD)
|
||||||
|
-n, --no-turbo disable cpu turbo (AMD)
|
||||||
|
-m, --min-percentage MIN-PERCENTAGE
|
||||||
|
set min cpu scaling (intel)
|
||||||
|
-M, --max-percentage MAX-PERCENTAGE
|
||||||
|
set max cpu scaling (intel)
|
||||||
|
-p, --preset PWR <silent, normal, boost>
|
||||||
|
-C, --curve CURVE set fan curve
|
||||||
|
|
||||||
$ asusctl led-mode --help
|
$ asusctl led-mode --help
|
||||||
Usage: asusctl led-mode [OPTIONS]
|
Usage: asusctl led-mode [OPTIONS]
|
||||||
|
|||||||
@@ -1,70 +0,0 @@
|
|||||||
%if %{defined fedora}
|
|
||||||
%global debug_package %{nil}
|
|
||||||
%endif
|
|
||||||
|
|
||||||
# Use hardening ldflags.
|
|
||||||
%global rustflags -Clink-arg=-Wl,-z,relro,-z,now
|
|
||||||
Name: asus-nb-ctrl
|
|
||||||
Version: 1.0.0
|
|
||||||
Release: 0
|
|
||||||
Summary: Text editor for terminal
|
|
||||||
License: MPLv2
|
|
||||||
Group: Productivity/Text/Editors
|
|
||||||
URL: https://gitlab.com/asus-linux/asus-nb-ctrl
|
|
||||||
Source: %{name}-%{version}.tar.gz
|
|
||||||
# cargo vendor &&
|
|
||||||
# tar cfJ vendor.tar.xz vendor
|
|
||||||
Source1: vendor.tar.xz
|
|
||||||
BuildRequires: clang-devel
|
|
||||||
BuildRequires: cargo
|
|
||||||
BuildRequires: rust
|
|
||||||
BuildRequires: rust-std-static
|
|
||||||
BuildRequires: pkgconfig(dbus-1)
|
|
||||||
BuildRequires: pkgconfig(libudev)
|
|
||||||
|
|
||||||
%description
|
|
||||||
ASUS Laptop control
|
|
||||||
|
|
||||||
%prep
|
|
||||||
%setup -q -n %name-next
|
|
||||||
%setup -q -n %name-next -D -T -a 1
|
|
||||||
|
|
||||||
mkdir .cargo
|
|
||||||
cat >.cargo/config <<EOF
|
|
||||||
[source.crates-io]
|
|
||||||
replace-with = "vendored-sources"
|
|
||||||
|
|
||||||
[source.vendored-sources]
|
|
||||||
directory = "vendor"
|
|
||||||
EOF
|
|
||||||
|
|
||||||
%build
|
|
||||||
export RUSTFLAGS="%{rustflags}"
|
|
||||||
RUST_BACKTRACE=1 cargo build --release
|
|
||||||
|
|
||||||
%install
|
|
||||||
export RUSTFLAGS="%{rustflags}"
|
|
||||||
|
|
||||||
mkdir -p "%{buildroot}%{_bindir}"
|
|
||||||
install -D -m 0755 target/release/asusd %{buildroot}%{_bindir}/asusd
|
|
||||||
install -D -m 0755 target/release/asusctl %{buildroot}%{_bindir}/asusctl
|
|
||||||
install -D -m 0644 data/asusd.rules %{buildroot}%{_udevrulesdir}/90-asusd.rules
|
|
||||||
install -D -m 0644 data/asusd.conf %{buildroot}%{_sysconfdir}/dbus-1/system.d/asusd.conf
|
|
||||||
install -D -m 0644 data/asusd.service %{buildroot}%{_unitdir}/asusd.service
|
|
||||||
install -D -m 0644 data/asusd-ledmodes.toml %{buildroot}%{_sysconfdir}/asusd/asusd-ledmodes.toml
|
|
||||||
|
|
||||||
mkdir -p "%{buildroot}%{_datadir}/licenses/%{name}"
|
|
||||||
cp LICENSE "%{buildroot}%{_datadir}/licenses/%{name}/"
|
|
||||||
|
|
||||||
mkdir -p "%{buildroot}/bin"
|
|
||||||
|
|
||||||
%files
|
|
||||||
%license LICENSE
|
|
||||||
%{_bindir}/asusd
|
|
||||||
%{_bindir}/asusctl
|
|
||||||
%{_unitdir}/asusd.service
|
|
||||||
%{_udevrulesdir}/90-asusd.rules
|
|
||||||
%{_sysconfdir}/dbus-1/system.d/asusd.conf
|
|
||||||
%{_sysconfdir}/asusd/asusd-ledmodes.toml
|
|
||||||
|
|
||||||
%changelog
|
|
||||||
@@ -1,6 +1,6 @@
|
|||||||
[package]
|
[package]
|
||||||
name = "asus-nb-ctrl"
|
name = "asus-nb-ctrl"
|
||||||
version = "1.0.2"
|
version = "1.1.2"
|
||||||
license = "MPL-2.0"
|
license = "MPL-2.0"
|
||||||
readme = "README.md"
|
readme = "README.md"
|
||||||
authors = ["Luke <luke@ljones.dev>"]
|
authors = ["Luke <luke@ljones.dev>"]
|
||||||
@@ -45,5 +45,6 @@ toml = "0.4.6"
|
|||||||
|
|
||||||
# Device control
|
# Device control
|
||||||
sysfs-class = "^0.1.2" # used for backlight control and baord ID
|
sysfs-class = "^0.1.2" # used for backlight control and baord ID
|
||||||
|
rog_fan_curve = { version = "0.1.5", features = ["serde"] }
|
||||||
# cpu power management
|
# cpu power management
|
||||||
intel-pstate = "^0.2.1"
|
intel-pstate = "^0.2.1"
|
||||||
|
|||||||
+36
-14
@@ -1,6 +1,8 @@
|
|||||||
use asus_nb::aura_modes::AuraModes;
|
use asus_nb::aura_modes::AuraModes;
|
||||||
use log::{error, warn};
|
use log::{error, warn};
|
||||||
|
use rog_fan_curve::Curve;
|
||||||
use serde_derive::{Deserialize, Serialize};
|
use serde_derive::{Deserialize, Serialize};
|
||||||
|
use std::collections::BTreeMap;
|
||||||
use std::fs::{File, OpenOptions};
|
use std::fs::{File, OpenOptions};
|
||||||
use std::io::{Read, Write};
|
use std::io::{Read, Write};
|
||||||
|
|
||||||
@@ -8,12 +10,15 @@ pub static CONFIG_PATH: &str = "/etc/asusd/asusd.conf";
|
|||||||
|
|
||||||
#[derive(Default, Deserialize, Serialize)]
|
#[derive(Default, Deserialize, Serialize)]
|
||||||
pub struct Config {
|
pub struct Config {
|
||||||
|
pub active_profile: String,
|
||||||
|
pub toggle_profiles: Vec<String>,
|
||||||
|
// TODO: remove power_profile
|
||||||
pub power_profile: u8,
|
pub power_profile: u8,
|
||||||
pub bat_charge_limit: u8,
|
pub bat_charge_limit: u8,
|
||||||
pub kbd_led_brightness: u8,
|
pub kbd_led_brightness: u8,
|
||||||
pub kbd_backlight_mode: u8,
|
pub kbd_backlight_mode: u8,
|
||||||
pub kbd_backlight_modes: Vec<AuraModes>,
|
pub kbd_backlight_modes: Vec<AuraModes>,
|
||||||
pub power_profiles: FanModeProfile,
|
pub power_profiles: BTreeMap<String, Profile>,
|
||||||
}
|
}
|
||||||
|
|
||||||
impl Config {
|
impl Config {
|
||||||
@@ -32,7 +37,10 @@ impl Config {
|
|||||||
self = Config::create_default(&mut file, &supported_led_modes);
|
self = Config::create_default(&mut file, &supported_led_modes);
|
||||||
} else {
|
} else {
|
||||||
self = serde_json::from_str(&buf).unwrap_or_else(|_| {
|
self = serde_json::from_str(&buf).unwrap_or_else(|_| {
|
||||||
warn!("Could not deserialise {}", CONFIG_PATH);
|
warn!(
|
||||||
|
"Could not deserialise {}. Overwriting with default",
|
||||||
|
CONFIG_PATH
|
||||||
|
);
|
||||||
Config::create_default(&mut file, &supported_led_modes)
|
Config::create_default(&mut file, &supported_led_modes)
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
@@ -51,6 +59,20 @@ impl Config {
|
|||||||
c.kbd_backlight_modes.push(AuraModes::from(*n))
|
c.kbd_backlight_modes.push(AuraModes::from(*n))
|
||||||
}
|
}
|
||||||
|
|
||||||
|
let profile = Profile::default();
|
||||||
|
c.power_profiles.insert("normal".into(), profile);
|
||||||
|
let mut profile = Profile::default();
|
||||||
|
profile.fan_preset = 1;
|
||||||
|
c.power_profiles.insert("boost".into(), profile);
|
||||||
|
let mut profile = Profile::default();
|
||||||
|
profile.fan_preset = 2;
|
||||||
|
c.power_profiles.insert("silent".into(), profile);
|
||||||
|
|
||||||
|
c.toggle_profiles.push("normal".into());
|
||||||
|
c.toggle_profiles.push("boost".into());
|
||||||
|
c.toggle_profiles.push("silent".into());
|
||||||
|
c.active_profile = "normal".into();
|
||||||
|
|
||||||
// Should be okay to unwrap this as is since it is a Default
|
// Should be okay to unwrap this as is since it is a Default
|
||||||
let json = serde_json::to_string_pretty(&c).unwrap();
|
let json = serde_json::to_string_pretty(&c).unwrap();
|
||||||
file.write_all(json.as_bytes())
|
file.write_all(json.as_bytes())
|
||||||
@@ -103,26 +125,26 @@ impl Config {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Default, Deserialize, Serialize)]
|
|
||||||
pub struct FanModeProfile {
|
|
||||||
pub normal: CPUSettings,
|
|
||||||
pub boost: CPUSettings,
|
|
||||||
pub silent: CPUSettings,
|
|
||||||
}
|
|
||||||
|
|
||||||
#[derive(Deserialize, Serialize)]
|
#[derive(Deserialize, Serialize)]
|
||||||
pub struct CPUSettings {
|
pub struct Profile {
|
||||||
pub min_percentage: u8,
|
pub min_percentage: u8,
|
||||||
pub max_percentage: u8,
|
pub max_percentage: u8,
|
||||||
pub no_turbo: bool,
|
pub turbo: bool,
|
||||||
|
pub fan_preset: u8,
|
||||||
|
pub fan_curve: Option<Curve>,
|
||||||
}
|
}
|
||||||
|
|
||||||
impl Default for CPUSettings {
|
#[deprecated]
|
||||||
|
pub type CPUSettings = Profile;
|
||||||
|
|
||||||
|
impl Default for Profile {
|
||||||
fn default() -> Self {
|
fn default() -> Self {
|
||||||
CPUSettings {
|
Profile {
|
||||||
min_percentage: 0,
|
min_percentage: 0,
|
||||||
max_percentage: 100,
|
max_percentage: 100,
|
||||||
no_turbo: false,
|
turbo: false,
|
||||||
|
fan_preset: 0,
|
||||||
|
fan_curve: None,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -67,21 +67,18 @@ impl CtrlAnimeDisplay {
|
|||||||
#[inline]
|
#[inline]
|
||||||
pub fn new() -> Result<CtrlAnimeDisplay, Box<dyn Error>> {
|
pub fn new() -> Result<CtrlAnimeDisplay, Box<dyn Error>> {
|
||||||
// We don't expect this ID to ever change
|
// We don't expect this ID to ever change
|
||||||
let device = CtrlAnimeDisplay::get_device(0x0b05, 0x193b).map_err(|err| {
|
let device = CtrlAnimeDisplay::get_device(0x0b05, 0x193b)?;
|
||||||
warn!("Could not get AniMe display handle: {:?}", err);
|
|
||||||
err
|
|
||||||
})?;
|
|
||||||
|
|
||||||
let mut device = device.open()?;
|
let mut device = device.open()?;
|
||||||
device.reset()?;
|
device.reset()?;
|
||||||
|
|
||||||
device.set_auto_detach_kernel_driver(true).map_err(|err| {
|
device.set_auto_detach_kernel_driver(true).map_err(|err| {
|
||||||
error!("Auto-detach kernel driver failed: {:?}", err);
|
error!("Auto-detach kernel driver failed: {}", err);
|
||||||
err
|
err
|
||||||
})?;
|
})?;
|
||||||
|
|
||||||
device.claim_interface(0).map_err(|err| {
|
device.claim_interface(0).map_err(|err| {
|
||||||
error!("Could not claim device interface: {:?}", err);
|
error!("Could not claim device interface: {}", err);
|
||||||
err
|
err
|
||||||
})?;
|
})?;
|
||||||
|
|
||||||
@@ -120,7 +117,6 @@ impl CtrlAnimeDisplay {
|
|||||||
/// Should only be used if the bytes you are writing are verified correct
|
/// Should only be used if the bytes you are writing are verified correct
|
||||||
#[inline]
|
#[inline]
|
||||||
async fn write_bytes(&self, message: &[u8]) -> Result<(), AuraError> {
|
async fn write_bytes(&self, message: &[u8]) -> Result<(), AuraError> {
|
||||||
let prev = std::time::Instant::now();
|
|
||||||
match self.handle.write_control(
|
match self.handle.write_control(
|
||||||
0x21, // request_type
|
0x21, // request_type
|
||||||
0x09, // request
|
0x09, // request
|
||||||
@@ -129,15 +125,10 @@ impl CtrlAnimeDisplay {
|
|||||||
message,
|
message,
|
||||||
Duration::from_millis(200),
|
Duration::from_millis(200),
|
||||||
) {
|
) {
|
||||||
Ok(_) => {
|
Ok(_) => {}
|
||||||
println!(
|
|
||||||
"{:?}",
|
|
||||||
std::time::Instant::now().duration_since(prev).as_micros()
|
|
||||||
);
|
|
||||||
}
|
|
||||||
Err(err) => match err {
|
Err(err) => match err {
|
||||||
rusb::Error::Timeout => {}
|
rusb::Error::Timeout => {}
|
||||||
_ => error!("Failed to write to led interrupt: {:?}", err),
|
_ => error!("Failed to write to led interrupt: {}", err),
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
Ok(())
|
Ok(())
|
||||||
|
|||||||
@@ -34,7 +34,7 @@ impl crate::Controller for CtrlCharge {
|
|||||||
while let Some(n) = recv.recv().await {
|
while let Some(n) = recv.recv().await {
|
||||||
let mut config = config.lock().await;
|
let mut config = config.lock().await;
|
||||||
self.set_charge_limit(n, &mut config)
|
self.set_charge_limit(n, &mut config)
|
||||||
.unwrap_or_else(|err| warn!("{:?}", err));
|
.unwrap_or_else(|err| warn!("charge_limit: {}", err));
|
||||||
}
|
}
|
||||||
})]
|
})]
|
||||||
}
|
}
|
||||||
@@ -80,11 +80,11 @@ impl CtrlCharge {
|
|||||||
.write(true)
|
.write(true)
|
||||||
.open(self.path)
|
.open(self.path)
|
||||||
.map_err(|err| {
|
.map_err(|err| {
|
||||||
warn!("Failed to open battery charge limit path: {:?}", err);
|
warn!("Failed to open battery charge limit path: {}", err);
|
||||||
err
|
err
|
||||||
})?;
|
})?;
|
||||||
file.write_all(limit.to_string().as_bytes())
|
file.write_all(limit.to_string().as_bytes())
|
||||||
.unwrap_or_else(|err| error!("Could not write to {}, {:?}", BAT_CHARGE_PATH, err));
|
.unwrap_or_else(|err| error!("Could not write to {}, {}", BAT_CHARGE_PATH, err));
|
||||||
info!("Battery charge limit: {}", limit);
|
info!("Battery charge limit: {}", limit);
|
||||||
|
|
||||||
config.read();
|
config.read();
|
||||||
|
|||||||
@@ -1,4 +1,6 @@
|
|||||||
use crate::config::Config;
|
use crate::config::Config;
|
||||||
|
use crate::config::Profile;
|
||||||
|
use asus_nb::profile::ProfileEvent;
|
||||||
use log::{error, info, warn};
|
use log::{error, info, warn};
|
||||||
use std::error::Error;
|
use std::error::Error;
|
||||||
use std::fs::OpenOptions;
|
use std::fs::OpenOptions;
|
||||||
@@ -23,7 +25,7 @@ use async_trait::async_trait;
|
|||||||
|
|
||||||
#[async_trait]
|
#[async_trait]
|
||||||
impl crate::Controller for CtrlFanAndCPU {
|
impl crate::Controller for CtrlFanAndCPU {
|
||||||
type A = u8;
|
type A = ProfileEvent;
|
||||||
|
|
||||||
/// Spawns two tasks which continuously check for changes
|
/// Spawns two tasks which continuously check for changes
|
||||||
fn spawn_task_loop(
|
fn spawn_task_loop(
|
||||||
@@ -39,11 +41,13 @@ impl crate::Controller for CtrlFanAndCPU {
|
|||||||
// spawn an endless loop
|
// spawn an endless loop
|
||||||
vec![
|
vec![
|
||||||
tokio::spawn(async move {
|
tokio::spawn(async move {
|
||||||
while let Some(mode) = recv.recv().await {
|
while let Some(event) = recv.recv().await {
|
||||||
let mut config = config1.lock().await;
|
let mut config = config1.lock().await;
|
||||||
let mut lock = gate1.lock().await;
|
let mut lock = gate1.lock().await;
|
||||||
lock.set_fan_mode(mode, &mut config)
|
|
||||||
.unwrap_or_else(|err| warn!("{:?}", err));
|
config.read();
|
||||||
|
lock.handle_profile_event(&event, &mut config)
|
||||||
|
.unwrap_or_else(|err| warn!("{}", err));
|
||||||
}
|
}
|
||||||
}),
|
}),
|
||||||
// need to watch file path
|
// need to watch file path
|
||||||
@@ -53,7 +57,7 @@ impl crate::Controller for CtrlFanAndCPU {
|
|||||||
let mut lock = gate2.lock().await;
|
let mut lock = gate2.lock().await;
|
||||||
let mut config = config.lock().await;
|
let mut config = config.lock().await;
|
||||||
lock.fan_mode_check_change(&mut config)
|
lock.fan_mode_check_change(&mut config)
|
||||||
.unwrap_or_else(|err| warn!("{:?}", err));
|
.unwrap_or_else(|err| warn!("fan_ctrl: {}", err));
|
||||||
}
|
}
|
||||||
}),
|
}),
|
||||||
]
|
]
|
||||||
@@ -61,9 +65,10 @@ impl crate::Controller for CtrlFanAndCPU {
|
|||||||
|
|
||||||
async fn reload_from_config(&mut self, config: &mut Config) -> Result<(), Box<dyn Error>> {
|
async fn reload_from_config(&mut self, config: &mut Config) -> Result<(), Box<dyn Error>> {
|
||||||
let mut file = OpenOptions::new().write(true).open(self.path)?;
|
let mut file = OpenOptions::new().write(true).open(self.path)?;
|
||||||
file.write_all(format!("{:?}\n", config.power_profile).as_bytes())
|
file.write_all(format!("{}\n", config.power_profile).as_bytes())
|
||||||
.unwrap_or_else(|err| error!("Could not write to {}, {:?}", self.path, err));
|
.unwrap_or_else(|err| error!("Could not write to {}, {}", self.path, err));
|
||||||
self.set_pstate_for_fan_mode(FanLevel::from(config.power_profile), config)?;
|
let profile = config.active_profile.clone();
|
||||||
|
self.set_profile(&profile, config)?;
|
||||||
info!(
|
info!(
|
||||||
"Reloaded fan mode: {:?}",
|
"Reloaded fan mode: {:?}",
|
||||||
FanLevel::from(config.power_profile)
|
FanLevel::from(config.power_profile)
|
||||||
@@ -87,7 +92,7 @@ impl CtrlFanAndCPU {
|
|||||||
} else {
|
} else {
|
||||||
Err(std::io::Error::new(
|
Err(std::io::Error::new(
|
||||||
std::io::ErrorKind::NotFound,
|
std::io::ErrorKind::NotFound,
|
||||||
"Fan mode not available",
|
"Fan mode not available, you may require a v5.8 series kernel or newer",
|
||||||
))
|
))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -102,13 +107,26 @@ impl CtrlFanAndCPU {
|
|||||||
if let Some(num) = char::from(buf[0]).to_digit(10) {
|
if let Some(num) = char::from(buf[0]).to_digit(10) {
|
||||||
if config.power_profile != num as u8 {
|
if config.power_profile != num as u8 {
|
||||||
config.read();
|
config.read();
|
||||||
config.power_profile = num as u8;
|
|
||||||
config.write();
|
let mut i = config
|
||||||
self.set_pstate_for_fan_mode(FanLevel::from(config.power_profile), config)?;
|
.toggle_profiles
|
||||||
info!(
|
.iter()
|
||||||
"Fan mode was changed: {:?}",
|
.position(|x| x == &config.active_profile)
|
||||||
FanLevel::from(config.power_profile)
|
.map(|i| i + 1)
|
||||||
);
|
.unwrap_or(0);
|
||||||
|
if i >= config.toggle_profiles.len() {
|
||||||
|
i = 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
let new_profile = config
|
||||||
|
.toggle_profiles
|
||||||
|
.get(i)
|
||||||
|
.unwrap_or(&config.active_profile)
|
||||||
|
.clone();
|
||||||
|
|
||||||
|
self.set_profile(&new_profile, config)?;
|
||||||
|
|
||||||
|
info!("Profile was changed: {}", &new_profile);
|
||||||
}
|
}
|
||||||
return Ok(());
|
return Ok(());
|
||||||
}
|
}
|
||||||
@@ -121,66 +139,118 @@ impl CtrlFanAndCPU {
|
|||||||
|
|
||||||
pub(super) fn set_fan_mode(
|
pub(super) fn set_fan_mode(
|
||||||
&mut self,
|
&mut self,
|
||||||
n: u8,
|
preset: u8,
|
||||||
config: &mut Config,
|
config: &mut Config,
|
||||||
) -> Result<(), Box<dyn Error>> {
|
) -> Result<(), Box<dyn Error>> {
|
||||||
|
let mode = config.active_profile.clone();
|
||||||
let mut fan_ctrl = OpenOptions::new().write(true).open(self.path)?;
|
let mut fan_ctrl = OpenOptions::new().write(true).open(self.path)?;
|
||||||
config.read();
|
config.read();
|
||||||
config.power_profile = n;
|
let mut mode_config = config
|
||||||
|
.power_profiles
|
||||||
|
.get_mut(&mode)
|
||||||
|
.ok_or_else(|| RogError::MissingProfile(mode.clone()))?;
|
||||||
|
config.power_profile = preset;
|
||||||
|
mode_config.fan_preset = preset;
|
||||||
config.write();
|
config.write();
|
||||||
fan_ctrl
|
fan_ctrl
|
||||||
.write_all(format!("{:?}\n", config.power_profile).as_bytes())
|
.write_all(format!("{}\n", preset).as_bytes())
|
||||||
.unwrap_or_else(|err| error!("Could not write to {}, {:?}", self.path, err));
|
.unwrap_or_else(|err| error!("Could not write to {}, {}", self.path, err));
|
||||||
info!(
|
info!("Fan mode set to: {:?}", FanLevel::from(preset));
|
||||||
"Fan mode set to: {:?}",
|
self.set_pstate_for_fan_mode(&mode, config)?;
|
||||||
FanLevel::from(config.power_profile)
|
self.set_fan_curve_for_fan_mode(&mode, config)?;
|
||||||
);
|
Ok(())
|
||||||
self.set_pstate_for_fan_mode(FanLevel::from(n), config)?;
|
}
|
||||||
|
|
||||||
|
fn handle_profile_event(
|
||||||
|
&mut self,
|
||||||
|
event: &ProfileEvent,
|
||||||
|
config: &mut Config,
|
||||||
|
) -> Result<(), Box<dyn Error>> {
|
||||||
|
match event {
|
||||||
|
ProfileEvent::ChangeMode(mode) => {
|
||||||
|
self.set_fan_mode(*mode, config)?;
|
||||||
|
}
|
||||||
|
ProfileEvent::Cli(command) => {
|
||||||
|
let profile_key = match command.profile.as_ref() {
|
||||||
|
Some(k) => k.clone(),
|
||||||
|
None => config.active_profile.clone(),
|
||||||
|
};
|
||||||
|
|
||||||
|
let mut profile = if command.create {
|
||||||
|
config
|
||||||
|
.power_profiles
|
||||||
|
.entry(profile_key.clone())
|
||||||
|
.or_insert_with(Profile::default)
|
||||||
|
} else {
|
||||||
|
config
|
||||||
|
.power_profiles
|
||||||
|
.get_mut(&profile_key)
|
||||||
|
.ok_or_else(|| RogError::MissingProfile(profile_key.clone()))?
|
||||||
|
};
|
||||||
|
|
||||||
|
if command.turbo.is_some() {
|
||||||
|
profile.turbo = command.turbo.unwrap();
|
||||||
|
}
|
||||||
|
if let Some(min_perc) = command.min_percentage {
|
||||||
|
profile.min_percentage = min_perc;
|
||||||
|
}
|
||||||
|
if let Some(max_perc) = command.max_percentage {
|
||||||
|
profile.max_percentage = max_perc;
|
||||||
|
}
|
||||||
|
if let Some(ref preset) = command.preset {
|
||||||
|
profile.fan_preset = preset.into();
|
||||||
|
}
|
||||||
|
if let Some(ref curve) = command.curve {
|
||||||
|
profile.fan_curve = Some(curve.clone());
|
||||||
|
}
|
||||||
|
|
||||||
|
self.set_profile(&profile_key, config)?;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
Ok(())
|
||||||
|
}
|
||||||
|
|
||||||
|
fn set_profile(&mut self, profile: &str, config: &mut Config) -> Result<(), Box<dyn Error>> {
|
||||||
|
let mode_config = config
|
||||||
|
.power_profiles
|
||||||
|
.get(profile)
|
||||||
|
.ok_or_else(|| RogError::MissingProfile(profile.into()))?;
|
||||||
|
let mut fan_ctrl = OpenOptions::new().write(true).open(self.path)?;
|
||||||
|
fan_ctrl
|
||||||
|
.write_all(format!("{}\n", mode_config.fan_preset).as_bytes())
|
||||||
|
.unwrap_or_else(|err| error!("Could not write to {}, {}", self.path, err));
|
||||||
|
config.power_profile = mode_config.fan_preset;
|
||||||
|
|
||||||
|
self.set_pstate_for_fan_mode(profile, config)?;
|
||||||
|
self.set_fan_curve_for_fan_mode(profile, config)?;
|
||||||
|
|
||||||
|
config.active_profile = profile.into();
|
||||||
|
|
||||||
|
config.write();
|
||||||
Ok(())
|
Ok(())
|
||||||
}
|
}
|
||||||
|
|
||||||
fn set_pstate_for_fan_mode(
|
fn set_pstate_for_fan_mode(
|
||||||
&self,
|
&self,
|
||||||
mode: FanLevel,
|
// mode: FanLevel,
|
||||||
|
mode: &str,
|
||||||
config: &mut Config,
|
config: &mut Config,
|
||||||
) -> Result<(), Box<dyn Error>> {
|
) -> Result<(), Box<dyn Error>> {
|
||||||
|
info!("Setting pstate");
|
||||||
|
let mode_config = config
|
||||||
|
.power_profiles
|
||||||
|
.get(mode)
|
||||||
|
.ok_or_else(|| RogError::MissingProfile(mode.into()))?;
|
||||||
|
|
||||||
// Set CPU pstate
|
// Set CPU pstate
|
||||||
if let Ok(pstate) = intel_pstate::PState::new() {
|
if let Ok(pstate) = intel_pstate::PState::new() {
|
||||||
match mode {
|
pstate.set_min_perf_pct(mode_config.min_percentage)?;
|
||||||
FanLevel::Normal => {
|
pstate.set_max_perf_pct(mode_config.max_percentage)?;
|
||||||
pstate.set_min_perf_pct(config.power_profiles.normal.min_percentage)?;
|
pstate.set_no_turbo(!mode_config.turbo)?;
|
||||||
pstate.set_max_perf_pct(config.power_profiles.normal.max_percentage)?;
|
info!(
|
||||||
pstate.set_no_turbo(config.power_profiles.normal.no_turbo)?;
|
"Intel CPU Power: min: {}%, max: {}%, turbo: {}",
|
||||||
info!(
|
mode_config.min_percentage, mode_config.max_percentage, mode_config.turbo
|
||||||
"Intel CPU Power: min: {:?}%, max: {:?}%, turbo: {:?}",
|
);
|
||||||
config.power_profiles.normal.min_percentage,
|
|
||||||
config.power_profiles.normal.max_percentage,
|
|
||||||
!config.power_profiles.normal.no_turbo
|
|
||||||
);
|
|
||||||
}
|
|
||||||
FanLevel::Boost => {
|
|
||||||
pstate.set_min_perf_pct(config.power_profiles.boost.min_percentage)?;
|
|
||||||
pstate.set_max_perf_pct(config.power_profiles.boost.max_percentage)?;
|
|
||||||
pstate.set_no_turbo(config.power_profiles.boost.no_turbo)?;
|
|
||||||
info!(
|
|
||||||
"Intel CPU Power: min: {:?}%, max: {:?}%, turbo: {:?}",
|
|
||||||
config.power_profiles.boost.min_percentage,
|
|
||||||
config.power_profiles.boost.max_percentage,
|
|
||||||
!config.power_profiles.boost.no_turbo
|
|
||||||
);
|
|
||||||
}
|
|
||||||
FanLevel::Silent => {
|
|
||||||
pstate.set_min_perf_pct(config.power_profiles.silent.min_percentage)?;
|
|
||||||
pstate.set_max_perf_pct(config.power_profiles.silent.max_percentage)?;
|
|
||||||
pstate.set_no_turbo(config.power_profiles.silent.no_turbo)?;
|
|
||||||
info!(
|
|
||||||
"Intel CPU Power: min: {:?}%, max: {:?}%, turbo: {:?}",
|
|
||||||
config.power_profiles.silent.min_percentage,
|
|
||||||
config.power_profiles.silent.max_percentage,
|
|
||||||
!config.power_profiles.silent.no_turbo
|
|
||||||
);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
} else {
|
} else {
|
||||||
info!("Setting pstate for AMD CPU");
|
info!("Setting pstate for AMD CPU");
|
||||||
// must be AMD CPU
|
// must be AMD CPU
|
||||||
@@ -188,45 +258,39 @@ impl CtrlFanAndCPU {
|
|||||||
.write(true)
|
.write(true)
|
||||||
.open(AMD_BOOST_PATH)
|
.open(AMD_BOOST_PATH)
|
||||||
.map_err(|err| {
|
.map_err(|err| {
|
||||||
warn!("Failed to open AMD boost: {:?}", err);
|
warn!("Failed to open AMD boost: {}", err);
|
||||||
err
|
err
|
||||||
})?;
|
})?;
|
||||||
match mode {
|
|
||||||
FanLevel::Normal => {
|
let boost = if mode_config.turbo { "1" } else { "0" }; // opposite of Intel
|
||||||
let boost = if config.power_profiles.normal.no_turbo {
|
file.write_all(boost.as_bytes())
|
||||||
"0"
|
.unwrap_or_else(|err| error!("Could not write to {}, {}", AMD_BOOST_PATH, err));
|
||||||
} else {
|
info!("AMD CPU Turbo: {}", boost);
|
||||||
"1"
|
}
|
||||||
}; // opposite of Intel
|
Ok(())
|
||||||
file.write_all(boost.as_bytes()).unwrap_or_else(|err| {
|
}
|
||||||
error!("Could not write to {}, {:?}", AMD_BOOST_PATH, err)
|
|
||||||
});
|
fn set_fan_curve_for_fan_mode(
|
||||||
info!("AMD CPU Turbo: {:?}", boost);
|
&self,
|
||||||
}
|
// mode: FanLevel,
|
||||||
FanLevel::Boost => {
|
mode: &str,
|
||||||
let boost = if config.power_profiles.boost.no_turbo {
|
config: &Config,
|
||||||
"0"
|
) -> Result<(), Box<dyn Error>> {
|
||||||
} else {
|
let mode_config = &config
|
||||||
"1"
|
.power_profiles
|
||||||
};
|
.get(mode)
|
||||||
file.write_all(boost.as_bytes()).unwrap_or_else(|err| {
|
.ok_or_else(|| RogError::MissingProfile(mode.into()))?;
|
||||||
error!("Could not write to {}, {:?}", AMD_BOOST_PATH, err)
|
|
||||||
});
|
if let Some(ref curve) = mode_config.fan_curve {
|
||||||
info!("AMD CPU Turbo: {:?}", boost);
|
use rog_fan_curve::{Board, Fan};
|
||||||
}
|
if let Some(board) = Board::from_board_name() {
|
||||||
FanLevel::Silent => {
|
curve.apply(board, Fan::Cpu)?;
|
||||||
let boost = if config.power_profiles.silent.no_turbo {
|
curve.apply(board, Fan::Gpu)?;
|
||||||
"0"
|
} else {
|
||||||
} else {
|
warn!("Fan curve unsupported on this board.")
|
||||||
"1"
|
|
||||||
};
|
|
||||||
file.write_all(boost.as_bytes()).unwrap_or_else(|err| {
|
|
||||||
error!("Could not write to {}, {:?}", AMD_BOOST_PATH, err)
|
|
||||||
});
|
|
||||||
info!("AMD CPU Turbo: {:?}", boost);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
Ok(())
|
Ok(())
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -2,7 +2,7 @@
|
|||||||
static LED_APPLY: [u8; 17] = [0x5d, 0xb4, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0];
|
static LED_APPLY: [u8; 17] = [0x5d, 0xb4, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0];
|
||||||
static LED_SET: [u8; 17] = [0x5d, 0xb5, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0];
|
static LED_SET: [u8; 17] = [0x5d, 0xb5, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0];
|
||||||
|
|
||||||
use crate::{config::Config, error::RogError};
|
use crate::{config::Config, error::RogError, laptops::HELP_ADDRESS};
|
||||||
use asus_nb::{
|
use asus_nb::{
|
||||||
aura_brightness_bytes, aura_modes::AuraModes, fancy::KeyColourArray, DBUS_IFACE, DBUS_PATH,
|
aura_brightness_bytes, aura_modes::AuraModes, fancy::KeyColourArray, DBUS_IFACE, DBUS_PATH,
|
||||||
LED_MSG_LEN,
|
LED_MSG_LEN,
|
||||||
@@ -18,8 +18,9 @@ use tokio::sync::Mutex;
|
|||||||
use tokio::task::JoinHandle;
|
use tokio::task::JoinHandle;
|
||||||
|
|
||||||
pub struct CtrlKbdBacklight {
|
pub struct CtrlKbdBacklight {
|
||||||
led_node: String,
|
led_node: Option<String>,
|
||||||
kbd_node: String,
|
#[allow(dead_code)]
|
||||||
|
kbd_node: Option<String>,
|
||||||
bright_node: String,
|
bright_node: String,
|
||||||
supported_modes: Vec<u8>,
|
supported_modes: Vec<u8>,
|
||||||
flip_effect_write: bool,
|
flip_effect_write: bool,
|
||||||
@@ -80,7 +81,7 @@ impl crate::Controller for CtrlKbdBacklight {
|
|||||||
let mut lock = gate2.lock().await;
|
let mut lock = gate2.lock().await;
|
||||||
let mut config = config.lock().await;
|
let mut config = config.lock().await;
|
||||||
lock.let_bright_check_change(&mut config)
|
lock.let_bright_check_change(&mut config)
|
||||||
.unwrap_or_else(|err| warn!("{:?}", err));
|
.unwrap_or_else(|err| warn!("led_ctrl: {}", err));
|
||||||
}
|
}
|
||||||
}),
|
}),
|
||||||
]
|
]
|
||||||
@@ -130,23 +131,60 @@ impl crate::Controller for CtrlKbdBacklight {
|
|||||||
|
|
||||||
impl CtrlKbdBacklight {
|
impl CtrlKbdBacklight {
|
||||||
#[inline]
|
#[inline]
|
||||||
pub fn new(id_product: &str, supported_modes: Vec<u8>) -> Result<Self, std::io::Error> {
|
pub fn new(id_product: &str, condev_iface: Option<&String>, supported_modes: Vec<u8>) -> Self {
|
||||||
Ok(CtrlKbdBacklight {
|
// TODO: return error if *all* nodes are None
|
||||||
led_node: Self::scan_led_node(id_product)?,
|
CtrlKbdBacklight {
|
||||||
kbd_node: Self::scan_kbd_node(id_product)?,
|
led_node: Self::get_node_failover(id_product, None, Self::scan_led_node).ok(),
|
||||||
// brightness node path should always be constant but this *might* change?
|
kbd_node: Self::get_node_failover(id_product, condev_iface, Self::scan_kbd_node).ok(),
|
||||||
|
// TODO: Check for existance
|
||||||
bright_node: "/sys/class/leds/asus::kbd_backlight/brightness".to_string(),
|
bright_node: "/sys/class/leds/asus::kbd_backlight/brightness".to_string(),
|
||||||
supported_modes,
|
supported_modes,
|
||||||
flip_effect_write: false,
|
flip_effect_write: false,
|
||||||
})
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
fn scan_led_node(id_product: &str) -> Result<String, std::io::Error> {
|
fn get_node_failover(
|
||||||
let mut enumerator = udev::Enumerator::new()?;
|
id_product: &str,
|
||||||
enumerator.match_subsystem("hidraw")?;
|
iface: Option<&String>,
|
||||||
|
fun: fn(&str, Option<&String>) -> Result<String, std::io::Error>,
|
||||||
|
) -> Result<String, std::io::Error> {
|
||||||
|
for n in 0..=2 {
|
||||||
|
// 0,1,2 inclusive
|
||||||
|
match fun(id_product, iface) {
|
||||||
|
Ok(o) => return Ok(o),
|
||||||
|
Err(e) => {
|
||||||
|
if n == 2 {
|
||||||
|
warn!("Looking for node: {}", e.to_string());
|
||||||
|
std::thread::sleep(std::time::Duration::from_secs(1));
|
||||||
|
} else {
|
||||||
|
return Err(e);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
// Shouldn't be possible to reach this...
|
||||||
|
let err = std::io::Error::new(std::io::ErrorKind::NotFound, "node not found");
|
||||||
|
Err(err)
|
||||||
|
}
|
||||||
|
|
||||||
|
fn scan_led_node(id_product: &str, _: Option<&String>) -> Result<String, std::io::Error> {
|
||||||
|
let mut enumerator = udev::Enumerator::new().map_err(|err| {
|
||||||
|
warn!("{}", err);
|
||||||
|
err
|
||||||
|
})?;
|
||||||
|
enumerator.match_subsystem("hidraw").map_err(|err| {
|
||||||
|
warn!("{}", err);
|
||||||
|
err
|
||||||
|
})?;
|
||||||
|
|
||||||
for device in enumerator.scan_devices()? {
|
for device in enumerator.scan_devices()? {
|
||||||
if let Some(parent) = device.parent_with_subsystem_devtype("usb", "usb_device")? {
|
if let Some(parent) = device
|
||||||
|
.parent_with_subsystem_devtype("usb", "usb_device")
|
||||||
|
.map_err(|err| {
|
||||||
|
warn!("{}", err);
|
||||||
|
err
|
||||||
|
})?
|
||||||
|
{
|
||||||
if parent.attribute_value("idProduct").unwrap() == id_product {
|
if parent.attribute_value("idProduct").unwrap() == id_product {
|
||||||
// && device.parent().unwrap().sysnum().unwrap() == 3
|
// && device.parent().unwrap().sysnum().unwrap() == 3
|
||||||
if let Some(dev_node) = device.devnode() {
|
if let Some(dev_node) = device.devnode() {
|
||||||
@@ -160,28 +198,43 @@ impl CtrlKbdBacklight {
|
|||||||
std::io::ErrorKind::NotFound,
|
std::io::ErrorKind::NotFound,
|
||||||
"ASUS LED device node not found",
|
"ASUS LED device node not found",
|
||||||
);
|
);
|
||||||
|
warn!("Did not find a hidraw node for LED control, your device may be unsupported or require a kernel patch, see: {}", HELP_ADDRESS);
|
||||||
Err(err)
|
Err(err)
|
||||||
}
|
}
|
||||||
|
|
||||||
fn scan_kbd_node(id_product: &str) -> Result<String, std::io::Error> {
|
fn scan_kbd_node(id_product: &str, iface: Option<&String>) -> Result<String, std::io::Error> {
|
||||||
let mut enumerator = udev::Enumerator::new()?;
|
let mut enumerator = udev::Enumerator::new()?;
|
||||||
enumerator.match_subsystem("input")?;
|
enumerator.match_subsystem("input").map_err(|err| {
|
||||||
enumerator.match_property("ID_MODEL_ID", id_product)?;
|
warn!("{}", err);
|
||||||
|
err
|
||||||
|
})?;
|
||||||
|
enumerator
|
||||||
|
.match_property("ID_MODEL_ID", id_product)
|
||||||
|
.map_err(|err| {
|
||||||
|
warn!("{}", err);
|
||||||
|
err
|
||||||
|
})?;
|
||||||
|
|
||||||
for device in enumerator.scan_devices()? {
|
for device in enumerator.scan_devices().map_err(|err| {
|
||||||
|
warn!("{}", err);
|
||||||
|
err
|
||||||
|
})? {
|
||||||
if let Some(dev_node) = device.devnode() {
|
if let Some(dev_node) = device.devnode() {
|
||||||
if let Some(inum) = device.property_value("ID_USB_INTERFACE_NUM") {
|
if let Some(inum) = device.property_value("ID_USB_INTERFACE_NUM") {
|
||||||
if inum == "02" {
|
if let Some(iface) = iface {
|
||||||
info!("Using device at: {:?} for keyboard polling", dev_node);
|
if inum == iface.as_str() {
|
||||||
return Ok(dev_node.to_string_lossy().to_string());
|
info!("Using device at: {:?} for keyboard polling", dev_node);
|
||||||
|
return Ok(dev_node.to_string_lossy().to_string());
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
let err = std::io::Error::new(
|
let err = std::io::Error::new(
|
||||||
std::io::ErrorKind::NotFound,
|
std::io::ErrorKind::NotFound,
|
||||||
"ASUS N-Key Consumer Device node not found",
|
"ASUS keyboard 'Consumer Device' node not found",
|
||||||
);
|
);
|
||||||
|
warn!("Did not find keyboard consumer device node, if expected functions are missing please file an issue at {}", HELP_ADDRESS);
|
||||||
Err(err)
|
Err(err)
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -215,9 +268,11 @@ impl CtrlKbdBacklight {
|
|||||||
/// Should only be used if the bytes you are writing are verified correct
|
/// Should only be used if the bytes you are writing are verified correct
|
||||||
#[inline]
|
#[inline]
|
||||||
async fn write_bytes(&self, message: &[u8]) -> Result<(), Box<dyn Error>> {
|
async fn write_bytes(&self, message: &[u8]) -> Result<(), Box<dyn Error>> {
|
||||||
if let Ok(mut file) = OpenOptions::new().write(true).open(&self.led_node) {
|
if let Some(led_node) = &self.led_node {
|
||||||
file.write_all(message).unwrap();
|
if let Ok(mut file) = OpenOptions::new().write(true).open(led_node) {
|
||||||
return Ok(());
|
file.write_all(message).unwrap();
|
||||||
|
return Ok(());
|
||||||
|
}
|
||||||
}
|
}
|
||||||
Err(Box::new(RogError::NotSupported))
|
Err(Box::new(RogError::NotSupported))
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -52,14 +52,11 @@ pub async fn start_daemon() -> Result<(), Box<dyn Error>> {
|
|||||||
};
|
};
|
||||||
|
|
||||||
let mut led_control = if let Some(laptop) = laptop {
|
let mut led_control = if let Some(laptop) = laptop {
|
||||||
CtrlKbdBacklight::new(laptop.usb_product(), laptop.supported_modes().to_owned())
|
Some(CtrlKbdBacklight::new(
|
||||||
.map_or_else(
|
laptop.usb_product(),
|
||||||
|err| {
|
laptop.condev_iface(),
|
||||||
error!("{}", err);
|
laptop.supported_modes().to_owned(),
|
||||||
None
|
))
|
||||||
},
|
|
||||||
Some,
|
|
||||||
)
|
|
||||||
} else {
|
} else {
|
||||||
None
|
None
|
||||||
};
|
};
|
||||||
@@ -114,8 +111,9 @@ pub async fn start_daemon() -> Result<(), Box<dyn Error>> {
|
|||||||
tree,
|
tree,
|
||||||
aura_command_recv,
|
aura_command_recv,
|
||||||
animatrix_recv,
|
animatrix_recv,
|
||||||
fan_mode_recv,
|
_fan_mode_recv,
|
||||||
charge_limit_recv,
|
charge_limit_recv,
|
||||||
|
profile_recv,
|
||||||
led_changed_signal,
|
led_changed_signal,
|
||||||
fanmode_signal,
|
fanmode_signal,
|
||||||
charge_limit_signal,
|
charge_limit_signal,
|
||||||
@@ -149,7 +147,7 @@ pub async fn start_daemon() -> Result<(), Box<dyn Error>> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if let Some(ctrl) = fan_control.take() {
|
if let Some(ctrl) = fan_control.take() {
|
||||||
handles.append(&mut ctrl.spawn_task_loop(config.clone(), fan_mode_recv, None, None));
|
handles.append(&mut ctrl.spawn_task_loop(config.clone(), profile_recv, None, None));
|
||||||
}
|
}
|
||||||
|
|
||||||
if let Some(ctrl) = charge_control.take() {
|
if let Some(ctrl) = charge_control.take() {
|
||||||
|
|||||||
@@ -1,4 +1,5 @@
|
|||||||
use crate::config::Config;
|
use crate::config::Config;
|
||||||
|
use asus_nb::profile::ProfileEvent;
|
||||||
use asus_nb::{aura_modes::AuraModes, DBUS_IFACE, DBUS_PATH};
|
use asus_nb::{aura_modes::AuraModes, DBUS_IFACE, DBUS_PATH};
|
||||||
use dbus::tree::{Factory, MTSync, Method, MethodErr, Signal, Tree};
|
use dbus::tree::{Factory, MTSync, Method, MethodErr, Signal, Tree};
|
||||||
use log::warn;
|
use log::warn;
|
||||||
@@ -170,6 +171,25 @@ fn set_charge_limit(sender: Mutex<Sender<u8>>) -> Method<MTSync, ()> {
|
|||||||
.annotate("org.freedesktop.DBus.Method.NoReply", "true")
|
.annotate("org.freedesktop.DBus.Method.NoReply", "true")
|
||||||
}
|
}
|
||||||
|
|
||||||
|
fn set_profile(sender: Sender<ProfileEvent>) -> Method<MTSync, ()> {
|
||||||
|
let factory = Factory::new_sync::<()>();
|
||||||
|
factory
|
||||||
|
// method for profile
|
||||||
|
.method("ProfileCommand", (), {
|
||||||
|
move |m| {
|
||||||
|
let mut iter = m.msg.iter_init();
|
||||||
|
let byte: String = iter.read()?;
|
||||||
|
if let Ok(byte) = serde_json::from_str(&byte) {
|
||||||
|
sender.clone().try_send(byte).unwrap_or_else(|_err| {});
|
||||||
|
}
|
||||||
|
|
||||||
|
Ok(vec![])
|
||||||
|
}
|
||||||
|
})
|
||||||
|
.inarg::<String, _>("limit")
|
||||||
|
.annotate("org.freedesktop.DBus.Method.NoReply", "true")
|
||||||
|
}
|
||||||
|
|
||||||
#[allow(clippy::type_complexity)]
|
#[allow(clippy::type_complexity)]
|
||||||
pub fn dbus_create_tree(
|
pub fn dbus_create_tree(
|
||||||
config: Arc<Mutex<Config>>,
|
config: Arc<Mutex<Config>>,
|
||||||
@@ -179,6 +199,7 @@ pub fn dbus_create_tree(
|
|||||||
Receiver<Vec<Vec<u8>>>,
|
Receiver<Vec<Vec<u8>>>,
|
||||||
Receiver<u8>,
|
Receiver<u8>,
|
||||||
Receiver<u8>,
|
Receiver<u8>,
|
||||||
|
Receiver<ProfileEvent>,
|
||||||
Arc<Signal<()>>,
|
Arc<Signal<()>>,
|
||||||
Arc<Signal<()>>,
|
Arc<Signal<()>>,
|
||||||
Arc<Signal<()>>,
|
Arc<Signal<()>>,
|
||||||
@@ -186,6 +207,7 @@ pub fn dbus_create_tree(
|
|||||||
let (aura_command_send, aura_command_recv) = channel::<AuraModes>(1);
|
let (aura_command_send, aura_command_recv) = channel::<AuraModes>(1);
|
||||||
let (animatrix_send, animatrix_recv) = channel::<Vec<Vec<u8>>>(1);
|
let (animatrix_send, animatrix_recv) = channel::<Vec<Vec<u8>>>(1);
|
||||||
let (fan_mode_send, fan_mode_recv) = channel::<u8>(1);
|
let (fan_mode_send, fan_mode_recv) = channel::<u8>(1);
|
||||||
|
let (profile_send, profile_recv) = channel::<ProfileEvent>(1);
|
||||||
let (charge_send, charge_recv) = channel::<u8>(1);
|
let (charge_send, charge_recv) = channel::<u8>(1);
|
||||||
|
|
||||||
let factory = Factory::new_sync::<()>();
|
let factory = Factory::new_sync::<()>();
|
||||||
@@ -211,6 +233,7 @@ pub fn dbus_create_tree(
|
|||||||
.add_m(set_keyboard_backlight(Mutex::new(aura_command_send)))
|
.add_m(set_keyboard_backlight(Mutex::new(aura_command_send)))
|
||||||
.add_m(set_animatrix(Mutex::new(animatrix_send)))
|
.add_m(set_animatrix(Mutex::new(animatrix_send)))
|
||||||
.add_m(set_fan_mode(Mutex::new(fan_mode_send)))
|
.add_m(set_fan_mode(Mutex::new(fan_mode_send)))
|
||||||
|
.add_m(set_profile(profile_send))
|
||||||
.add_m(set_charge_limit(Mutex::new(charge_send)))
|
.add_m(set_charge_limit(Mutex::new(charge_send)))
|
||||||
.add_m(get_fan_mode(config.clone()))
|
.add_m(get_fan_mode(config.clone()))
|
||||||
.add_m(get_charge_limit(config.clone()))
|
.add_m(get_charge_limit(config.clone()))
|
||||||
@@ -228,6 +251,7 @@ pub fn dbus_create_tree(
|
|||||||
animatrix_recv,
|
animatrix_recv,
|
||||||
fan_mode_recv,
|
fan_mode_recv,
|
||||||
charge_recv,
|
charge_recv,
|
||||||
|
profile_recv,
|
||||||
key_backlight_changed,
|
key_backlight_changed,
|
||||||
fanmode_changed,
|
fanmode_changed,
|
||||||
chrg_limit_changed,
|
chrg_limit_changed,
|
||||||
|
|||||||
@@ -3,6 +3,7 @@ use std::fmt;
|
|||||||
#[derive(Debug)]
|
#[derive(Debug)]
|
||||||
pub enum RogError {
|
pub enum RogError {
|
||||||
ParseFanLevel,
|
ParseFanLevel,
|
||||||
|
MissingProfile(String),
|
||||||
NotSupported,
|
NotSupported,
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -13,6 +14,7 @@ impl fmt::Display for RogError {
|
|||||||
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
|
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
|
||||||
match self {
|
match self {
|
||||||
RogError::ParseFanLevel => write!(f, "Parse error"),
|
RogError::ParseFanLevel => write!(f, "Parse error"),
|
||||||
|
RogError::MissingProfile(profile) => write!(f, "Profile does not exist {}", profile),
|
||||||
RogError::NotSupported => write!(f, "Not supported"),
|
RogError::NotSupported => write!(f, "Not supported"),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -6,10 +6,11 @@ use std::io::Read;
|
|||||||
|
|
||||||
pub static LEDMODE_CONFIG_PATH: &str = "/etc/asusd/asusd-ledmodes.toml";
|
pub static LEDMODE_CONFIG_PATH: &str = "/etc/asusd/asusd-ledmodes.toml";
|
||||||
|
|
||||||
static HELP_ADDRESS: &str = "https://gitlab.com/asus-linux/asus-nb-ctrl";
|
pub static HELP_ADDRESS: &str = "https://gitlab.com/asus-linux/asus-nb-ctrl";
|
||||||
|
|
||||||
pub struct LaptopBase {
|
pub struct LaptopBase {
|
||||||
usb_product: String,
|
usb_product: String,
|
||||||
|
condev_iface: Option<String>, // required for finding the Consumer Device interface
|
||||||
supported_modes: Vec<u8>,
|
supported_modes: Vec<u8>,
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -17,6 +18,9 @@ impl LaptopBase {
|
|||||||
pub fn usb_product(&self) -> &str {
|
pub fn usb_product(&self) -> &str {
|
||||||
&self.usb_product
|
&self.usb_product
|
||||||
}
|
}
|
||||||
|
pub fn condev_iface(&self) -> Option<&String> {
|
||||||
|
self.condev_iface.as_ref()
|
||||||
|
}
|
||||||
pub fn supported_modes(&self) -> &[u8] {
|
pub fn supported_modes(&self) -> &[u8] {
|
||||||
&self.supported_modes
|
&self.supported_modes
|
||||||
}
|
}
|
||||||
@@ -37,6 +41,7 @@ pub fn match_laptop() -> Option<LaptopBase> {
|
|||||||
info!("Found GL753 or similar");
|
info!("Found GL753 or similar");
|
||||||
return Some(LaptopBase {
|
return Some(LaptopBase {
|
||||||
usb_product: "1854".to_string(),
|
usb_product: "1854".to_string(),
|
||||||
|
condev_iface: None,
|
||||||
supported_modes: vec![STATIC, BREATHING, STROBE],
|
supported_modes: vec![STATIC, BREATHING, STROBE],
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
@@ -44,6 +49,11 @@ pub fn match_laptop() -> Option<LaptopBase> {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
warn!(
|
||||||
|
"Unsupported laptop, please request support at {}",
|
||||||
|
HELP_ADDRESS
|
||||||
|
);
|
||||||
|
warn!("Continuing with minimal support");
|
||||||
None
|
None
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -58,6 +68,7 @@ fn select_1866_device(prod: String) -> LaptopBase {
|
|||||||
|
|
||||||
let mut laptop = LaptopBase {
|
let mut laptop = LaptopBase {
|
||||||
usb_product: prod,
|
usb_product: prod,
|
||||||
|
condev_iface: Some("02".to_owned()),
|
||||||
supported_modes: vec![],
|
supported_modes: vec![],
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -67,13 +78,6 @@ fn select_1866_device(prod: String) -> LaptopBase {
|
|||||||
return laptop;
|
return laptop;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
warn!(
|
|
||||||
"Unsupported laptop, please request support at {}",
|
|
||||||
HELP_ADDRESS
|
|
||||||
);
|
|
||||||
warn!("Continuing with minimal support");
|
|
||||||
|
|
||||||
laptop
|
laptop
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -23,7 +23,7 @@ use std::sync::Arc;
|
|||||||
use tokio::sync::{mpsc::Receiver, Mutex};
|
use tokio::sync::{mpsc::Receiver, Mutex};
|
||||||
use tokio::task::JoinHandle;
|
use tokio::task::JoinHandle;
|
||||||
|
|
||||||
pub static VERSION: &str = "1.0.2";
|
pub static VERSION: &str = "1.1.2";
|
||||||
|
|
||||||
use ::dbus::{nonblock::SyncConnection, tree::Signal};
|
use ::dbus::{nonblock::SyncConnection, tree::Signal};
|
||||||
|
|
||||||
|
|||||||
@@ -1,6 +1,7 @@
|
|||||||
use asus_nb::{
|
use asus_nb::{
|
||||||
cli_options::{LedBrightness, SetAuraBuiltin},
|
cli_options::{LedBrightness, SetAuraBuiltin},
|
||||||
core_dbus::AuraDbusClient,
|
core_dbus::AuraDbusClient,
|
||||||
|
profile::{ProfileCommand, ProfileEvent},
|
||||||
};
|
};
|
||||||
use daemon::ctrl_fan_cpu::FanLevel;
|
use daemon::ctrl_fan_cpu::FanLevel;
|
||||||
use gumdrop::Options;
|
use gumdrop::Options;
|
||||||
@@ -27,6 +28,8 @@ struct CLIStart {
|
|||||||
enum Command {
|
enum Command {
|
||||||
#[options(help = "Set the keyboard lighting from built-in modes")]
|
#[options(help = "Set the keyboard lighting from built-in modes")]
|
||||||
LedMode(LedModeCommand),
|
LedMode(LedModeCommand),
|
||||||
|
#[options(help = "Create and configure profiles")]
|
||||||
|
Profile(ProfileCommand),
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Options)]
|
#[derive(Options)]
|
||||||
@@ -54,11 +57,18 @@ pub async fn main() -> Result<(), Box<dyn std::error::Error>> {
|
|||||||
|
|
||||||
let writer = AuraDbusClient::new()?;
|
let writer = AuraDbusClient::new()?;
|
||||||
|
|
||||||
if let Some(Command::LedMode(mode)) = parsed.command {
|
match parsed.command {
|
||||||
if let Some(command) = mode.command {
|
Some(Command::LedMode(mode)) => {
|
||||||
writer.write_builtin_mode(&command.into())?
|
if let Some(command) = mode.command {
|
||||||
|
writer.write_builtin_mode(&command.into())?
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
Some(Command::Profile(command)) => {
|
||||||
|
writer.write_profile_command(&ProfileEvent::Cli(command))?
|
||||||
|
}
|
||||||
|
None => (),
|
||||||
}
|
}
|
||||||
|
|
||||||
if let Some(brightness) = parsed.kbd_bright {
|
if let Some(brightness) = parsed.kbd_bright {
|
||||||
writer.write_brightness(brightness.level())?;
|
writer.write_brightness(brightness.level())?;
|
||||||
}
|
}
|
||||||
|
|||||||
+2
-1
@@ -1,6 +1,6 @@
|
|||||||
[package]
|
[package]
|
||||||
name = "asus-nb"
|
name = "asus-nb"
|
||||||
version = "0.15.0"
|
version = "1.1.0"
|
||||||
license = "MPL-2.0"
|
license = "MPL-2.0"
|
||||||
readme = "README.md"
|
readme = "README.md"
|
||||||
authors = ["Luke <luke@ljones.dev>"]
|
authors = ["Luke <luke@ljones.dev>"]
|
||||||
@@ -16,6 +16,7 @@ serde = "^1.0"
|
|||||||
serde_derive = "^1.0"
|
serde_derive = "^1.0"
|
||||||
serde_json = "^1.0"
|
serde_json = "^1.0"
|
||||||
yansi-term = "^0.1"
|
yansi-term = "^0.1"
|
||||||
|
rog_fan_curve = { version = "0.1", features = ["serde"] }
|
||||||
|
|
||||||
[dev-dependencies]
|
[dev-dependencies]
|
||||||
tinybmp = "^0.2.3"
|
tinybmp = "^0.2.3"
|
||||||
@@ -1,5 +1,6 @@
|
|||||||
use super::*;
|
use super::*;
|
||||||
use crate::fancy::KeyColourArray;
|
use crate::fancy::KeyColourArray;
|
||||||
|
use crate::profile::ProfileEvent;
|
||||||
use dbus::channel::Sender;
|
use dbus::channel::Sender;
|
||||||
use dbus::{blocking::Connection, channel::Token, Message};
|
use dbus::{blocking::Connection, channel::Token, Message};
|
||||||
use std::error::Error;
|
use std::error::Error;
|
||||||
@@ -95,8 +96,20 @@ impl AuraDbusClient {
|
|||||||
|
|
||||||
#[inline]
|
#[inline]
|
||||||
pub fn write_fan_mode(&self, level: u8) -> Result<(), Box<dyn std::error::Error>> {
|
pub fn write_fan_mode(&self, level: u8) -> Result<(), Box<dyn std::error::Error>> {
|
||||||
let mut msg = Message::new_method_call(DBUS_NAME, DBUS_PATH, DBUS_IFACE, "SetFanMode")?
|
let mut msg = Message::new_method_call(DBUS_NAME, DBUS_PATH, DBUS_IFACE, "ProfileCommand")?
|
||||||
.append1(level);
|
.append1(serde_json::to_string(&ProfileEvent::ChangeMode(level))?);
|
||||||
|
msg.set_no_reply(true);
|
||||||
|
self.connection.send(msg).unwrap();
|
||||||
|
Ok(())
|
||||||
|
}
|
||||||
|
|
||||||
|
#[inline]
|
||||||
|
pub fn write_profile_command(
|
||||||
|
&self,
|
||||||
|
cmd: &ProfileEvent,
|
||||||
|
) -> Result<(), Box<dyn std::error::Error>> {
|
||||||
|
let mut msg = Message::new_method_call(DBUS_NAME, DBUS_PATH, DBUS_IFACE, "ProfileCommand")?
|
||||||
|
.append1(serde_json::to_string(cmd)?);
|
||||||
msg.set_no_reply(true);
|
msg.set_no_reply(true);
|
||||||
self.connection.send(msg).unwrap();
|
self.connection.send(msg).unwrap();
|
||||||
Ok(())
|
Ok(())
|
||||||
|
|||||||
@@ -6,6 +6,8 @@ pub const LED_MSG_LEN: usize = 17;
|
|||||||
pub mod aura_modes;
|
pub mod aura_modes;
|
||||||
use aura_modes::AuraModes;
|
use aura_modes::AuraModes;
|
||||||
|
|
||||||
|
pub mod profile;
|
||||||
|
|
||||||
/// Contains mostly only what is required for parsing CLI options
|
/// Contains mostly only what is required for parsing CLI options
|
||||||
pub mod cli_options;
|
pub mod cli_options;
|
||||||
|
|
||||||
|
|||||||
@@ -0,0 +1,94 @@
|
|||||||
|
use gumdrop::Options;
|
||||||
|
use rog_fan_curve::{Curve, Fan};
|
||||||
|
use serde_derive::{Deserialize, Serialize};
|
||||||
|
use std::str::FromStr;
|
||||||
|
|
||||||
|
#[derive(Debug, Serialize, Deserialize)]
|
||||||
|
pub enum ProfileEvent {
|
||||||
|
Cli(ProfileCommand),
|
||||||
|
ChangeMode(u8),
|
||||||
|
}
|
||||||
|
|
||||||
|
#[derive(Debug, Clone, Serialize, Deserialize)]
|
||||||
|
pub enum FanLevel {
|
||||||
|
Normal,
|
||||||
|
Boost,
|
||||||
|
Silent,
|
||||||
|
}
|
||||||
|
|
||||||
|
impl FromStr for FanLevel {
|
||||||
|
type Err = &'static str;
|
||||||
|
|
||||||
|
fn from_str(s: &str) -> Result<Self, Self::Err> {
|
||||||
|
match s.to_lowercase().as_str() {
|
||||||
|
"normal" => Ok(FanLevel::Normal),
|
||||||
|
"boost" => Ok(FanLevel::Boost),
|
||||||
|
"silent" => Ok(FanLevel::Silent),
|
||||||
|
_ => Err("Invalid fan level"),
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
impl From<u8> for FanLevel {
|
||||||
|
fn from(n: u8) -> Self {
|
||||||
|
match n {
|
||||||
|
0 => FanLevel::Normal,
|
||||||
|
1 => FanLevel::Boost,
|
||||||
|
2 => FanLevel::Silent,
|
||||||
|
_ => FanLevel::Normal,
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
impl From<FanLevel> for u8 {
|
||||||
|
fn from(n: FanLevel) -> Self {
|
||||||
|
match n {
|
||||||
|
FanLevel::Normal => 0,
|
||||||
|
FanLevel::Boost => 1,
|
||||||
|
FanLevel::Silent => 2,
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
impl From<&FanLevel> for u8 {
|
||||||
|
fn from(n: &FanLevel) -> Self {
|
||||||
|
match n {
|
||||||
|
FanLevel::Normal => 0,
|
||||||
|
FanLevel::Boost => 1,
|
||||||
|
FanLevel::Silent => 2,
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
fn parse_fan_curve(data: &str) -> Result<Curve, String> {
|
||||||
|
let curve = Curve::from_config_str(data)?;
|
||||||
|
if let Err(err) = curve.check_safety(Fan::Cpu) {
|
||||||
|
return Err(format!("Unsafe curve {:?}", err));
|
||||||
|
}
|
||||||
|
if let Err(err) = curve.check_safety(Fan::Gpu) {
|
||||||
|
return Err(format!("Unsafe curve {:?}", err));
|
||||||
|
}
|
||||||
|
Ok(curve)
|
||||||
|
}
|
||||||
|
|
||||||
|
#[derive(Debug, Clone, Options, Serialize, Deserialize)]
|
||||||
|
pub struct ProfileCommand {
|
||||||
|
#[options(help = "print help message")]
|
||||||
|
help: bool,
|
||||||
|
#[options(help = "create the profile if it doesn't exist")]
|
||||||
|
pub create: bool,
|
||||||
|
|
||||||
|
#[options(help = "enable or disable cpu turbo")]
|
||||||
|
pub turbo: Option<bool>,
|
||||||
|
#[options(help = "set min cpu scaling (intel)")]
|
||||||
|
pub min_percentage: Option<u8>,
|
||||||
|
#[options(help = "set max cpu scaling (intel)")]
|
||||||
|
pub max_percentage: Option<u8>,
|
||||||
|
|
||||||
|
#[options(meta = "PWR", help = "<silent, normal, boost>")]
|
||||||
|
pub preset: Option<FanLevel>,
|
||||||
|
#[options(parse(try_from_str = "parse_fan_curve"), help = "set fan curve")]
|
||||||
|
pub curve: Option<Curve>,
|
||||||
|
#[options(free)]
|
||||||
|
pub profile: Option<String>,
|
||||||
|
}
|
||||||
+10
-10
@@ -3,11 +3,6 @@ prod_family = "Zephyrus S"
|
|||||||
board_names = ["GX502", "GX701", "G531", "GL531", "G532"]
|
board_names = ["GX502", "GX701", "G531", "GL531", "G532"]
|
||||||
led_modes = [0, 1, 2, 3, 4, 5, 6, 7, 8, 10, 11, 12, 255]
|
led_modes = [0, 1, 2, 3, 4, 5, 6, 7, 8, 10, 11, 12, 255]
|
||||||
|
|
||||||
[[led_modes]]
|
|
||||||
prod_family = "ROG Strix"
|
|
||||||
board_names = ["GX531", "G512LV", "G712LV"]
|
|
||||||
led_modes = [0, 1, 2, 3, 10, 13]
|
|
||||||
|
|
||||||
[[led_modes]]
|
[[led_modes]]
|
||||||
prod_family = "Zephyrus"
|
prod_family = "Zephyrus"
|
||||||
board_names = ["GM501GM", "GX531"]
|
board_names = ["GM501GM", "GX531"]
|
||||||
@@ -15,14 +10,19 @@ led_modes = [0, 1, 2, 3, 10, 13]
|
|||||||
|
|
||||||
[[led_modes]]
|
[[led_modes]]
|
||||||
prod_family = "ROG Strix"
|
prod_family = "ROG Strix"
|
||||||
board_names = ["G512LI", "G712LI"]
|
|
||||||
led_modes = [0, 1, 2, 3, 10]
|
|
||||||
|
|
||||||
[[led_modes]]
|
|
||||||
prod_family = "Strix Scar 3"
|
|
||||||
board_names = ["G531GW"]
|
board_names = ["G531GW"]
|
||||||
led_modes = [0, 1, 2, 3, 4, 5, 6, 7, 8, 10, 11, 12, 255]
|
led_modes = [0, 1, 2, 3, 4, 5, 6, 7, 8, 10, 11, 12, 255]
|
||||||
|
|
||||||
|
[[led_modes]]
|
||||||
|
prod_family = "ROG Strix"
|
||||||
|
board_names = ["GX531", "G512LV", "G712LV"]
|
||||||
|
led_modes = [0, 1, 2, 3, 10, 13]
|
||||||
|
|
||||||
|
[[led_modes]]
|
||||||
|
prod_family = "ROG Strix"
|
||||||
|
board_names = ["G512LI", "G712LI"]
|
||||||
|
led_modes = [0, 1, 2, 3, 10]
|
||||||
|
|
||||||
[[led_modes]]
|
[[led_modes]]
|
||||||
prod_family = "Strix"
|
prod_family = "Strix"
|
||||||
board_names = ["G731GV", "G731GW", "G531GV"]
|
board_names = ["G731GV", "G731GW", "G531GV"]
|
||||||
|
|||||||
@@ -1,8 +1,12 @@
|
|||||||
[Unit]
|
[Unit]
|
||||||
Description=ASUS Notebook Control
|
Description=ASUS Notebook Control
|
||||||
|
StartLimitInterval=200
|
||||||
|
StartLimitBurst=2
|
||||||
|
|
||||||
[Service]
|
[Service]
|
||||||
ExecStart=/usr/bin/asusd
|
ExecStart=/usr/bin/asusd
|
||||||
Restart=on-failure
|
Restart=on-failure
|
||||||
|
Restart=always
|
||||||
|
RestartSec=1
|
||||||
Type=dbus
|
Type=dbus
|
||||||
BusName=org.asuslinux.Daemon
|
BusName=org.asuslinux.Daemon
|
||||||
Vendored
-22
@@ -1,22 +0,0 @@
|
|||||||
#!/bin/sh
|
|
||||||
|
|
||||||
set -e
|
|
||||||
|
|
||||||
case "$1" in
|
|
||||||
configure)
|
|
||||||
CONF='/etc/asusd.conf'
|
|
||||||
if [ -f $CONF ]; then
|
|
||||||
mv $CONF $CONF.save
|
|
||||||
fi
|
|
||||||
systemctl unmask asusd.service
|
|
||||||
#ROG=$(lsusb |grep 0b05 |cut -d ' ' -f 6 |cut -d ':' -f 2)
|
|
||||||
#sed -i -e "s|==/"1866/"|==/"${ROG}/"|g" /etc/udev/rules.d/99-rog-core.rules
|
|
||||||
;;
|
|
||||||
|
|
||||||
*)
|
|
||||||
;;
|
|
||||||
esac
|
|
||||||
|
|
||||||
#DEBHELPER#
|
|
||||||
|
|
||||||
exit 0
|
|
||||||
Vendored
-19
@@ -1,19 +0,0 @@
|
|||||||
#!/bin/sh
|
|
||||||
|
|
||||||
set -e
|
|
||||||
|
|
||||||
case "$1" in
|
|
||||||
remove)
|
|
||||||
CONF='/etc/rogcore.conf'
|
|
||||||
if [ -f $CONF ]; then
|
|
||||||
rm -rf $CONF
|
|
||||||
fi
|
|
||||||
;;
|
|
||||||
|
|
||||||
*)
|
|
||||||
;;
|
|
||||||
esac
|
|
||||||
|
|
||||||
#DEBHELPER#
|
|
||||||
|
|
||||||
exit 0
|
|
||||||
Vendored
Vendored
-1
@@ -1 +0,0 @@
|
|||||||
9
|
|
||||||
Vendored
-39
@@ -1,39 +0,0 @@
|
|||||||
Source: asus-nb-ctrl
|
|
||||||
Section: admin
|
|
||||||
Priority: optional
|
|
||||||
Maintainer: Luke Jones <luke@ljones.dev>
|
|
||||||
Build-Depends:
|
|
||||||
debhelper (>=9),
|
|
||||||
cargo,
|
|
||||||
llvm,
|
|
||||||
libclang-dev,
|
|
||||||
libusb-1.0-0-dev,
|
|
||||||
libdbus-1-dev,
|
|
||||||
libudev-1-dev
|
|
||||||
pkg-config
|
|
||||||
Standards-Version: 4.1.1
|
|
||||||
Homepage: https://gitlab.com/asus-linux/asus-nb-ctrl
|
|
||||||
|
|
||||||
Package: asus-nb-ctrl
|
|
||||||
Architecture: amd64
|
|
||||||
Depends:
|
|
||||||
dbus,
|
|
||||||
systemd,
|
|
||||||
libusb-1.0-0,
|
|
||||||
libudev,
|
|
||||||
${misc:Depends},
|
|
||||||
${shlibs:Depends}
|
|
||||||
Description:ASUS ROG Laptop Management
|
|
||||||
Extra support for ASUS laptop models:
|
|
||||||
- GM501
|
|
||||||
- GX502
|
|
||||||
- GX531
|
|
||||||
- G512
|
|
||||||
- G712
|
|
||||||
- GX531
|
|
||||||
- G531
|
|
||||||
- GA14/GA401. You will need kernel patches
|
|
||||||
+ https://lab.retarded.farm/zappel/asus-rog-zephyrus-g14/-/tree/master/kernel_patches
|
|
||||||
- GA15/GA502/GU502 appears to have most things working
|
|
||||||
- GL703(0x1869)
|
|
||||||
- GL553/GL753
|
|
||||||
Vendored
-7
@@ -1,7 +0,0 @@
|
|||||||
Format: http://www.debian.org/doc/packaging-manuals/copyright-format/1.0/
|
|
||||||
Upstream-Name: rog-core
|
|
||||||
Source: https://github.com/flukejones/rog-core
|
|
||||||
|
|
||||||
Files: *
|
|
||||||
Copyright: Copyright 2020 Luke Jones
|
|
||||||
License: MPL-2.0
|
|
||||||
Vendored
-21
@@ -1,21 +0,0 @@
|
|||||||
#!/usr/bin/make -f
|
|
||||||
|
|
||||||
export VENDORED ?= 1
|
|
||||||
CLEAN ?= 1
|
|
||||||
|
|
||||||
%:
|
|
||||||
dh $@ --with=systemd
|
|
||||||
|
|
||||||
override_dh_auto_build:
|
|
||||||
env CARGO_HOME="$$(pwd)/target/cargo" \
|
|
||||||
dh_auto_build
|
|
||||||
|
|
||||||
override_dh_auto_clean:
|
|
||||||
ifeq ($(CLEAN),1)
|
|
||||||
make clean
|
|
||||||
endif
|
|
||||||
ifeq ($(VENDORED),1)
|
|
||||||
if ! ischroot; then \
|
|
||||||
make vendor; \
|
|
||||||
fi
|
|
||||||
endif
|
|
||||||
Vendored
-1
@@ -1 +0,0 @@
|
|||||||
3.0 (native)
|
|
||||||
Reference in New Issue
Block a user