mirror of
https://gitlab.com/asus-linux/asusctl.git
synced 2026-02-06 00:15:04 +01:00
Compare commits
14 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 9ffeb19c8c | |||
| f61f62c219 | |||
| bb70fd7b71 | |||
| b80c860b7a | |||
| 3c7544f034 | |||
| 6746c2b654 | |||
| 8d59f89438 | |||
| 5753160e91 | |||
| 622cd9d943 | |||
| 2daa7f0811 | |||
| 05c53df0ed | |||
| a7419cbc4c | |||
| 67ad38a7e6 | |||
| e572ae2c62 |
+9
-1
@@ -5,8 +5,16 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
|
|||||||
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
|
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
|
||||||
|
|
||||||
## [Unreleased]
|
## [Unreleased]
|
||||||
|
# [2.0.5] - 2020-09-29
|
||||||
|
### Changed
|
||||||
|
- Bugfixes
|
||||||
|
|
||||||
# [2.0.0] - 2020-09-21
|
# [2.0.4] - 2020-09-24
|
||||||
|
### Changed
|
||||||
|
- Better and more verbose error handling and logging in many places.
|
||||||
|
- Fix timeout for client waiting on reply for graphics switching
|
||||||
|
|
||||||
|
# [2.0.2] - 2020-09-21
|
||||||
### Changed
|
### Changed
|
||||||
- graphics options via CLI are now a command block:
|
- graphics options via CLI are now a command block:
|
||||||
+ `asusctl graphics`
|
+ `asusctl graphics`
|
||||||
|
|||||||
Generated
+34
-33
@@ -29,7 +29,7 @@ checksum = "cff77d8686867eceff3105329d4698d96c2391c176d5d03adc90c7389162b5b8"
|
|||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "asus-nb"
|
name = "asus-nb"
|
||||||
version = "2.0.2"
|
version = "2.0.4"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"ctrl-gfx",
|
"ctrl-gfx",
|
||||||
"dbus",
|
"dbus",
|
||||||
@@ -46,7 +46,7 @@ dependencies = [
|
|||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "asus-nb-ctrl"
|
name = "asus-nb-ctrl"
|
||||||
version = "2.0.2"
|
version = "2.0.4"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"asus-nb",
|
"asus-nb",
|
||||||
"ctrl-gfx",
|
"ctrl-gfx",
|
||||||
@@ -69,7 +69,7 @@ dependencies = [
|
|||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "asus-notify"
|
name = "asus-notify"
|
||||||
version = "1.0.1"
|
version = "2.0.4"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"asus-nb",
|
"asus-nb",
|
||||||
"asus-nb-ctrl",
|
"asus-nb-ctrl",
|
||||||
@@ -152,13 +152,15 @@ checksum = "4785bdd1c96b2a846b2bd7cc02e86b6b3dbf14e7e53446c4f54c92a361040822"
|
|||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "chrono"
|
name = "chrono"
|
||||||
version = "0.4.15"
|
version = "0.4.18"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "942f72db697d8767c22d46a598e01f2d3b475501ea43d0db4f16d90259182d0b"
|
checksum = "d021fddb7bd3e734370acfa4a83f34095571d8570c039f1420d77540f68d5772"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
|
"libc",
|
||||||
"num-integer",
|
"num-integer",
|
||||||
"num-traits",
|
"num-traits",
|
||||||
"time",
|
"time",
|
||||||
|
"winapi",
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
@@ -189,7 +191,7 @@ dependencies = [
|
|||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "ctrl-gfx"
|
name = "ctrl-gfx"
|
||||||
version = "2.1.0"
|
version = "2.1.1"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"log",
|
"log",
|
||||||
"sysfs-class",
|
"sysfs-class",
|
||||||
@@ -215,7 +217,7 @@ checksum = "cb582b60359da160a9477ee80f15c8d784c477e69c217ef2cdd4169c24ea380f"
|
|||||||
dependencies = [
|
dependencies = [
|
||||||
"proc-macro2",
|
"proc-macro2",
|
||||||
"quote 1.0.7",
|
"quote 1.0.7",
|
||||||
"syn 1.0.41",
|
"syn 1.0.42",
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
@@ -247,7 +249,7 @@ checksum = "946ee94e3dbf58fdd324f9ce245c7b238d46a66f00e86a020b71996349e46cce"
|
|||||||
dependencies = [
|
dependencies = [
|
||||||
"proc-macro2",
|
"proc-macro2",
|
||||||
"quote 1.0.7",
|
"quote 1.0.7",
|
||||||
"syn 1.0.41",
|
"syn 1.0.42",
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
@@ -273,7 +275,7 @@ dependencies = [
|
|||||||
"proc-macro2",
|
"proc-macro2",
|
||||||
"quote 1.0.7",
|
"quote 1.0.7",
|
||||||
"rustversion",
|
"rustversion",
|
||||||
"syn 1.0.41",
|
"syn 1.0.42",
|
||||||
"synstructure",
|
"synstructure",
|
||||||
]
|
]
|
||||||
|
|
||||||
@@ -323,14 +325,14 @@ checksum = "915ef07c710d84733522461de2a734d4d62a3fd39a4d4f404c2f385ef8618d05"
|
|||||||
dependencies = [
|
dependencies = [
|
||||||
"proc-macro2",
|
"proc-macro2",
|
||||||
"quote 1.0.7",
|
"quote 1.0.7",
|
||||||
"syn 1.0.41",
|
"syn 1.0.42",
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "hermit-abi"
|
name = "hermit-abi"
|
||||||
version = "0.1.15"
|
version = "0.1.16"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "3deed196b6e7f9e44a2ae8d94225d80302d81208b1bb673fd21fe634645c85a9"
|
checksum = "4c30f6d0bc6b00693347368a67d41b58f2fb851215ff1da49e90fe2c5c667151"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"libc",
|
"libc",
|
||||||
]
|
]
|
||||||
@@ -411,9 +413,9 @@ dependencies = [
|
|||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "libusb1-sys"
|
name = "libusb1-sys"
|
||||||
version = "0.4.1"
|
version = "0.4.2"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "ca5c2a82e2c56537de7d1a163575049593667af689122fafbccc117bbaa59079"
|
checksum = "1f02e930161703cc97c0aab3a905feb9740db03a80910f31ab0f8fa309223f39"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"cc",
|
"cc",
|
||||||
"libc",
|
"libc",
|
||||||
@@ -577,7 +579,7 @@ dependencies = [
|
|||||||
"proc-macro-error-attr",
|
"proc-macro-error-attr",
|
||||||
"proc-macro2",
|
"proc-macro2",
|
||||||
"quote 1.0.7",
|
"quote 1.0.7",
|
||||||
"syn 1.0.41",
|
"syn 1.0.42",
|
||||||
"version_check",
|
"version_check",
|
||||||
]
|
]
|
||||||
|
|
||||||
@@ -594,9 +596,9 @@ dependencies = [
|
|||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "proc-macro2"
|
name = "proc-macro2"
|
||||||
version = "1.0.21"
|
version = "1.0.23"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "36e28516df94f3dd551a587da5357459d9b36d945a7c37c3557928c1c2ff2a2c"
|
checksum = "51ef7cd2518ead700af67bf9d1a658d90b6037d77110fd9c0445429d0ba1c6c9"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"unicode-xid 0.2.1",
|
"unicode-xid 0.2.1",
|
||||||
]
|
]
|
||||||
@@ -665,9 +667,9 @@ checksum = "cabe4fa914dec5870285fa7f71f602645da47c486e68486d2b4ceb4a343e90ac"
|
|||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "rog_fan_curve"
|
name = "rog_fan_curve"
|
||||||
version = "0.1.5"
|
version = "0.1.6"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "b9d3867a0df47bf57c6eebe8b2fb3c2e5c09586a23c715cd7963c2f090c9983f"
|
checksum = "da77fe4a6ad41da874d83eca6a32075a5b8f6ad4778682bc1308075e7ef856a9"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"serde",
|
"serde",
|
||||||
]
|
]
|
||||||
@@ -702,7 +704,7 @@ checksum = "b9bdc5e856e51e685846fb6c13a1f5e5432946c2c90501bdc76a1319f19e29da"
|
|||||||
dependencies = [
|
dependencies = [
|
||||||
"proc-macro2",
|
"proc-macro2",
|
||||||
"quote 1.0.7",
|
"quote 1.0.7",
|
||||||
"syn 1.0.41",
|
"syn 1.0.42",
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
@@ -734,7 +736,7 @@ checksum = "f630a6370fd8e457873b4bd2ffdae75408bc291ba72be773772a4c2a065d9ae8"
|
|||||||
dependencies = [
|
dependencies = [
|
||||||
"proc-macro2",
|
"proc-macro2",
|
||||||
"quote 1.0.7",
|
"quote 1.0.7",
|
||||||
"syn 1.0.41",
|
"syn 1.0.42",
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
@@ -756,7 +758,7 @@ checksum = "2dc6b7951b17b051f3210b063f12cc17320e2fe30ae05b0fe2a3abb068551c76"
|
|||||||
dependencies = [
|
dependencies = [
|
||||||
"proc-macro2",
|
"proc-macro2",
|
||||||
"quote 1.0.7",
|
"quote 1.0.7",
|
||||||
"syn 1.0.41",
|
"syn 1.0.42",
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
@@ -767,7 +769,7 @@ checksum = "133659a15339456eeeb07572eb02a91c91e9815e9cbc89566944d2c8d3efdbf6"
|
|||||||
dependencies = [
|
dependencies = [
|
||||||
"proc-macro2",
|
"proc-macro2",
|
||||||
"quote 1.0.7",
|
"quote 1.0.7",
|
||||||
"syn 1.0.41",
|
"syn 1.0.42",
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
@@ -799,9 +801,9 @@ dependencies = [
|
|||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "syn"
|
name = "syn"
|
||||||
version = "1.0.41"
|
version = "1.0.42"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "6690e3e9f692504b941dc6c3b188fd28df054f7fb8469ab40680df52fdcc842b"
|
checksum = "9c51d92969d209b54a98397e1b91c8ae82d8c87a7bb87df0b29aa2ad81454228"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"proc-macro2",
|
"proc-macro2",
|
||||||
"quote 1.0.7",
|
"quote 1.0.7",
|
||||||
@@ -825,7 +827,7 @@ checksum = "b834f2d66f734cb897113e34aaff2f1ab4719ca946f9a7358dba8f8064148701"
|
|||||||
dependencies = [
|
dependencies = [
|
||||||
"proc-macro2",
|
"proc-macro2",
|
||||||
"quote 1.0.7",
|
"quote 1.0.7",
|
||||||
"syn 1.0.41",
|
"syn 1.0.42",
|
||||||
"unicode-xid 0.2.1",
|
"unicode-xid 0.2.1",
|
||||||
]
|
]
|
||||||
|
|
||||||
@@ -1040,9 +1042,9 @@ dependencies = [
|
|||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "zbus"
|
name = "zbus"
|
||||||
version = "1.1.1"
|
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 = "e941349efbc28a22449be1e7bdaac074c9f9d96b465f855af018aa1a4e99d0a6"
|
checksum = "3f3d015ea4cb76e7f951e429086995126807372f80c9a2a29bf00fcfd31a50b0"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"byteorder",
|
"byteorder",
|
||||||
"derivative",
|
"derivative",
|
||||||
@@ -1055,19 +1057,18 @@ dependencies = [
|
|||||||
"serde_repr",
|
"serde_repr",
|
||||||
"zbus_macros",
|
"zbus_macros",
|
||||||
"zvariant",
|
"zvariant",
|
||||||
"zvariant_derive",
|
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "zbus_macros"
|
name = "zbus_macros"
|
||||||
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 = "a153562b600280af9eaf6aff75132e1781e04bdcbb37ae03ebcc8286bb0ede42"
|
checksum = "54567d486c1ece9268173866c227ac1e168aa5cdf983ae9d13aaf45767fdf679"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"proc-macro-crate",
|
"proc-macro-crate",
|
||||||
"proc-macro2",
|
"proc-macro2",
|
||||||
"quote 1.0.7",
|
"quote 1.0.7",
|
||||||
"syn 1.0.41",
|
"syn 1.0.42",
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
@@ -1091,5 +1092,5 @@ dependencies = [
|
|||||||
"proc-macro-crate",
|
"proc-macro-crate",
|
||||||
"proc-macro2",
|
"proc-macro2",
|
||||||
"quote 1.0.7",
|
"quote 1.0.7",
|
||||||
"syn 1.0.41",
|
"syn 1.0.42",
|
||||||
]
|
]
|
||||||
|
|||||||
@@ -44,7 +44,6 @@ install: all
|
|||||||
install -D -m 0755 "target/release/$(BIN_N)" "$(DESTDIR)$(bindir)/$(BIN_N)"
|
install -D -m 0755 "target/release/$(BIN_N)" "$(DESTDIR)$(bindir)/$(BIN_N)"
|
||||||
install -D -m 0644 "data/$(PMRULES)" "$(DESTDIR)/lib/udev/rules.d/$(PMRULES)"
|
install -D -m 0644 "data/$(PMRULES)" "$(DESTDIR)/lib/udev/rules.d/$(PMRULES)"
|
||||||
install -D -m 0644 "data/$(BIN_D).rules" "$(DESTDIR)/lib/udev/rules.d/99-$(BIN_D).rules"
|
install -D -m 0644 "data/$(BIN_D).rules" "$(DESTDIR)/lib/udev/rules.d/99-$(BIN_D).rules"
|
||||||
install -D -m 0644 "data/$(PMRULES).rules" "$(DESTDIR)/lib/udev/rules.d/$(PMRULES).rules"
|
|
||||||
install -D -m 0644 "data/$(LEDCFG)" "$(DESTDIR)$(sysconfdir)/asusd/$(LEDCFG)"
|
install -D -m 0644 "data/$(LEDCFG)" "$(DESTDIR)$(sysconfdir)/asusd/$(LEDCFG)"
|
||||||
install -D -m 0644 "data/$(BIN_D).conf" "$(DESTDIR)$(sysconfdir)/dbus-1/system.d/$(BIN_D).conf"
|
install -D -m 0644 "data/$(BIN_D).conf" "$(DESTDIR)$(sysconfdir)/dbus-1/system.d/$(BIN_D).conf"
|
||||||
install -D -m 0644 "data/$(X11CFG)" "$(DESTDIR)$(sysconfdir)/X11/xorg.conf.d/$(X11CFG)"
|
install -D -m 0644 "data/$(X11CFG)" "$(DESTDIR)$(sysconfdir)/X11/xorg.conf.d/$(X11CFG)"
|
||||||
@@ -60,7 +59,6 @@ uninstall:
|
|||||||
rm -f "$(DESTDIR)$(bindir)/$(BIN_N)"
|
rm -f "$(DESTDIR)$(bindir)/$(BIN_N)"
|
||||||
rm -f "$(DESTDIR)/lib/udev/rules.d/$(PMRULES)"
|
rm -f "$(DESTDIR)/lib/udev/rules.d/$(PMRULES)"
|
||||||
rm -f "$(DESTDIR)/lib/udev/rules.d/99-$(BIN_D).rules"
|
rm -f "$(DESTDIR)/lib/udev/rules.d/99-$(BIN_D).rules"
|
||||||
rm -f "$(DESTDIR)/lib/udev/rules.d/$(PMRULES).rules"
|
|
||||||
rm -f "$(DESTDIR)$(sysconfdir)/dbus-1/system.d/$(BIN_D).conf"
|
rm -f "$(DESTDIR)$(sysconfdir)/dbus-1/system.d/$(BIN_D).conf"
|
||||||
rm -f "$(DESTDIR)$(sysconfdir)/X11/xorg.conf.d/$(X11CFG)"
|
rm -f "$(DESTDIR)$(sysconfdir)/X11/xorg.conf.d/$(X11CFG)"
|
||||||
rm -f "$(DESTDIR)/lib/systemd/system/$(BIN_D).service"
|
rm -f "$(DESTDIR)/lib/systemd/system/$(BIN_D).service"
|
||||||
|
|||||||
@@ -5,6 +5,8 @@ but can also be used with non-asus laptops with reduced features.
|
|||||||
|
|
||||||
**NOTICE:**
|
**NOTICE:**
|
||||||
|
|
||||||
|
This app is developed and tested on fedora only. Support is not provided for Arch or Arch based distros.
|
||||||
|
|
||||||
This program requires the kernel patch [here](https://www.spinics.net/lists/linux-input/msg68977.html) to be applied.
|
This program requires the kernel patch [here](https://www.spinics.net/lists/linux-input/msg68977.html) to be applied.
|
||||||
Alternatively you may use the dkms module for 'hid-asus-rog` from one of the
|
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/).
|
repositories [here](https://download.opensuse.org/repositories/home:/luke_nukem:/asus/).
|
||||||
@@ -74,9 +76,6 @@ stray configs blocking nvidia modules from loading in:
|
|||||||
If you have installed the Nvidia driver manually you will require the
|
If you have installed the Nvidia driver manually you will require the
|
||||||
`data/90-asusd-nvidia-pm.rules` udev rule to be installed in `/etc/udev/rules.d/`.
|
`data/90-asusd-nvidia-pm.rules` udev rule to be installed in `/etc/udev/rules.d/`.
|
||||||
|
|
||||||
The above seems to also apply to Arch in general as it leaves a lot of things up
|
|
||||||
to the user.
|
|
||||||
|
|
||||||
### fedora and openSUSE
|
### fedora and openSUSE
|
||||||
|
|
||||||
You *may* need a file `/etc/dracut.conf.d/90-nvidia-dracut-G05.conf` installed
|
You *may* need a file `/etc/dracut.conf.d/90-nvidia-dracut-G05.conf` installed
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
[package]
|
[package]
|
||||||
name = "asus-nb-ctrl"
|
name = "asus-nb-ctrl"
|
||||||
version = "2.0.2"
|
version = "2.0.5"
|
||||||
license = "MPL-2.0"
|
license = "MPL-2.0"
|
||||||
readme = "README.md"
|
readme = "README.md"
|
||||||
authors = ["Luke <luke@ljones.dev>"]
|
authors = ["Luke <luke@ljones.dev>"]
|
||||||
@@ -33,7 +33,7 @@ log = "^0.4.8"
|
|||||||
env_logger = "^0.7.1"
|
env_logger = "^0.7.1"
|
||||||
|
|
||||||
# async
|
# async
|
||||||
zbus = "1.1.1"
|
zbus = "1.2.0"
|
||||||
zvariant = "2.2.0"
|
zvariant = "2.2.0"
|
||||||
#tokio = { version = "^0.2.4", features = ["rt-threaded", "sync"] }
|
#tokio = { version = "^0.2.4", features = ["rt-threaded", "sync"] }
|
||||||
|
|
||||||
|
|||||||
@@ -23,15 +23,14 @@ pub struct Config {
|
|||||||
}
|
}
|
||||||
|
|
||||||
impl Config {
|
impl Config {
|
||||||
/// `load` will attempt to read the config, but if it is not found it
|
/// `load` will attempt to read the config, and panic if the dir is missing
|
||||||
/// will create a new default config and write that out.
|
|
||||||
pub fn load(mut self, supported_led_modes: &[u8]) -> Self {
|
pub fn load(mut self, supported_led_modes: &[u8]) -> Self {
|
||||||
let mut file = OpenOptions::new()
|
let mut file = OpenOptions::new()
|
||||||
.read(true)
|
.read(true)
|
||||||
.write(true)
|
.write(true)
|
||||||
.create(true)
|
.create(true)
|
||||||
.open(&CONFIG_PATH)
|
.open(&CONFIG_PATH)
|
||||||
.unwrap(); // okay to cause panic here
|
.expect(&format!("The file {} or directory /etc/asusd/ is missing", CONFIG_PATH)); // okay to cause panic here
|
||||||
let mut buf = String::new();
|
let mut buf = String::new();
|
||||||
if let Ok(l) = file.read_to_string(&mut buf) {
|
if let Ok(l) = file.read_to_string(&mut buf) {
|
||||||
if l == 0 {
|
if l == 0 {
|
||||||
|
|||||||
@@ -40,7 +40,11 @@ impl crate::ZbusAdd for CtrlAnimeDisplay {
|
|||||||
fn add_to_server(self, server: &mut zbus::ObjectServer) {
|
fn add_to_server(self, server: &mut zbus::ObjectServer) {
|
||||||
server
|
server
|
||||||
.at(&"/org/asuslinux/Anime".try_into().unwrap(), self)
|
.at(&"/org/asuslinux/Anime".try_into().unwrap(), self)
|
||||||
.unwrap();
|
.map_err(|err| {
|
||||||
|
warn!("CtrlAnimeDisplay: add_to_server {}", err);
|
||||||
|
err
|
||||||
|
})
|
||||||
|
.ok();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -16,22 +16,26 @@ pub struct CtrlCharge {
|
|||||||
config: Arc<Mutex<Config>>,
|
config: Arc<Mutex<Config>>,
|
||||||
}
|
}
|
||||||
|
|
||||||
trait Dbus {
|
|
||||||
fn set_limit(&mut self, charge: u8);
|
|
||||||
fn limit(&self) -> i8;
|
|
||||||
fn notify_charge(&self, limit: u8) -> zbus::Result<()>;
|
|
||||||
}
|
|
||||||
|
|
||||||
#[dbus_interface(name = "org.asuslinux.Daemon")]
|
#[dbus_interface(name = "org.asuslinux.Daemon")]
|
||||||
impl Dbus for CtrlCharge {
|
impl CtrlCharge {
|
||||||
fn set_limit(&mut self, limit: u8) {
|
pub fn set_limit(&mut self, limit: u8) {
|
||||||
if let Ok(mut config) = self.config.try_lock() {
|
if let Ok(mut config) = self.config.try_lock() {
|
||||||
self.set(limit, &mut config).unwrap();
|
self.set(limit, &mut config)
|
||||||
self.notify_charge(limit).unwrap();
|
.map_err(|err| {
|
||||||
|
warn!("CtrlCharge: set_limit {}", err);
|
||||||
|
err
|
||||||
|
})
|
||||||
|
.ok();
|
||||||
|
self.notify_charge(limit)
|
||||||
|
.map_err(|err| {
|
||||||
|
warn!("CtrlCharge: set_limit {}", err);
|
||||||
|
err
|
||||||
|
})
|
||||||
|
.ok();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
fn limit(&self) -> i8 {
|
pub fn limit(&self) -> i8 {
|
||||||
if let Ok(config) = self.config.try_lock() {
|
if let Ok(config) = self.config.try_lock() {
|
||||||
return config.bat_charge_limit as i8;
|
return config.bat_charge_limit as i8;
|
||||||
}
|
}
|
||||||
@@ -39,14 +43,18 @@ impl Dbus for CtrlCharge {
|
|||||||
}
|
}
|
||||||
|
|
||||||
#[dbus_interface(signal)]
|
#[dbus_interface(signal)]
|
||||||
fn notify_charge(&self, limit: u8) -> zbus::Result<()>;
|
pub fn notify_charge(&self, limit: u8) -> zbus::Result<()>;
|
||||||
}
|
}
|
||||||
|
|
||||||
impl crate::ZbusAdd for CtrlCharge {
|
impl crate::ZbusAdd for CtrlCharge {
|
||||||
fn add_to_server(self, server: &mut zbus::ObjectServer) {
|
fn add_to_server(self, server: &mut zbus::ObjectServer) {
|
||||||
server
|
server
|
||||||
.at(&"/org/asuslinux/Charge".try_into().unwrap(), self)
|
.at(&"/org/asuslinux/Charge".try_into().unwrap(), self)
|
||||||
.unwrap();
|
.map_err(|err| {
|
||||||
|
warn!("CtrlCharge: add_to_server {}", err);
|
||||||
|
err
|
||||||
|
})
|
||||||
|
.ok();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -45,6 +45,16 @@ impl DbusFanAndCpu {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
fn active_profile_name(&mut self) -> String {
|
||||||
|
if let Ok(ctrl) = self.inner.try_lock() {
|
||||||
|
if let Ok(mut cfg) = ctrl.config.try_lock() {
|
||||||
|
cfg.read();
|
||||||
|
return cfg.active_profile.clone();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
"Failed".to_string()
|
||||||
|
}
|
||||||
|
|
||||||
fn profile(&mut self) -> String {
|
fn profile(&mut self) -> String {
|
||||||
if let Ok(ctrl) = self.inner.try_lock() {
|
if let Ok(ctrl) = self.inner.try_lock() {
|
||||||
if let Ok(mut cfg) = ctrl.config.try_lock() {
|
if let Ok(mut cfg) = ctrl.config.try_lock() {
|
||||||
@@ -79,7 +89,11 @@ impl crate::ZbusAdd for DbusFanAndCpu {
|
|||||||
fn add_to_server(self, server: &mut zbus::ObjectServer) {
|
fn add_to_server(self, server: &mut zbus::ObjectServer) {
|
||||||
server
|
server
|
||||||
.at(&"/org/asuslinux/Profile".try_into().unwrap(), self)
|
.at(&"/org/asuslinux/Profile".try_into().unwrap(), self)
|
||||||
.unwrap();
|
.map_err(|err| {
|
||||||
|
warn!("DbusFanAndCpu: {}", err);
|
||||||
|
err
|
||||||
|
})
|
||||||
|
.ok();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -311,7 +325,7 @@ impl CtrlFanAndCPU {
|
|||||||
|
|
||||||
let boost = if mode_config.turbo { "1" } else { "0" }; // opposite of Intel
|
let boost = if mode_config.turbo { "1" } else { "0" }; // opposite of Intel
|
||||||
file.write_all(boost.as_bytes())
|
file.write_all(boost.as_bytes())
|
||||||
.map_err(|err| RogError::Write(AMD_BOOST_PATH.into(), err))?;
|
.map_err(|err| RogError::Write(AMD_BOOST_PATH.into(), err))?;
|
||||||
info!("AMD CPU Turbo: {}", boost);
|
info!("AMD CPU Turbo: {}", boost);
|
||||||
}
|
}
|
||||||
Ok(())
|
Ok(())
|
||||||
|
|||||||
@@ -42,7 +42,7 @@ impl crate::ZbusAdd for DbusKbdBacklight {
|
|||||||
fn add_to_server(self, server: &mut zbus::ObjectServer) {
|
fn add_to_server(self, server: &mut zbus::ObjectServer) {
|
||||||
server
|
server
|
||||||
.at(&"/org/asuslinux/Led".try_into().unwrap(), self)
|
.at(&"/org/asuslinux/Led".try_into().unwrap(), self)
|
||||||
.unwrap();
|
.ok();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -58,10 +58,11 @@ impl DbusKbdBacklight {
|
|||||||
.unwrap_or_else(|err| warn!("{}", err));
|
.unwrap_or_else(|err| warn!("{}", err));
|
||||||
}
|
}
|
||||||
_ => {
|
_ => {
|
||||||
let json = serde_json::to_string(&data).unwrap();
|
if let Ok(json) = serde_json::to_string(&data) {
|
||||||
ctrl.do_command(data, &mut cfg)
|
ctrl.do_command(data, &mut cfg)
|
||||||
.unwrap_or_else(|err| warn!("{}", err));
|
.unwrap_or_else(|err| warn!("{}", err));
|
||||||
self.notify_led(&json).unwrap();
|
self.notify_led(&json).ok();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -151,7 +152,12 @@ impl crate::CtrlTask for CtrlKbdBacklight {
|
|||||||
let mut file = OpenOptions::new()
|
let mut file = OpenOptions::new()
|
||||||
.read(true)
|
.read(true)
|
||||||
.open(&self.bright_node)
|
.open(&self.bright_node)
|
||||||
.map_err(|err| RogError::Path((&self.bright_node).into(), err))?;
|
.map_err(|err| {
|
||||||
|
match err.kind() {
|
||||||
|
std::io::ErrorKind::NotFound => RogError::MissingLedBrightNode((&self.bright_node).into(), err),
|
||||||
|
_ => RogError::Path((&self.bright_node).into(), err),
|
||||||
|
}
|
||||||
|
})?;
|
||||||
let mut buf = [0u8; 1];
|
let mut buf = [0u8; 1];
|
||||||
file.read_exact(&mut buf)
|
file.read_exact(&mut buf)
|
||||||
.map_err(|err| RogError::Read("buffer".into(), err))?;
|
.map_err(|err| RogError::Read("buffer".into(), err))?;
|
||||||
@@ -233,8 +239,11 @@ impl CtrlKbdBacklight {
|
|||||||
RogError::Udev("parent_with_subsystem_devtype failed".into(), err)
|
RogError::Udev("parent_with_subsystem_devtype failed".into(), err)
|
||||||
})?
|
})?
|
||||||
{
|
{
|
||||||
if parent.attribute_value("idProduct").unwrap() == id_product {
|
if parent
|
||||||
// && device.parent().unwrap().sysnum().unwrap() == 3
|
.attribute_value("idProduct")
|
||||||
|
.ok_or(RogError::NotFound("LED idProduct".into()))?
|
||||||
|
== id_product
|
||||||
|
{
|
||||||
if let Some(dev_node) = device.devnode() {
|
if let Some(dev_node) = device.devnode() {
|
||||||
info!("Using device at: {:?} for LED control", dev_node);
|
info!("Using device at: {:?} for LED control", dev_node);
|
||||||
return Ok(dev_node.to_string_lossy().to_string());
|
return Ok(dev_node.to_string_lossy().to_string());
|
||||||
@@ -264,13 +273,17 @@ impl CtrlKbdBacklight {
|
|||||||
RogError::Udev("match_property failed".into(), err)
|
RogError::Udev("match_property failed".into(), err)
|
||||||
})?;
|
})?;
|
||||||
|
|
||||||
for device in enumerator.scan_devices().map_err(|err| {
|
for device in enumerator
|
||||||
warn!("{}", err);
|
.scan_devices()
|
||||||
err
|
.map_err(|err| {
|
||||||
}).map_err(|err| {
|
warn!("{}", err);
|
||||||
warn!("{}", err);
|
err
|
||||||
RogError::Udev("scan_devices failed".into(), err)
|
})
|
||||||
})? {
|
.map_err(|err| {
|
||||||
|
warn!("{}", err);
|
||||||
|
RogError::Udev("scan_devices failed".into(), 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 let Some(iface) = iface {
|
if let Some(iface) = iface {
|
||||||
@@ -298,8 +311,7 @@ impl CtrlKbdBacklight {
|
|||||||
fn write_bytes(&self, message: &[u8]) -> Result<(), RogError> {
|
fn write_bytes(&self, message: &[u8]) -> Result<(), RogError> {
|
||||||
if let Some(led_node) = &self.led_node {
|
if let Some(led_node) = &self.led_node {
|
||||||
if let Ok(mut file) = OpenOptions::new().write(true).open(led_node) {
|
if let Ok(mut file) = OpenOptions::new().write(true).open(led_node) {
|
||||||
file.write_all(message).unwrap();
|
return file.write_all(message).map_err(|err| RogError::Write("write_bytes".into(), err));
|
||||||
return Ok(());
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
Err(RogError::NotSupported)
|
Err(RogError::NotSupported)
|
||||||
|
|||||||
@@ -17,6 +17,8 @@ use std::sync::Mutex;
|
|||||||
|
|
||||||
use zbus::fdo;
|
use zbus::fdo;
|
||||||
use zbus::Connection;
|
use zbus::Connection;
|
||||||
|
use std::convert::Into;
|
||||||
|
use std::convert::TryInto;
|
||||||
|
|
||||||
pub fn main() -> Result<(), Box<dyn std::error::Error>> {
|
pub fn main() -> Result<(), Box<dyn std::error::Error>> {
|
||||||
let mut logger = env_logger::Builder::new();
|
let mut logger = env_logger::Builder::new();
|
||||||
@@ -126,11 +128,19 @@ fn start_daemon() -> Result<(), Box<dyn Error>> {
|
|||||||
|
|
||||||
for ctrl in tasks.iter() {
|
for ctrl in tasks.iter() {
|
||||||
if let Ok(mut lock) = ctrl.try_lock() {
|
if let Ok(mut lock) = ctrl.try_lock() {
|
||||||
lock.do_task().unwrap();
|
lock.do_task().map_err(|err| {
|
||||||
|
warn!("do_task error: {}", err);
|
||||||
|
})
|
||||||
|
.ok();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
object_server.with(&"/org/asuslinux/Charge".try_into()?, |obj: &CtrlCharge| {
|
||||||
|
let x = obj.limit();
|
||||||
|
obj.notify_charge(x as u8)
|
||||||
|
})?;
|
||||||
|
|
||||||
loop {
|
loop {
|
||||||
if let Err(err) = object_server.try_handle_next() {
|
if let Err(err) = object_server.try_handle_next() {
|
||||||
eprintln!("{}", err);
|
eprintln!("{}", err);
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
use std::fmt;
|
|
||||||
use std::convert::From;
|
|
||||||
use intel_pstate::PStateError;
|
use intel_pstate::PStateError;
|
||||||
use rog_fan_curve::CurveError;
|
use rog_fan_curve::CurveError;
|
||||||
|
use std::convert::From;
|
||||||
|
use std::fmt;
|
||||||
|
|
||||||
#[derive(Debug)]
|
#[derive(Debug)]
|
||||||
pub enum RogError {
|
pub enum RogError {
|
||||||
@@ -19,6 +19,7 @@ pub enum RogError {
|
|||||||
FanCurve(CurveError),
|
FanCurve(CurveError),
|
||||||
DoTask(String),
|
DoTask(String),
|
||||||
MissingFunction(String),
|
MissingFunction(String),
|
||||||
|
MissingLedBrightNode(String, std::io::Error),
|
||||||
}
|
}
|
||||||
|
|
||||||
impl fmt::Display for RogError {
|
impl fmt::Display for RogError {
|
||||||
@@ -39,6 +40,7 @@ impl fmt::Display for RogError {
|
|||||||
RogError::FanCurve(err) => write!(f, "Custom fan-curve error: {}", err),
|
RogError::FanCurve(err) => write!(f, "Custom fan-curve error: {}", err),
|
||||||
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),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -19,7 +19,7 @@ use config::Config;
|
|||||||
use crate::error::RogError;
|
use crate::error::RogError;
|
||||||
use zbus::ObjectServer;
|
use zbus::ObjectServer;
|
||||||
|
|
||||||
pub static VERSION: &str = "2.0.2";
|
pub static VERSION: &str = env!("CARGO_PKG_VERSION");
|
||||||
|
|
||||||
pub trait Reloadable {
|
pub trait Reloadable {
|
||||||
fn reload(&mut self) -> Result<(), RogError>;
|
fn reload(&mut self) -> Result<(), RogError>;
|
||||||
|
|||||||
@@ -107,7 +107,7 @@ fn do_gfx(
|
|||||||
) -> Result<(), Box<dyn std::error::Error>> {
|
) -> Result<(), Box<dyn std::error::Error>> {
|
||||||
if let Some(mode) = command.mode {
|
if let Some(mode) = command.mode {
|
||||||
println!("Updating settings, please wait...");
|
println!("Updating settings, please wait...");
|
||||||
println!("If this takes longer than 30s, ctrl+c then check journalctl");
|
println!("If this takes longer than 30s, ctrl+c then check `journalctl -b -u asusd`");
|
||||||
|
|
||||||
writer.write_gfx_mode(mode)?;
|
writer.write_gfx_mode(mode)?;
|
||||||
let res = writer.wait_gfx_changed()?;
|
let res = writer.wait_gfx_changed()?;
|
||||||
@@ -119,7 +119,7 @@ fn do_gfx(
|
|||||||
);
|
);
|
||||||
do_gfx_action(
|
do_gfx_action(
|
||||||
command.force,
|
command.force,
|
||||||
Command::new("systemctl").arg("reboot"),
|
Command::new("systemctl").arg("reboot").arg("-i"),
|
||||||
"Reboot Linux PC",
|
"Reboot Linux PC",
|
||||||
"Please reboot when ready",
|
"Please reboot when ready",
|
||||||
)?;
|
)?;
|
||||||
|
|||||||
+1
-1
@@ -1,6 +1,6 @@
|
|||||||
[package]
|
[package]
|
||||||
name = "asus-nb"
|
name = "asus-nb"
|
||||||
version = "2.0.2"
|
version = "2.0.4"
|
||||||
license = "MPL-2.0"
|
license = "MPL-2.0"
|
||||||
readme = "README.md"
|
readme = "README.md"
|
||||||
authors = ["Luke <luke@ljones.dev>"]
|
authors = ["Luke <luke@ljones.dev>"]
|
||||||
|
|||||||
@@ -14,9 +14,10 @@ fn main() {
|
|||||||
let mut matrix = AniMeMatrix::new();
|
let mut matrix = AniMeMatrix::new();
|
||||||
|
|
||||||
// Aligned left
|
// Aligned left
|
||||||
for px in pixels {
|
for (i, px) in pixels.iter().enumerate() {
|
||||||
if (px.x as usize / 2) < WIDTH && (px.y as usize) < HEIGHT && px.x % 2 == 0 {
|
if (px.x as usize / 2) < WIDTH && (px.y as usize) < HEIGHT && px.x % 2 == 0 {
|
||||||
matrix.get_mut()[px.y as usize][px.x as usize / 2] = px.color as u8;
|
let mut c = px.color as u32;
|
||||||
|
matrix.get_mut()[px.y as usize][px.x as usize / 2] = c as u8;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -17,7 +17,7 @@ pub const ANIME_PANE2_PREFIX: [u8; 7] = [0x5e, 0xc0, 0x02, 0x74, 0x02, 0x73, 0x0
|
|||||||
/// The resolution is 34x56 (1904) but only 1,215 LEDs in the top-left are used.
|
/// The resolution is 34x56 (1904) but only 1,215 LEDs in the top-left are used.
|
||||||
/// The display is available only on select GA401 models.
|
/// The display is available only on select GA401 models.
|
||||||
///
|
///
|
||||||
/// Actual image ration when displayed is stretched width.
|
/// Actual image ratio when displayed is stretched width.
|
||||||
///
|
///
|
||||||
/// Data structure should be nested array of [[u8; 33]; 56]
|
/// Data structure should be nested array of [[u8; 33]; 56]
|
||||||
pub struct AniMeDbusWriter {
|
pub struct AniMeDbusWriter {
|
||||||
|
|||||||
@@ -46,9 +46,9 @@ impl AniMeMatrix {
|
|||||||
// Write the top block of LEDs (first 7 rows)
|
// Write the top block of LEDs (first 7 rows)
|
||||||
if count < 6 {
|
if count < 6 {
|
||||||
if count % 2 != 0 {
|
if count % 2 != 0 {
|
||||||
print!(" ");
|
print!(" ");
|
||||||
} else {
|
} else {
|
||||||
print!(" ");
|
print!("");
|
||||||
}
|
}
|
||||||
let tmp = if count == 0 || count == 1 || count == 3 || count == 5 {
|
let tmp = if count == 0 || count == 1 || count == 3 || count == 5 {
|
||||||
row[1..].iter()
|
row[1..].iter()
|
||||||
@@ -56,7 +56,7 @@ impl AniMeMatrix {
|
|||||||
row.iter()
|
row.iter()
|
||||||
};
|
};
|
||||||
for x in tmp {
|
for x in tmp {
|
||||||
print!(" {}", RGB(*x, *x, *x).paint(&format!("{:#04X}", x)));
|
print!(" {}", RGB(*x, *x, *x).paint("XY"));
|
||||||
}
|
}
|
||||||
|
|
||||||
println!();
|
println!();
|
||||||
@@ -76,13 +76,13 @@ impl AniMeMatrix {
|
|||||||
let index = row.len() - prog_row_len;
|
let index = row.len() - prog_row_len;
|
||||||
|
|
||||||
if count % 2 == 0 {
|
if count % 2 == 0 {
|
||||||
print!(" ");
|
print!(" ");
|
||||||
}
|
}
|
||||||
for (i, x) in row.iter().enumerate() {
|
for (i, x) in row.iter().enumerate() {
|
||||||
if i >= index {
|
if i >= index {
|
||||||
print!(" {}", RGB(*x, *x, *x).paint(&format!("{:#04X}", x)));
|
print!(" {}", RGB(*x, *x, *x).paint("XY"));
|
||||||
} else {
|
} else {
|
||||||
print!(" ");
|
print!(" ");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
println!();
|
println!();
|
||||||
|
|||||||
+15
-15
@@ -37,7 +37,7 @@ impl CtrlSignals {
|
|||||||
let proxy = connection.with_proxy(
|
let proxy = connection.with_proxy(
|
||||||
"org.asuslinux.Daemon",
|
"org.asuslinux.Daemon",
|
||||||
"/org/asuslinux/Gfx",
|
"/org/asuslinux/Gfx",
|
||||||
Duration::from_millis(5000),
|
Duration::from_secs(2),
|
||||||
);
|
);
|
||||||
|
|
||||||
let gfx_vendor_signal = Arc::new(Mutex::new(None));
|
let gfx_vendor_signal = Arc::new(Mutex::new(None));
|
||||||
@@ -68,7 +68,7 @@ impl CtrlSignals {
|
|||||||
let proxy = connection.with_proxy(
|
let proxy = connection.with_proxy(
|
||||||
"org.asuslinux.Daemon",
|
"org.asuslinux.Daemon",
|
||||||
"/org/asuslinux/Profile",
|
"/org/asuslinux/Profile",
|
||||||
Duration::from_millis(5000),
|
Duration::from_secs(2),
|
||||||
);
|
);
|
||||||
|
|
||||||
let profile_signal = Arc::new(Mutex::new(None));
|
let profile_signal = Arc::new(Mutex::new(None));
|
||||||
@@ -87,7 +87,7 @@ impl CtrlSignals {
|
|||||||
let proxy = connection.with_proxy(
|
let proxy = connection.with_proxy(
|
||||||
"org.asuslinux.Daemon",
|
"org.asuslinux.Daemon",
|
||||||
"/org/asuslinux/Led",
|
"/org/asuslinux/Led",
|
||||||
Duration::from_millis(5000),
|
Duration::from_secs(2),
|
||||||
);
|
);
|
||||||
|
|
||||||
let ledmode_signal = Arc::new(Mutex::new(None));
|
let ledmode_signal = Arc::new(Mutex::new(None));
|
||||||
@@ -108,7 +108,7 @@ impl CtrlSignals {
|
|||||||
let proxy = connection.with_proxy(
|
let proxy = connection.with_proxy(
|
||||||
"org.asuslinux.Daemon",
|
"org.asuslinux.Daemon",
|
||||||
"/org/asuslinux/Charge",
|
"/org/asuslinux/Charge",
|
||||||
Duration::from_millis(5000),
|
Duration::from_secs(2),
|
||||||
);
|
);
|
||||||
|
|
||||||
let charge_signal = Arc::new(Mutex::new(None));
|
let charge_signal = Arc::new(Mutex::new(None));
|
||||||
@@ -168,7 +168,7 @@ impl AuraDbusClient {
|
|||||||
|
|
||||||
pub fn wait_gfx_changed(&self) -> Result<String, Box<dyn Error>> {
|
pub fn wait_gfx_changed(&self) -> Result<String, Box<dyn Error>> {
|
||||||
loop {
|
loop {
|
||||||
self.connection.process(Duration::from_micros(500))?;
|
self.connection.process(Duration::from_millis(1))?;
|
||||||
if let Ok(lock) = self.signals.gfx_action_signal.lock() {
|
if let Ok(lock) = self.signals.gfx_action_signal.lock() {
|
||||||
if let Some(stuff) = lock.as_ref() {
|
if let Some(stuff) = lock.as_ref() {
|
||||||
return Ok(stuff.to_string());
|
return Ok(stuff.to_string());
|
||||||
@@ -185,7 +185,7 @@ impl AuraDbusClient {
|
|||||||
let proxy = self.connection.with_proxy(
|
let proxy = self.connection.with_proxy(
|
||||||
"org.asuslinux.Daemon",
|
"org.asuslinux.Daemon",
|
||||||
"/org/asuslinux/Led",
|
"/org/asuslinux/Led",
|
||||||
Duration::from_millis(5000),
|
Duration::from_secs(2),
|
||||||
);
|
);
|
||||||
proxy.set_led_mode(&serde_json::to_string(&mode)?)?;
|
proxy.set_led_mode(&serde_json::to_string(&mode)?)?;
|
||||||
Ok(())
|
Ok(())
|
||||||
@@ -224,7 +224,7 @@ impl AuraDbusClient {
|
|||||||
let proxy = self.connection.with_proxy(
|
let proxy = self.connection.with_proxy(
|
||||||
"org.asuslinux.Daemon",
|
"org.asuslinux.Daemon",
|
||||||
"/org/asuslinux/Led",
|
"/org/asuslinux/Led",
|
||||||
Duration::from_millis(5000),
|
Duration::from_secs(2),
|
||||||
);
|
);
|
||||||
proxy.set_led_mode(&serde_json::to_string(mode)?)?;
|
proxy.set_led_mode(&serde_json::to_string(mode)?)?;
|
||||||
Ok(())
|
Ok(())
|
||||||
@@ -235,9 +235,9 @@ impl AuraDbusClient {
|
|||||||
let proxy = self.connection.with_proxy(
|
let proxy = self.connection.with_proxy(
|
||||||
"org.asuslinux.Daemon",
|
"org.asuslinux.Daemon",
|
||||||
"/org/asuslinux/Gfx",
|
"/org/asuslinux/Gfx",
|
||||||
Duration::from_millis(5000),
|
Duration::from_secs(2),
|
||||||
);
|
);
|
||||||
let x = proxy.power().unwrap();
|
let x = proxy.power()?;
|
||||||
Ok(x)
|
Ok(x)
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -246,9 +246,9 @@ impl AuraDbusClient {
|
|||||||
let proxy = self.connection.with_proxy(
|
let proxy = self.connection.with_proxy(
|
||||||
"org.asuslinux.Daemon",
|
"org.asuslinux.Daemon",
|
||||||
"/org/asuslinux/Gfx",
|
"/org/asuslinux/Gfx",
|
||||||
Duration::from_millis(5000),
|
Duration::from_secs(2),
|
||||||
);
|
);
|
||||||
let x = proxy.vendor().unwrap();
|
let x = proxy.vendor()?;
|
||||||
Ok(x)
|
Ok(x)
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -257,7 +257,7 @@ impl AuraDbusClient {
|
|||||||
let proxy = self.connection.with_proxy(
|
let proxy = self.connection.with_proxy(
|
||||||
"org.asuslinux.Daemon",
|
"org.asuslinux.Daemon",
|
||||||
"/org/asuslinux/Gfx",
|
"/org/asuslinux/Gfx",
|
||||||
Duration::from_millis(5000),
|
Duration::from_secs(30),
|
||||||
);
|
);
|
||||||
proxy.set_vendor(<&str>::from(&vendor))?;
|
proxy.set_vendor(<&str>::from(&vendor))?;
|
||||||
Ok(())
|
Ok(())
|
||||||
@@ -268,7 +268,7 @@ impl AuraDbusClient {
|
|||||||
let proxy = self.connection.with_proxy(
|
let proxy = self.connection.with_proxy(
|
||||||
"org.asuslinux.Daemon",
|
"org.asuslinux.Daemon",
|
||||||
"/org/asuslinux/Profile",
|
"/org/asuslinux/Profile",
|
||||||
Duration::from_millis(5000),
|
Duration::from_secs(2),
|
||||||
);
|
);
|
||||||
proxy.set_profile(&serde_json::to_string(&ProfileEvent::ChangeMode(level))?)?;
|
proxy.set_profile(&serde_json::to_string(&ProfileEvent::ChangeMode(level))?)?;
|
||||||
Ok(())
|
Ok(())
|
||||||
@@ -282,7 +282,7 @@ impl AuraDbusClient {
|
|||||||
let proxy = self.connection.with_proxy(
|
let proxy = self.connection.with_proxy(
|
||||||
"org.asuslinux.Daemon",
|
"org.asuslinux.Daemon",
|
||||||
"/org/asuslinux/Profile",
|
"/org/asuslinux/Profile",
|
||||||
Duration::from_millis(5000),
|
Duration::from_secs(2),
|
||||||
);
|
);
|
||||||
proxy.set_profile(&serde_json::to_string(cmd)?)?;
|
proxy.set_profile(&serde_json::to_string(cmd)?)?;
|
||||||
Ok(())
|
Ok(())
|
||||||
@@ -293,7 +293,7 @@ impl AuraDbusClient {
|
|||||||
let proxy = self.connection.with_proxy(
|
let proxy = self.connection.with_proxy(
|
||||||
"org.asuslinux.Daemon",
|
"org.asuslinux.Daemon",
|
||||||
"/org/asuslinux/Charge",
|
"/org/asuslinux/Charge",
|
||||||
Duration::from_millis(5000),
|
Duration::from_secs(2),
|
||||||
);
|
);
|
||||||
proxy.set_limit(level)?;
|
proxy.set_limit(level)?;
|
||||||
Ok(())
|
Ok(())
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
[package]
|
[package]
|
||||||
name = "asus-notify"
|
name = "asus-notify"
|
||||||
version = "1.0.1"
|
version = "2.0.4"
|
||||||
authors = ["Luke D Jones <luke@ljones.dev>"]
|
authors = ["Luke D Jones <luke@ljones.dev>"]
|
||||||
edition = "2018"
|
edition = "2018"
|
||||||
|
|
||||||
|
|||||||
@@ -6,6 +6,8 @@ use std::error::Error;
|
|||||||
use std::time::Duration;
|
use std::time::Duration;
|
||||||
|
|
||||||
fn main() -> Result<(), Box<dyn std::error::Error>> {
|
fn main() -> Result<(), Box<dyn std::error::Error>> {
|
||||||
|
println!("Version {}", env!("CARGO_PKG_VERSION"));
|
||||||
|
|
||||||
let mut cfg = Config::read_new()?;
|
let mut cfg = Config::read_new()?;
|
||||||
let mut last_profile = String::new();
|
let mut last_profile = String::new();
|
||||||
|
|
||||||
|
|||||||
+1
-1
@@ -1,6 +1,6 @@
|
|||||||
[package]
|
[package]
|
||||||
name = "ctrl-gfx"
|
name = "ctrl-gfx"
|
||||||
version = "2.1.0"
|
version = "2.1.1"
|
||||||
license = "MPL-2.0"
|
license = "MPL-2.0"
|
||||||
readme = "README.md"
|
readme = "README.md"
|
||||||
authors = ["Luke <luke@ljones.dev>"]
|
authors = ["Luke <luke@ljones.dev>"]
|
||||||
|
|||||||
@@ -37,15 +37,11 @@ use std::convert::TryInto;
|
|||||||
#[dbus_interface(name = "org.asuslinux.Daemon")]
|
#[dbus_interface(name = "org.asuslinux.Daemon")]
|
||||||
impl Dbus for CtrlGraphics {
|
impl Dbus for CtrlGraphics {
|
||||||
fn vendor(&self) -> String {
|
fn vendor(&self) -> String {
|
||||||
Self::get_vendor()
|
Self::get_vendor().unwrap_or_else(|err| format!("Get vendor failed: {}", err))
|
||||||
.map_err(|err| format!("Get vendor failed: {}", err))
|
|
||||||
.unwrap()
|
|
||||||
}
|
}
|
||||||
|
|
||||||
fn power(&self) -> String {
|
fn power(&self) -> String {
|
||||||
Self::get_runtime_status()
|
Self::get_runtime_status().unwrap_or_else(|err| format!("Get power status failed: {}", err))
|
||||||
.map_err(|err| format!("Get power status failed: {}", err))
|
|
||||||
.unwrap()
|
|
||||||
}
|
}
|
||||||
|
|
||||||
fn set_vendor(&mut self, vendor: String) {
|
fn set_vendor(&mut self, vendor: String) {
|
||||||
@@ -149,7 +145,11 @@ impl CtrlGraphics {
|
|||||||
pub fn add_to_server(self, server: &mut zbus::ObjectServer) {
|
pub fn add_to_server(self, server: &mut zbus::ObjectServer) {
|
||||||
server
|
server
|
||||||
.at(&"/org/asuslinux/Gfx".try_into().unwrap(), self)
|
.at(&"/org/asuslinux/Gfx".try_into().unwrap(), self)
|
||||||
.unwrap();
|
.map_err(|err| {
|
||||||
|
warn!("CtrlGraphics: add_to_server {}", err);
|
||||||
|
err
|
||||||
|
})
|
||||||
|
.ok();
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn reload(&mut self) -> Result<(), Box<dyn Error>> {
|
pub fn reload(&mut self) -> Result<(), Box<dyn Error>> {
|
||||||
@@ -328,8 +328,7 @@ impl CtrlGraphics {
|
|||||||
// }
|
// }
|
||||||
pub fn get_runtime_status() -> Result<String, GfxError> {
|
pub fn get_runtime_status() -> Result<String, GfxError> {
|
||||||
const PATH: &str = "/sys/bus/pci/devices/0000:01:00.0/power/runtime_status";
|
const PATH: &str = "/sys/bus/pci/devices/0000:01:00.0/power/runtime_status";
|
||||||
let buf = std::fs::read_to_string(PATH)
|
let buf = std::fs::read_to_string(PATH).map_err(|err| GfxError::Read(PATH.into(), err))?;
|
||||||
.map_err(|err| GfxError::Read(PATH.into(), err))?;
|
|
||||||
Ok(buf)
|
Ok(buf)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
+1
-1
@@ -9,7 +9,7 @@ pub mod system;
|
|||||||
const PRIME_DISCRETE_PATH: &str = "/etc/prime-discrete";
|
const PRIME_DISCRETE_PATH: &str = "/etc/prime-discrete";
|
||||||
const MODPROBE_PATH: &str = "/etc/modprobe.d/asusd.conf";
|
const MODPROBE_PATH: &str = "/etc/modprobe.d/asusd.conf";
|
||||||
const INITRAMFS_PATH: &str = "/usr/sbin/update-initramfs";
|
const INITRAMFS_PATH: &str = "/usr/sbin/update-initramfs";
|
||||||
//const DRACUT_PATH: &str = "/usr/bin/dracut";
|
// const DRACUT_PATH: &str = "/usr/bin/dracut";
|
||||||
|
|
||||||
static MODPROBE_NVIDIA: &[u8] = MODPROBE_HYBRID;
|
static MODPROBE_NVIDIA: &[u8] = MODPROBE_HYBRID;
|
||||||
|
|
||||||
|
|||||||
@@ -121,7 +121,7 @@ impl GraphicsDevice {
|
|||||||
warn!("{}: Already removed", func.id());
|
warn!("{}: Already removed", func.id());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
info!("Remmoved all gfx devices");
|
info!("Removed all gfx devices");
|
||||||
Ok(())
|
Ok(())
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,5 +1,4 @@
|
|||||||
Section "ServerLayout"
|
Section "ServerLayout"
|
||||||
Identifier "layout"
|
Identifier "layout"
|
||||||
Option "AllowNVIDIAGPUScreens"
|
Option "AllowNVIDIAGPUScreens"
|
||||||
Option "metamodes" "nvidia-auto-select +0+0 {AllowGSYNC=On, AllowGSYNCCompatible=On}"
|
|
||||||
EndSection
|
EndSection
|
||||||
|
|||||||
Reference in New Issue
Block a user