Compare commits

...

81 Commits

Author SHA1 Message Date
Luke D. Jones
ea9ca79a8f Point release 2024-08-30 21:32:06 +12:00
Luke D. Jones
4a97f173be Unify the aura data more. Prep for better format 2024-08-30 21:29:13 +12:00
Luke D. Jones
8f35220c5f Add Ally 1 and X as "old" style devices for power
These have a slightly different power settings data which needs to be verified.
We can use the old style for now.

Closes #542
2024-08-30 18:35:26 +12:00
Luke D. Jones
c3880d055d Fix cli args for led mode 2024-08-26 19:16:11 +12:00
Luke D. Jones
b661f67084 Many updates 2024-08-26 17:53:10 +12:00
Luke Jones
abd2ca8601 Merge branch 'main' into 'main'
Fix vendored build with feature rog-control-center/x11

See merge request asus-linux/asusctl!197
2024-08-26 04:48:12 +00:00
Luke Jones
0905ed8ad4 Merge branch 'g614jz-aura' into 'main'
Add G614JZ/JJ  (2023 Strix G16) Aura support

See merge request asus-linux/asusctl!195
2024-08-26 04:47:42 +00:00
Luke Jones
c1268d4aad Merge branch 'Chaser_1-main-patch-70824' into 'main'
Fixed a typo in README.md

See merge request asus-linux/asusctl!199
2024-08-15 10:17:59 +00:00
Christian Haser
5ed47abc32 Update README.md 2024-08-15 08:36:30 +00:00
The0919
718bb8b86f Add cargo vendor-filter all-features 2024-08-03 03:11:32 -04:00
Luke D. Jones
5ab9642b79 Update G713P 2024-07-25 23:10:57 +12:00
Luke D. Jones
14acab9a9c Add Ally X config 2024-07-25 22:52:19 +12:00
Luke Jones
e4dd485dd4 Merge branch 'main' into 'main'
Add FX517Z to aura_support

See merge request asus-linux/asusctl!196
2024-07-15 22:35:05 +00:00
Carl Dunning
ab1d75e5ec Add FX517Z to aura_support 2024-07-15 13:30:05 +01:00
ulville
e4c5df6cca Add G614JJ Aura support 2024-07-10 20:47:18 +03:00
ulville
9ee7ee26a2 Add G614JZ (2023 Strix G16) Aura support
This laptop has a 4 zone led keyboard.
Tested on my own device. G614J model
probably also has the same 4 basic zone
support but I can't test it
2024-07-10 00:47:14 +03:00
Luke Jones
e8ebdacb91 Merge branch 'fhui16776-main-patch-11114' into 'main'
Add 2023 G14 model to aura_support.ron

See merge request asus-linux/asusctl!191
2024-07-01 06:31:13 +00:00
Luke Jones
b97921fea2 Merge branch 'main' into 'main'
Simplified Chinese translation

See merge request asus-linux/asusctl!194
2024-06-24 00:16:41 +00:00
UM-Li
a3423195a6 Simplified Chinese translation 2024-06-19 10:41:16 +02:00
Luke Jones
f55edfbae0 Merge branch 'gu605-slash-support' into 'main'
Add slash detection for GU605

Closes #523

See merge request asus-linux/asusctl!193
2024-06-17 00:35:24 +00:00
banditopazzo
3e065b6715 Add slash detection for GU605 2024-06-16 17:58:49 +02:00
Luke D. Jones
f14d1ad61e Prep 6.0.11 release 2024-06-09 20:11:55 +12:00
Luke D. Jones
85d4e9cabd Update aura_support.ron 2024-06-09 12:20:32 +12:00
Luke Jones
e47a9cffd7 Merge branch 'aura-G513RM' into 'main'
Aura support for G513RM

See merge request asus-linux/asusctl!192
2024-06-07 22:23:56 +00:00
GingerBreadMuncher
ca93dc7215 Aura support for G513RM 2024-06-07 20:52:19 +00:00
fhui16776 fhui16776
93a646773c Add 2023 G14 model to aura_support.ron 2024-06-07 09:23:22 +00:00
Luke D. Jones
1cba693469 Update G713 aura spec 2024-06-07 09:22:59 +12:00
Luke D. Jones
166149b351 Remove a debug statement 2024-05-26 21:21:54 +12:00
Luke Jones
1b11b6d8fb Merge branch 'main' into 'main'
Resolve "AniMe Broken on GA402XZ"

Closes #512

See merge request asus-linux/asusctl!190
2024-05-26 21:19:40 +12:00
Mihir Patil
02568299df Fix AniMe on GA402XZ 2024-05-26 03:58:06 -04:00
Luke D. Jones
acdc93596c Ranem rainbow/strobe effects 2024-05-24 22:43:58 +12:00
Luke D. Jones
22e26adfb6 Update lang 2024-05-24 20:01:19 +12:00
Luke D. Jones
4730e645ba Fix sortof notifs 2024-05-24 18:49:23 +12:00
Luke D. Jones
d203fab70d Prep 6.0.10 2024-05-24 14:01:35 +12:00
Luke D. Jones
792fae3ed7 Enable tray and notifs without supergfx 2024-05-24 13:00:56 +12:00
Luke D. Jones
e443ab00c9 Adjust anime init sequence 2024-05-21 22:36:18 +12:00
Luke D. Jones
aee54f5756 Adjust G513Q support to match device specs 2024-05-21 10:11:56 +12:00
Luke D. Jones
00904e9603 Don't panic if -ENODEV on fan_curve enable 2024-05-19 22:38:45 +12:00
Luke D. Jones
b1212585e2 Add GA401I to aura_support
Closes #501
2024-05-18 22:56:24 +12:00
Luke D. Jones
faca084cff Prep new release 2024-05-18 13:13:35 +12:00
Luke Jones
89dc0b3501 Merge branch 'tokio_console' into 'main'
Fix GUI taking 100% of CPU core

Closes #480

See merge request asus-linux/asusctl!189
2024-05-18 01:10:33 +00:00
Luke D. Jones
ea988279a8 Fix GUI taking 100% of CPU core
Closes #480
2024-05-18 12:59:26 +12:00
Luke D. Jones
219bd559b6 tokio instrument 2024-05-18 11:21:33 +12:00
Luke D. Jones
ad1ef9b8a2 Update deps 2024-05-17 22:31:28 +12:00
Luke D. Jones
59795c605c Add G512LI and G513RS to aura_support.ron 2024-05-17 22:14:40 +12:00
Luke D. Jones
a36ac2b6d3 Add a warning log for missing laptop model 2024-05-17 22:09:30 +12:00
Luke Jones
a20837f252 Merge branch '505-invalid-paths-in-etc-asusd-anime-ron-result-in-broken-anime-control' into 'main'
Resolve "Invalid paths in /etc/asusd/anime.ron result in broken anime control"

Closes #505

See merge request asus-linux/asusctl!188
2024-05-17 10:09:12 +00:00
Luke D. Jones
1353fe3fdb Rename and recreate the default Anime config if cache setup fails 2024-05-17 21:54:37 +12:00
Luke D. Jones
770bd12a5c Add G513RS to laptop DB 2024-05-17 18:56:51 +12:00
Luke Jones
af2f5592f0 Merge pull request #29 from chrnin/fix/udev-for-zenbook
add Zenbook to asusd.rules
2024-05-17 11:37:36 +12:00
Luke D. Jones
9686c41ac4 Fix pipeline 2024-05-17 11:35:36 +12:00
Luke D. Jones
fbdb0514d2 Prep new release 2024-05-17 10:18:54 +12:00
Luke D. Jones
1f5650d26b Add tests, G513L laptop 2024-05-17 09:41:40 +12:00
Luke D. Jones
14db97c476 Update G513 model DB entry 2024-05-15 10:04:02 +12:00
Luke D. Jones
66a501ecf6 Prepare new release 2024-05-14 17:35:44 +12:00
Luke D. Jones
6b129763d4 Reimplement the 0x1866 keyboard power settings 2024-05-14 10:18:56 +12:00
Luke D. Jones
a0368d4345 Temporary fix of old keyboard+lightbar 2024-05-13 23:53:25 +12:00
Luke D. Jones
f2f090a88f Use backup hidraw brightness write if read-back value fails 2024-05-13 16:18:00 +12:00
Luke D. Jones
6c7e1a6467 Add option for enable/disable apply AC/Bat policy on change 2024-05-12 21:37:04 +12:00
Luke Jones
92ca7bc70d Merge branch 'main' into 'main'
rog-control-center Turkish language support added

See merge request asus-linux/asusctl!185
2024-05-11 08:31:20 +00:00
Winfried
dd1e6b845b rog-control-center Turkish language support added 2024-05-11 10:52:19 +03:00
Luke D. Jones
882fa9bed8 don't setup page data if unsupported 2024-05-11 11:52:26 +12:00
Luke D. Jones
9c7dfb4030 Small fixups 2024-05-11 11:09:02 +12:00
Luke D. Jones
f855908c82 Better everything 2024-05-11 11:03:13 +12:00
Luke D. Jones
293a087b8a Fixups 2024-05-10 23:14:48 +12:00
Luke D. Jones
fd72a04bb8 Sanitize the dbus path for aura devices (remove '.' chars) 2024-05-10 19:37:38 +12:00
Luke D. Jones
f131a3fa70 More logigng. Adjust the aura init process. Fix TUF led power 2024-05-10 18:58:05 +12:00
Luke D. Jones
ccf8d8df91 Prep 6.0.5 version 2024-05-10 12:44:46 +12:00
Luke D. Jones
b970d364f7 Fix test 2024-05-10 12:36:34 +12:00
Luke D. Jones
1da68ea69d Try to mitigate the lack of kbd_brightness on some laptops 2024-05-10 12:22:36 +12:00
Luke D. Jones
e62e7e8eca Cleanup sys config 2024-05-10 10:26:32 +12:00
Luke D. Jones
1b1d10c461 Try to better handle pre-2021 laptops with lightbar 2024-05-10 10:04:51 +12:00
Stefan Boca
14ea0f6d83 Update GA402XV supported aura modes 2024-05-08 19:20:17 -07:00
Luke Jones
5107a6c39c Merge branch 'FAYZER77-main-patch-34823' into 'main'
Change 733C model profile to add support for Lid LED, and remove unneeded basic zones entries

See merge request asus-linux/asusctl!183
2024-05-08 23:12:56 +00:00
FAYZER77
2c77ec9e24 Change 733C model profile to add support for Lid LED, and remove unneeded basic zones entries 2024-05-08 23:08:19 +00:00
Luke D. Jones
817a66bdf1 Prep 6.0.4 2024-05-09 11:00:51 +12:00
Luke D. Jones
664a3d5533 Match G533Q to 0x8166 keyboard ID explicitly
Should close #438
2024-05-09 10:01:48 +12:00
Luke D. Jones
37bc5e45b9 Fix: ensure property derive is on all property methods for slash 2024-05-09 09:34:02 +12:00
Luke D. Jones
a18692ef1e Fix up colour sliders
- Fixup colour sliders for UI
- Correctly drop tokio runtime
2024-05-08 22:55:11 +12:00
Luke D. Jones
1b023d0f5f Fix and prep new 6.0.2 release 2024-05-08 16:27:40 +12:00
Christophe Ninucci
7122fbaca8 add Zenbook to asusd.rules 2024-04-14 11:30:39 +02:00
97 changed files with 5682 additions and 2494 deletions

View File

@@ -12,7 +12,7 @@ echo '+cargo clippy --all -- -D warnings'
cargo clippy --all -- -D warnings
echo '+cargo test --all'
cargo test --all
cargo test --all -- --test-threads=1
echo '+cargo cranky'
cargo cranky
cargo cranky

View File

@@ -52,7 +52,7 @@ test:
<<: *rust_cache
script:
- mkdir -p .git/hooks > /dev/null
- cargo test --all
- cargo test --all -- --test-threads=1
release:
only:

View File

@@ -1,12 +1,129 @@
# Changelog
All notable changes to this project will be documented in this file.
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).
## [Unreleased]
## [v6.0.12]
### Changed
- Add Ally X aura config
- Fixes to Ally led power configs
- Fix CLI led modes
- Add FX517Z to aura_support
- Add G614JJ Aura support
- Add G614JZ (2023 Strix G16) Aura support
## [v6.0.11]
### Changed
- Renamed `Strobe` effect to `RainbowCycle` to prevent confusion over what it is
- Ranamed `Rainbow` effect to `RainbowWave`
- Cleaned up serde crate deps
- Fixed AniMe on GA402XZ
- Update some of the G713 device aura features
- Update some of the G513 device aura features
## [v6.0.10]
### Added
- Add the GA401I model to aura_support.
### Changed
- Aura support return a default aura definition instead of nothing
- Minor updates in aura controller to ensure configs are updated if the support file changes
- Don't panic if -ENODEV on fan_curve enable
- Adjust the G513Q support to match what is on the asus website.
- Adjust init sequence of anime to prevent accidental use of Slash as Anime
- Enable notifs and tray icon without supergfx
## [v6.0.9]
### Added
- Add G513RS to laptop DB.
- Add G512LI to laptop DB.
### Changed
- Rename and recreate the default Anime config if cache setup fails
### Fixed
- Nuke the issue of GUI taking 100% of a CPU core
## [v6.0.8]
### Added
- Add G512L laptop DB entry
### Changed
- Add more tests to verify things
### Fix
- asusctl incorrectly assumes fan-curves unsupported. Now fixed.
- try to fix ROGCC using CPU time.
## [v6.0.7]
### Changed
- Add a config option to set if throttle policy is changed on ac/bat change (UI only)
- Allow X11 GUI. This is *not* supported. Please see readme.
- Fixes to some GUI widget layouts and sizing
- Do a backup HID raw write fro brightness if the read-back value does not match. This is a temporary solve for some G14 and G16 until the kernel patch is ready.
- Reimplement the older 0x1866 MCU keyboard control power bits plus UI control for it. If you had a keyboard affected by Lightbar issues and it is older than a couple of years this should help. If not, please file a bug.
## [v6.0.6]
### Added
- Add GX650R laptop to aura DB
### Changed
- Further tweaks to aura init
- More logging
- Fix TUF laptop led power
- Sanitize the dbus path for aura devices (remove `.` chars)
- Even more error handling (gracefully)
- Better checking for dbus interfaces
- Remove dbus `supported_interfaces`
- dbus ObjectManager is now at root `/`
## [v6.0.5]
### Changed
- Better more robust error handling in ROGCC
- Try to better handle pre-2021 laptops with lightbar
- Add more logging to try and trace the charge_control_end_threshold issue
- Make `kbd_brightness` optional to work around issues on some laptops that seem to lack it. Likely this will all need a refactor *again* if work proceeds in kernel for better RGB support.
## [v6.0.4]
### Changed
- Remove some `todo()` in rogcc
- Add missing `#[zbus(property)]` derive to Slash dbus properties
- Match G533Q laptop explicitly to the 0x8166 PID
## [v6.0.3]
### NOTE
- Xorg is not supported any longer. All major desktops and distros are Wayland.
### Changed
- Add a check to prevent non-TUF laptops with screwed up method return from TUF acpi methods from trying to add a TUF aura device without actually being a TUF laptop.
- Make the G834JZ entry in aura db generic for all G834J
## [v6.0.2]
### Changed
- Clean up code
- Don't panic if no aura device in ROGCC
- Try to prevent an errorenous tuf keyboard detection
## [v6.0.1]
### Added

2357
Cargo.lock generated

File diff suppressed because it is too large Load Diff

View File

@@ -1,4 +1,16 @@
[workspace.package]
version = "6.0.12"
rust-version = "1.77"
license = "MPL-2.0"
readme = "README.md"
authors = ["Luke <luke@ljones.dev>"]
repository = "https://gitlab.com/asus-linux/asusctl"
homepage = "https://gitlab.com/asus-linux/asusctl"
description = "Laptop feature control for ASUS ROG laptops and others"
edition = "2021"
[workspace]
resolver = "2"
members = [
"asusctl",
"asusd",
@@ -22,21 +34,9 @@ default-members = [
"cpuctl",
"rog-control-center",
]
resolver = "2"
[workspace.package]
version = "6.0.1"
rust-version = "1.77"
license = "MPL-2.0"
readme = "README.md"
authors = ["Luke <luke@ljones.dev>"]
repository = "https://gitlab.com/asus-linux/asusctl"
homepage = "https://gitlab.com/asus-linux/asusctl"
description = "Laptop feature control for ASUS ROG laptops and others"
edition = "2021"
[workspace.dependencies]
tokio = { version = "^1.36.0", default-features = false, features = [
tokio = { version = "^1.39.0", default-features = false, features = [
"macros",
"sync",
"time",
@@ -47,11 +47,10 @@ dirs = "^4.0"
smol = "^1.3"
mio = "0.8.11"
zbus = "4.1"
logind-zbus = { version = "4.0.2" } #, default-features = false, features = ["non_blocking"] }
zbus = "4.4"
logind-zbus = { version = "4.0.3" } #, default-features = false, features = ["non_blocking"] }
serde = "^1.0"
serde_derive = "^1.0"
serde = { version = "^1.0", features = ["serde_derive"] }
ron = "*"
typeshare = "1.0.0"
@@ -71,9 +70,7 @@ gif = "^0.12.0"
versions = "6.2"
notify-rust = { git = "https://github.com/flukejones/notify-rust.git", rev = "54176413b81189a3e4edbdc20a0b4f7e2e35c063", default-features = false, features = [
"z",
] }
notify-rust = { version = "4.11.0", features = ["z", "async"] }
[profile.release]
# thin = 57s, asusd = 9.0M

View File

@@ -1,4 +1,4 @@
VERSION := $(shell /usr/bin/grep -Pm1 'version = "(\d.\d.\d)"' Cargo.toml | cut -d'"' -f2)
VERSION := $(shell /usr/bin/grep -Pm1 'version = "(\d+.\d+.\d+)"' Cargo.toml | cut -d'"' -f2)
INSTALL = install
INSTALL_PROGRAM = ${INSTALL} -D -m 0755
@@ -23,10 +23,10 @@ STRIP_BINARIES ?= 0
DEBUG ?= 0
ifeq ($(DEBUG),0)
ARGS += --release
ARGS += --release --features "rog-control-center/x11"
TARGET = release
else
ARGS += --profile dev
ARGS += --profile dev --features "rog-control-center/x11"
TARGET = debug
endif
@@ -113,7 +113,7 @@ vendor:
mv .cargo/config ./cargo-config
rm -rf .cargo
rm -rf vendor
cargo vendor-filterer --platform x86_64-unknown-linux-gnu vendor
cargo vendor-filterer --all-features --platform x86_64-unknown-linux-gnu vendor
tar pcfJ vendor_asusctl_$(VERSION).tar.xz vendor
rm -rf vendor

View File

@@ -11,7 +11,13 @@ Now includes a GUI, `rog-control-center`.
## Kernel support
**The minimum supported kernel version is 6.10**, which will contain the patches from [here](https://lore.kernel.org/platform-driver-x86/20240404001652.86207-1-luke@ljones.dev/). Z13 devices will need [these](https://lore.kernel.org/linux-input/20240416090402.31057-1-luke@ljones.dev/T/#t)
**The minimum supported kernel version is 6.10**, which will contain the patches from [here](https://lore.kernel.org/platform-driver-x86/20240404001652.86207-1-luke@ljones.dev/). This is especially required for 2023+ devices and possibly some late 2022 devices.
Z13 devices will need [these](https://lore.kernel.org/linux-input/20240416090402.31057-1-luke@ljones.dev/T/#t)
## X11 support
X11 is not supported at all, as in I will not help you with X11 issues if there are any due to limited time and it being unmaintained itself. You can however build `rog-control-center` with it enabled `cargo build --features "rog-control-center/x11"`.
## Goals
@@ -31,7 +37,7 @@ See the [rog-aura readme](./rog-aura/README.md) for more details.
## Discord
[Discord server link](https://discord.gg/z8y99XqPb7)
[![Discord](https://img.shields.io/badge/Discord-7289DA?style=for-the-badge&logo=discord&logoColor=white)](https://discord.gg/z8y99XqPb7)
## SUPPORTED LAPTOPS
@@ -70,14 +76,15 @@ The list is a bit outdated as many features have been enabled in the Linux kerne
A gui is now in the repo - ROG Control Center. At this time it is still a WIP, but it has almost all features in place already.
**NOTE**: Xorg is not supported.
# BUILDING
Rust and cargo are required, they can be installed from [rustup.rs](https://rustup.rs/) or from the distro repos if newer than 1.75.
**fedora:**
dnf install cmake clang-devel libinput-devel libseat-devel libgbm-devel libxkbcommon-devel systemd-devel \
libdrm-devel expat-devel pcre2-devel libzstd-devel libappindicator-gtk3
dnf install cmake clang-devel libinput-devel libseat-devel libgbm-devel libxkbcommon-devel systemd-devel libdrm-devel expat-devel pcre2-devel libzstd-devel gtk3-devel
make
sudo make install
@@ -86,7 +93,7 @@ Rust and cargo are required, they can be installed from [rustup.rs](https://rust
Works with KDE Plasma (without GTK packages)
zypper in -t pattern devel_basis
zypper in rustup make cmake libinput-devel libseat-devel libgbm-devel systemd-devel clang-devel llvm-devel gdk-pixbuf-devel cairo-devel pango-devel freetype-devel libexpat-devel libayatana-indicator3-7
zypper in rustup make cmake clang-devel libinput-devel libseat-devel libgbm-devel libxkbcommon-devel systemd-devel libdrm-devel expat-devel pcre2-devel libzstd-devel gtk3-devel
make
sudo make install

View File

@@ -3,7 +3,7 @@ use std::error::Error;
use std::path::Path;
use std::process::exit;
use rog_anime::usb::get_anime_type;
use rog_anime::usb::get_maybe_anime_type;
use rog_anime::{AnimeDiagonal, AnimeType};
use rog_dbus::zbus_anime::AnimeProxyBlocking;
use zbus::blocking::Connection;
@@ -26,7 +26,7 @@ fn main() -> Result<(), Box<dyn Error>> {
AnimeType::GA401,
)?;
let anime_type = get_anime_type()?;
let anime_type = get_maybe_anime_type()?;
proxy.write(matrix.into_data_buffer(anime_type)?).unwrap();

View File

@@ -1,7 +1,7 @@
use std::thread::sleep;
use std::time::Duration;
use rog_anime::usb::get_anime_type;
use rog_anime::usb::get_maybe_anime_type;
use rog_anime::{AnimeDiagonal, AnimeType};
use rog_dbus::zbus_anime::AnimeProxyBlocking;
use zbus::blocking::Connection;
@@ -29,7 +29,7 @@ fn main() {
}
}
let anime_type = get_anime_type().unwrap();
let anime_type = get_maybe_anime_type().unwrap();
proxy
.write(matrix.into_data_buffer(anime_type).unwrap())
.unwrap();

View File

@@ -2,7 +2,7 @@ use std::env;
use std::path::Path;
use std::thread::sleep;
use rog_anime::usb::get_anime_type;
use rog_anime::usb::get_maybe_anime_type;
use rog_anime::{ActionData, ActionLoader, Sequences};
use rog_dbus::zbus_anime::AnimeProxyBlocking;
use zbus::blocking::Connection;
@@ -19,7 +19,7 @@ fn main() {
let path = Path::new(&args[1]);
let brightness = args[2].parse::<f32>().unwrap();
let anime_type = get_anime_type().unwrap();
let anime_type = get_maybe_anime_type().unwrap();
let mut seq = Sequences::new(anime_type);
seq.insert(
0,

View File

@@ -1,6 +1,6 @@
use std::convert::TryFrom;
use rog_anime::usb::get_anime_type;
use rog_anime::usb::get_maybe_anime_type;
use rog_anime::{AnimeDataBuffer, AnimeGrid};
use rog_dbus::zbus_anime::AnimeProxyBlocking;
use zbus::blocking::Connection;
@@ -14,7 +14,7 @@ fn main() {
let conn = Connection::system().unwrap();
let proxy = AnimeProxyBlocking::new(&conn).unwrap();
let anime_type = get_anime_type().unwrap();
let anime_type = get_maybe_anime_type().unwrap();
let mut matrix = AnimeGrid::new(anime_type);
let tmp = matrix.get_mut();

View File

@@ -1,4 +1,4 @@
use rog_anime::usb::get_anime_type;
use rog_anime::usb::get_maybe_anime_type;
use rog_anime::AnimeDataBuffer;
use rog_dbus::zbus_anime::AnimeProxyBlocking;
use zbus::blocking::Connection;
@@ -9,7 +9,7 @@ use zbus::blocking::Connection;
fn main() {
let conn = Connection::system().unwrap();
let proxy = AnimeProxyBlocking::new(&conn).unwrap();
let anime_type = get_anime_type().unwrap();
let anime_type = get_maybe_anime_type().unwrap();
let mut matrix = AnimeDataBuffer::new(anime_type);
matrix.data_mut()[1] = 100; // start = 1
for n in matrix.data_mut()[2..32].iter_mut() {

View File

@@ -4,7 +4,7 @@ use std::error::Error;
use std::path::Path;
use std::process::exit;
use rog_anime::usb::get_anime_type;
use rog_anime::usb::get_maybe_anime_type;
use rog_anime::{AnimeDataBuffer, AnimeImage, Vec2};
use rog_dbus::zbus_anime::AnimeProxyBlocking;
use zbus::blocking::Connection;
@@ -20,7 +20,7 @@ fn main() -> Result<(), Box<dyn Error>> {
exit(-1);
}
let anime_type = get_anime_type()?;
let anime_type = get_maybe_anime_type()?;
let matrix = AnimeImage::from_png(
Path::new(&args[1]),
args[2].parse::<f32>().unwrap(),

View File

@@ -7,7 +7,7 @@ use std::process::exit;
use std::thread::sleep;
use std::time::Duration;
use rog_anime::usb::get_anime_type;
use rog_anime::usb::get_maybe_anime_type;
use rog_anime::{AnimeDataBuffer, AnimeImage, Vec2};
use rog_dbus::zbus_anime::AnimeProxyBlocking;
use zbus::blocking::Connection;
@@ -23,7 +23,7 @@ fn main() -> Result<(), Box<dyn Error>> {
exit(-1);
}
let anime_type = get_anime_type()?;
let anime_type = get_maybe_anime_type()?;
let mut matrix = AnimeImage::from_png(
Path::new(&args[1]),
args[2].parse::<f32>().unwrap(),

View File

@@ -41,6 +41,8 @@ pub enum SetAuraZoneEnabled {
Lid(AuraPowerStates),
#[options(help = "")]
RearGlow(AuraPowerStates),
#[options(help = "")]
Ally(AuraPowerStates),
}
#[derive(Debug, Clone, Options)]
@@ -219,9 +221,9 @@ pub enum SetAuraBuiltin {
#[options(help = "pulse between one or two colours")]
Breathe(TwoColourSpeed), // 1
#[options(help = "strobe through all colours")]
Strobe(SingleSpeed), // 2
RainbowCycle(SingleSpeed), // 2
#[options(help = "rainbow cycling in one of four directions")]
Rainbow(SingleSpeedDirection), // 3
RainbowWave(SingleSpeedDirection), // 3
#[options(help = "rain pattern mimicking raindrops")]
Stars(TwoColourSpeed), // 4
#[options(help = "rain pattern of three preset colours")]
@@ -312,14 +314,14 @@ impl From<&SetAuraBuiltin> for AuraEffect {
data.mode = AuraModeNum::Breathe;
data
}
SetAuraBuiltin::Strobe(x) => {
SetAuraBuiltin::RainbowCycle(x) => {
let mut data: AuraEffect = x.into();
data.mode = AuraModeNum::Strobe;
data.mode = AuraModeNum::RainbowCycle;
data
}
SetAuraBuiltin::Rainbow(x) => {
SetAuraBuiltin::RainbowWave(x) => {
let mut data: AuraEffect = x.into();
data.mode = AuraModeNum::Rainbow;
data.mode = AuraModeNum::RainbowWave;
data
}
SetAuraBuiltin::Stars(x) => {

View File

@@ -5,15 +5,15 @@ use std::process::Command;
use std::thread::sleep;
use anime_cli::{AnimeActions, AnimeCommand};
use asusd::ctrl_fancurves::FAN_CURVE_ZBUS_NAME;
use aura_cli::{LedPowerCommand1, LedPowerCommand2};
use dmi_id::DMIID;
use fan_curve_cli::FanCurveCommand;
use gumdrop::{Opt, Options};
use rog_anime::usb::get_anime_type;
use rog_anime::usb::get_maybe_anime_type;
use rog_anime::{AnimTime, AnimeDataBuffer, AnimeDiagonal, AnimeGif, AnimeImage, AnimeType, Vec2};
use rog_aura::keyboard::{AuraPowerState, LaptopAuraPower};
use rog_aura::{self, AuraDeviceType, AuraEffect, PowerZones};
use rog_dbus::list_iface_blocking;
use rog_dbus::zbus_anime::AnimeProxyBlocking;
use rog_dbus::zbus_aura::AuraProxyBlocking;
use rog_dbus::zbus_fan_curves::FanCurvesProxyBlocking;
@@ -36,6 +36,8 @@ mod fan_curve_cli;
mod slash_cli;
fn main() {
let self_version = env!("CARGO_PKG_VERSION");
println!("Starting version {self_version}");
let args: Vec<String> = args().skip(1).collect();
let missing_argument_k = gumdrop::Error::missing_argument(Opt::Short('k'));
@@ -57,7 +59,6 @@ fn main() {
println!("\nError: {e}\n");
print_info();
}) {
let self_version = env!("CARGO_PKG_VERSION");
let asusd_version = platform_proxy.version().unwrap();
if asusd_version != self_version {
println!("Version mismatch: asusctl = {self_version}, asusd = {asusd_version}");
@@ -65,7 +66,7 @@ fn main() {
}
let supported_properties = platform_proxy.supported_properties().unwrap();
let supported_interfaces = platform_proxy.supported_interfaces().unwrap();
let supported_interfaces = list_iface_blocking().unwrap();
if parsed.version {
println!("asusctl v{}", env!("CARGO_PKG_VERSION"));
@@ -89,7 +90,10 @@ fn print_error_help(
print_info();
println!();
println!("Supported interfaces:\n\n{:#?}\n", supported_interfaces);
println!("Supported properties:\n\n{:#?}\n", supported_properties);
println!(
"Supported properties on Platform:\n\n{:#?}\n",
supported_properties
);
}
fn print_info() {
@@ -120,12 +124,8 @@ fn check_service(name: &str) -> bool {
fn find_aura_iface() -> Result<Vec<AuraProxyBlocking<'static>>, Box<dyn std::error::Error>> {
let conn = zbus::blocking::Connection::system().unwrap();
let f = zbus::blocking::fdo::ObjectManagerProxy::new(
&conn,
"org.asuslinux.Daemon",
"/org/asuslinux",
)
.unwrap();
let f =
zbus::blocking::fdo::ObjectManagerProxy::new(&conn, "org.asuslinux.Daemon", "/").unwrap();
let interfaces = f.get_managed_objects().unwrap();
let mut aura_paths = Vec::new();
for v in interfaces.iter() {
@@ -172,7 +172,7 @@ fn do_parsed(
handle_throttle_profile(&conn, supported_properties, cmd)?
}
Some(CliCommand::FanCurve(cmd)) => {
handle_fan_curve(&conn, supported_interfaces, cmd)?;
handle_fan_curve(&conn, cmd)?;
}
Some(CliCommand::Graphics(_)) => do_gfx(),
Some(CliCommand::Anime(cmd)) => handle_anime(&conn, cmd)?,
@@ -203,6 +203,31 @@ fn do_parsed(
};
let commands: Vec<String> = cmdlist.lines().map(|s| s.to_owned()).collect();
for command in commands.iter().filter(|command| {
if command.trim().starts_with("fan-curve")
&& !supported_interfaces
.contains(&"org.asuslinux.FanCurves".to_string())
{
return false;
}
if command.trim().starts_with("anime")
&& !supported_interfaces.contains(&"org.asuslinux.Anime".to_string())
{
return false;
}
if command.trim().starts_with("slash")
&& !supported_interfaces.contains(&"org.asuslinux.Slash".to_string())
{
return false;
}
if command.trim().starts_with("bios")
&& !supported_interfaces.contains(&"org.asuslinux.Platform".to_string())
{
return false;
}
if !dev_type.is_old_laptop()
&& !dev_type.is_tuf_laptop()
&& command.trim().starts_with("led-pow-1")
@@ -340,8 +365,8 @@ fn handle_anime(conn: &Connection, cmd: &AnimeCommand) -> Result<(), Box<dyn std
println!("Did Alice _really_ make it back from Wonderland?");
}
let mut anime_type = get_anime_type()?;
if let AnimeType::Unknown = anime_type {
let mut anime_type = get_maybe_anime_type()?;
if let AnimeType::Unsupported = anime_type {
if let Some(model) = cmd.override_type {
anime_type = model;
}
@@ -548,10 +573,11 @@ fn handle_led_mode(
let modes = aura.first().unwrap().supported_basic_modes()?;
for command in commands.iter().filter(|command| {
for mode in &modes {
if command
.trim()
.starts_with(&<&str>::from(mode).to_lowercase())
{
let mut mode = <&str>::from(mode).to_string();
if let Some(pos) = mode.chars().skip(1).position(|c| c.is_uppercase()) {
mode.insert(pos + 1, '-');
}
if command.trim().starts_with(&mode.to_lowercase()) {
return true;
}
}
@@ -645,25 +671,28 @@ fn handle_led_power_1_do_1866(
aura: &AuraProxyBlocking,
power: &LedPowerCommand1,
) -> Result<(), Box<dyn std::error::Error>> {
let zone = if power.keyboard && power.lightbar {
PowerZones::KeyboardAndLightbar
} else if power.lightbar {
PowerZones::Lightbar
} else {
PowerZones::Keyboard
};
let states = LaptopAuraPower {
states: vec![AuraPowerState {
zone,
let mut states = Vec::new();
if power.keyboard {
states.push(AuraPowerState {
zone: PowerZones::Keyboard,
boot: power.boot.unwrap_or_default(),
awake: power.awake.unwrap_or_default(),
sleep: power.sleep.unwrap_or_default(),
shutdown: false,
}],
};
});
}
if power.lightbar {
states.push(AuraPowerState {
zone: PowerZones::Lightbar,
boot: power.boot.unwrap_or_default(),
awake: power.awake.unwrap_or_default(),
sleep: power.sleep.unwrap_or_default(),
shutdown: false,
});
}
let states = LaptopAuraPower { states };
aura.set_led_power(states)?;
Ok(())
}
@@ -722,6 +751,7 @@ fn handle_led_power2(
aura_cli::SetAuraZoneEnabled::Lightbar(l) => set(PowerZones::Lightbar, l),
aura_cli::SetAuraZoneEnabled::Lid(l) => set(PowerZones::Lid, l),
aura_cli::SetAuraZoneEnabled::RearGlow(r) => set(PowerZones::RearGlow, r),
aura_cli::SetAuraZoneEnabled::Ally(r) => set(PowerZones::Ally, r),
}
}
@@ -779,13 +809,13 @@ fn handle_throttle_profile(
fn handle_fan_curve(
conn: &Connection,
supported: &[String],
cmd: &FanCurveCommand,
) -> Result<(), Box<dyn std::error::Error>> {
if !supported.contains(&FAN_CURVE_ZBUS_NAME.to_string()) {
println!("Fan-curves not supported by either this kernel or by the laptop.");
let Ok(fan_proxy) = FanCurvesProxyBlocking::new(conn).map_err(|e| {
println!("Fan-curves not supported by either this kernel or by the laptop: {e:?}");
}) else {
return Err(ProfileError::NotSupported.into());
}
};
if !cmd.get_enabled && !cmd.default && cmd.mod_profile.is_none() {
if !cmd.help {
@@ -810,7 +840,6 @@ fn handle_fan_curve(
}
let plat_proxy = PlatformProxyBlocking::new(conn)?;
let fan_proxy = FanCurvesProxyBlocking::new(conn)?;
if cmd.get_enabled {
let profile = plat_proxy.throttle_thermal_policy()?;
let curves = fan_proxy.fan_curve_data(profile)?;

View File

@@ -12,13 +12,16 @@ edition.workspace = true
name = "asusd-user"
path = "src/daemon.rs"
[features]
default = []
local_data = []
[dependencies]
dirs.workspace = true
smol.workspace = true
# serialisation
serde.workspace = true
serde_derive.workspace = true
ron.workspace = true
rog_anime = { path = "../rog-anime" }

View File

@@ -6,7 +6,7 @@ use rog_anime::{ActionLoader, AnimTime, AnimeType, Fade, Sequences as AnimeSeque
use rog_aura::effects::{AdvancedEffects as AuraSequences, Breathe, DoomFlicker, Effect, Static};
use rog_aura::keyboard::LedCode;
use rog_aura::{Colour, Speed};
use serde_derive::{Deserialize, Serialize};
use serde::{Deserialize, Serialize};
use crate::error::Error;

View File

@@ -9,7 +9,7 @@ use rog_anime::error::AnimeError;
use rog_anime::{ActionData, ActionLoader, AnimTime, Fade, Sequences, Vec2};
use rog_dbus::zbus_anime::AnimeProxyBlocking;
use ron::ser::PrettyConfig;
use serde_derive::{Deserialize, Serialize};
use serde::{Deserialize, Serialize};
use zbus::interface;
use zbus::zvariant::{ObjectPath, Type};

View File

@@ -6,13 +6,12 @@ use std::sync::{Arc, Mutex};
use asusd_user::config::*;
use asusd_user::ctrl_anime::{CtrlAnime, CtrlAnimeInner};
use config_traits::{StdConfig, StdConfigLoad};
use rog_anime::usb::get_anime_type;
use rog_anime::usb::get_maybe_anime_type;
use rog_aura::aura_detection::LedSupportData;
use rog_aura::keyboard::KeyLayout;
use rog_dbus::zbus_anime::AnimeProxyBlocking;
use rog_dbus::zbus_aura::AuraProxyBlocking;
use rog_dbus::zbus_platform::PlatformProxyBlocking;
use rog_dbus::DBUS_NAME;
use rog_dbus::{list_iface_blocking, DBUS_NAME};
use smol::Executor;
use zbus::Connection;
@@ -36,20 +35,16 @@ fn main() -> Result<(), Box<dyn std::error::Error>> {
println!("rog-platform v{}", rog_platform::VERSION);
let conn = zbus::blocking::Connection::system().unwrap();
let platform_proxy = PlatformProxyBlocking::new(&conn).unwrap();
let supported = platform_proxy
.supported_interfaces()
.unwrap_or_default()
.contains(&"Anime".to_string());
let supported = list_iface_blocking()?;
let config = ConfigBase::new().load();
let executor = Executor::new();
let early_return = Arc::new(AtomicBool::new(false));
// Set up the anime data and run loop/thread
if supported {
if supported.contains(&"org.asuslinux.Anime".to_string()) {
if let Some(cfg) = config.active_anime {
let anime_type = get_anime_type()?;
let anime_type = get_maybe_anime_type()?;
let anime_config = ConfigAnime::new().set_name(cfg).load();
let anime = anime_config.create(anime_type)?;
let anime_config = Arc::new(Mutex::new(anime_config));

View File

@@ -38,7 +38,6 @@ logind-zbus.workspace = true
# serialisation
serde.workspace = true
serde_derive.workspace = true
concat-idents.workspace = true

View File

@@ -1,7 +1,7 @@
use config_traits::{StdConfig, StdConfigLoad3};
use config_traits::{StdConfig, StdConfigLoad1};
use rog_platform::cpu::CPUEPP;
use rog_platform::platform::ThrottlePolicy;
use serde_derive::{Deserialize, Serialize};
use serde::{Deserialize, Serialize};
const CONFIG_FILE: &str = "asusd.ron";
@@ -22,8 +22,12 @@ pub struct Config {
pub throttle_policy_linked_epp: bool,
/// Which throttle/profile to use on battery power
pub throttle_policy_on_battery: ThrottlePolicy,
/// Should the throttle policy be set on bat/ac change?
pub change_throttle_policy_on_battery: bool,
/// Which throttle/profile to use on AC power
pub throttle_policy_on_ac: ThrottlePolicy,
/// Should the throttle policy be set on bat/ac change?
pub change_throttle_policy_on_ac: bool,
/// The energy_performance_preference for this throttle/platform profile
pub throttle_quiet_epp: CPUEPP,
/// The energy_performance_preference for this throttle/platform profile
@@ -68,7 +72,9 @@ impl Default for Config {
bat_command: Default::default(),
throttle_policy_linked_epp: true,
throttle_policy_on_battery: ThrottlePolicy::Quiet,
change_throttle_policy_on_battery: true,
throttle_policy_on_ac: ThrottlePolicy::Performance,
change_throttle_policy_on_ac: true,
throttle_quiet_epp: CPUEPP::Power,
throttle_balanced_epp: CPUEPP::BalancePower,
throttle_performance_epp: CPUEPP::Performance,
@@ -106,7 +112,7 @@ impl StdConfig for Config {
}
}
impl StdConfigLoad3<Config472, Config506, Config507> for Config {}
impl StdConfigLoad1<Config507> for Config {}
#[derive(Deserialize, Serialize)]
pub struct Config507 {
@@ -142,7 +148,9 @@ impl From<Config507> for Config {
mini_led_mode: c.mini_led_mode,
throttle_policy_linked_epp: true,
throttle_policy_on_battery: c.platform_policy_on_battery,
change_throttle_policy_on_battery: true,
throttle_policy_on_ac: c.platform_policy_on_ac,
change_throttle_policy_on_ac: true,
throttle_quiet_epp: CPUEPP::Power,
throttle_balanced_epp: CPUEPP::BalancePower,
throttle_performance_epp: CPUEPP::Performance,
@@ -157,79 +165,3 @@ impl From<Config507> for Config {
}
}
}
#[derive(Deserialize, Serialize)]
pub struct Config506 {
/// Save charge limit for restoring on boot
pub charge_control_end_threshold: u8,
pub panel_od: bool,
pub mini_led_mode: bool,
pub disable_nvidia_powerd_on_battery: bool,
pub ac_command: String,
pub bat_command: String,
/// Restored on boot as well as when power is plugged
#[serde(skip)]
pub platform_policy_to_restore: ThrottlePolicy,
pub platform_policy_on_battery: ThrottlePolicy,
pub platform_policy_on_ac: ThrottlePolicy,
//
pub ppt_pl1_spl: Option<u8>,
pub ppt_pl2_sppt: Option<u8>,
pub ppt_fppt: Option<u8>,
pub ppt_apu_sppt: Option<u8>,
pub ppt_platform_sppt: Option<u8>,
pub nv_dynamic_boost: Option<u8>,
pub nv_temp_target: Option<u8>,
}
impl From<Config506> for Config {
fn from(c: Config506) -> Self {
Self {
charge_control_end_threshold: c.charge_control_end_threshold,
panel_od: c.panel_od,
boot_sound: false,
disable_nvidia_powerd_on_battery: c.disable_nvidia_powerd_on_battery,
ac_command: c.ac_command,
bat_command: c.bat_command,
mini_led_mode: c.mini_led_mode,
throttle_policy_linked_epp: true,
throttle_policy_on_battery: c.platform_policy_on_battery,
throttle_policy_on_ac: c.platform_policy_on_ac,
throttle_quiet_epp: CPUEPP::Power,
throttle_balanced_epp: CPUEPP::BalancePower,
throttle_performance_epp: CPUEPP::Performance,
ppt_pl1_spl: c.ppt_pl1_spl,
ppt_pl2_sppt: c.ppt_pl2_sppt,
ppt_fppt: c.ppt_fppt,
ppt_apu_sppt: c.ppt_apu_sppt,
ppt_platform_sppt: c.ppt_platform_sppt,
nv_dynamic_boost: c.nv_dynamic_boost,
nv_temp_target: c.nv_temp_target,
last_power_plugged: 0,
}
}
}
#[derive(Deserialize, Serialize)]
pub struct Config472 {
/// Save charge limit for restoring on boot
pub bat_charge_limit: u8,
pub panel_od: bool,
pub mini_led_mode: bool,
pub disable_nvidia_powerd_on_battery: bool,
pub ac_command: String,
pub bat_command: String,
}
impl From<Config472> for Config {
fn from(c: Config472) -> Self {
Self {
charge_control_end_threshold: c.bat_charge_limit,
panel_od: c.panel_od,
disable_nvidia_powerd_on_battery: true,
ac_command: c.ac_command,
bat_command: c.bat_command,
..Default::default()
}
}
}

View File

@@ -1,69 +1,15 @@
use std::time::Duration;
use config_traits::{StdConfig, StdConfigLoad2};
use config_traits::{StdConfig, StdConfigLoad};
use rog_anime::error::AnimeError;
use rog_anime::usb::Brightness;
use rog_anime::{
ActionData, ActionLoader, AnimTime, Animations, AnimeType, DeviceState, Fade, Vec2,
};
use serde_derive::{Deserialize, Serialize};
use serde::{Deserialize, Serialize};
const CONFIG_FILE: &str = "anime.ron";
#[derive(Deserialize, Serialize)]
pub struct AnimeConfigV460 {
pub system: Vec<ActionLoader>,
pub boot: Vec<ActionLoader>,
pub wake: Vec<ActionLoader>,
pub sleep: Vec<ActionLoader>,
pub shutdown: Vec<ActionLoader>,
pub brightness: f32,
}
impl From<AnimeConfigV460> for AnimeConfig {
fn from(c: AnimeConfigV460) -> AnimeConfig {
AnimeConfig {
system: c.system,
boot: c.boot,
wake: c.wake,
shutdown: c.shutdown,
..Default::default()
}
}
}
#[derive(Deserialize, Serialize, Debug)]
pub struct AnimeConfigV472 {
pub model_override: Option<AnimeType>,
pub system: Vec<ActionLoader>,
pub boot: Vec<ActionLoader>,
pub wake: Vec<ActionLoader>,
pub sleep: Vec<ActionLoader>,
pub shutdown: Vec<ActionLoader>,
pub brightness: f32,
pub display_enabled: bool,
pub display_brightness: Brightness,
pub builtin_anims_enabled: bool,
pub builtin_anims: Animations,
}
impl From<AnimeConfigV472> for AnimeConfig {
fn from(c: AnimeConfigV472) -> AnimeConfig {
AnimeConfig {
system: c.system,
boot: c.boot,
wake: c.wake,
shutdown: c.shutdown,
model_override: c.model_override,
display_enabled: c.display_enabled,
display_brightness: c.display_brightness,
builtin_anims_enabled: c.builtin_anims_enabled,
builtin_anims: c.builtin_anims,
..Default::default()
}
}
}
#[derive(Deserialize, Serialize, Default)]
pub struct AnimeConfigCached {
pub system: Vec<ActionData>,
@@ -108,7 +54,6 @@ impl AnimeConfigCached {
/// Config for base system actions for the anime display
#[derive(Deserialize, Serialize, Debug, Clone)]
pub struct AnimeConfig {
pub model_override: Option<AnimeType>,
pub system: Vec<ActionLoader>,
pub boot: Vec<ActionLoader>,
pub wake: Vec<ActionLoader>,
@@ -127,7 +72,6 @@ pub struct AnimeConfig {
impl Default for AnimeConfig {
fn default() -> Self {
AnimeConfig {
model_override: None,
system: Vec::new(),
boot: Vec::new(),
wake: Vec::new(),
@@ -159,7 +103,7 @@ impl StdConfig for AnimeConfig {
}
}
impl StdConfigLoad2<AnimeConfigV460, AnimeConfigV472> for AnimeConfig {}
impl StdConfigLoad for AnimeConfig {}
impl From<&AnimeConfig> for DeviceState {
fn from(config: &AnimeConfig) -> Self {

View File

@@ -8,10 +8,11 @@ use std::sync::Arc;
use std::thread::sleep;
use ::zbus::export::futures_util::lock::Mutex;
use config_traits::{StdConfig, StdConfigLoad};
use log::{error, info, warn};
use rog_anime::error::AnimeError;
use rog_anime::usb::{
get_anime_type, pkt_flush, pkt_set_brightness, pkt_set_enable_display,
get_maybe_anime_type, pkt_flush, pkt_set_brightness, pkt_set_enable_display,
pkt_set_enable_powersave_anim, pkts_for_init, Brightness,
};
use rog_anime::{ActionData, AnimeDataBuffer, AnimePacketType, AnimeType};
@@ -62,7 +63,13 @@ pub struct CtrlAnime {
impl CtrlAnime {
#[inline]
pub fn new(config: AnimeConfig) -> Result<CtrlAnime, RogError> {
pub fn new() -> Result<CtrlAnime, RogError> {
let anime_type = get_maybe_anime_type()?;
if matches!(anime_type, AnimeType::Unsupported) {
info!("No Anime Matrix capable laptop found");
return Err(RogError::Anime(AnimeError::NoDevice));
}
let usb = USBRaw::new(0x193b).ok();
let hid = HidRaw::new("193b").ok();
let node = if usb.is_some() {
@@ -89,17 +96,16 @@ impl CtrlAnime {
// }
// }
let mut anime_type = get_anime_type()?;
if let AnimeType::Unknown = anime_type {
if let Some(model) = config.model_override {
warn!("Overriding the Animatrix type as {model:?}");
anime_type = model;
}
}
let mut config = AnimeConfig::new().load();
info!("Device has an AniMe Matrix display: {anime_type:?}");
let mut cache = AnimeConfigCached::default();
cache.init_from_config(&config, anime_type)?;
if let Err(e) = cache.init_from_config(&config, anime_type) {
error!("Trying to cache the Anime Config failed, will reset to default config: {e:?}");
config.rename_file_old();
config = AnimeConfig::new();
config.write();
}
let ctrl = CtrlAnime {
node,

View File

@@ -7,12 +7,16 @@ use rog_aura::keyboard::LaptopAuraPower;
use rog_aura::{
AuraDeviceType, AuraEffect, AuraModeNum, AuraZone, Direction, LedBrightness, Speed, GRADIENT,
};
use serde_derive::{Deserialize, Serialize};
use serde::{Deserialize, Serialize};
use crate::error::RogError;
#[derive(Deserialize, Serialize, Default, Debug, Clone)]
// #[serde(default)]
pub struct AuraConfig {
pub config_name: String,
#[serde(skip_serializing_if = "Option::is_none", default)]
pub ally_fix: Option<bool>,
pub brightness: LedBrightness,
pub current_mode: AuraModeNum,
pub builtins: BTreeMap<AuraModeNum, AuraEffect>,
@@ -55,6 +59,7 @@ impl AuraConfig {
let enabled = LaptopAuraPower::new(device_type, &support_data);
let mut config = AuraConfig {
config_name: format!("aura_{prod_id}.ron"),
ally_fix: None,
brightness: LedBrightness::Med,
current_mode: AuraModeNum::Static,
builtins: BTreeMap::new(),
@@ -130,16 +135,51 @@ impl AuraConfig {
}
None
}
/// Create a default for the `current_mode` if multizone and no config
/// exists.
pub(super) fn create_multizone_default(
&mut self,
supported_data: &LedSupportData,
) -> Result<(), RogError> {
let mut default = vec![];
for (i, tmp) in supported_data.basic_zones.iter().enumerate() {
default.push(AuraEffect {
mode: self.current_mode,
zone: *tmp,
colour1: *GRADIENT.get(i).unwrap_or(&GRADIENT[0]),
colour2: *GRADIENT.get(GRADIENT.len() - i).unwrap_or(&GRADIENT[6]),
speed: Speed::Med,
direction: Direction::Left,
});
}
if default.is_empty() {
return Err(RogError::AuraEffectNotSupported);
}
if let Some(multizones) = self.multizone.as_mut() {
multizones.insert(self.current_mode, default);
} else {
let mut tmp = BTreeMap::new();
tmp.insert(self.current_mode, default);
self.multizone = Some(tmp);
}
Ok(())
}
}
#[cfg(test)]
mod tests {
use rog_aura::{AuraEffect, AuraModeNum, AuraZone, Colour};
use rog_aura::keyboard::AuraPowerState;
use rog_aura::{
AuraEffect, AuraModeNum, AuraZone, Colour, Direction, LedBrightness, PowerZones, Speed,
};
use super::AuraConfig;
#[test]
fn set_multizone_4key_config() {
std::env::set_var("BOARD_NAME", "");
let mut config = AuraConfig::new("19b6");
let effect = AuraEffect {
@@ -230,6 +270,7 @@ mod tests {
#[test]
fn set_multizone_multimode_config() {
std::env::set_var("BOARD_NAME", "");
let mut config = AuraConfig::new("19b6");
let effect = AuraEffect {
@@ -274,4 +315,66 @@ mod tests {
let sta = res.get(&AuraModeNum::Pulse).unwrap();
assert_eq!(sta.len(), 1);
}
#[test]
fn verify_0x1866_g531i() {
std::env::set_var("BOARD_NAME", "G513I");
let mut config = AuraConfig::new("1866");
assert_eq!(config.brightness, LedBrightness::Med);
assert_eq!(config.builtins.len(), 5);
assert_eq!(
config.builtins.first_entry().unwrap().get(),
&AuraEffect {
mode: AuraModeNum::Static,
zone: AuraZone::None,
colour1: Colour { r: 166, g: 0, b: 0 },
colour2: Colour { r: 0, g: 0, b: 0 },
speed: Speed::Med,
direction: Direction::Right
}
);
assert_eq!(config.enabled.states.len(), 1);
assert_eq!(
config.enabled.states[0],
AuraPowerState {
zone: PowerZones::KeyboardAndLightbar,
boot: true,
awake: true,
sleep: true,
shutdown: true
}
);
}
#[test]
fn verify_0x19b6_g634j() {
std::env::set_var("BOARD_NAME", "G634J");
let mut config = AuraConfig::new("19b6");
assert_eq!(config.brightness, LedBrightness::Med);
assert_eq!(config.builtins.len(), 12);
assert_eq!(
config.builtins.first_entry().unwrap().get(),
&AuraEffect {
mode: AuraModeNum::Static,
zone: AuraZone::None,
colour1: Colour { r: 166, g: 0, b: 0 },
colour2: Colour { r: 0, g: 0, b: 0 },
speed: Speed::Med,
direction: Direction::Right
}
);
assert_eq!(config.enabled.states.len(), 4);
assert_eq!(
config.enabled.states[0],
AuraPowerState {
zone: PowerZones::Keyboard,
boot: true,
awake: true,
sleep: true,
shutdown: true
}
);
}
}

View File

@@ -1,28 +1,31 @@
use std::collections::{BTreeMap, HashSet};
use std::collections::HashSet;
use config_traits::{StdConfig, StdConfigLoad};
use dmi_id::DMIID;
use inotify::Inotify;
use log::{debug, info, warn};
use rog_aura::aura_detection::LedSupportData;
use rog_aura::keyboard::{LedUsbPackets, UsbPackets};
use rog_aura::usb::{LED_APPLY, LED_SET};
use rog_aura::{
AuraDeviceType, AuraEffect, Direction, LedBrightness, Speed, GRADIENT, LED_MSG_LEN,
};
use rog_aura::{AuraDeviceType, AuraEffect, LedBrightness, PowerZones, LED_MSG_LEN};
use rog_platform::hid_raw::HidRaw;
use rog_platform::keyboard_led::KeyboardLed;
use rog_platform::keyboard_led::KeyboardBacklight;
use udev::Device;
use zbus::zvariant::OwnedObjectPath;
use zbus::Connection;
use super::config::AuraConfig;
use crate::ctrl_aura::manager::{dbus_path_for_dev, dbus_path_for_tuf};
use crate::ctrl_aura::manager::{dbus_path_for_dev, dbus_path_for_tuf, start_tasks};
use crate::ctrl_aura::trait_impls::CtrlAuraZbus;
use crate::error::RogError;
use crate::CtrlTask;
#[derive(Debug)]
pub enum LEDNode {
/// Brightness and/or TUF RGB controls
KbdLed(KeyboardLed),
KbdLed(KeyboardBacklight),
/// Raw HID handle
Rog(KeyboardLed, HidRaw),
Rog(Option<KeyboardBacklight>, HidRaw),
}
impl LEDNode {
@@ -30,7 +33,22 @@ impl LEDNode {
pub fn set_brightness(&self, value: u8) -> Result<(), RogError> {
match self {
LEDNode::KbdLed(k) => k.set_brightness(value)?,
LEDNode::Rog(k, _) => k.set_brightness(value)?,
LEDNode::Rog(k, r) => {
if let Some(k) = k {
k.set_brightness(value)?;
let x = k.get_brightness()?;
if x != value {
debug!(
"Kernel brightness control didn't read back correct value, setting \
with raw hid"
);
r.write_bytes(&[0x5a, 0xba, 0xc5, 0xc4, value])?;
}
} else {
debug!("No brightness control found, trying raw write");
r.write_bytes(&[0x5a, 0xba, 0xc5, 0xc4, value])?;
}
}
}
Ok(())
}
@@ -38,16 +56,47 @@ impl LEDNode {
pub fn get_brightness(&self) -> Result<u8, RogError> {
Ok(match self {
LEDNode::KbdLed(k) => k.get_brightness()?,
LEDNode::Rog(k, _) => k.get_brightness()?,
LEDNode::Rog(k, _) => {
if let Some(k) = k {
k.get_brightness()?
} else {
debug!("No brightness control found");
return Err(RogError::MissingFunction(
"No keyboard brightness control found".to_string(),
));
}
}
})
}
pub fn monitor_brightness(&self) -> Result<Inotify, RogError> {
Ok(match self {
LEDNode::KbdLed(k) => k.monitor_brightness()?,
LEDNode::Rog(k, _) => k.monitor_brightness()?,
LEDNode::Rog(k, _) => {
if let Some(k) = k {
k.monitor_brightness()?
} else {
debug!("No brightness control found");
return Err(RogError::MissingFunction(
"No keyboard brightness control found".to_string(),
));
}
}
})
}
pub fn has_brightness_control(&self) -> bool {
match self {
LEDNode::KbdLed(k) => k.has_brightness(),
LEDNode::Rog(k, _) => {
if let Some(k) = k {
k.has_brightness()
} else {
false
}
}
}
}
}
/// Individual controller for one Aura device
@@ -61,10 +110,85 @@ pub struct CtrlKbdLed {
}
impl CtrlKbdLed {
pub fn add_to_dbus_and_start(
self,
interfaces: &mut HashSet<OwnedObjectPath>,
conn: Connection,
) -> Result<(), RogError> {
let dbus_path = self.dbus_path.clone();
let dbus_path_cpy = self.dbus_path.clone();
info!(
"AuraManager starting device at: {:?}, {:?}",
dbus_path, self.led_type
);
let conn_copy = conn.clone();
let sig_ctx1 = CtrlAuraZbus::signal_context(&conn_copy)?;
let sig_ctx2 = CtrlAuraZbus::signal_context(&conn_copy)?;
let zbus = CtrlAuraZbus::new(self, sig_ctx1);
tokio::spawn(
async move { start_tasks(zbus, conn_copy.clone(), sig_ctx2, dbus_path).await },
);
interfaces.insert(dbus_path_cpy);
Ok(())
}
/// Build and init a `CtrlKbdLed` from a udev device. Maybe.
/// This will initialise the config also.
pub fn maybe_device(
device: Device,
interfaces: &mut HashSet<OwnedObjectPath>,
) -> Result<Option<Self>, RogError> {
// usb_device gives us a product and vendor ID
if let Some(usb_device) = device.parent_with_subsystem_devtype("usb", "usb_device")? {
let dbus_path = dbus_path_for_dev(&usb_device).unwrap_or_default();
if interfaces.contains(&dbus_path) {
debug!("Already a ctrl at {dbus_path:?}, ignoring this end-point");
return Ok(None);
}
// The asus_wmi driver latches MCU that controls the USB endpoints
if let Some(parent) = device.parent() {
if let Some(driver) = parent.driver() {
// There is a tree of devices added so filter by driver
if driver != "asus" {
return Ok(None);
}
} else {
return Ok(None);
}
}
// Device is something like 002, while its parent is the MCU
// Think of it like the device is an endpoint of the USB device attached
let mut prod_id = String::new();
if let Some(usb_id) = usb_device.attribute_value("idProduct") {
prod_id = usb_id.to_string_lossy().to_string();
let aura_device = AuraDeviceType::from(prod_id.as_str());
if aura_device == AuraDeviceType::Unknown {
log::debug!("Unknown or invalid device: {usb_id:?}, skipping");
return Ok(None);
}
}
let dev_node = if let Some(dev_node) = usb_device.devnode() {
dev_node
} else {
debug!("Device has no devnode, skipping");
return Ok(None);
};
info!("AuraControl found device at: {:?}", dev_node);
let dev = HidRaw::from_device(device)?;
let mut controller = Self::from_hidraw(dev, dbus_path.clone())?;
controller.config = Self::load_and_update_config(&prod_id);
interfaces.insert(dbus_path);
return Ok(Some(controller));
}
Ok(None)
}
pub fn find_all() -> Result<Vec<Self>, RogError> {
info!("Searching for all Aura devices");
let mut devices = Vec::new();
let mut found = HashSet::new(); // track and ensure we use only one hidraw per prod_id
let mut interfaces = HashSet::new(); // track and ensure we use only one hidraw per prod_id
let mut enumerator = udev::Enumerator::new().map_err(|err| {
warn!("{}", err);
@@ -77,63 +201,37 @@ impl CtrlKbdLed {
})?;
for end_point in enumerator.scan_devices()? {
// usb_device gives us a product and vendor ID
if let Some(usb_device) =
end_point.parent_with_subsystem_devtype("usb", "usb_device")?
{
// The asus_wmi driver latches MCU that controls the USB endpoints
if let Some(parent) = end_point.parent() {
if let Some(driver) = parent.driver() {
// There is a tree of devices added so filter by driver
if driver != "asus" {
continue;
}
} else {
continue;
}
}
// Device is something like 002, while its parent is the MCU
// Think of it like the device is an endpoint of the USB device attached
let mut prod_id = String::new();
if let Some(usb_id) = usb_device.attribute_value("idProduct") {
prod_id = usb_id.to_string_lossy().to_string();
let aura_dev = AuraDeviceType::from(prod_id.as_str());
if aura_dev == AuraDeviceType::Unknown || found.contains(&aura_dev) {
log::debug!("Unknown or invalid device: {usb_id:?}, skipping");
continue;
}
found.insert(aura_dev);
}
let dev_node = if let Some(dev_node) = usb_device.devnode() {
dev_node
} else {
debug!("Device has no devnode, skipping");
continue;
};
info!("AuraControl found device at: {:?}", dev_node);
let dbus_path = dbus_path_for_dev(&usb_device).unwrap_or_default();
let dev = HidRaw::from_device(end_point)?;
let mut dev = Self::from_hidraw(dev, dbus_path)?;
dev.config = Self::init_config(&prod_id);
devices.push(dev);
// maybe?
if let Some(device) = Self::maybe_device(end_point, &mut interfaces)? {
devices.push(device);
}
}
// Check for a TUF laptop LED. Assume there is only ever one.
if let Ok(tuf_kbd) = KeyboardLed::new() {
if tuf_kbd.has_kbd_rgb_mode() {
info!("AuraControl found a TUF laptop keyboard");
let ctrl = CtrlKbdLed {
led_type: AuraDeviceType::LaptopTuf,
led_node: LEDNode::KbdLed(tuf_kbd),
supported_data: LedSupportData::get_data("tuf"),
per_key_mode_active: false,
config: Self::init_config("tuf"),
dbus_path: dbus_path_for_tuf(),
};
devices.push(ctrl);
if let Ok(kbd_backlight) = KeyboardBacklight::new() {
if kbd_backlight.has_kbd_rgb_mode() {
// Extra sure double-check that this isn't a laptop with crap
// ACPI with borked return on the TUF rgb methods
let dmi = DMIID::new().unwrap_or_default();
info!("Found a TUF with product family: {}", dmi.product_family);
info!("and board name: {}", dmi.board_name);
if dmi.product_family.contains("TUF") {
info!("AuraControl found a TUF laptop keyboard");
let ctrl = CtrlKbdLed {
led_type: AuraDeviceType::LaptopTuf,
led_node: LEDNode::KbdLed(kbd_backlight),
supported_data: LedSupportData::get_data("tuf"),
per_key_mode_active: false,
config: Self::load_and_update_config("tuf"),
dbus_path: dbus_path_for_tuf(),
};
devices.push(ctrl);
}
}
} else {
let dmi = DMIID::new().unwrap_or_default();
warn!("No asus::kbd_backlight found for {} ??", dmi.product_family);
}
info!("Found {} Aura devices", devices.len());
@@ -144,8 +242,15 @@ impl CtrlKbdLed {
/// The generated data from this function has a default config. This config
/// should be overwritten. The reason for the default config is because
/// of async issues between this and udev/hidraw
pub fn from_hidraw(device: HidRaw, dbus_path: OwnedObjectPath) -> Result<Self, RogError> {
let rgb_led = KeyboardLed::new()?;
fn from_hidraw(device: HidRaw, dbus_path: OwnedObjectPath) -> Result<Self, RogError> {
let rgb_led = KeyboardBacklight::new()
.map_err(|e| {
log::error!(
"{} is missing a keyboard backlight brightness control: {e:?}",
device.prod_id()
);
})
.ok();
let prod_id = AuraDeviceType::from(device.prod_id());
if prod_id == AuraDeviceType::Unknown {
log::error!("{} is AuraDevice::Unknown", device.prod_id());
@@ -167,7 +272,8 @@ impl CtrlKbdLed {
Ok(ctrl)
}
pub fn init_config(prod_id: &str) -> AuraConfig {
/// Reload the config from disk then verify and update it if required
fn load_and_update_config(prod_id: &str) -> AuraConfig {
// New loads data from the DB also
let mut config_init = AuraConfig::new(prod_id);
// config_init.set_filename(prod_id);
@@ -182,6 +288,12 @@ impl CtrlKbdLed {
// Then replace just incase the initialised data contains new modes added
config_loaded.builtins = config_init.builtins;
// Check the powerzones and replace, if the len is different then the support
// file was updated
if config_loaded.enabled.states.len() != config_init.enabled.states.len() {
config_loaded.enabled.states = config_init.enabled.states;
}
if let (Some(mut multizone_init), Some(multizone_loaded)) =
(config_init.multizone, config_loaded.multizone.as_mut())
{
@@ -205,24 +317,42 @@ impl CtrlKbdLed {
config_loaded
}
pub(super) fn fix_ally_power(&mut self) -> Result<(), RogError> {
if self.led_type == AuraDeviceType::Ally {
if let LEDNode::Rog(_, hid_raw) = &self.led_node {
if let Some(fix) = self.config.ally_fix.as_mut() {
if !*fix {
let msg = [0x5d, 0xbd, 0x01, 0xff, 0xff, 0xff, 0xff];
hid_raw.write_bytes(&msg)?;
info!("Reset Ally power settings to base");
}
*fix = true;
}
self.config.write();
}
}
Ok(())
}
/// Set combination state for boot animation/sleep animation/all leds/keys
/// leds/side leds LED active
pub(super) fn set_power_states(&mut self) -> Result<(), RogError> {
if let LEDNode::KbdLed(_platform) = &mut self.led_node {
if let LEDNode::KbdLed(platform) = &mut self.led_node {
// TODO: tuf bool array
// if let Some(pwr) =
// AuraPowerConfig::to_tuf_bool_array(&self.config.enabled) {
// let buf = [1, pwr[1] as u8, pwr[2] as u8, pwr[3] as u8,
// pwr[4] as u8]; platform.set_kbd_rgb_state(&buf)?;
// }
let buf = self.config.enabled.to_bytes(self.led_type);
platform.set_kbd_rgb_state(&buf)?;
} else if let LEDNode::Rog(_, hid_raw) = &self.led_node {
let bytes = self.config.enabled.to_bytes(self.led_type);
let message = [0x5d, 0xbd, 0x01, bytes[0], bytes[1], bytes[2], bytes[3]];
if let Some(p) = self.config.enabled.states.first() {
if p.zone == PowerZones::Ally {
let msg = [0x5d, 0xd1, 0x09, 0x01, p.new_to_byte() as u8, 0x0, 0x0];
hid_raw.write_bytes(&msg)?;
return Ok(());
}
}
hid_raw.write_bytes(&message)?;
hid_raw.write_bytes(&LED_SET)?;
// Changes won't persist unless apply is set
hid_raw.write_bytes(&LED_APPLY)?;
let bytes = self.config.enabled.to_bytes(self.led_type);
let msg = [0x5d, 0xbd, 0x01, bytes[0], bytes[1], bytes[2], bytes[3]];
hid_raw.write_bytes(&msg)?;
}
Ok(())
}
@@ -270,7 +400,8 @@ impl CtrlKbdLed {
Ok(())
}
pub fn write_mode(&mut self, mode: &AuraEffect) -> Result<(), RogError> {
/// Write the AuraEffect to the device
pub fn write_effect_and_apply(&mut self, mode: &AuraEffect) -> Result<(), RogError> {
if let LEDNode::KbdLed(platform) = &self.led_node {
let buf = [
1,
@@ -310,53 +441,25 @@ impl CtrlKbdLed {
}
if create {
info!("No user-set config for zone founding, attempting a default");
self.create_multizone_default()?;
self.config.create_multizone_default(&self.supported_data)?;
}
if let Some(multizones) = self.config.multizone.as_mut() {
if let Some(set) = multizones.get(&mode) {
for mode in set.clone() {
self.write_mode(&mode)?;
self.write_effect_and_apply(&mode)?;
}
}
}
} else {
let mode = self.config.current_mode;
if let Some(effect) = self.config.builtins.get(&mode).cloned() {
self.write_mode(&effect)?;
self.write_effect_and_apply(&effect)?;
}
}
Ok(())
}
/// Create a default for the `current_mode` if multizone and no config
/// exists.
fn create_multizone_default(&mut self) -> Result<(), RogError> {
let mut default = vec![];
for (i, tmp) in self.supported_data.basic_zones.iter().enumerate() {
default.push(AuraEffect {
mode: self.config.current_mode,
zone: *tmp,
colour1: *GRADIENT.get(i).unwrap_or(&GRADIENT[0]),
colour2: *GRADIENT.get(GRADIENT.len() - i).unwrap_or(&GRADIENT[6]),
speed: Speed::Med,
direction: Direction::Left,
});
}
if default.is_empty() {
return Err(RogError::AuraEffectNotSupported);
}
if let Some(multizones) = self.config.multizone.as_mut() {
multizones.insert(self.config.current_mode, default);
} else {
let mut tmp = BTreeMap::new();
tmp.insert(self.config.current_mode, default);
self.config.multizone = Some(tmp);
}
Ok(())
}
}
#[cfg(test)]
@@ -364,7 +467,7 @@ mod tests {
use rog_aura::aura_detection::LedSupportData;
use rog_aura::{AuraDeviceType, AuraModeNum, AuraZone, PowerZones};
use rog_platform::hid_raw::HidRaw;
use rog_platform::keyboard_led::KeyboardLed;
use rog_platform::keyboard_led::KeyboardBacklight;
use zbus::zvariant::OwnedObjectPath;
use super::CtrlKbdLed;
@@ -387,7 +490,10 @@ mod tests {
};
let mut controller = CtrlKbdLed {
led_type: AuraDeviceType::LaptopPost2021,
led_node: LEDNode::Rog(KeyboardLed::default(), HidRaw::new("19b6").unwrap()),
led_node: LEDNode::Rog(
Some(KeyboardBacklight::default()),
HidRaw::new("19b6").unwrap(),
),
supported_data: supported_basic_modes,
per_key_mode_active: false,
config,
@@ -395,12 +501,18 @@ mod tests {
};
assert!(controller.config.multizone.is_none());
assert!(controller.create_multizone_default().is_err());
assert!(controller
.config
.create_multizone_default(&controller.supported_data)
.is_err());
assert!(controller.config.multizone.is_none());
controller.supported_data.basic_zones.push(AuraZone::Key1);
controller.supported_data.basic_zones.push(AuraZone::Key2);
assert!(controller.create_multizone_default().is_ok());
assert!(controller
.config
.create_multizone_default(&controller.supported_data)
.is_ok());
assert!(controller.config.multizone.is_some());
let m = controller.config.multizone.unwrap();
@@ -428,7 +540,10 @@ mod tests {
};
let mut controller = CtrlKbdLed {
led_type: AuraDeviceType::LaptopPost2021,
led_node: LEDNode::Rog(KeyboardLed::default(), HidRaw::new("19b6").unwrap()),
led_node: LEDNode::Rog(
Some(KeyboardBacklight::default()),
HidRaw::new("19b6").unwrap(),
),
supported_data: supported_basic_modes,
per_key_mode_active: false,
config,

View File

@@ -6,10 +6,8 @@
use std::collections::HashSet;
use log::{debug, error, info, warn};
use log::{error, info, warn};
use mio::{Events, Interest, Poll, Token};
use rog_aura::AuraDeviceType;
use rog_platform::hid_raw::HidRaw;
use tokio::task::spawn_blocking;
use udev::{Device, MonitorBuilder};
use zbus::object_server::SignalContext;
@@ -59,93 +57,42 @@ impl AuraManager {
continue;
}
for event in monitor.iter() {
let parent = if let Some(parent) =
let action = event.action().unwrap_or_default();
if let Some(parent) =
event.parent_with_subsystem_devtype("usb", "usb_device")?
{
parent
} else {
continue;
};
let action = if let Some(action) = event.action() {
action
} else {
continue;
};
let id_product = if let Some(id_product) = parent.attribute_value("idProduct") {
id_product.to_string_lossy()
} else {
continue;
};
let path = if let Some(path) = dbus_path_for_dev(&parent) {
path
} else {
continue;
};
let aura_device = AuraDeviceType::from(&*id_product);
if aura_device == AuraDeviceType::Unknown {
warn!("idProduct:{id_product:?} is unknown, not using");
continue;
}
if action == "remove" {
if interfaces.remove(&path) {
info!("AuraManager removing: {path:?}");
let conn_copy = conn_copy.clone();
tokio::spawn(async move {
let res = conn_copy
.object_server()
.remove::<CtrlAuraZbus, _>(&path)
.await
.map_err(|e| {
error!("Failed to remove {path:?}, {e:?}");
e
})?;
info!("AuraManager removed: {path:?}, {res}");
Ok::<(), RogError>(())
});
}
} else if action == "add" {
if interfaces.contains(&path) {
debug!("Already a ctrl at {path:?}");
continue;
}
// Need to check the driver is asus to prevent using hid_generic
if let Some(p2) = event.parent() {
if let Some(driver) = p2.driver() {
// There is a tree of devices added so filter by driver
if driver != "asus" {
debug!("{id_product:?} driver was not asus, skipping");
continue;
}
} else {
continue;
}
}
if let Some(dev_node) = event.devnode() {
if let Ok(raw) = HidRaw::from_device(event.device())
.map_err(|e| error!("device path error: {e:?}"))
{
if let Ok(mut ctrl) = CtrlKbdLed::from_hidraw(raw, path.clone()) {
ctrl.config = CtrlKbdLed::init_config(&id_product);
interfaces.insert(path.clone());
info!("AuraManager starting device at: {dev_node:?}, {path:?}");
let sig_ctx = CtrlAuraZbus::signal_context(&conn_copy)?;
let zbus = CtrlAuraZbus::new(ctrl, sig_ctx);
let sig_ctx = CtrlAuraZbus::signal_context(&conn_copy)?;
if action == "remove" {
if let Some(path) = dbus_path_for_dev(&parent) {
if interfaces.remove(&path) {
info!("AuraManager removing: {path:?}");
let conn_copy = conn_copy.clone();
tokio::spawn(async move {
start_tasks(zbus, conn_copy.clone(), sig_ctx, path).await
let res = conn_copy
.object_server()
.remove::<CtrlAuraZbus, _>(&path)
.await
.map_err(|e| {
error!("Failed to remove {path:?}, {e:?}");
e
})?;
info!("AuraManager removed: {path:?}, {res}");
Ok::<(), RogError>(())
});
}
}
}
};
} else if action == "add" {
if let Ok(Some(ctrl)) =
CtrlKbdLed::maybe_device(event.device(), &mut interfaces)
{
ctrl.add_to_dbus_and_start(&mut interfaces, conn_copy.clone())
.map_err(|e| {
error!("Couldn't start aura device on dbus: {e:?}")
})
.ok();
}
};
}
}
}
// Required for return type on spawn
@@ -169,7 +116,7 @@ pub(crate) fn dbus_path_for_tuf() -> OwnedObjectPath {
ObjectPath::from_str_unchecked(&format!("{AURA_ZBUS_PATH}/tuf")).into()
}
async fn start_tasks(
pub async fn start_tasks(
mut zbus: CtrlAuraZbus,
connection: Connection,
_signal_ctx: SignalContext<'static>,
@@ -180,7 +127,12 @@ async fn start_tasks(
zbus.reload()
.await
.unwrap_or_else(|err| warn!("Controller error: {}", err));
connection.object_server().at(path, zbus).await.unwrap();
connection
.object_server()
.at(path.clone(), zbus)
.await
.map_err(|e| error!("Couldn't add server at path: {path}, {e:?}"))
.ok();
// TODO: skip this until we keep handles to tasks so they can be killed
// task.create_tasks(signal_ctx).await
Ok(())

View File

@@ -1,3 +1,4 @@
use log::warn;
use udev::Device;
use zbus::zvariant::{ObjectPath, OwnedObjectPath};
@@ -12,7 +13,7 @@ pub mod trait_impls;
pub(super) fn filename_partial(parent: &Device) -> Option<OwnedObjectPath> {
if let Some(id_product) = parent.attribute_value("idProduct") {
let id_product = id_product.to_string_lossy();
let path = if let Some(devnum) = parent.attribute_value("devnum") {
let mut path = if let Some(devnum) = parent.attribute_value("devnum") {
let devnum = devnum.to_string_lossy();
if let Some(devpath) = parent.attribute_value("devpath") {
let devpath = devpath.to_string_lossy();
@@ -23,6 +24,10 @@ pub(super) fn filename_partial(parent: &Device) -> Option<OwnedObjectPath> {
} else {
format!("{id_product}")
};
if path.contains('.') {
warn!("dbus path for {id_product} contains `.`, removing");
path.replace('.', "").clone_into(&mut path);
}
return Some(ObjectPath::from_str_unchecked(&path).into());
}
None

View File

@@ -26,7 +26,7 @@ impl CtrlAuraZbus {
}
fn update_config(lock: &mut CtrlKbdLed) -> Result<(), RogError> {
let bright = lock.led_node.get_brightness()?;
let bright = lock.led_node.get_brightness().unwrap_or_default();
lock.config.read();
lock.config.brightness = bright.into();
lock.config.write();
@@ -109,8 +109,10 @@ impl CtrlAuraZbus {
if ctrl.config.brightness == LedBrightness::Off {
ctrl.config.brightness = LedBrightness::Med;
}
ctrl.led_node
.set_brightness(ctrl.config.brightness.into())?;
if ctrl.led_node.has_brightness_control() {
ctrl.led_node
.set_brightness(ctrl.config.brightness.into())?;
}
ctrl.config.write();
self.led_mode_data_invalidate(&self.1).await.ok();
@@ -144,12 +146,14 @@ impl CtrlAuraZbus {
)));
}
ctrl.write_mode(&effect)?;
ctrl.write_effect_and_apply(&effect)?;
if ctrl.config.brightness == LedBrightness::Off {
ctrl.config.brightness = LedBrightness::Med;
}
ctrl.led_node
.set_brightness(ctrl.config.brightness.into())?;
if ctrl.led_node.has_brightness_control() {
ctrl.led_node
.set_brightness(ctrl.config.brightness.into())?;
}
ctrl.config.set_builtin(effect);
ctrl.config.write();
@@ -213,12 +217,14 @@ impl CtrlTask for CtrlAuraZbus {
// If waking up
if !start {
info!("CtrlKbdLedTask reloading brightness and modes");
lock.led_node
.set_brightness(lock.config.brightness.into())
.map_err(|e| {
error!("CtrlKbdLedTask: {e}");
e
})?;
if lock.led_node.has_brightness_control() {
lock.led_node
.set_brightness(lock.config.brightness.into())
.map_err(|e| {
error!("CtrlKbdLedTask: {e}");
e
})?;
}
lock.write_current_config_mode().map_err(|e| {
error!("CtrlKbdLedTask: {e}");
e
@@ -264,20 +270,24 @@ impl CtrlTask for CtrlAuraZbus {
let ctrl2 = self.0.clone();
let ctrl = self.0.lock().await;
let watch = ctrl.led_node.monitor_brightness()?;
tokio::spawn(async move {
let mut buffer = [0; 32];
watch
.into_event_stream(&mut buffer)
.unwrap()
.for_each(|_| async {
if let Some(lock) = ctrl2.try_lock() {
load_save(true, lock).unwrap(); // unwrap as we want to
// bomb out of the task
}
})
.await;
});
if ctrl.led_node.has_brightness_control() {
let watch = ctrl.led_node.monitor_brightness()?;
tokio::spawn(async move {
let mut buffer = [0; 32];
watch
.into_event_stream(&mut buffer)
.unwrap()
.for_each(|_| async {
if let Some(lock) = ctrl2.try_lock() {
load_save(true, lock).unwrap(); // unwrap as we want
// to
// bomb out of the
// task
}
})
.await;
});
}
Ok(())
}
@@ -286,6 +296,7 @@ impl CtrlTask for CtrlAuraZbus {
impl crate::Reloadable for CtrlAuraZbus {
async fn reload(&mut self) -> Result<(), RogError> {
let mut ctrl = self.0.lock().await;
ctrl.fix_ally_power()?;
debug!("reloading keyboard mode");
ctrl.write_current_config_mode()?;
debug!("reloading power states");

View File

@@ -8,7 +8,7 @@ use rog_platform::platform::{RogPlatform, ThrottlePolicy};
use rog_profiles::error::ProfileError;
use rog_profiles::fan_curve_set::CurveData;
use rog_profiles::{find_fan_curve_node, FanCurvePU, FanCurveProfiles};
use serde_derive::{Deserialize, Serialize};
use serde::{Deserialize, Serialize};
use tokio::sync::Mutex;
use zbus::{interface, Connection, SignalContext};

View File

@@ -5,21 +5,17 @@ use std::sync::Arc;
use config_traits::StdConfig;
use log::{debug, error, info, warn};
use rog_platform::cpu::{CPUControl, CPUGovernor, CPUEPP};
// use rog_platform::firmware_attributes::FirmwareAttributes;
use rog_platform::platform::{GpuMode, Properties, RogPlatform, ThrottlePolicy};
use rog_platform::power::AsusPower;
use zbus::export::futures_util::lock::Mutex;
use zbus::fdo::Error as FdoErr;
use zbus::{interface, Connection, ObjectServer, SignalContext};
use zbus::{interface, Connection, SignalContext};
use crate::config::Config;
use crate::ctrl_anime::trait_impls::{CtrlAnimeZbus, ANIME_ZBUS_NAME, ANIME_ZBUS_PATH};
use crate::ctrl_aura::trait_impls::{CtrlAuraZbus, AURA_ZBUS_NAME, AURA_ZBUS_PATH};
use crate::ctrl_fancurves::{CtrlFanCurveZbus, FAN_CURVE_ZBUS_NAME, FAN_CURVE_ZBUS_PATH};
use crate::ctrl_slash::trait_impls::{CtrlSlashZbus, SLASH_ZBUS_NAME, SLASH_ZBUS_PATH};
use crate::error::RogError;
use crate::{task_watch_item, task_watch_item_notify, CtrlTask, ReloadAndNotify};
const PLATFORM_ZBUS_NAME: &str = "Platform";
const PLATFORM_ZBUS_PATH: &str = "/org/asuslinux";
macro_rules! platform_get_value {
@@ -99,6 +95,7 @@ impl CtrlPlatform {
config_path: &Path,
signal_context: SignalContext<'static>,
) -> Result<Self, RogError> {
// let attrs = FirmwareAttributes::new();
let platform = RogPlatform::new()?;
let power = AsusPower::new()?;
@@ -137,13 +134,12 @@ impl CtrlPlatform {
| inotify::WatchMask::ATTRIB
| inotify::WatchMask::CREATE,
)
.map_err(|e| {
.inspect_err(|e| {
if e.kind() == std::io::ErrorKind::NotFound {
error!("Not found: {:?}", config_path);
} else {
error!("Could not set asusd config inotify: {:?}", config_path);
}
e
})
.ok();
let mut events = inotify.into_event_stream(&mut buffer).unwrap();
@@ -258,6 +254,21 @@ impl CtrlPlatform {
}
async fn update_policy_ac_or_bat(&self, power_plugged: bool, change_epp: bool) {
if power_plugged && !self.config.lock().await.change_throttle_policy_on_ac {
debug!(
"Power status changed but set_throttle_policy_on_ac set false. Not setting the \
thing"
);
return;
}
if !power_plugged && !self.config.lock().await.change_throttle_policy_on_battery {
debug!(
"Power status changed but set_throttle_policy_on_battery set false. Not setting \
the thing"
);
return;
}
let throttle = if power_plugged {
self.config.lock().await.throttle_policy_on_ac
} else {
@@ -328,49 +339,6 @@ impl CtrlPlatform {
supported
}
async fn supported_interfaces(
&self,
#[zbus(object_server)] server: &ObjectServer,
) -> Vec<String> {
let mut interfaces = Vec::default();
if server
.interface::<_, CtrlAnimeZbus>(ANIME_ZBUS_PATH)
.await
.is_ok()
{
interfaces.push(ANIME_ZBUS_NAME.to_owned());
}
if server
.interface::<_, CtrlAuraZbus>(AURA_ZBUS_PATH)
.await
.is_ok()
{
interfaces.push(AURA_ZBUS_NAME.to_owned());
}
if server
.interface::<_, CtrlFanCurveZbus>(FAN_CURVE_ZBUS_PATH)
.await
.is_ok()
{
interfaces.push(FAN_CURVE_ZBUS_NAME.to_owned());
}
if server
.interface::<_, CtrlPlatform>(PLATFORM_ZBUS_PATH)
.await
.is_ok()
{
interfaces.push(PLATFORM_ZBUS_NAME.to_owned());
}
if server
.interface::<_, CtrlSlashZbus>(SLASH_ZBUS_PATH)
.await
.is_ok()
{
interfaces.push(SLASH_ZBUS_NAME.to_owned());
}
interfaces
}
#[zbus(property)]
fn charge_control_end_threshold(&self) -> Result<u8, FdoErr> {
let limit = self.power.get_charge_control_end_threshold()?;
@@ -496,6 +464,18 @@ impl CtrlPlatform {
Ok(())
}
#[zbus(property)]
async fn change_throttle_policy_on_battery(&self) -> Result<bool, FdoErr> {
Ok(self.config.lock().await.change_throttle_policy_on_battery)
}
#[zbus(property)]
async fn set_change_throttle_policy_on_battery(&mut self, change: bool) -> Result<(), FdoErr> {
self.config.lock().await.change_throttle_policy_on_battery = change;
self.config.lock().await.write();
Ok(())
}
#[zbus(property)]
async fn throttle_policy_on_ac(&self) -> Result<ThrottlePolicy, FdoErr> {
Ok(self.config.lock().await.throttle_policy_on_ac)
@@ -509,6 +489,18 @@ impl CtrlPlatform {
Ok(())
}
#[zbus(property)]
async fn change_throttle_policy_on_ac(&self) -> Result<bool, FdoErr> {
Ok(self.config.lock().await.change_throttle_policy_on_ac)
}
#[zbus(property)]
async fn set_change_throttle_policy_on_ac(&mut self, change: bool) -> Result<(), FdoErr> {
self.config.lock().await.change_throttle_policy_on_ac = change;
self.config.lock().await.write();
Ok(())
}
/// The energy_performance_preference for the quiet throttle/platform
/// profile
#[zbus(property)]
@@ -720,6 +712,7 @@ impl crate::ZbusRun for CtrlPlatform {
impl ReloadAndNotify for CtrlPlatform {
type Data = Config;
/// Called on config file changed externally
async fn reload_and_notify(
&mut self,
signal_context: &SignalContext<'static>,
@@ -730,8 +723,9 @@ impl ReloadAndNotify for CtrlPlatform {
info!("asusd.ron updated externally, reloading and updating internal copy");
if self.power.has_charge_control_end_threshold() {
self.power
.set_charge_control_end_threshold(data.charge_control_end_threshold)?;
let limit = data.charge_control_end_threshold;
warn!("setting charge_control_end_threshold to {limit}");
self.power.set_charge_control_end_threshold(limit)?;
self.charge_control_end_threshold_changed(signal_context)
.await?;
}
@@ -790,6 +784,15 @@ impl ReloadAndNotify for CtrlPlatform {
impl crate::Reloadable for CtrlPlatform {
async fn reload(&mut self) -> Result<(), RogError> {
info!("Begin Platform settings restore");
if self.power.has_charge_control_end_threshold() {
let limit = self.config.lock().await.charge_control_end_threshold;
info!("reloading charge_control_end_threshold to {limit}");
self.power.set_charge_control_end_threshold(limit)?;
} else {
warn!("No charge_control_end_threshold found")
}
macro_rules! reload {
($property:tt, $prop_name:literal) => {
concat_idents::concat_idents!(has = has_, $property {
@@ -825,12 +828,6 @@ impl crate::Reloadable for CtrlPlatform {
ppt_reload!(nv_dynamic_boost, "nv_dynamic_boost");
ppt_reload!(nv_temp_target, "nv_temp_target");
if self.power.has_charge_control_end_threshold() {
self.power.set_charge_control_end_threshold(
self.config.lock().await.charge_control_end_threshold,
)?;
}
if let Ok(power_plugged) = self.power.get_online() {
self.config.lock().await.last_power_plugged = power_plugged;
if self.platform.has_throttle_thermal_policy() {
@@ -846,11 +843,11 @@ impl crate::Reloadable for CtrlPlatform {
}
impl CtrlPlatform {
task_watch_item!(panel_od platform);
task_watch_item!(panel_od "panel_od" platform);
task_watch_item!(mini_led_mode platform);
task_watch_item!(mini_led_mode "mini_led_mode" platform);
task_watch_item!(charge_control_end_threshold power);
task_watch_item!(charge_control_end_threshold "charge_control_end_threshold" power);
task_watch_item_notify!(boot_sound platform);
@@ -900,12 +897,16 @@ impl CtrlTask for CtrlPlatform {
})
.ok();
}
if sleeping && platform1.power.has_charge_control_end_threshold() {
platform1.config.lock().await.charge_control_end_threshold = platform1
.power
.get_charge_control_end_threshold()
.unwrap_or(100);
} else if !sleeping && platform1.power.has_charge_control_end_threshold() {
// This block is commented out due to some kind of issue reported. Maybe the
// desktops used were storing a value whcih was then read here.
// Don't store it on suspend, assume that the current config setting is desired
// if sleeping && platform1.power.has_charge_control_end_threshold() {
// platform1.config.lock().await.charge_control_end_threshold = platform1
// .power
// .get_charge_control_end_threshold()
// .unwrap_or(100);
// } else
if !sleeping && platform1.power.has_charge_control_end_threshold() {
platform1
.power
.set_charge_control_end_threshold(

View File

@@ -1,6 +1,6 @@
use config_traits::{StdConfig, StdConfigLoad};
use rog_slash::{DeviceState, SlashMode};
use serde_derive::{Deserialize, Serialize};
use serde::{Deserialize, Serialize};
const CONFIG_FILE: &str = "slash.ron";

View File

@@ -1,10 +1,12 @@
pub mod config;
pub mod trait_impls;
use config_traits::{StdConfig, StdConfigLoad};
use log::info;
use rog_platform::hid_raw::HidRaw;
use rog_platform::usb_raw::USBRaw;
use rog_slash::error::SlashError;
use rog_slash::usb::{get_slash_type, pkt_set_mode, pkt_set_options, pkts_for_init};
use rog_slash::usb::{get_maybe_slash_type, pkt_set_mode, pkt_set_options, pkts_for_init};
use rog_slash::{SlashMode, SlashType};
use crate::ctrl_slash::config::SlashConfig;
@@ -31,21 +33,16 @@ impl Node {
}
pub struct CtrlSlash {
// node: HidRaw,
node: Node,
config: SlashConfig,
// slash_type: SlashType,
// // set to force thread to exit
// thread_exit: Arc<AtomicBool>,
// // Set to false when the thread exits
// thread_running: Arc<AtomicBool>,
}
impl CtrlSlash {
#[inline]
pub fn new(config: SlashConfig) -> Result<CtrlSlash, RogError> {
let slash_type = get_slash_type()?;
if matches!(slash_type, SlashType::Unknown | SlashType::Unsupported) {
pub fn new() -> Result<CtrlSlash, RogError> {
let slash_type = get_maybe_slash_type()?;
if matches!(slash_type, SlashType::Unsupported) {
info!("No Slash capable laptop found");
return Err(RogError::Slash(SlashError::NoDevice));
}
@@ -56,15 +53,12 @@ impl CtrlSlash {
} else if hid.is_some() {
unsafe { Node::Hid(hid.unwrap_unchecked()) }
} else {
return Err(RogError::NotSupported);
return Err(RogError::Slash(SlashError::NoDevice));
};
let ctrl = CtrlSlash {
node,
config,
// slash_type,
// thread_exit: Arc::new(AtomicBool::new(false)),
// thread_running: Arc::new(AtomicBool::new(false)),
config: SlashConfig::new().load(),
};
ctrl.do_initialization()?;

View File

@@ -33,6 +33,7 @@ impl CtrlSlashZbus {
}
/// Set enabled true or false
#[zbus(property)]
async fn set_enabled(&self, enabled: bool) {
let mut lock = self.0.lock().await;
let brightness = if enabled && lock.config.slash_brightness == 0 {
@@ -64,6 +65,7 @@ impl CtrlSlashZbus {
}
/// Set brightness level
#[zbus(property)]
async fn set_brightness(&self, brightness: u8) {
let mut lock = self.0.lock().await;
let enabled = brightness > 0;
@@ -90,6 +92,7 @@ impl CtrlSlashZbus {
}
/// Set interval between slash animations (0-255)
#[zbus(property)]
async fn set_interval(&self, interval: u8) {
let mut lock = self.0.lock().await;
lock.node
@@ -114,6 +117,7 @@ impl CtrlSlashZbus {
}
/// Set interval between slash animations (0-255)
#[zbus(property)]
async fn set_slash_mode(&self, slash_mode: SlashMode) {
let mut lock = self.0.lock().await;

View File

@@ -5,17 +5,15 @@ use std::sync::Arc;
use ::zbus::export::futures_util::lock::Mutex;
use ::zbus::Connection;
use asusd::config::Config;
use asusd::ctrl_anime::config::AnimeConfig;
use asusd::ctrl_anime::trait_impls::CtrlAnimeZbus;
use asusd::ctrl_anime::CtrlAnime;
use asusd::ctrl_aura::manager::AuraManager;
use asusd::ctrl_fancurves::CtrlFanCurveZbus;
use asusd::ctrl_platform::CtrlPlatform;
use asusd::ctrl_slash::config::SlashConfig;
use asusd::ctrl_slash::trait_impls::CtrlSlashZbus;
use asusd::ctrl_slash::CtrlSlash;
use asusd::{print_board_info, start_tasks, CtrlTask, DBUS_NAME};
use config_traits::{StdConfig, StdConfigLoad, StdConfigLoad2, StdConfigLoad3};
use config_traits::{StdConfig, StdConfigLoad1};
use log::{error, info};
use zbus::fdo::ObjectManager;
@@ -64,7 +62,7 @@ async fn start_daemon() -> Result<(), Box<dyn Error>> {
let mut connection = Connection::system().await?;
connection
.object_server()
.at("/org/asuslinux", ObjectManager)
.at("/", ObjectManager)
.await
.unwrap();
@@ -98,7 +96,7 @@ async fn start_daemon() -> Result<(), Box<dyn Error>> {
}
}
match CtrlAnime::new(AnimeConfig::new().load()) {
match CtrlAnime::new() {
Ok(ctrl) => {
let zbus = CtrlAnimeZbus(Arc::new(Mutex::new(ctrl)));
let sig_ctx = CtrlAnimeZbus::signal_context(&connection)?;
@@ -109,7 +107,7 @@ async fn start_daemon() -> Result<(), Box<dyn Error>> {
}
}
match CtrlSlash::new(SlashConfig::new().load()) {
match CtrlSlash::new() {
Ok(ctrl) => {
let zbus = CtrlSlashZbus(Arc::new(Mutex::new(ctrl)));
// Currently, the Slash has no need for a loop watching power events, however,

View File

@@ -56,7 +56,7 @@ pub static DBUS_IFACE: &str = "org.asuslinux.Daemon";
/// // TODO: this is kind of useless if it can't trigger some action
#[macro_export]
macro_rules! task_watch_item {
($name:ident $self_inner:ident) => {
($name:ident $name_str:literal $self_inner:ident) => {
concat_idents::concat_idents!(fn_name = watch_, $name {
async fn fn_name(
&self,
@@ -72,12 +72,15 @@ macro_rules! task_watch_item {
let mut buffer = [0; 32];
watch.into_event_stream(&mut buffer).unwrap().for_each(|_| async {
if let Ok(value) = ctrl.$name() { // get new value from zbus method
concat_idents::concat_idents!(notif_fn = $name, _changed {
ctrl.notif_fn(&signal_ctxt).await.ok();
});
let mut lock = ctrl.config.lock().await;
lock.$name = value;
lock.write();
if ctrl.config.lock().await.$name != value {
log::debug!("{} was changed to {} externally", $name_str, value);
concat_idents::concat_idents!(notif_fn = $name, _changed {
ctrl.notif_fn(&signal_ctxt).await.ok();
});
let mut lock = ctrl.config.lock().await;
lock.$name = value;
lock.write();
}
}
}).await;
});

View File

@@ -146,11 +146,7 @@ where
/// Renames the existing file to `<file>-old`
fn rename_file_old(&self) {
warn!(
"Renaming {} to {}-old and recreating config",
self.file_name(),
self.file_name()
);
warn!("Renaming {} to {}-old", self.file_name(), self.file_name());
let mut cfg_old = self.file_path().to_string_lossy().to_string();
cfg_old.push_str("-old");
std::fs::rename(self.file_path(), cfg_old).unwrap_or_else(|err| {
@@ -274,6 +270,8 @@ mod tests {
}
}
let _ = Test {};
impl crate::StdConfigLoad1<Old1> for Test {}
}
@@ -323,6 +321,8 @@ mod tests {
}
}
let _ = Test {};
impl crate::StdConfigLoad3<Old1, Old2, Old3> for Test {}
}
}

View File

@@ -7,6 +7,7 @@ ENV{DMI_FAMILY}=="*ROG*", GOTO="asusd_start"
ENV{DMI_FAMILY}=="*Zephyrus*", GOTO="asusd_start"
ENV{DMI_FAMILY}=="*Strix*", GOTO="asusd_start"
ENV{DMI_FAMILY}=="*Vivo*ook*", GOTO="asusd_start"
ENV{DMI_FAMILY}=="*Zenbook*", GOTO="asusd_start"
# No match so
GOTO="asusd_end"

View File

@@ -20,13 +20,14 @@
%global debug_package %{nil}
%endif
%global rpm_dkms_opt 1
%define specrelease %{?dist}
%define pkg_release 3%{specrelease}
# Use hardening ldflags.
%global rustflags -Clink-arg=-Wl,-z,relro,-z,now
Name: asusctl
Version: 4.7.0
Release: 2
Version: 6.0.7
Release: %{pkg_release}
Summary: Control fan speeds, LEDs, graphics modes, and charge levels for ASUS notebooks
License: MPLv2
@@ -34,8 +35,8 @@ Group: System Environment/Kernel
URL: https://gitlab.com/asus-linux/asusctl
Source: %{name}-%{version}.tar.gz
Source1: vendor-%{name}-%{version}.tar.gz
Source2: cargo_config
Source1: vendor_%{name}_%{version}.tar.xz
Source2: cargo-config
BuildRequires: cargo
BuildRequires: rust-packaging
@@ -44,12 +45,20 @@ BuildRequires: clang-devel
BuildRequires: cmake
BuildRequires: rust
BuildRequires: rust-std-static
BuildRequires: pkgconfig(expat)
BuildRequires: pkgconfig(gbm)
BuildRequires: pkgconfig(dbus-1)
BuildRequires: pkgconfig(libdrm)
BuildRequires: pkgconfig(libinput)
BuildRequires: pkgconfig(libseat)
BuildRequires: pkgconfig(libudev)
BuildRequires: pkgconfig(xkbcommon)
BuildRequires: pkgconfig(libzstd)
BuildRequires: pkgconfig(gtk+-3.0)
BuildRequires: pkgconfig(gdk-3.0)
BuildRequires: desktop-file-utils
Requires: libappindicator-gtk3
# expat-devel pcre2-devel
%description
asus-nb-ctrl is a utility for Linux to control many aspects of various
@@ -67,9 +76,10 @@ A one-stop-shop GUI tool for asusd/asusctl. It aims to provide most controls,
a notification service, and ability to run in the background.
%prep
# %setup -D -T -a 1 -c -n %{name}-%{version}/vendor
# %setup -D -T -a 0 -c
%autosetup
%setup -D -T -a 1 -c -n %{name}-%{version}/vendor
cd ..
%setup -D -T -a 1
mv Cargo.lock{,.bak}
%cargo_prep
@@ -86,7 +96,7 @@ export RUSTFLAGS="%{rustflags}"
export RUSTFLAGS="%{rustflags}"
mkdir -p "%{buildroot}/%{_bindir}" "%{buildroot}%{_docdir}"
%make_install
install -D -m 0644 README.md %{buildroot}/%{_docdir}/%{name}/README.md
install -D -m 0644 rog-anime/README.md %{buildroot}/%{_docdir}/%{name}/README-anime.md
install -D -m 0644 rog-anime/data/diagonal-template.png %{buildroot}/%{_docdir}/%{name}/diagonal-template.png

View File

@@ -28,7 +28,6 @@ gif.workspace = true
log.workspace = true
serde.workspace = true
serde_derive.workspace = true
glam.workspace = true
typeshare.workspace = true

View File

@@ -4,7 +4,7 @@ use std::thread::sleep;
use std::time::{Duration, Instant};
use log::info;
use serde_derive::{Deserialize, Serialize};
use serde::{Deserialize, Serialize};
use typeshare::typeshare;
#[cfg(feature = "dbus")]
use zbus::zvariant::{OwnedValue, Type, Value};
@@ -62,7 +62,7 @@ pub enum AnimeType {
GA401,
GA402,
GU604,
Unknown,
Unsupported,
}
impl FromStr for AnimeType {
@@ -73,7 +73,7 @@ impl FromStr for AnimeType {
"ga401" | "GA401" => Self::GA401,
"ga402" | "GA402" => Self::GA402,
"gu604" | "GU604" => Self::GU604,
_ => Self::Unknown,
_ => Self::Unsupported,
})
}
}
@@ -165,7 +165,7 @@ impl TryFrom<AnimeDataBuffer> for AnimePacketType {
let mut buffers = match anime.anime {
AnimeType::GA401 => vec![[0; 640]; 2],
AnimeType::GA402 | AnimeType::GU604 | AnimeType::Unknown => vec![[0; 640]; 3],
AnimeType::GA402 | AnimeType::GU604 | AnimeType::Unsupported => vec![[0; 640]; 3],
};
for (idx, chunk) in anime.data.as_slice().chunks(PANE_LEN).enumerate() {
@@ -176,7 +176,7 @@ impl TryFrom<AnimeDataBuffer> for AnimePacketType {
if matches!(
anime.anime,
AnimeType::GA402 | AnimeType::GU604 | AnimeType::Unknown
AnimeType::GA402 | AnimeType::GU604 | AnimeType::Unsupported
) {
buffers[2][..7].copy_from_slice(&USB_PREFIX3);
}

View File

@@ -3,6 +3,8 @@
use std::path::Path;
use std::time::Duration;
use log::error;
use crate::data::AnimeDataBuffer;
use crate::error::{AnimeError, Result};
use crate::AnimeType;
@@ -49,7 +51,10 @@ impl AnimeDiagonal {
bright: f32,
anime_type: AnimeType,
) -> Result<Self> {
let data = std::fs::read(path)?;
let data = std::fs::read(path).map_err(|e| {
error!("Could not open {path:?}: {e:?}");
e
})?;
let data = std::io::Cursor::new(data);
let decoder = png_pong::Decoder::new(data)?.into_steps();
let png_pong::Step { raster, delay: _ } = decoder.last().ok_or(AnimeError::NoFrames)??;

View File

@@ -4,7 +4,8 @@ use std::path::Path;
use std::time::Duration;
use glam::Vec2;
use serde_derive::{Deserialize, Serialize};
use log::error;
use serde::{Deserialize, Serialize};
use crate::error::{AnimeError, Result};
use crate::{AnimeDataBuffer, AnimeDiagonal, AnimeImage, AnimeType, Pixel};
@@ -107,7 +108,10 @@ impl AnimeGif {
// Configure the decoder such that it will expand the image to RGBA.
decoder.set_color_output(gif::ColorOutput::RGBA);
// Read the file header
let file = File::open(file_name)?;
let file = File::open(file_name).map_err(|e| {
error!("Could not open {file_name:?}: {e:?}");
e
})?;
let mut decoder = decoder.read_info(file)?;
let mut frames = Vec::default();
@@ -186,12 +190,14 @@ impl AnimeGif {
anime_type: AnimeType,
) -> Result<Self> {
let mut frames = Vec::new();
let mut decoder = gif::DecodeOptions::new();
// Configure the decoder such that it will expand the image to RGBA.
decoder.set_color_output(gif::ColorOutput::RGBA);
// Read the file header
let file = File::open(file_name)?;
let file = File::open(file_name).map_err(|e| {
error!("Could not open {file_name:?}: {e:?}");
e
})?;
let mut decoder = decoder.read_info(file)?;
let height = decoder.height();

View File

@@ -3,6 +3,7 @@ use std::path::Path;
pub use glam::Vec2;
use glam::{Mat3, Vec3};
use log::error;
use crate::data::AnimeDataBuffer;
use crate::error::{AnimeError, Result};
@@ -421,7 +422,10 @@ impl AnimeImage {
bright: f32,
anime_type: AnimeType,
) -> Result<Self> {
let data = std::fs::read(path)?;
let data = std::fs::read(path).map_err(|e| {
error!("Could not open {path:?}: {e:?}");
e
})?;
let data = std::io::Cursor::new(data);
let decoder = png_pong::Decoder::new(data)?.into_steps();
let png_pong::Step { raster, delay: _ } = decoder.last().ok_or(AnimeError::NoFrames)??;

View File

@@ -3,7 +3,7 @@ use std::path::PathBuf;
use std::time::Duration;
use glam::Vec2;
use serde_derive::{Deserialize, Serialize};
use serde::{Deserialize, Serialize};
use crate::error::Result;
use crate::{AnimTime, AnimeDataBuffer, AnimeDiagonal, AnimeGif, AnimeImage, AnimeType};

View File

@@ -11,7 +11,7 @@
use std::str::FromStr;
use dmi_id::DMIID;
use serde_derive::{Deserialize, Serialize};
use serde::{Deserialize, Serialize};
use typeshare::typeshare;
#[cfg(feature = "dbus")]
use zbus::zvariant::{OwnedValue, Type, Value};
@@ -241,25 +241,25 @@ impl From<AnimShutdown> for i32 {
}
}
/// `get_anime_type` is very broad, matching on part of the laptop board name
/// only. For this reason `find_node()` must be used also to verify if the USB
/// device is available.
/// `get_maybe_anime_type` is very broad, matching on part of the laptop board
/// name only. For this reason `find_node()` must be used also to verify if the
/// USB device is available.
///
/// The currently known USB device is `19b6`.
#[inline]
pub fn get_anime_type() -> Result<AnimeType, AnimeError> {
pub fn get_maybe_anime_type() -> Result<AnimeType, AnimeError> {
let dmi = DMIID::new().map_err(|_| AnimeError::NoDevice)?; // TODO: better error
let board_name = dmi.board_name;
if board_name.contains("GA401I") || board_name.contains("GA401Q") {
return Ok(AnimeType::GA401);
} else if board_name.contains("GA402R") {
} else if board_name.contains("GA402R") || board_name.contains("GA402X") {
return Ok(AnimeType::GA402);
} else if board_name.contains("GU604V") {
return Ok(AnimeType::GU604);
}
log::warn!("AniMe Matrix device found but not yet supported, will default to a GA402 layout");
Ok(AnimeType::Unknown)
log::warn!("AniMe Matrix device found but could be a slash");
Ok(AnimeType::Unsupported)
}
/// Get the two device initialization packets. These are required for device

View File

@@ -18,7 +18,6 @@ dbus = ["zbus"]
[dependencies]
serde.workspace = true
serde_derive.workspace = true
zbus = { workspace = true, optional = true }
dmi_id = { path = "../dmi-id" }

View File

@@ -3,7 +3,7 @@
device_name: "FA506I",
product_id: "",
layout_name: "fa506i",
basic_modes: [Static, Breathe, Strobe, Pulse],
basic_modes: [Static, Breathe, RainbowCycle, RainbowWave, Pulse],
basic_zones: [],
advanced_type: None,
power_zones: [Keyboard],
@@ -12,7 +12,7 @@
device_name: "FA506Q",
product_id: "",
layout_name: "fa506i",
basic_modes: [Static, Breathe, Strobe, Rainbow],
basic_modes: [Static, Breathe, RainbowCycle, RainbowWave, Pulse],
basic_zones: [],
advanced_type: None,
power_zones: [Keyboard],
@@ -21,43 +21,25 @@
device_name: "FA507",
product_id: "",
layout_name: "fa507",
basic_modes: [Static, Breathe, Strobe, Pulse],
basic_modes: [Static, Breathe, RainbowCycle, RainbowWave, Pulse],
basic_zones: [],
advanced_type: None,
power_zones: [Keyboard],
),
(
device_name: "FX505D",
device_name: "FX505",
product_id: "",
layout_name: "fx505d",
basic_modes: [Static, Breathe, Strobe, Rainbow, Pulse],
basic_modes: [Static, Breathe, RainbowCycle, RainbowWave, Pulse],
basic_zones: [],
advanced_type: None,
power_zones: [Keyboard],
),
(
device_name: "FX505G",
product_id: "",
layout_name: "fx505d",
basic_modes: [Static, Breathe, Strobe, Rainbow, Pulse],
basic_zones: [],
advanced_type: None,
power_zones: [Keyboard],
),
(
device_name: "FX506H",
device_name: "FX506",
product_id: "",
layout_name: "fa506i",
basic_modes: [Static, Breathe, Strobe, Pulse],
basic_zones: [],
advanced_type: None,
power_zones: [Keyboard],
),
(
device_name: "FX506L",
product_id: "",
layout_name: "fa506i",
basic_modes: [Static, Breathe, Strobe, Pulse],
basic_modes: [Static, Breathe, RainbowCycle, RainbowWave, Pulse],
basic_zones: [],
advanced_type: None,
power_zones: [Keyboard],
@@ -66,7 +48,7 @@
device_name: "FX507Z",
product_id: "",
layout_name: "fa506i",
basic_modes: [Static, Breathe, Strobe, Pulse],
basic_modes: [Static, Breathe, RainbowCycle, RainbowWave, Pulse],
basic_zones: [],
advanced_type: None,
power_zones: [Keyboard],
@@ -75,7 +57,16 @@
device_name: "FX516P",
product_id: "",
layout_name: "fa506i",
basic_modes: [Static, Breathe, Strobe],
basic_modes: [Static, Breathe, Pulse],
basic_zones: [],
advanced_type: None,
power_zones: [Keyboard],
),
(
device_name: "FX517Z",
product_id: "",
layout_name: "fa506i",
basic_modes: [Static, Breathe, Pulse],
basic_zones: [],
advanced_type: None,
power_zones: [Keyboard],
@@ -84,151 +75,70 @@
device_name: "FX705D",
product_id: "",
layout_name: "fx505d",
basic_modes: [Static, Breathe, Strobe, Pulse],
basic_modes: [Static, Breathe, RainbowCycle, RainbowWave, Pulse],
basic_zones: [],
advanced_type: None,
power_zones: [Keyboard],
),
(
device_name: "G512",
device_name: "G512L",
product_id: "",
layout_name: "g512",
basic_modes: [Static, Breathe, Strobe, Rainbow, Pulse],
basic_modes: [Static, Breathe, RainbowCycle, RainbowWave, Pulse],
basic_zones: [Key1, Key2, Key3, Key4],
advanced_type: None,
power_zones: [Keyboard],
),
(
device_name: "G512LV",
product_id: "",
layout_name: "ga401q",
basic_modes: [Static, Breathe, Strobe, Rainbow, Pulse],
basic_zones: [Key1, Key2, Key3, Key4],
advanced_type: None,
power_zones: [Keyboard],
power_zones: [Keyboard, Lightbar],
),
(
device_name: "G513I",
product_id: "",
layout_name: "g513i",
basic_modes: [Static, Breathe, Strobe, Rainbow, Pulse],
basic_modes: [Static, Breathe, RainbowCycle, RainbowWave, Pulse],
basic_zones: [Key1, Key2, Key3, Key4],
advanced_type: Zoned([ZonedKbLeft, ZonedKbLeftMid, ZonedKbRightMid, ZonedKbRight, LightbarRight, LightbarRightCorner, LightbarRightBottom, LightbarLeftBottom, LightbarLeftCorner, LightbarLeft]),
power_zones: [Keyboard, Lightbar],
),
(
device_name: "G513QE",
device_name: "G513Q",
product_id: "",
layout_name: "g513i",
basic_modes: [Static, Breathe, Strobe, Rainbow, Pulse],
basic_modes: [Static, Breathe, RainbowCycle, RainbowWave, Pulse],
basic_zones: [Key1, Key2, Key3, Key4],
advanced_type: None,
power_zones: [Keyboard],
),
(
device_name: "G513QM",
product_id: "",
layout_name: "g513i",
basic_modes: [Static, Breathe, Strobe, Rainbow, Star, Rain, Highlight, Laser, Ripple, Pulse, Comet, Flash],
basic_zones: [],
advanced_type: PerKey,
power_zones: [Keyboard],
power_zones: [Keyboard, Lightbar],
),
(
device_name: "G513QR",
product_id: "",
layout_name: "g513i-per-key",
basic_modes: [Static, Breathe, Strobe, Rainbow, Star, Rain, Highlight, Laser, Ripple, Pulse, Comet, Flash],
basic_modes: [Static, Breathe, RainbowCycle, RainbowWave, Star, Rain, Highlight, Laser, Ripple, Pulse, Comet, Flash],
basic_zones: [],
advanced_type: PerKey,
power_zones: [Keyboard],
power_zones: [Keyboard, Lightbar],
),
(
device_name: "G513QY",
device_name: "G513R",
product_id: "",
layout_name: "g513i-per-key",
basic_modes: [Static, Breathe, Strobe, Rainbow, Pulse],
basic_zones: [Key1, Key2, Key3, Key4],
basic_modes: [Static, Breathe, RainbowCycle, RainbowWave, Star, Rain, Highlight, Laser, Ripple, Pulse, Comet, Flash],
basic_zones: [],
advanced_type: PerKey,
power_zones: [Keyboard],
power_zones: [Keyboard, Lightbar],
),
(
device_name: "G513RC",
product_id: "",
layout_name: "g513i",
basic_modes: [Static, Breathe, Strobe, Rainbow, Pulse],
basic_modes: [Static, Breathe, RainbowCycle, RainbowWave, Pulse],
basic_zones: [],
advanced_type: Zoned([ZonedKbLeft, ZonedKbLeftMid, ZonedKbRightMid, ZonedKbRight, LightbarRight, LightbarRightCorner, LightbarRightBottom, LightbarLeftBottom, LightbarLeftCorner, LightbarLeft]),
power_zones: [Keyboard, Lightbar],
),
(
device_name: "G513RM",
product_id: "",
layout_name: "g513i",
basic_modes: [Static, Breathe, Strobe, Rainbow, Pulse],
basic_zones: [],
advanced_type: Zoned([ZonedKbLeft, ZonedKbLeftMid, ZonedKbRightMid, ZonedKbRight, LightbarRight, LightbarRightCorner, LightbarRightBottom, LightbarLeftBottom, LightbarLeftCorner, LightbarLeft]),
power_zones: [Keyboard, Lightbar],
),
(
device_name: "G513RW",
product_id: "",
layout_name: "g513i-per-key",
basic_modes: [Static, Breathe, Strobe, Rainbow, Star, Rain, Highlight, Laser, Ripple, Pulse, Comet, Flash],
basic_zones: [],
advanced_type: PerKey,
power_zones: [Keyboard],
),
(
device_name: "G531",
product_id: "",
layout_name: "g513i-per-key",
basic_modes: [Static, Breathe, Strobe, Rainbow, Star, Rain, Highlight, Laser, Ripple, Pulse, Comet, Flash],
basic_zones: [],
advanced_type: PerKey,
power_zones: [Keyboard],
),
(
device_name: "G531",
product_id: "",
layout_name: "g513i-per-key",
basic_modes: [Static, Breathe, Strobe, Rainbow, Star, Rain, Highlight, Laser, Ripple, Pulse, Comet, Flash],
basic_zones: [Key1, Key2, Key3, Key4],
advanced_type: PerKey,
power_zones: [Keyboard],
),
(
device_name: "G531GD",
device_name: "G531G",
product_id: "",
layout_name: "gx502",
basic_modes: [Static, Breathe, Strobe, Rainbow, Pulse],
basic_zones: [],
advanced_type: None,
power_zones: [Keyboard],
),
(
device_name: "G531GT",
product_id: "",
layout_name: "gx502",
basic_modes: [Static, Breathe, Strobe, Rainbow],
basic_zones: [],
advanced_type: None,
power_zones: [Keyboard],
),
(
device_name: "G531GU",
product_id: "",
layout_name: "gx502",
basic_modes: [Static, Breathe, Strobe, Rainbow],
basic_zones: [Key1, Key2, Key3, Key4],
advanced_type: None,
power_zones: [Keyboard],
),
(
device_name: "G531GV",
product_id: "",
layout_name: "gx502",
basic_modes: [Static, Breathe, Strobe, Rainbow],
basic_modes: [Static, Breathe, RainbowCycle, RainbowWave, Pulse],
basic_zones: [Key1, Key2, Key3, Key4],
advanced_type: None,
power_zones: [Keyboard],
@@ -237,7 +147,7 @@
device_name: "G531GW",
product_id: "",
layout_name: "gx502",
basic_modes: [Static, Breathe, Strobe, Rainbow, Star, Rain, Highlight, Laser, Ripple, Pulse, Comet, Flash],
basic_modes: [Static, Breathe, RainbowCycle, RainbowWave, Star, Rain, Highlight, Laser, Ripple, Pulse, Comet, Flash],
basic_zones: [Key1, Key2, Key3, Key4],
advanced_type: None,
power_zones: [Keyboard],
@@ -246,25 +156,25 @@
device_name: "G532",
product_id: "",
layout_name: "gx502",
basic_modes: [Static, Breathe, Strobe, Rainbow, Star, Rain, Highlight, Laser, Ripple, Pulse, Comet, Flash],
basic_modes: [Static, Breathe, RainbowCycle, RainbowWave, Star, Rain, Highlight, Laser, Ripple, Pulse, Comet, Flash],
basic_zones: [],
advanced_type: PerKey,
power_zones: [Keyboard],
),
(
device_name: "G533Q",
product_id: "",
product_id: "1866",
layout_name: "g533q-per-key",
basic_modes: [Static, Breathe, Strobe, Rainbow, Star, Rain, Highlight, Laser, Ripple, Pulse, Comet, Flash],
basic_modes: [Static, Breathe, RainbowCycle, RainbowWave, Star, Rain, Highlight, Laser, Ripple, Pulse, Comet, Flash],
basic_zones: [],
advanced_type: PerKey,
power_zones: [Keyboard],
power_zones: [Keyboard, Lightbar],
),
(
device_name: "G533Z",
product_id: "",
layout_name: "g533q-per-key",
basic_modes: [Static, Breathe, Strobe, Rainbow, Star, Rain, Highlight, Laser, Ripple, Pulse, Comet, Flash],
basic_modes: [Static, Breathe, RainbowCycle, RainbowWave, Star, Rain, Highlight, Laser, Ripple, Pulse, Comet, Flash],
basic_zones: [],
advanced_type: PerKey,
power_zones: [Keyboard],
@@ -273,16 +183,34 @@
device_name: "G614J",
product_id: "",
layout_name: "g634j-per-key",
basic_modes: [Static, Breathe, Pulse, Strobe, Rainbow],
basic_modes: [Static, Breathe, RainbowCycle, RainbowWave, Pulse],
basic_zones: [],
advanced_type: None,
power_zones: [Keyboard, Lightbar],
),
(
device_name: "G614JJ",
product_id: "",
layout_name: "g634j-per-key",
basic_modes: [Static, Breathe, RainbowCycle, RainbowWave, Pulse],
basic_zones: [Key1, Key2, Key3, Key4],
advanced_type: None,
power_zones: [Keyboard, Lightbar],
),
(
device_name: "G614JZ",
product_id: "",
layout_name: "g634j-per-key",
basic_modes: [Static, Breathe, RainbowCycle, RainbowWave, Pulse],
basic_zones: [Key1, Key2, Key3, Key4],
advanced_type: None,
power_zones: [Keyboard, Lightbar],
),
(
device_name: "G634J",
product_id: "",
layout_name: "g634j-per-key",
basic_modes: [Static, Breathe, Strobe, Rainbow, Star, Rain, Highlight, Laser, Ripple, Pulse, Comet, Flash],
basic_modes: [Static, Breathe, RainbowCycle, RainbowWave, Star, Rain, Highlight, Laser, Ripple, Pulse, Comet, Flash],
basic_zones: [],
advanced_type: PerKey,
power_zones: [Keyboard, Lightbar, Logo, RearGlow],
@@ -291,7 +219,7 @@
device_name: "G712LI",
product_id: "",
layout_name: "gl503",
basic_modes: [Static, Breathe, Strobe, Rainbow, Pulse],
basic_modes: [Static, Breathe, RainbowCycle, RainbowWave, Pulse],
basic_zones: [],
advanced_type: None,
power_zones: [Keyboard],
@@ -300,7 +228,7 @@
device_name: "G712LV",
product_id: "",
layout_name: "ga401q",
basic_modes: [Static, Breathe, Strobe, Rainbow, Pulse],
basic_modes: [Static, Breathe, RainbowCycle, RainbowWave, Pulse],
basic_zones: [Key1, Key2, Key3, Key4],
advanced_type: None,
power_zones: [Keyboard],
@@ -309,7 +237,7 @@
device_name: "G712LW",
product_id: "",
layout_name: "ga401q",
basic_modes: [Static, Breathe, Strobe, Rainbow, Pulse],
basic_modes: [Static, Breathe, RainbowCycle, RainbowWave, Pulse],
basic_zones: [Key1, Key2, Key3, Key4],
advanced_type: None,
power_zones: [Keyboard],
@@ -318,43 +246,61 @@
device_name: "G713IC",
product_id: "",
layout_name: "gx502",
basic_modes: [Static, Breathe, Strobe, Rainbow, Star, Rain, Highlight, Laser, Ripple, Pulse, Comet, Flash],
basic_zones: [],
advanced_type: PerKey,
power_zones: [Keyboard],
basic_modes: [Static, Breathe, RainbowCycle, RainbowWave, Pulse],
basic_zones: [Key1, Key2, Key3, Key4],
advanced_type: None,
power_zones: [Keyboard, Lightbar],
),
(
device_name: "G713P",
product_id: "",
layout_name: "ga401q",
basic_modes: [Static, Breathe, Strobe, Rainbow, Pulse],
basic_modes: [Static, Breathe, RainbowCycle, RainbowWave, Pulse],
basic_zones: [Key1, Key2, Key3, Key4],
advanced_type: None,
power_zones: [Keyboard],
power_zones: [Keyboard, Lightbar],
),
(
device_name: "G713QC",
product_id: "",
layout_name: "gx502",
basic_modes: [Static, Breathe, RainbowCycle, RainbowWave, Pulse],
basic_zones: [Key1, Key2, Key3, Key4],
advanced_type: None,
power_zones: [Keyboard, Lightbar],
),
(
device_name: "G713QE",
product_id: "",
layout_name: "gx502",
basic_modes: [Static, Breathe, RainbowCycle, RainbowWave, Pulse],
basic_zones: [Key1, Key2, Key3, Key4],
advanced_type: None,
power_zones: [Keyboard, Lightbar],
),
(
device_name: "G713QM",
product_id: "",
layout_name: "ga401q",
basic_modes: [Static, Breathe, Strobe, Rainbow, Pulse],
basic_zones: [Key1, Key2, Key3, Key4],
advanced_type: None,
power_zones: [Keyboard],
layout_name: "gx502",
basic_modes: [Static, Breathe, RainbowCycle, RainbowWave, Star, Rain, Highlight, Laser, Ripple, Pulse, Comet, Flash],
basic_zones: [],
advanced_type: PerKey,
power_zones: [Keyboard, Lightbar],
),
(
device_name: "G713QR",
product_id: "",
layout_name: "gx502",
basic_modes: [Static, Breathe, Strobe, Rainbow, Star, Rain, Highlight, Laser, Ripple, Pulse, Comet, Flash],
basic_modes: [Static, Breathe, RainbowCycle, RainbowWave, Star, Rain, Highlight, Laser, Ripple, Pulse, Comet, Flash],
basic_zones: [],
advanced_type: PerKey,
power_zones: [Keyboard],
power_zones: [Keyboard, Lightbar],
),
(
device_name: "G713RC",
product_id: "",
layout_name: "gx502",
basic_modes: [Static, Breathe, Strobe, Rainbow, Pulse],
basic_modes: [Static, Breathe, RainbowCycle, RainbowWave, Pulse],
basic_zones: [],
advanced_type: Zoned([ZonedKbLeft, ZonedKbLeftMid, ZonedKbRightMid, ZonedKbRight, LightbarRight, LightbarRightCorner, LightbarRightBottom, LightbarLeftBottom, LightbarLeftCorner, LightbarLeft]),
power_zones: [Keyboard, Lightbar],
@@ -363,7 +309,7 @@
device_name: "G713RM",
product_id: "",
layout_name: "ga401q",
basic_modes: [Static, Breathe, Strobe, Rainbow, Pulse],
basic_modes: [Static, Breathe, RainbowCycle, RainbowWave, Pulse],
basic_zones: [Key1, Key2, Key3, Key4],
advanced_type: None,
power_zones: [Keyboard],
@@ -372,7 +318,7 @@
device_name: "G713RS",
product_id: "",
layout_name: "gx502",
basic_modes: [Static, Breathe, Strobe, Rainbow, Star, Rain, Highlight, Laser, Ripple, Pulse, Comet, Flash],
basic_modes: [Static, Breathe, RainbowCycle, RainbowWave, Star, Rain, Highlight, Laser, Ripple, Pulse, Comet, Flash],
basic_zones: [],
advanced_type: PerKey,
power_zones: [Keyboard],
@@ -381,34 +327,25 @@
device_name: "G713RW",
product_id: "",
layout_name: "ga401q",
basic_modes: [Static, Breathe, Strobe, Rainbow, Pulse],
basic_zones: [Key1, Key2, Key3, Key4],
basic_modes: [Static, Breathe, RainbowCycle, RainbowWave, Pulse],
basic_zones: [Key1, Key2, Key3, Key4, BarLeft, BarRight],
advanced_type: None,
power_zones: [Keyboard],
power_zones: [Keyboard, Lightbar],
),
(
device_name: "G731",
product_id: "",
layout_name: "g533q",
basic_modes: [Static, Breathe, Strobe, Rainbow, Star, Rain, Highlight, Laser, Ripple, Pulse, Comet, Flash],
basic_modes: [Static, Breathe, RainbowCycle, RainbowWave, Star, Rain, Highlight, Laser, Ripple, Pulse, Comet, Flash],
basic_zones: [Key1, Key2, Key3, Key4],
advanced_type: PerKey,
power_zones: [Keyboard],
),
(
device_name: "G731GT",
device_name: "G731G",
product_id: "",
layout_name: "g533q",
basic_modes: [Static, Breathe, Strobe, Rainbow],
basic_zones: [],
advanced_type: None,
power_zones: [Keyboard],
),
(
device_name: "G731GU",
product_id: "",
layout_name: "g533q",
basic_modes: [Static, Breathe, Strobe, Rainbow],
basic_modes: [Static, Breathe, RainbowCycle, RainbowWave, Pulse],
basic_zones: [],
advanced_type: None,
power_zones: [Keyboard],
@@ -417,7 +354,7 @@
device_name: "G731GV",
product_id: "",
layout_name: "g533q",
basic_modes: [Static, Breathe, Strobe, Rainbow],
basic_modes: [Static, Breathe, RainbowCycle, RainbowWave, Pulse],
basic_zones: [Key1, Key2, Key3, Key4],
advanced_type: None,
power_zones: [Keyboard],
@@ -426,7 +363,7 @@
device_name: "G731GW",
product_id: "",
layout_name: "g533q",
basic_modes: [Static, Breathe, Strobe, Rainbow],
basic_modes: [Static, Breathe, RainbowCycle, RainbowWave, Pulse],
basic_zones: [Key1, Key2, Key3, Key4],
advanced_type: None,
power_zones: [Keyboard],
@@ -435,16 +372,16 @@
device_name: "G733C",
product_id: "",
layout_name: "g513i-per-key",
basic_modes: [Static, Breathe, Strobe, Rainbow, Star, Rain, Highlight, Laser, Ripple, Pulse, Comet, Flash],
basic_zones: [Logo, BarLeft, BarRight],
basic_modes: [Static, Breathe, RainbowCycle, RainbowWave, Star, Rain, Highlight, Laser, Ripple, Pulse, Comet, Flash],
basic_zones: [],
advanced_type: PerKey,
power_zones: [Keyboard],
power_zones: [Keyboard, Lightbar, Logo, Lid],
),
(
device_name: "G733PZ",
device_name: "G733P",
product_id: "",
layout_name: "g733pz-per-key",
basic_modes: [Static, Breathe, Strobe, Rainbow, Star, Rain, Highlight, Laser, Ripple, Pulse, Comet, Flash],
basic_modes: [Static, Breathe, RainbowCycle, RainbowWave, Star, Rain, Highlight, Laser, Ripple, Pulse, Comet, Flash],
basic_zones: [],
advanced_type: PerKey,
power_zones: [Keyboard, Lightbar],
@@ -453,7 +390,7 @@
device_name: "G733Q",
product_id: "",
layout_name: "gx502",
basic_modes: [Static, Breathe, Strobe, Rainbow, Star, Rain, Highlight, Laser, Ripple, Pulse, Comet, Flash],
basic_modes: [Static, Breathe, RainbowCycle, RainbowWave, Star, Rain, Highlight, Laser, Ripple, Pulse, Comet, Flash],
basic_zones: [],
advanced_type: PerKey,
power_zones: [Keyboard],
@@ -462,38 +399,38 @@
device_name: "G733Z",
product_id: "",
layout_name: "g513i-per-key",
basic_modes: [Static, Breathe, Strobe, Rainbow, Star, Rain, Highlight, Laser, Ripple, Pulse, Comet, Flash],
basic_modes: [Static, Breathe, RainbowCycle, RainbowWave, Star, Rain, Highlight, Laser, Ripple, Pulse, Comet, Flash],
basic_zones: [],
advanced_type: PerKey,
power_zones: [Keyboard],
),
(
device_name: "G814JI",
device_name: "G814J",
product_id: "",
layout_name: "g814ji-per-key",
basic_modes: [Static, Breathe, Strobe, Rainbow, Star, Rain, Highlight, Laser, Ripple, Pulse, Comet, Flash],
basic_modes: [Static, Breathe, RainbowCycle, RainbowWave, Star, Rain, Highlight, Laser, Ripple, Pulse, Comet, Flash],
basic_zones: [],
advanced_type: PerKey,
power_zones: [Keyboard, Lightbar],
),
(
device_name: "G814JZ",
device_name: "G834J",
product_id: "",
layout_name: "g814ji-per-key",
basic_modes: [Static, Breathe, Strobe, Rainbow, Star, Rain, Highlight, Laser, Ripple, Pulse, Comet, Flash],
basic_zones: [],
advanced_type: PerKey,
power_zones: [Keyboard, Lightbar],
),
(
device_name: "G834JZ",
product_id: "",
layout_name: "g814ji-per-key",
basic_modes: [Static, Breathe, Strobe, Rainbow, Star, Rain, Highlight, Laser, Ripple, Pulse, Comet, Flash],
basic_modes: [Static, Breathe, RainbowCycle, RainbowWave, Star, Rain, Highlight, Laser, Ripple, Pulse, Comet, Flash],
basic_zones: [],
advanced_type: PerKey,
power_zones: [Keyboard, Lightbar, Logo, RearGlow],
),
(
device_name: "GA401I",
product_id: "",
layout_name: "ga401q",
basic_modes: [Static, Breathe, Pulse],
basic_zones: [],
advanced_type: None,
power_zones: [Keyboard],
),
(
device_name: "GA401Q",
product_id: "",
@@ -507,31 +444,13 @@
device_name: "GA402N",
product_id: "",
layout_name: "ga401q",
basic_modes: [Static, Breathe, Pulse, Rainbow, Strobe],
basic_modes: [Static, Breathe, RainbowCycle, RainbowWave, Pulse],
basic_zones: [],
advanced_type: None,
power_zones: [Keyboard],
),
(
device_name: "GA402R",
product_id: "",
layout_name: "ga401q",
basic_modes: [Static, Breathe, Pulse, Rainbow],
basic_zones: [],
advanced_type: None,
power_zones: [Keyboard],
),
(
device_name: "GA402X",
product_id: "",
layout_name: "ga401q",
basic_modes: [Static, Breathe, Pulse, Rainbow],
basic_zones: [],
advanced_type: None,
power_zones: [Keyboard],
),
(
device_name: "GA402XV",
device_name: "GA402NU-0002",
product_id: "",
layout_name: "ga401q",
basic_modes: [Static, Breathe, Pulse],
@@ -540,7 +459,34 @@
power_zones: [Keyboard],
),
(
device_name: "GA403UI",
device_name: "GA402R",
product_id: "",
layout_name: "ga401q",
basic_modes: [Static, Breathe, RainbowCycle, RainbowWave, Pulse],
basic_zones: [],
advanced_type: None,
power_zones: [Keyboard],
),
(
device_name: "GA402X",
product_id: "",
layout_name: "ga401q",
basic_modes: [Static, Breathe, RainbowCycle, RainbowWave, Pulse],
basic_zones: [],
advanced_type: None,
power_zones: [Keyboard],
),
(
device_name: "GA402XV-NC012",
product_id: "",
layout_name: "ga401q",
basic_modes: [Static, Breathe, Pulse],
basic_zones: [],
advanced_type: None,
power_zones: [Keyboard],
),
(
device_name: "GA403U",
product_id: "",
layout_name: "ga401q",
basic_modes: [Static, Breathe, Pulse],
@@ -552,7 +498,7 @@
device_name: "GA503Q",
product_id: "",
layout_name: "ga401q",
basic_modes: [Static, Breathe, Pulse, Rainbow, Strobe],
basic_modes: [Static, Breathe, RainbowCycle, RainbowWave, Pulse],
basic_zones: [],
advanced_type: None,
power_zones: [Keyboard],
@@ -570,7 +516,7 @@
device_name: "GA503R",
product_id: "",
layout_name: "ga401q",
basic_modes: [Static, Breathe, Pulse, Rainbow, Strobe],
basic_modes: [Static, Breathe, RainbowCycle, RainbowWave, Pulse],
basic_zones: [],
advanced_type: None,
power_zones: [Keyboard],
@@ -579,7 +525,7 @@
device_name: "GL503",
product_id: "",
layout_name: "gl503",
basic_modes: [Static, Breathe, Strobe, Rainbow, Pulse],
basic_modes: [Static, Breathe, RainbowCycle, RainbowWave, Pulse],
basic_zones: [Key1, Key2, Key3, Key4],
advanced_type: None,
power_zones: [Keyboard],
@@ -588,7 +534,7 @@
device_name: "GL503V",
product_id: "",
layout_name: "gl503",
basic_modes: [Static, Breathe, Strobe, Rainbow, Pulse],
basic_modes: [Static, Breathe, RainbowCycle, RainbowWave, Pulse],
basic_zones: [Key1, Key2, Key3, Key4],
advanced_type: None,
power_zones: [Keyboard],
@@ -597,7 +543,7 @@
device_name: "GL504G",
product_id: "",
layout_name: "gl503",
basic_modes: [Static, Breathe, Strobe, Rainbow, Pulse],
basic_modes: [Static, Breathe, RainbowCycle, RainbowWave, Pulse],
basic_zones: [Key1, Key2, Key3, Key4, Logo, BarLeft, BarRight],
advanced_type: None,
power_zones: [Keyboard],
@@ -606,7 +552,7 @@
device_name: "GL531",
product_id: "",
layout_name: "g512",
basic_modes: [Static, Breathe, Strobe, Rainbow, Star, Rain, Highlight, Laser, Ripple, Pulse, Comet, Flash],
basic_modes: [Static, Breathe, RainbowCycle, RainbowWave, Star, Rain, Highlight, Laser, Ripple, Pulse, Comet, Flash],
basic_zones: [],
advanced_type: PerKey,
power_zones: [Keyboard],
@@ -615,7 +561,7 @@
device_name: "GL553V",
product_id: "",
layout_name: "g533q",
basic_modes: [Static, Breathe, Strobe],
basic_modes: [Static, Breathe, RainbowCycle, RainbowWave, Pulse],
basic_zones: [Key1, Key2, Key3, Key4],
advanced_type: None,
power_zones: [Keyboard],
@@ -624,7 +570,7 @@
device_name: "GL703G",
product_id: "",
layout_name: "gl503",
basic_modes: [Static, Breathe, Strobe, Rainbow],
basic_modes: [Static, Breathe, RainbowCycle, RainbowWave, Pulse],
basic_zones: [],
advanced_type: None,
power_zones: [Keyboard],
@@ -633,61 +579,34 @@
device_name: "GM501G",
product_id: "",
layout_name: "fa507",
basic_modes: [Static, Breathe, Strobe, Rainbow, Pulse],
basic_modes: [Static, Breathe, RainbowCycle, RainbowWave, Pulse],
basic_zones: [Key1, Key2, Key3, Key4],
advanced_type: None,
power_zones: [Keyboard],
),
(
device_name: "GU502",
product_id: "",
layout_name: "gx502",
basic_modes: [Static, Breathe, Strobe, Rainbow, Star, Rain, Highlight, Laser, Ripple, Pulse, Comet, Flash],
basic_zones: [],
advanced_type: PerKey,
power_zones: [Keyboard],
),
(
device_name: "GU502G",
product_id: "",
layout_name: "gx502",
basic_modes: [Static, Breathe, Strobe, Rainbow, Star, Rain, Highlight, Laser, Ripple, Pulse, Comet, Flash],
basic_zones: [],
advanced_type: PerKey,
power_zones: [Keyboard],
),
(
device_name: "GU502L",
product_id: "",
layout_name: "gx502",
basic_modes: [Static, Breathe, Strobe, Rainbow, Star, Rain, Highlight, Laser, Ripple, Pulse, Comet, Flash],
basic_modes: [Static, Breathe, RainbowCycle, RainbowWave, Star, Rain, Highlight, Laser, Ripple, Pulse, Comet, Flash],
basic_zones: [],
advanced_type: PerKey,
power_zones: [Keyboard],
),
(
device_name: "GU502LU",
product_id: "",
layout_name: "gx502",
basic_modes: [Static, Breathe, Strobe, Pulse],
basic_zones: [],
advanced_type: None,
power_zones: [Keyboard],
),
(
device_name: "GU603H",
product_id: "",
layout_name: "ga401q",
basic_modes: [Static, Breathe, Strobe, Rainbow, Pulse],
basic_modes: [Static, Breathe, RainbowCycle, RainbowWave, Pulse],
basic_zones: [],
advanced_type: Zoned([SingleZone]),
power_zones: [Keyboard],
),
(
device_name: "GU603VV",
device_name: "GU603V",
product_id: "",
layout_name: "ga401q",
basic_modes: [Static, Breathe, Strobe, Rainbow, Pulse],
basic_modes: [Static, Breathe, RainbowCycle, RainbowWave, Pulse],
basic_zones: [],
advanced_type: Zoned([SingleZone]),
power_zones: [Keyboard],
@@ -696,7 +615,7 @@
device_name: "GU603Z",
product_id: "",
layout_name: "ga401q",
basic_modes: [Static, Breathe, Strobe, Rainbow, Pulse],
basic_modes: [Static, Breathe, RainbowCycle, RainbowWave, Pulse],
basic_zones: [],
advanced_type: Zoned([SingleZone]),
power_zones: [Keyboard],
@@ -705,7 +624,7 @@
device_name: "GU604V",
product_id: "",
layout_name: "ga401q",
basic_modes: [Static, Breathe, Strobe, Rainbow, Pulse],
basic_modes: [Static, Breathe, RainbowCycle, RainbowWave, Pulse],
basic_zones: [],
advanced_type: Zoned([SingleZone]),
power_zones: [Keyboard],
@@ -714,7 +633,7 @@
device_name: "GU605M",
product_id: "",
layout_name: "ga401q",
basic_modes: [Static, Breathe, Strobe, Rainbow, Pulse],
basic_modes: [Static, Breathe, RainbowCycle, RainbowWave, Pulse],
basic_zones: [],
advanced_type: Zoned([SingleZone]),
power_zones: [Keyboard],
@@ -750,7 +669,7 @@
device_name: "GV601R",
product_id: "",
layout_name: "ga401q",
basic_modes: [Static, Breathe, Strobe, Pulse],
basic_modes: [Static, Breathe, RainbowCycle, RainbowWave, Pulse],
basic_zones: [],
advanced_type: None,
power_zones: [Keyboard],
@@ -768,7 +687,7 @@
device_name: "GV604V",
product_id: "",
layout_name: "ga401q",
basic_modes: [Static, Breathe, Strobe, Pulse],
basic_modes: [Static, Breathe, RainbowCycle, RainbowWave, Pulse],
basic_zones: [],
advanced_type: None,
power_zones: [Keyboard],
@@ -777,7 +696,7 @@
device_name: "GX502",
product_id: "",
layout_name: "gx502",
basic_modes: [Static, Breathe, Strobe, Rainbow, Star, Rain, Highlight, Laser, Ripple, Pulse, Comet, Flash],
basic_modes: [Static, Breathe, RainbowCycle, RainbowWave, Star, Rain, Highlight, Laser, Ripple, Pulse, Comet, Flash],
basic_zones: [],
advanced_type: PerKey,
power_zones: [Keyboard],
@@ -786,7 +705,7 @@
device_name: "GX531",
product_id: "",
layout_name: "gx531-per-key",
basic_modes: [Static, Breathe, Strobe, Rainbow, Pulse],
basic_modes: [Static, Breathe, RainbowCycle, RainbowWave, Pulse],
basic_zones: [Key1, Key2, Key3, Key4],
advanced_type: None,
power_zones: [Keyboard],
@@ -795,7 +714,7 @@
device_name: "GX550L",
product_id: "",
layout_name: "gx531-per-key",
basic_modes: [Static, Breathe, Strobe, Rainbow, Star, Rain, Highlight, Laser, Ripple, Pulse, Comet, Flash],
basic_modes: [Static, Breathe, RainbowCycle, RainbowWave, Star, Rain, Highlight, Laser, Ripple, Pulse, Comet, Flash],
basic_zones: [],
advanced_type: PerKey,
power_zones: [Keyboard],
@@ -804,7 +723,7 @@
device_name: "GX551Q",
product_id: "",
layout_name: "gx531-per-key",
basic_modes: [Static, Breathe, Strobe, Rainbow, Pulse],
basic_modes: [Static, Breathe, RainbowCycle, RainbowWave, Pulse],
basic_zones: [],
advanced_type: PerKey,
power_zones: [Keyboard],
@@ -813,7 +732,16 @@
device_name: "GX650P",
product_id: "",
layout_name: "gx531-per-key",
basic_modes: [Static, Breathe, Strobe, Rainbow, Star, Rain, Highlight, Laser, Ripple, Pulse, Comet, Flash],
basic_modes: [Static, Breathe, RainbowCycle, RainbowWave, Star, Rain, Highlight, Laser, Ripple, Pulse, Comet, Flash],
basic_zones: [],
advanced_type: PerKey,
power_zones: [Keyboard],
),
(
device_name: "GX650R",
product_id: "",
layout_name: "gx531-per-key",
basic_modes: [Static, Breathe, RainbowCycle, RainbowWave, Star, Rain, Highlight, Laser, Ripple, Pulse, Comet, Flash],
basic_zones: [],
advanced_type: PerKey,
power_zones: [Keyboard],
@@ -822,7 +750,7 @@
device_name: "GX701",
product_id: "",
layout_name: "gx531-per-key",
basic_modes: [Static, Breathe, Strobe, Rainbow, Star, Rain, Highlight, Laser, Ripple, Pulse, Comet, Flash],
basic_modes: [Static, Breathe, RainbowCycle, RainbowWave, Star, Rain, Highlight, Laser, Ripple, Pulse, Comet, Flash],
basic_zones: [],
advanced_type: PerKey,
power_zones: [Keyboard],
@@ -831,7 +759,7 @@
device_name: "GX703H",
product_id: "",
layout_name: "gx531-per-key",
basic_modes: [Static, Breathe, Strobe, Rainbow, Star, Rain, Highlight, Laser, Ripple, Pulse, Comet, Flash],
basic_modes: [Static, Breathe, RainbowCycle, RainbowWave, Star, Rain, Highlight, Laser, Ripple, Pulse, Comet, Flash],
basic_zones: [],
advanced_type: None,
power_zones: [Keyboard],
@@ -854,15 +782,6 @@
advanced_type: None,
power_zones: [Keyboard],
),
(
device_name: "GZ301Z",
product_id: "",
layout_name: "ga401q",
basic_modes: [Static, Breathe, Pulse],
basic_zones: [],
advanced_type: None,
power_zones: [Keyboard],
),
(
device_name: "GZ301Z",
product_id: "18c6",
@@ -885,9 +804,18 @@
device_name: "RC71L",
product_id: "",
layout_name: "ga401q",
basic_modes: [Static, Breathe, Pulse],
basic_modes: [Static, Breathe, RainbowCycle, RainbowWave, Pulse],
basic_zones: [],
advanced_type: None,
power_zones: [Keyboard],
power_zones: [Ally],
),
(
device_name: "RC72L",
product_id: "",
layout_name: "ga401q",
basic_modes: [Static, Breathe, RainbowCycle, RainbowWave, Pulse],
basic_zones: [],
advanced_type: None,
power_zones: [Ally],
),
])

View File

@@ -1,6 +1,8 @@
use std::env;
use dmi_id::DMIID;
use log::{error, info, warn};
use serde_derive::{Deserialize, Serialize};
use serde::{Deserialize, Serialize};
use crate::keyboard::AdvancedAuraType;
use crate::{AuraModeNum, AuraZone, PowerZones};
@@ -60,17 +62,20 @@ impl LedSupportData {
/// matches against laptops first, then will proceed with matching the
/// `device_name` if there are no DMI matches.
pub fn get_data(product_id: &str) -> Self {
let dmi = DMIID::new().unwrap_or_default();
let mut dmi = DMIID::new().unwrap_or_default();
if let Ok(board_name) = env::var("BOARD_NAME") {
dmi.board_name = board_name;
}
// let prod_family = dmi.product_family().expect("Could not get
// product_family");
if let Some(data) = LedSupportFile::load_from_supoprt_db() {
if let Some(data) = data.match_device(&dmi.board_name, product_id) {
return data;
}
return data.match_device(&dmi.board_name, product_id);
}
info!("Using generic LED control for keyboard brightness only");
LedSupportData::default()
info!("Using generic LED control for keyboard brightness only. No aura_support file found");
let mut data = LedSupportData::default();
data.power_zones.push(PowerZones::Keyboard);
data
}
}
@@ -84,7 +89,7 @@ impl LedSupportFile {
/// The list is stored in ordered format, so the iterator must be reversed
/// to ensure we match to *whole names* first before doing a glob match
fn match_device(&self, device_name: &str, product_id: &str) -> Option<LedSupportData> {
fn match_device(&self, device_name: &str, product_id: &str) -> LedSupportData {
for config in self.0.iter().rev() {
if device_name.contains(&config.device_name) {
info!("Matched to {}", config.device_name);
@@ -92,15 +97,27 @@ impl LedSupportFile {
info!("Checking product ID");
if config.product_id == product_id {
info!("Matched to {}", config.product_id);
return Some(config.clone());
return config.clone();
} else {
continue;
}
}
return Some(config.clone());
return config.clone();
}
}
None
warn!(
"the aura_support.ron file has no entry for this model: {device_name}, {product_id}. \
Using a default"
);
LedSupportData {
device_name: device_name.to_owned(),
product_id: product_id.to_owned(),
layout_name: "Default".to_owned(),
basic_modes: vec![AuraModeNum::Static],
basic_zones: vec![],
advanced_type: AdvancedAuraType::None,
power_zones: vec![PowerZones::Keyboard],
}
}
/// Load `LedSupportFile` from the `aura_support.ron` file at
@@ -154,6 +171,7 @@ impl LedSupportFile {
#[cfg(test)]
mod tests {
use std::collections::HashMap;
use std::fs::OpenOptions;
use std::io::Write;
use std::path::PathBuf;
@@ -195,6 +213,11 @@ mod tests {
let mut tmp_sort = tmp.clone();
tmp_sort.0.sort_by(|a, b| a.product_id.cmp(&b.product_id));
tmp_sort.0.sort_by(|a, b| a.device_name.cmp(&b.device_name));
for model in tmp_sort.0.iter_mut() {
model
.basic_modes
.sort_by(|a, b| (*a as u8).cmp(&(*b as u8)));
}
if tmp != tmp_sort {
let sorted =
ron::ser::to_string_pretty(&tmp_sort, PrettyConfig::new().depth_limit(2)).unwrap();
@@ -217,4 +240,31 @@ mod tests {
ron::ser::to_string_pretty(&tmp, my_config).unwrap()
);
}
#[test]
fn find_data_file_groups() {
let mut data = PathBuf::from(env!("CARGO_MANIFEST_DIR"));
data.push("data/aura_support.ron");
let buf = std::fs::read_to_string(&data).unwrap();
let tmp = ron::from_str::<LedSupportFile>(&buf).unwrap();
let mut modes: HashMap<Vec<AuraModeNum>, Vec<String>> = HashMap::new();
for entry in tmp.0 {
if let Some(modes) = modes.get_mut(&entry.basic_modes) {
modes.push(entry.device_name);
} else {
modes.insert(entry.basic_modes, vec![entry.device_name]);
}
}
dbg!(modes);
// let my_config = PrettyConfig::new().depth_limit(2);
// println!(
// "RON: {}",
// ron::ser::to_string_pretty(&tmp, my_config).unwrap()
// );
}
}

View File

@@ -1,7 +1,7 @@
use std::fmt::Display;
use std::str::FromStr;
use serde_derive::{Deserialize, Serialize};
use serde::{Deserialize, Serialize};
use typeshare::typeshare;
#[cfg(feature = "dbus")]
use zbus::zvariant::{OwnedValue, Type, Value};
@@ -261,8 +261,8 @@ pub enum AuraModeNum {
#[default]
Static = 0,
Breathe = 1,
Strobe = 2,
Rainbow = 3,
RainbowCycle = 2,
RainbowWave = 3,
Star = 4,
Rain = 5,
Highlight = 6,
@@ -290,8 +290,8 @@ impl From<&AuraModeNum> for &str {
match mode {
AuraModeNum::Static => "Static",
AuraModeNum::Breathe => "Breathe",
AuraModeNum::Strobe => "Strobe",
AuraModeNum::Rainbow => "Rainbow",
AuraModeNum::RainbowCycle => "RainbowCycle",
AuraModeNum::RainbowWave => "RainbowWave",
AuraModeNum::Star => "Stars",
AuraModeNum::Rain => "Rain",
AuraModeNum::Highlight => "Highlight",
@@ -307,8 +307,8 @@ impl From<&str> for AuraModeNum {
fn from(mode: &str) -> Self {
match mode {
"Breathe" => AuraModeNum::Breathe,
"Strobe" => AuraModeNum::Strobe,
"Rainbow" => AuraModeNum::Rainbow,
"RainbowCycle" => AuraModeNum::RainbowCycle,
"RainbowWave" => AuraModeNum::RainbowWave,
"Stars" => AuraModeNum::Star,
"Rain" => AuraModeNum::Rain,
"Highlight" => AuraModeNum::Highlight,
@@ -326,8 +326,8 @@ impl From<u8> for AuraModeNum {
fn from(mode: u8) -> Self {
match mode {
1 => AuraModeNum::Breathe,
2 => AuraModeNum::Strobe,
3 => AuraModeNum::Rainbow,
2 => AuraModeNum::RainbowCycle,
3 => AuraModeNum::RainbowWave,
4 => AuraModeNum::Star,
5 => AuraModeNum::Rain,
6 => AuraModeNum::Highlight,
@@ -434,7 +434,7 @@ impl From<AuraZone> for i32 {
/// ```
#[typeshare]
#[cfg_attr(feature = "dbus", derive(Type, Value, OwnedValue))]
#[derive(Debug, Clone, Deserialize, Serialize)]
#[derive(Debug, Clone, PartialEq, Deserialize, Serialize)]
pub struct AuraEffect {
/// The effect type
pub mode: AuraModeNum,
@@ -532,10 +532,10 @@ impl AuraEffect {
| AuraModeNum::Comet
| AuraModeNum::Flash => AuraParameters::new(true, true, false, false, false),
AuraModeNum::Breathe => AuraParameters::new(true, true, true, true, false),
AuraModeNum::Strobe | AuraModeNum::Rain => {
AuraModeNum::RainbowCycle | AuraModeNum::Rain => {
AuraParameters::new(true, false, false, true, false)
}
AuraModeNum::Rainbow => AuraParameters::new(true, false, false, true, true),
AuraModeNum::RainbowWave => AuraParameters::new(true, false, false, true, true),
AuraModeNum::Star => AuraParameters::new(true, true, true, true, true),
AuraModeNum::Laser | AuraModeNum::Ripple => {
AuraParameters::new(true, true, false, true, false)
@@ -710,7 +710,7 @@ mod tests {
];
assert_eq!(<[u8; LED_MSG_LEN]>::from(&st)[..9], capture[..9]);
st.mode = AuraModeNum::Rainbow;
st.mode = AuraModeNum::RainbowWave;
let capture = [
0x5d, 0xb3, 0x07, 0x03, 0xff, 0x00, 0xcd, 0xe1, 0x01, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0,
0x0, 0x0,

View File

@@ -2,6 +2,7 @@ use super::{EffectState, InputForEffect};
use crate::keyboard::{KeyLayout, LedCode};
use crate::Colour;
#[allow(dead_code)]
pub struct InputBased {
led: LedCode,
colour: Colour,

View File

@@ -1,4 +1,4 @@
use serde_derive::{Deserialize, Serialize};
use serde::{Deserialize, Serialize};
mod doom;
pub use doom::*;

View File

@@ -488,7 +488,7 @@ mod tests {
let rows = &data.key_rows;
for row in rows {
for k in &row.row {
if data.key_shapes.get(&k.1).is_some() {
if data.key_shapes.contains_key(&k.1) {
unused.remove(&k.1);
} else {
panic!("Key {:?} was missing matching shape {}", k.0, k.1);

View File

@@ -53,7 +53,8 @@ impl AuraPowerState {
}
fn tuf_to_bytes(&self) -> Vec<u8> {
todo!("0s and 1s for bool array")
// &cmd, &boot, &awake, &sleep, &keyboard
vec![1, self.boot as u8, self.awake as u8, self.sleep as u8, 1]
}
/// # Bits for older 0x1866 keyboard model
@@ -101,7 +102,7 @@ impl AuraPowerState {
]
}
fn new_to_byte(&self) -> u32 {
pub fn new_to_byte(&self) -> u32 {
match self.zone {
PowerZones::Logo => {
self.boot as u32
@@ -109,6 +110,12 @@ impl AuraPowerState {
| (self.sleep as u32) << 4
| (self.shutdown as u32) << 6
}
PowerZones::Ally => {
(self.boot as u32)
| (self.awake as u32) << 1
| (self.sleep as u32) << 2
| (self.shutdown as u32) << 3
}
PowerZones::Keyboard => {
(self.boot as u32) << 1
| (self.awake as u32) << 3
@@ -133,7 +140,7 @@ impl AuraPowerState {
| (self.sleep as u32) << (23 + 3)
| (self.shutdown as u32) << (23 + 4)
}
PowerZones::KeyboardAndLightbar | PowerZones::None => 0,
PowerZones::None | PowerZones::KeyboardAndLightbar => 0,
}
}
}
@@ -186,7 +193,7 @@ impl LaptopAuraPower {
// TODO: use support data to setup correct zones
pub fn new(aura_type: AuraDeviceType, support_data: &LedSupportData) -> Self {
match aura_type {
AuraDeviceType::Unknown | AuraDeviceType::LaptopPost2021 => {
AuraDeviceType::Unknown | AuraDeviceType::Ally | AuraDeviceType::LaptopPost2021 => {
let mut states = Vec::new();
for zone in support_data.power_zones.iter() {
states.push(AuraPowerState::default_for(*zone))
@@ -194,6 +201,10 @@ impl LaptopAuraPower {
Self { states }
}
AuraDeviceType::LaptopPre2021 => {
// The older devices are tri-state if have lightbar:
// 1. Keyboard
// 2. Lightbar
// 3. KeyboardAndLightbar
if support_data.power_zones.contains(&PowerZones::Lightbar) {
Self {
states: vec![AuraPowerState::default_for(PowerZones::KeyboardAndLightbar)],
@@ -212,14 +223,32 @@ impl LaptopAuraPower {
}
pub fn to_bytes(&self, aura_type: AuraDeviceType) -> Vec<u8> {
if let Some(stuff) = self.states.first() {
if stuff.zone == PowerZones::Ally {
return vec![0x5d, 0xd1, 0x09, 0x01, stuff.new_to_byte() as u8];
}
}
match aura_type {
AuraDeviceType::LaptopPost2021 => self.new_to_bytes(),
AuraDeviceType::LaptopPre2021 => self
.states
.first()
.cloned()
.unwrap_or_default()
.old_to_bytes(),
AuraDeviceType::LaptopPost2021 | AuraDeviceType::Ally => self.new_to_bytes(),
AuraDeviceType::LaptopPre2021 => {
if self.states.len() == 1 {
self.states
.first()
.cloned()
.unwrap_or_default()
.old_to_bytes()
} else {
let mut bytes: Vec<Vec<u8>> =
self.states.iter().map(|s| s.old_to_bytes()).collect();
let mut b = bytes.pop().unwrap();
for i in bytes {
for (i, n) in i.iter().enumerate() {
b[i] |= n;
}
}
b
}
}
AuraDeviceType::LaptopTuf => self
.states
.first()
@@ -230,7 +259,7 @@ impl LaptopAuraPower {
warn!("Trying to create bytes for an unknown device");
self.new_to_bytes()
}
AuraDeviceType::ScsiExtDisk => todo!(),
AuraDeviceType::ScsiExtDisk => todo!("scsi disk not implemented yet"),
}
}
}
@@ -279,76 +308,75 @@ mod test {
use crate::keyboard::{AuraPowerState, LaptopAuraPower};
use crate::{AuraDeviceType, PowerZones};
fn to_binary_string_post2021(power: &LaptopAuraPower) -> String {
let bytes = power.to_bytes(AuraDeviceType::LaptopPost2021);
format!(
"{:08b}, {:08b}, {:08b}, {:08b}",
bytes[0], bytes[1], bytes[2], bytes[3]
)
}
#[test]
fn check_0x1866_control_bytes() {
let state = AuraPowerState {
zone: PowerZones::Keyboard,
awake: true,
boot: false,
sleep: false,
shutdown: false,
let power = LaptopAuraPower {
states: vec![AuraPowerState {
zone: PowerZones::Keyboard,
boot: false,
awake: true,
sleep: false,
shutdown: false,
}],
};
let bytes = state.old_to_bytes();
let bytes = power.to_bytes(AuraDeviceType::LaptopPre2021);
println!("{:08b}, {:08b}, {:08b}", bytes[0], bytes[1], bytes[2]);
assert_eq!(bytes, [0x08, 0x00, 0x02, 0x00]);
let state = AuraPowerState {
zone: PowerZones::Lightbar,
awake: true,
boot: false,
sleep: false,
shutdown: false,
let power = LaptopAuraPower {
states: vec![AuraPowerState {
zone: PowerZones::Lightbar,
boot: false,
awake: true,
sleep: false,
shutdown: false,
}],
};
let bytes = state.old_to_bytes();
let bytes = power.to_bytes(AuraDeviceType::LaptopPre2021);
println!("{:08b}, {:08b}, {:08b}", bytes[0], bytes[1], bytes[2]);
assert_eq!(bytes, [0x04, 0x05, 0x02, 0x00]);
let bytes = AuraPowerState {
zone: PowerZones::None,
awake: false,
boot: false,
sleep: true,
shutdown: false,
// let bytes = [
// OldAuraPower::Keyboard,
// OldAuraPower::Lightbar,
// OldAuraPower::Awake,
// OldAuraPower::Sleep,
// OldAuraPower::Boot,
// ];
let power = LaptopAuraPower {
states: vec![
AuraPowerState {
zone: PowerZones::Keyboard,
boot: true,
awake: true,
sleep: true,
shutdown: false,
},
AuraPowerState {
zone: PowerZones::Lightbar,
boot: true,
awake: true,
sleep: true,
shutdown: false,
},
],
};
let bytes = bytes.old_to_bytes();
println!("{:08b}, {:08b}, {:08b}", bytes[0], bytes[1], bytes[2]);
assert_eq!(bytes, [0x30, 0x08, 0x04, 0x00]);
let bytes = AuraPowerState {
zone: PowerZones::None,
awake: false,
boot: true,
sleep: false,
shutdown: false,
};
let bytes = bytes.old_to_bytes();
println!("{:08b}, {:08b}, {:08b}", bytes[0], bytes[1], bytes[2]);
assert_eq!(bytes, [0xc3, 0x12, 0x09, 0x00]);
let power = AuraPowerState {
zone: PowerZones::KeyboardAndLightbar,
awake: true,
boot: true,
sleep: true,
shutdown: false,
};
let bytes = power.old_to_bytes();
let bytes = power.to_bytes(AuraDeviceType::LaptopPre2021);
println!("{:08b}, {:08b}, {:08b}", bytes[0], bytes[1], bytes[2]);
assert_eq!(bytes, [0xff, 0x1f, 0x000f, 0x00]);
}
#[test]
fn check_0x19b6_control_bytes_binary_rep() {
fn to_binary_string(power: &LaptopAuraPower) -> String {
let bytes = power.to_bytes(AuraDeviceType::LaptopPost2021);
format!(
"{:08b}, {:08b}, {:08b}, {:08b}",
bytes[0], bytes[1], bytes[2], bytes[3]
)
}
let boot_logo_ = to_binary_string(&LaptopAuraPower {
let boot_logo_ = to_binary_string_post2021(&LaptopAuraPower {
states: vec![AuraPowerState {
zone: PowerZones::Logo,
boot: true,
@@ -357,7 +385,7 @@ mod test {
shutdown: false,
}],
});
let boot_keyb_ = to_binary_string(&LaptopAuraPower {
let boot_keyb_ = to_binary_string_post2021(&LaptopAuraPower {
states: vec![AuraPowerState {
zone: PowerZones::Keyboard,
boot: true,
@@ -366,7 +394,7 @@ mod test {
shutdown: false,
}],
});
let sleep_logo = to_binary_string(&LaptopAuraPower {
let sleep_logo = to_binary_string_post2021(&LaptopAuraPower {
states: vec![AuraPowerState {
zone: PowerZones::Logo,
boot: false,
@@ -375,7 +403,7 @@ mod test {
shutdown: false,
}],
});
let sleep_keyb = to_binary_string(&LaptopAuraPower {
let sleep_keyb = to_binary_string_post2021(&LaptopAuraPower {
states: vec![AuraPowerState {
zone: PowerZones::Keyboard,
boot: false,
@@ -384,7 +412,7 @@ mod test {
shutdown: false,
}],
});
let awake_logo = to_binary_string(&LaptopAuraPower {
let awake_logo = to_binary_string_post2021(&LaptopAuraPower {
states: vec![AuraPowerState {
zone: PowerZones::Logo,
boot: false,
@@ -393,7 +421,7 @@ mod test {
shutdown: false,
}],
});
let awake_keyb = to_binary_string(&LaptopAuraPower {
let awake_keyb = to_binary_string_post2021(&LaptopAuraPower {
states: vec![AuraPowerState {
zone: PowerZones::Keyboard,
boot: false,
@@ -402,7 +430,7 @@ mod test {
shutdown: false,
}],
});
let shut_logo_ = to_binary_string(&LaptopAuraPower {
let shut_logo_ = to_binary_string_post2021(&LaptopAuraPower {
states: vec![AuraPowerState {
zone: PowerZones::Logo,
boot: false,
@@ -411,7 +439,7 @@ mod test {
shutdown: true,
}],
});
let shut_keyb_ = to_binary_string(&LaptopAuraPower {
let shut_keyb_ = to_binary_string_post2021(&LaptopAuraPower {
states: vec![AuraPowerState {
zone: PowerZones::Keyboard,
boot: false,
@@ -420,7 +448,7 @@ mod test {
shutdown: true,
}],
});
let boot_bar__ = to_binary_string(&LaptopAuraPower {
let boot_bar__ = to_binary_string_post2021(&LaptopAuraPower {
states: vec![AuraPowerState {
zone: PowerZones::Lightbar,
boot: true,
@@ -429,7 +457,7 @@ mod test {
shutdown: false,
}],
});
let awake_bar_ = to_binary_string(&LaptopAuraPower {
let awake_bar_ = to_binary_string_post2021(&LaptopAuraPower {
states: vec![AuraPowerState {
zone: PowerZones::Lightbar,
boot: false,
@@ -438,7 +466,7 @@ mod test {
shutdown: false,
}],
});
let sleep_bar_ = to_binary_string(&LaptopAuraPower {
let sleep_bar_ = to_binary_string_post2021(&LaptopAuraPower {
states: vec![AuraPowerState {
zone: PowerZones::Lightbar,
boot: false,
@@ -447,7 +475,7 @@ mod test {
shutdown: false,
}],
});
let shut_bar__ = to_binary_string(&LaptopAuraPower {
let shut_bar__ = to_binary_string_post2021(&LaptopAuraPower {
states: vec![AuraPowerState {
zone: PowerZones::Lightbar,
boot: false,
@@ -456,7 +484,7 @@ mod test {
shutdown: true,
}],
});
let boot_lid__ = to_binary_string(&LaptopAuraPower {
let boot_lid__ = to_binary_string_post2021(&LaptopAuraPower {
states: vec![AuraPowerState {
zone: PowerZones::Lid,
boot: true,
@@ -465,7 +493,7 @@ mod test {
shutdown: false,
}],
});
let awake_lid_ = to_binary_string(&LaptopAuraPower {
let awake_lid_ = to_binary_string_post2021(&LaptopAuraPower {
states: vec![AuraPowerState {
zone: PowerZones::Lid,
boot: false,
@@ -474,7 +502,7 @@ mod test {
shutdown: false,
}],
});
let sleep_lid_ = to_binary_string(&LaptopAuraPower {
let sleep_lid_ = to_binary_string_post2021(&LaptopAuraPower {
states: vec![AuraPowerState {
zone: PowerZones::Lid,
boot: false,
@@ -483,7 +511,7 @@ mod test {
shutdown: false,
}],
});
let shut_lid__ = to_binary_string(&LaptopAuraPower {
let shut_lid__ = to_binary_string_post2021(&LaptopAuraPower {
states: vec![AuraPowerState {
zone: PowerZones::Lid,
boot: false,
@@ -492,7 +520,7 @@ mod test {
shutdown: true,
}],
});
let boot_rear_ = to_binary_string(&LaptopAuraPower {
let boot_rear_ = to_binary_string_post2021(&LaptopAuraPower {
states: vec![AuraPowerState {
zone: PowerZones::RearGlow,
boot: true,
@@ -501,7 +529,7 @@ mod test {
shutdown: false,
}],
});
let awake_rear = to_binary_string(&LaptopAuraPower {
let awake_rear = to_binary_string_post2021(&LaptopAuraPower {
states: vec![AuraPowerState {
zone: PowerZones::RearGlow,
boot: false,
@@ -510,7 +538,7 @@ mod test {
shutdown: false,
}],
});
let sleep_rear = to_binary_string(&LaptopAuraPower {
let sleep_rear = to_binary_string_post2021(&LaptopAuraPower {
states: vec![AuraPowerState {
zone: PowerZones::RearGlow,
boot: false,
@@ -519,7 +547,7 @@ mod test {
shutdown: false,
}],
});
let shut_rear_ = to_binary_string(&LaptopAuraPower {
let shut_rear_ = to_binary_string_post2021(&LaptopAuraPower {
states: vec![AuraPowerState {
zone: PowerZones::RearGlow,
boot: false,
@@ -554,7 +582,7 @@ mod test {
assert_eq!(shut_rear_, "00000000, 00000000, 00000000, 00001000");
// All on
let byte1 = to_binary_string(&LaptopAuraPower {
let byte1 = to_binary_string_post2021(&LaptopAuraPower {
states: vec![
AuraPowerState {
zone: PowerZones::Keyboard,

View File

@@ -74,6 +74,7 @@ pub enum AuraDeviceType {
LaptopPre2021 = 1,
LaptopTuf = 2,
ScsiExtDisk = 3,
Ally = 4,
Unknown = 255,
}
@@ -90,6 +91,10 @@ impl AuraDeviceType {
*self == Self::LaptopPost2021
}
pub fn is_ally(&self) -> bool {
*self == Self::Ally
}
pub fn is_scsi(&self) -> bool {
*self == Self::ScsiExtDisk
}
@@ -101,6 +106,7 @@ impl From<&str> for AuraDeviceType {
"tuf" => AuraDeviceType::LaptopTuf,
"1932" => AuraDeviceType::ScsiExtDisk,
"1866" | "18c6" | "1869" | "1854" => Self::LaptopPre2021,
"1abe" | "1b4c" => Self::Ally,
_ => Self::LaptopPost2021,
}
}
@@ -126,7 +132,9 @@ pub enum PowerZones {
Lid = 3,
/// The led strip on the rear of some laptops
RearGlow = 4,
/// On pre-2021 laptops there is either 1 or 2 zones used
/// Exists for the older 0x1866 models
KeyboardAndLightbar = 5,
/// Ally specific for creating correct packet
Ally = 6,
None = 255,
}

View File

@@ -9,11 +9,16 @@ homepage.workspace = true
edition.workspace = true
[features]
#default = ["mocking"]
#mocking = []
default = []
mocking = []
x11 = ["slint/backend-winit-x11"]
# Requires RUSTFLAGS="--cfg tokio_unstable"
tokio-debug = ["console-subscriber"]
[dependencies]
nix = { version = "^0.28.0", features = ["fs"] }
console-subscriber = { version = "^0.4", optional = true }
nix = { version = "^0.29.0", features = ["fs"] }
tempfile = "3.3.0"
betrayer = { version = "0.2.0" }
@@ -24,7 +29,7 @@ rog_dbus = { path = "../rog-dbus" }
rog_aura = { path = "../rog-aura" }
rog_profiles = { path = "../rog-profiles" }
rog_platform = { path = "../rog-platform" }
supergfxctl = { git = "https://gitlab.com/asus-linux/supergfxctl.git", rev = "4eb6e97c22b68ae8d1e80500709b0c0580776ad3", default-features = false }
supergfxctl = { git = "https://gitlab.com/asus-linux/supergfxctl.git", default-features = false }
dmi_id = { path = "../dmi-id" }
gumdrop.workspace = true
@@ -33,7 +38,6 @@ env_logger.workspace = true
tokio.workspace = true
serde.workspace = true
serde_derive.workspace = true
zbus.workspace = true
dirs.workspace = true
notify-rust.workspace = true

View File

@@ -1,5 +1,9 @@
# ROGALOG
## X11 support
X11 is not supported at all, as in I will not help you with X11 issues if there are any due to limited time and it being unmaintained itself. You can however build `rog-control-center` with it enabled `cargo build --features x11`.
### Translations
You can help with translations by following https://slint.dev/releases/1.1.0/docs/slint/src/concepts/translations#translate-the-strings
@@ -8,4 +12,4 @@ Begin by copying `rog-control-center/translations/en/rog-control-center.po` to `
Run `msgfmt rog-control-center/translations/<YOUR LOCALE>/rog-control-center.po -o rog-control-center/translations/<YOUR LOCALE>/LC_MESSAGES/rog-control-center.mo` to make the binary formatted translation where `<YOUR LOCALE>` is changed to your translation locale.
To test you local translations run `RUST_TRANSLATIONS=1 rog-control-center`.
To test you local translations run `RUST_TRANSLATIONS=1 rog-control-center`.

View File

@@ -1,7 +1,7 @@
use std::fs::create_dir;
use config_traits::{StdConfig, StdConfigLoad1};
use serde_derive::{Deserialize, Serialize};
use serde::{Deserialize, Serialize};
use crate::notify::EnabledNotifications;

View File

@@ -22,11 +22,12 @@ use rog_control_center::{
get_ipc_file, on_tmp_dir_exists, print_versions, MainWindow, QUIT_APP, SHOWING_GUI, SHOW_GUI,
};
use tokio::runtime::Runtime;
// use winit::monitor::VideoMode;
// use winit::window::{Fullscreen, WindowLevel};
#[tokio::main]
async fn main() -> Result<()> {
#[cfg(feature = "tokio-debug")]
console_subscriber::init();
let self_version = env!("CARGO_PKG_VERSION");
let conn = zbus::blocking::Connection::system()?;
let proxy = rog_dbus::zbus_platform::PlatformProxyBlocking::new(&conn)?;
@@ -73,18 +74,7 @@ async fn main() -> Result<()> {
.format_timestamp(None)
.init();
// start tokio
let rt = Runtime::new().expect("Unable to create Runtime");
// Enter the runtime so that `tokio::spawn` is available immediately.
let _enter = rt.enter();
let supported_properties = match proxy.supported_properties() {
Ok(s) => s,
Err(_e) => {
// TODO: show an error window
Vec::default()
}
};
let supported_properties = proxy.supported_properties().unwrap_or_default();
// Startup
let mut config = Config::new().load();
@@ -117,7 +107,13 @@ async fn main() -> Result<()> {
let enable_tray_icon = config.enable_tray_icon;
let startup_in_background = config.startup_in_background;
let config = Arc::new(Mutex::new(config));
start_notifications(config.clone())?;
// start tokio
let rt = Runtime::new().expect("Unable to create Runtime");
// Enter the runtime so that `tokio::spawn` is available immediately.
let _enter = rt.enter();
start_notifications(config.clone(), &rt)?;
if enable_tray_icon {
init_tray(supported_properties, config.clone());
}
@@ -208,6 +204,7 @@ async fn main() -> Result<()> {
});
slint::run_event_loop_until_quit().unwrap();
rt.shutdown_background();
Ok(())
}

View File

@@ -9,8 +9,8 @@ use std::process::Command;
use std::sync::{Arc, Mutex};
use std::time::Duration;
use log::{error, info, warn};
use notify_rust::{Hint, Notification, NotificationHandle, Urgency};
use log::{debug, error, info, warn};
use notify_rust::{Hint, Notification, Timeout, Urgency};
use rog_dbus::zbus_platform::PlatformProxy;
use rog_platform::platform::GpuMode;
use rog_platform::power::AsusPower;
@@ -18,7 +18,8 @@ use serde::{Deserialize, Serialize};
use supergfxctl::actions::UserActionRequired as GfxUserAction;
use supergfxctl::pci_device::{GfxMode, GfxPower};
use supergfxctl::zbus_proxy::DaemonProxy as SuperProxy;
use tokio::time::sleep;
use tokio::runtime::Runtime;
use tokio::task::JoinHandle;
use zbus::export::futures_util::StreamExt;
use crate::config::Config;
@@ -44,10 +45,59 @@ impl Default for EnabledNotifications {
}
}
pub fn start_notifications(config: Arc<Mutex<Config>>) -> Result<()> {
fn start_dpu_status_mon(config: Arc<Mutex<Config>>) {
use supergfxctl::pci_device::Device;
let dev = Device::find().unwrap_or_default();
let mut found_dgpu = false; // just for logging
for dev in dev {
if dev.is_dgpu() {
info!(
"Found dGPU: {}, starting status notifications",
dev.pci_id()
);
let enabled_notifications_copy = config.clone();
// Plain old thread is perfectly fine since most of this is potentially blocking
std::thread::spawn(move || {
let mut last_status = GfxPower::Unknown;
loop {
std::thread::sleep(Duration::from_millis(1500));
if let Ok(status) = dev.get_runtime_status() {
if status != GfxPower::Unknown && status != last_status {
if let Ok(config) = enabled_notifications_copy.lock() {
if !config.notifications.receive_notify_gfx_status
|| !config.notifications.enabled
{
continue;
}
}
// Required check because status cycles through
// active/unknown/suspended
do_gpu_status_notif("dGPU status changed:", &status)
.show()
.unwrap()
.on_close(|_| ());
debug!("dGPU status changed: {:?}", &status);
}
last_status = status;
}
}
});
found_dgpu = true;
break;
}
}
if !found_dgpu {
warn!("Did not find a dGPU on this system, dGPU status won't be avilable");
}
}
pub fn start_notifications(
config: Arc<Mutex<Config>>,
rt: &Runtime,
) -> Result<Vec<JoinHandle<()>>> {
// Setup the AC/BAT commands that will run on power status change
let config_copy = config.clone();
tokio::task::spawn_blocking(move || {
let blocking = rt.spawn_blocking(move || {
let power = AsusPower::new()
.map_err(|e| {
error!("AsusPower: {e}");
@@ -96,23 +146,24 @@ pub fn start_notifications(config: Arc<Mutex<Config>>) -> Result<()> {
}
});
let enabled_notifications_copy = config.clone();
let no_supergfx = move |e: &zbus::Error| {
error!("zbus signal: receive_notify_gfx_status: {e}");
warn!("Attempting to start plain dgpu status monitor");
start_dpu_status_mon(enabled_notifications_copy.clone());
};
// GPU MUX Mode notif
let enabled_notifications_copy = config.clone();
tokio::spawn(async move {
let conn = zbus::Connection::system()
.await
.map_err(|e| {
error!("zbus signal: receive_notify_gpu_mux_mode: {e}");
e
})
.unwrap();
let proxy = PlatformProxy::new(&conn)
.await
.map_err(|e| {
error!("zbus signal: receive_notify_gpu_mux_mode: {e}");
e
})
.unwrap();
let conn = zbus::Connection::system().await.map_err(|e| {
error!("zbus signal: receive_notify_gpu_mux_mode: {e}");
e
})?;
let proxy = PlatformProxy::new(&conn).await.map_err(|e| {
error!("zbus signal: receive_notify_gpu_mux_mode: {e}");
e
})?;
let mut actual_mux_mode = GpuMode::Error;
if let Ok(mode) = proxy.gpu_mux_mode().await {
@@ -134,68 +185,25 @@ pub fn start_notifications(config: Arc<Mutex<Config>>) -> Result<()> {
do_mux_notification("Reboot required. BIOS GPU MUX mode set to", &mode).ok();
}
}
Ok::<(), zbus::Error>(())
});
use supergfxctl::pci_device::Device;
let dev = Device::find().unwrap_or_default();
let mut found_dgpu = false; // just for logging
for dev in dev {
if dev.is_dgpu() {
let enabled_notifications_copy = config.clone();
// Plain old thread is perfectly fine since most of this is potentially blocking
tokio::spawn(async move {
let mut last_status = GfxPower::Unknown;
loop {
if let Ok(status) = dev.get_runtime_status() {
if status != GfxPower::Unknown && status != last_status {
if let Ok(config) = enabled_notifications_copy.lock() {
if !config.notifications.receive_notify_gfx_status
|| !config.notifications.enabled
{
continue;
}
}
// Required check because status cycles through
// active/unknown/suspended
do_gpu_status_notif("dGPU status changed:", &status).ok();
}
last_status = status;
}
sleep(Duration::from_millis(500)).await;
}
});
found_dgpu = true;
break;
}
}
if !found_dgpu {
warn!("Did not find a dGPU on this system, dGPU status won't be avilable");
}
let enabled_notifications_copy = config.clone();
// GPU Mode change/action notif
tokio::spawn(async move {
let conn = zbus::Connection::system()
.await
.map_err(|e| {
error!("zbus signal: receive_notify_action: {e}");
e
})
.unwrap();
let proxy = SuperProxy::builder(&conn)
.build()
.await
.map_err(|e| {
error!("zbus signal: receive_notify_action: {e}");
e
})
.unwrap();
let conn = zbus::Connection::system().await.inspect_err(|e| {
no_supergfx(e);
})?;
let proxy = SuperProxy::builder(&conn).build().await.inspect_err(|e| {
no_supergfx(e);
})?;
let _ = proxy.mode().await.inspect_err(|e| {
no_supergfx(e);
})?;
if proxy.mode().await.is_err() {
info!("supergfxd not running or not responding");
return;
}
if let Ok(mut p) = proxy.receive_notify_action().await {
let proxy_copy = proxy.clone();
let mut p = proxy.receive_notify_action().await?;
tokio::spawn(async move {
info!("Started zbus signal thread: receive_notify_action");
while let Some(e) = p.next().await {
if let Ok(out) = e.args() {
@@ -214,10 +222,39 @@ pub fn start_notifications(config: Arc<Mutex<Config>>) -> Result<()> {
.ok();
}
}
};
});
let mut p = proxy_copy.receive_notify_gfx_status().await?;
tokio::spawn(async move {
info!("Started zbus signal thread: receive_notify_gfx_status");
let mut last_status = GfxPower::Unknown;
while let Some(e) = p.next().await {
if let Ok(out) = e.args() {
let status = out.status;
if status != GfxPower::Unknown && status != last_status {
if let Ok(config) = enabled_notifications_copy.lock() {
if !config.notifications.receive_notify_gfx_status
|| !config.notifications.enabled
{
continue;
}
}
// Required check because status cycles through
// active/unknown/suspended
do_gpu_status_notif("dGPU status changed:", &status)
.show_async()
.await
.unwrap()
.on_close(|_| ());
}
last_status = status;
}
}
});
Ok::<(), zbus::Error>(())
});
Ok(())
Ok(vec![blocking])
}
fn convert_gfx_mode(gfx: GfxMode) -> GpuMode {
@@ -237,19 +274,15 @@ where
T: Display,
{
let mut notif = Notification::new();
notif
.summary(NOTIF_HEADER)
.body(&format!("{message} {data}"))
.timeout(-1)
//.hint(Hint::Resident(true))
.appname(NOTIF_HEADER)
.summary(&format!("{message} {data}"))
.timeout(Timeout::Milliseconds(3000))
.hint(Hint::Category("device".into()));
notif
}
fn do_gpu_status_notif(message: &str, data: &GfxPower) -> Result<NotificationHandle> {
// eww
fn do_gpu_status_notif(message: &str, data: &GfxPower) -> Notification {
let mut notif = base_notification(message, &<&str>::from(data).to_owned());
let icon = match data {
GfxPower::Suspended => "asus_notif_blue",
@@ -259,7 +292,7 @@ fn do_gpu_status_notif(message: &str, data: &GfxPower) -> Result<NotificationHan
GfxPower::Unknown => "gpu-integrated",
};
notif.icon(icon);
Ok(Notification::show(&notif)?)
notif
}
fn do_gfx_action_notif(message: &str, action: GfxUserAction, mode: GpuMode) -> Result<()> {
@@ -270,13 +303,12 @@ fn do_gfx_action_notif(message: &str, action: GfxUserAction, mode: GpuMode) -> R
let mut notif = Notification::new();
notif
.summary(NOTIF_HEADER)
.body(&format!("Changing to {mode}. {message}"))
.timeout(2000)
.appname(NOTIF_HEADER)
.summary(&format!("Changing to {mode}. {message}"))
//.hint(Hint::Resident(true))
.hint(Hint::Category("device".into()))
.urgency(Urgency::Critical)
.timeout(-1)
.timeout(Timeout::Never)
.icon("dialog-warning")
.hint(Hint::Transient(true));

View File

@@ -12,7 +12,7 @@ use std::time::Duration;
use betrayer::{Icon, Menu, MenuItem, TrayEvent, TrayIcon, TrayIconBuilder};
use log::{debug, error, info, warn};
use rog_platform::platform::Properties;
use supergfxctl::pci_device::{GfxMode, GfxPower};
use supergfxctl::pci_device::{Device, GfxMode, GfxPower};
use supergfxctl::zbus_proxy::DaemonProxyBlocking as GfxProxy;
use versions::Versioning;
@@ -71,7 +71,7 @@ fn build_menu() -> Menu<TrayAction> {
Menu::new([
MenuItem::separator(),
MenuItem::button("Open", TrayAction::Open),
MenuItem::button("Quit", TrayAction::Quit),
MenuItem::button("Quit App", TrayAction::Quit),
])
}
@@ -126,6 +126,20 @@ fn set_tray_icon_and_tip(
}
}
fn find_dgpu() -> Option<Device> {
use supergfxctl::pci_device::Device;
let dev = Device::find().unwrap_or_default();
for dev in dev {
if dev.is_dgpu() {
info!("Found dGPU: {}", dev.pci_id());
// Plain old thread is perfectly fine since most of this is potentially blocking
return Some(dev);
}
}
warn!("Did not find a dGPU on this system, dGPU status won't be avilable");
None
}
/// The tray is controlled somewhat by `Arc<Mutex<SystemState>>`
pub fn init_tray(_supported_properties: Vec<Properties>, config: Arc<Mutex<Config>>) {
std::thread::spawn(move || {
@@ -136,7 +150,11 @@ pub fn init_tray(_supported_properties: Vec<Properties>, config: Arc<Mutex<Confi
.with_tooltip(TRAY_LABEL)
.with_menu(build_menu())
.build(do_action)
.map_err(|e| log::error!("Tray unable to be initialised: {e:?}"))
.map_err(|e| {
log::error!(
"Tray unable to be initialised: {e:?}. Do you have a system tray enabled?"
)
})
{
info!("Tray started");
let rog_blue = read_icon(&PathBuf::from("asus_notif_blue.png"));
@@ -151,38 +169,57 @@ pub fn init_tray(_supported_properties: Vec<Properties>, config: Arc<Mutex<Confi
gpu_integrated,
});
let mut has_supergfx = false;
let conn = zbus::blocking::Connection::system().unwrap();
let gfx_proxy = GfxProxy::new(&conn).unwrap();
let mut supergfx_active = false;
if gfx_proxy.mode().is_ok() {
supergfx_active = true;
if let Ok(version) = gfx_proxy.version() {
if let Some(version) = Versioning::new(&version) {
let curr_gfx = Versioning::new("5.0.3-RC4").unwrap();
warn!("supergfxd version = {version}");
if version < curr_gfx {
// Don't allow mode changing if too old a version
warn!("supergfxd found but is too old to use");
// tray.gfx_proxy_is_active = false;
if let Ok(gfx_proxy) = GfxProxy::new(&conn) {
match gfx_proxy.mode() {
Ok(_) => {
has_supergfx = true;
if let Ok(version) = gfx_proxy.version() {
if let Some(version) = Versioning::new(&version) {
let curr_gfx = Versioning::new("5.2.0").unwrap();
warn!("supergfxd version = {version}");
if version < curr_gfx {
// Don't allow mode changing if too old a version
warn!("supergfxd found but is too old to use");
has_supergfx = false;
}
}
}
}
Err(e) => warn!("Couldn't get mode form supergfxd: {e:?}"),
}
};
info!("Started ROGTray");
let mut last_power = GfxPower::Unknown;
loop {
sleep(Duration::from_millis(1000));
if let Ok(lock) = config.try_lock() {
if !lock.enable_tray_icon {
return;
info!("Started ROGTray");
let mut last_power = GfxPower::Unknown;
let dev = find_dgpu();
loop {
sleep(Duration::from_millis(1000));
if let Ok(lock) = config.try_lock() {
if !lock.enable_tray_icon {
return;
}
}
}
if let Ok(mode) = gfx_proxy.mode() {
if let Ok(power) = gfx_proxy.power() {
if last_power != power {
set_tray_icon_and_tip(mode, power, &mut tray, supergfx_active);
last_power = power;
if has_supergfx {
if let Ok(mode) = gfx_proxy.mode() {
if let Ok(power) = gfx_proxy.power() {
if last_power != power {
set_tray_icon_and_tip(mode, power, &mut tray, has_supergfx);
last_power = power;
}
}
}
} else if let Some(dev) = dev.as_ref() {
if let Ok(power) = dev.get_runtime_status() {
if last_power != power {
set_tray_icon_and_tip(
GfxMode::Hybrid,
power,
&mut tray,
has_supergfx,
);
last_power = power;
}
}
}
}

View File

@@ -1,5 +1,6 @@
use crate::slint_generatedMainWindow::{
AuraPowerState as SlintAuraPowerState, LaptopAuraPower as SlintLaptopAuraPower,
AuraDevType as SlintDeviceType, AuraPowerState as SlintAuraPowerState,
LaptopAuraPower as SlintLaptopAuraPower,
};
impl From<rog_aura::AuraEffect> for crate::slint_generatedMainWindow::AuraEffect {
@@ -51,7 +52,7 @@ impl From<crate::slint_generatedMainWindow::AuraEffect> for rog_aura::AuraEffect
}
use rog_aura::keyboard::{AuraPowerState, LaptopAuraPower};
use rog_aura::PowerZones;
use rog_aura::{AuraDeviceType, PowerZones};
use slint::{Model, ModelRc, RgbaColor};
use crate::slint_generatedMainWindow::PowerZones as SlintPowerZones;
@@ -63,8 +64,9 @@ impl From<PowerZones> for SlintPowerZones {
PowerZones::Lightbar => SlintPowerZones::Lightbar,
PowerZones::Lid => SlintPowerZones::Lid,
PowerZones::RearGlow => SlintPowerZones::RearGlow,
PowerZones::KeyboardAndLightbar => todo!(),
PowerZones::None => todo!(),
PowerZones::KeyboardAndLightbar => SlintPowerZones::KeyboardAndLightbar,
PowerZones::Ally => SlintPowerZones::Ally,
PowerZones::None => SlintPowerZones::Keyboard,
}
}
}
@@ -78,6 +80,7 @@ impl From<SlintPowerZones> for PowerZones {
SlintPowerZones::Lid => PowerZones::Lid,
SlintPowerZones::RearGlow => PowerZones::RearGlow,
SlintPowerZones::KeyboardAndLightbar => PowerZones::KeyboardAndLightbar,
SlintPowerZones::Ally => PowerZones::Ally,
}
}
}
@@ -141,3 +144,29 @@ impl From<LaptopAuraPower> for SlintLaptopAuraPower {
}
}
}
impl From<SlintDeviceType> for AuraDeviceType {
fn from(value: SlintDeviceType) -> Self {
match value {
SlintDeviceType::New => Self::LaptopPost2021,
SlintDeviceType::Old => Self::LaptopPre2021,
SlintDeviceType::Tuf => Self::LaptopTuf,
SlintDeviceType::ScsiExtDisk => Self::ScsiExtDisk,
SlintDeviceType::Unknown => Self::Unknown,
SlintDeviceType::Ally => Self::Ally,
}
}
}
impl From<AuraDeviceType> for SlintDeviceType {
fn from(value: AuraDeviceType) -> Self {
match value {
AuraDeviceType::LaptopPost2021 => SlintDeviceType::New,
AuraDeviceType::LaptopPre2021 => SlintDeviceType::Old,
AuraDeviceType::LaptopTuf => SlintDeviceType::Tuf,
AuraDeviceType::ScsiExtDisk => SlintDeviceType::ScsiExtDisk,
AuraDeviceType::Unknown => SlintDeviceType::Unknown,
AuraDeviceType::Ally => SlintDeviceType::Ally,
}
}
}

View File

@@ -6,12 +6,12 @@ pub mod setup_system;
use std::sync::{Arc, Mutex};
use config_traits::StdConfig;
use rog_dbus::zbus_platform::PlatformProxyBlocking;
use rog_dbus::list_iface_blocking;
use slint::{ComponentHandle, PhysicalSize, SharedString, Weak};
use crate::config::Config;
use crate::ui::setup_anime::setup_anime_page;
use crate::ui::setup_aura::{has_aura_iface_blocking, setup_aura_page};
use crate::ui::setup_aura::setup_aura_page;
use crate::ui::setup_fans::setup_fan_curve_page;
use crate::ui::setup_system::{setup_system_page, setup_system_page_callbacks};
use crate::{AppSettingsPageData, MainWindow};
@@ -108,19 +108,14 @@ pub fn setup_window(config: Arc<Mutex<Config>>) -> MainWindow {
}
};
let conn = zbus::blocking::Connection::system().unwrap();
let platform = PlatformProxyBlocking::new(&conn).unwrap();
let interfaces = platform.supported_interfaces().unwrap();
log::debug!("Available interfaces: {interfaces:?}");
// "Anime", "Aura", "FanCurves", "Platform"
let available = list_iface_blocking().unwrap_or_default();
ui.set_sidebar_items_avilable(
[
// Needs to match the order of slint sidebar items
interfaces.contains(&"Platform".into()),
has_aura_iface_blocking().unwrap_or(false),
interfaces.contains(&"Anime".into()),
interfaces.contains(&"FanCurves".into()),
available.contains(&"org.asuslinux.Platform".to_string()),
available.contains(&"org.asuslinux.Aura".to_string()),
available.contains(&"org.asuslinux.Anime".to_string()),
available.contains(&"org.asuslinux.FanCurves".to_string()),
true,
true,
]
@@ -132,11 +127,19 @@ pub fn setup_window(config: Arc<Mutex<Config>>) -> MainWindow {
});
setup_app_settings_page(&ui, config.clone());
setup_system_page(&ui, config.clone());
setup_system_page_callbacks(&ui, config.clone());
setup_aura_page(&ui, config.clone());
setup_anime_page(&ui, config.clone());
setup_fan_curve_page(&ui, config);
if available.contains(&"org.asuslinux.Platform".to_string()) {
setup_system_page(&ui, config.clone());
setup_system_page_callbacks(&ui, config.clone());
}
if available.contains(&"org.asuslinux.Aura".to_string()) {
setup_aura_page(&ui, config.clone());
}
if available.contains(&"org.asuslinux.Anime".to_string()) {
setup_anime_page(&ui, config.clone());
}
if available.contains(&"org.asuslinux.FanCurves".to_string()) {
setup_fan_curve_page(&ui, config);
}
ui
}

View File

@@ -1,5 +1,6 @@
use std::sync::{Arc, Mutex};
use log::{error, info, warn};
use rog_anime::Animations;
use rog_dbus::zbus_anime::AnimeProxy;
use slint::ComponentHandle;
@@ -11,8 +12,13 @@ use crate::{set_ui_callbacks, set_ui_props_async, AnimePageData, MainWindow};
pub fn setup_anime_page(ui: &MainWindow, _states: Arc<Mutex<Config>>) {
let handle = ui.as_weak();
tokio::spawn(async move {
let conn = zbus::Connection::system().await.unwrap();
let anime = AnimeProxy::new(&conn).await.unwrap();
let Ok(conn) = zbus::Connection::system().await.map_err(|e| warn!("{e:}")) else {
return;
};
let Ok(anime) = AnimeProxy::new(&conn).await.map_err(|e| warn!("{e:}")) else {
info!("This device may not have an AniMe. If not then the error can be ignored");
return;
};
set_ui_props_async!(handle, anime, AnimePageData, brightness);
set_ui_props_async!(handle, anime, AnimePageData, builtins_enabled);
@@ -123,6 +129,7 @@ pub fn setup_anime_page(ui: &MainWindow, _states: Arc<Mutex<Config>>) {
"Setting Anime off_when_unplugged failed"
);
})
.unwrap();
.map_err(|e| error!("setup_anime_page: upgrade_in_event_loop: {e:?}"))
.ok();
});
}

View File

@@ -1,6 +1,8 @@
use std::sync::{Arc, Mutex};
use log::{debug, error, info};
use rog_aura::keyboard::LaptopAuraPower;
use rog_aura::{AuraDeviceType, PowerZones};
use rog_dbus::zbus_aura::AuraProxy;
use slint::{ComponentHandle, Model, RgbaColor, SharedString};
@@ -32,31 +34,11 @@ fn decode_hex(s: &str) -> RgbaColor<u8> {
}
}
pub fn has_aura_iface_blocking() -> Result<bool, Box<dyn std::error::Error>> {
let conn = zbus::blocking::Connection::system()?;
let f = zbus::blocking::fdo::ObjectManagerProxy::new(
&conn,
"org.asuslinux.Daemon",
"/org/asuslinux",
)?;
let interfaces = f.get_managed_objects()?;
let mut aura_paths = Vec::new();
for v in interfaces.iter() {
for k in v.1.keys() {
if k.as_str() == "org.asuslinux.Aura" {
aura_paths.push(v.0.clone());
}
}
}
Ok(!aura_paths.is_empty())
}
/// Returns the first available Aura interface
// TODO: return all
async fn find_aura_iface() -> Result<AuraProxy<'static>, Box<dyn std::error::Error>> {
let conn = zbus::Connection::system().await?;
let f =
zbus::fdo::ObjectManagerProxy::new(&conn, "org.asuslinux.Daemon", "/org/asuslinux").await?;
let f = zbus::fdo::ObjectManagerProxy::new(&conn, "org.asuslinux.Daemon", "/").await?;
let interfaces = f.get_managed_objects().await?;
let mut aura_paths = Vec::new();
for v in interfaces.iter() {
@@ -92,21 +74,51 @@ pub fn setup_aura_page(ui: &MainWindow, _states: Arc<Mutex<Config>>) {
let handle = ui.as_weak();
tokio::spawn(async move {
let aura = find_aura_iface().await.unwrap();
let Ok(aura) = find_aura_iface().await else {
info!("This device appears to have no aura interfaces");
return Ok::<(), zbus::Error>(());
};
set_ui_props_async!(handle, aura, AuraPageData, brightness);
set_ui_props_async!(handle, aura, AuraPageData, led_mode);
set_ui_props_async!(handle, aura, AuraPageData, led_mode_data);
set_ui_props_async!(handle, aura, AuraPageData, led_power);
set_ui_props_async!(handle, aura, AuraPageData, device_type);
if let Ok(power) = aura.supported_power_zones().await {
log::debug!("Available LED power modes {power:?}");
let power: Vec<SlintPowerZones> = power.iter().map(|p| (*p).into()).collect();
if let Ok(mut pow3r) = aura.supported_power_zones().await {
let dev_type = aura
.device_type()
.await
.unwrap_or(AuraDeviceType::LaptopPost2021);
log::debug!("Available LED power modes {pow3r:?}");
handle
.upgrade_in_event_loop(move |handle| {
handle
let names: Vec<SharedString> = handle
.global::<AuraPageData>()
.set_supported_power_zones(power.as_slice().into());
.get_power_zone_names()
.iter()
.collect();
if dev_type.is_old_laptop() {
// Need to add the specific KeyboardAndLightbar
if pow3r.contains(&PowerZones::Keyboard)
&& pow3r.contains(&PowerZones::Lightbar)
{
pow3r.push(PowerZones::KeyboardAndLightbar);
}
let names: Vec<SharedString> =
pow3r.iter().map(|n| names[(*n) as usize].clone()).collect();
handle
.global::<AuraPageData>()
.set_power_zone_names_old(names.as_slice().into());
} else {
let power: Vec<SlintPowerZones> =
pow3r.iter().map(|p| (*p).into()).collect();
handle
.global::<AuraPageData>()
.set_supported_power_zones(power.as_slice().into());
}
})
.ok();
}
@@ -132,6 +144,7 @@ pub fn setup_aura_page(ui: &MainWindow, _states: Arc<Mutex<Config>>) {
.global::<AuraPageData>()
.set_available_mode_names(res.as_slice().into());
})
.map_err(|e| error!("{e:}"))
.ok();
}
@@ -190,7 +203,8 @@ pub fn setup_aura_page(ui: &MainWindow, _states: Arc<Mutex<Config>>) {
});
});
})
.unwrap();
.map_err(|e| error!("{e:}"))
.ok();
// Need to update the UI if the mode changes
let handle_copy = handle.clone();
@@ -207,9 +221,12 @@ pub fn setup_aura_page(ui: &MainWindow, _states: Arc<Mutex<Config>>) {
.invoke_update_led_mode_data(out.into());
handle.invoke_external_colour_change();
})
.map_err(|e| error!("{e:}"))
.ok();
}
}
});
debug!("Aura setup tasks complete");
Ok(())
});
}

View File

@@ -1,5 +1,6 @@
use std::sync::{Arc, Mutex};
use log::{error, info};
use rog_dbus::zbus_fan_curves::FanCurvesProxy;
use rog_platform::platform::ThrottlePolicy;
use rog_profiles::fan_curve_set::CurveData;
@@ -81,7 +82,8 @@ pub fn update_fan_data(
}
}
})
.unwrap();
.map_err(|e| error!("update_fan_data: upgrade_in_event_loop: {e:?}"))
.ok();
}
pub fn setup_fan_curve_page(ui: &MainWindow, _config: Arc<Mutex<Config>>) {
@@ -89,17 +91,44 @@ pub fn setup_fan_curve_page(ui: &MainWindow, _config: Arc<Mutex<Config>>) {
tokio::spawn(async move {
// Create the connections/proxies here to prevent future delays in process
let conn = zbus::Connection::system().await.unwrap();
let fans = FanCurvesProxy::new(&conn).await.unwrap();
let conn = if let Ok(conn) = zbus::Connection::system().await.map_err(|e| error!("{e:}")) {
conn
} else {
return;
};
let fans = if let Ok(fans) = FanCurvesProxy::new(&conn).await.map_err(|e| error!("{e:}")) {
fans
} else {
info!(
"This device may not have an Fan Curve control. If not then the error can be \
ignored"
);
return;
};
let handle_copy = handle.clone();
// Do initial setup
let balanced = fans.fan_curve_data(ThrottlePolicy::Balanced).await.unwrap();
let perf = fans
let Ok(balanced) = fans
.fan_curve_data(ThrottlePolicy::Balanced)
.await
.map_err(|e| error!("{e:}"))
else {
return;
};
let Ok(perf) = fans
.fan_curve_data(ThrottlePolicy::Performance)
.await
.unwrap();
let quiet = fans.fan_curve_data(ThrottlePolicy::Quiet).await.unwrap();
.map_err(|e| error!("{e:}"))
else {
return;
};
let Ok(quiet) = fans
.fan_curve_data(ThrottlePolicy::Quiet)
.await
.map_err(|e| error!("{e:}"))
else {
return;
};
update_fan_data(handle, balanced, perf, quiet);
let handle_next1 = handle_copy.clone();
@@ -111,14 +140,30 @@ pub fn setup_fan_curve_page(ui: &MainWindow, _config: Arc<Mutex<Config>>) {
let fans = fans1.clone();
let handle_next = handle_next1.clone();
tokio::spawn(async move {
fans.set_curves_to_defaults(profile.into()).await.unwrap();
let balanced = fans.fan_curve_data(ThrottlePolicy::Balanced).await.unwrap();
let perf = fans
if fans.set_curves_to_defaults(profile.into()).await.is_err() {
return;
}
let Ok(balanced) = fans
.fan_curve_data(ThrottlePolicy::Balanced)
.await
.map_err(|e| error!("{e:}"))
else {
return;
};
let Ok(perf) = fans
.fan_curve_data(ThrottlePolicy::Performance)
.await
.unwrap();
let quiet = fans.fan_curve_data(ThrottlePolicy::Quiet).await.unwrap();
.map_err(|e| error!("{e:}"))
else {
return;
};
let Ok(quiet) = fans
.fan_curve_data(ThrottlePolicy::Quiet)
.await
.map_err(|e| error!("{e:}"))
else {
return;
};
update_fan_data(handle_next, balanced, perf, quiet);
});
});
@@ -127,11 +172,15 @@ pub fn setup_fan_curve_page(ui: &MainWindow, _config: Arc<Mutex<Config>>) {
let data: Vec<Node> = data.iter().collect();
let data = fan_data_for(fan, enabled, data);
tokio::spawn(async move {
fans.set_fan_curve(profile.into(), data).await.unwrap();
fans.set_fan_curve(profile.into(), data)
.await
.map_err(|e| error!("{e:}"))
.ok()
});
});
})
.unwrap();
.map_err(|e| error!("setup_fan_curve_page: upgrade_in_event_loop: {e:?}"))
.ok();
});
}

View File

@@ -60,7 +60,19 @@ pub fn setup_system_page_callbacks(ui: &MainWindow, _states: Arc<Mutex<Config>>)
set_ui_props_async!(handle, platform, SystemPageData, throttle_performance_epp);
set_ui_props_async!(handle, platform, SystemPageData, throttle_quiet_epp);
set_ui_props_async!(handle, platform, SystemPageData, throttle_policy_on_battery);
set_ui_props_async!(
handle,
platform,
SystemPageData,
change_throttle_policy_on_battery
);
set_ui_props_async!(handle, platform, SystemPageData, throttle_policy_on_ac);
set_ui_props_async!(
handle,
platform,
SystemPageData,
change_throttle_policy_on_ac
);
set_ui_props_async!(handle, platform, SystemPageData, panel_od);
set_ui_props_async!(handle, platform, SystemPageData, boot_sound);
@@ -94,6 +106,7 @@ pub fn setup_system_page_callbacks(ui: &MainWindow, _states: Arc<Mutex<Config>>)
throttle_thermal_policy: sys_props.contains(&Properties::ThrottlePolicy),
};
// TODO: move the fail/sucess messages to slint
handle
.upgrade_in_event_loop(move |handle| {
handle.global::<SystemPageData>().set_available(props);
@@ -163,13 +176,24 @@ pub fn setup_system_page_callbacks(ui: &MainWindow, _states: Arc<Mutex<Config>>)
"Throttle policy on AC set to {}",
"Setting Throttle policy on AC failed"
);
set_ui_callbacks!(handle,
SystemPageData(as bool),
platform.change_throttle_policy_on_ac(.into()),
"Throttle policy on AC enabled: {}",
"Setting Throttle policy on AC failed"
);
set_ui_callbacks!(handle,
SystemPageData(as i32),
platform.throttle_policy_on_battery(.into()),
"Throttle policy on abttery set to {}",
"Setting Throttle policy on battery failed"
);
set_ui_callbacks!(handle,
SystemPageData(as bool),
platform.change_throttle_policy_on_battery(.into()),
"Throttle policy on battery enabled: {}",
"Setting Throttle policy on AC failed"
);
set_ui_callbacks!(handle,
SystemPageData(as f32),
platform.ppt_pl1_spl(as u8),

View File

@@ -2,7 +2,7 @@
msgid ""
msgstr ""
"Project-Id-Version: PACKAGE VERSION\n"
"POT-Creation-Date: 2024-05-06 11:00+0000\n"
"POT-Creation-Date: 2024-08-30 09:29+0000\n"
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
"Language-Team: LANGUAGE <LL@li.org>\n"
@@ -137,77 +137,122 @@ msgctxt "PageAnime"
msgid "Off when on battery"
msgstr ""
#: rog-control-center/ui/pages/app_settings.slint:29
#: rog-control-center/ui/pages/app_settings.slint:26
msgctxt "PageAppSettings"
msgid "Run in background after closing"
msgstr ""
#: rog-control-center/ui/pages/app_settings.slint:38
#: rog-control-center/ui/pages/app_settings.slint:34
msgctxt "PageAppSettings"
msgid "Start app in background (UI closed)"
msgstr ""
#: rog-control-center/ui/pages/app_settings.slint:50
#: rog-control-center/ui/pages/app_settings.slint:42
msgctxt "PageAppSettings"
msgid "Enable system tray icon"
msgstr ""
#: rog-control-center/ui/pages/app_settings.slint:59
#: rog-control-center/ui/pages/app_settings.slint:50
msgctxt "PageAppSettings"
msgid "Enable dGPU notifications"
msgstr ""
#: rog-control-center/ui/pages/fans.slint:27
#: rog-control-center/ui/pages/aura.slint:28
msgctxt "PageAura"
msgid "Brightness"
msgstr ""
#: rog-control-center/ui/pages/aura.slint:39
msgctxt "PageAura"
msgid "Aura mode"
msgstr ""
#: rog-control-center/ui/pages/aura.slint:59
msgctxt "PageAura"
msgid "Colour 1"
msgstr ""
#: rog-control-center/ui/pages/aura.slint:85
msgctxt "PageAura"
msgid "Colour 2"
msgstr ""
#: rog-control-center/ui/pages/aura.slint:119
msgctxt "PageAura"
msgid "Zone"
msgstr ""
#: rog-control-center/ui/pages/aura.slint:142
msgctxt "PageAura"
msgid "Direction"
msgstr ""
#: rog-control-center/ui/pages/aura.slint:164
msgctxt "PageAura"
msgid "Speed"
msgstr ""
#: rog-control-center/ui/pages/aura.slint:185
msgctxt "PageAura"
msgid "Power Settings"
msgstr ""
#: rog-control-center/ui/pages/aura.slint:270
msgctxt "PageAura"
msgid "Power Zones"
msgstr ""
#: rog-control-center/ui/pages/fans.slint:26
msgctxt "FanTab"
msgid "This fan is not avilable on this machine"
msgstr ""
#: rog-control-center/ui/pages/fans.slint:35
#: rog-control-center/ui/pages/fans.slint:34
msgctxt "FanTab"
msgid "Enabled"
msgstr ""
#: rog-control-center/ui/pages/fans.slint:44
#: rog-control-center/ui/pages/fans.slint:43
msgctxt "FanTab"
msgid "Apply"
msgstr ""
#: rog-control-center/ui/pages/fans.slint:52
#: rog-control-center/ui/pages/fans.slint:51
msgctxt "FanTab"
msgid "Cancel"
msgstr ""
#: rog-control-center/ui/pages/fans.slint:60
#: rog-control-center/ui/pages/fans.slint:59
msgctxt "FanTab"
msgid "Factory Default (all fans)"
msgstr ""
#: rog-control-center/ui/pages/fans.slint:73
#: rog-control-center/ui/pages/fans.slint:72
msgctxt "PageFans"
msgid "Balanced"
msgstr ""
#: rog-control-center/ui/pages/fans.slint:76 rog-control-center/ui/pages/fans.slint:135 rog-control-center/ui/pages/fans.slint:194
#: rog-control-center/ui/pages/fans.slint:75 rog-control-center/ui/pages/fans.slint:134 rog-control-center/ui/pages/fans.slint:193
msgctxt "PageFans"
msgid "CPU"
msgstr ""
#: rog-control-center/ui/pages/fans.slint:94 rog-control-center/ui/pages/fans.slint:153 rog-control-center/ui/pages/fans.slint:212
#: rog-control-center/ui/pages/fans.slint:93 rog-control-center/ui/pages/fans.slint:152 rog-control-center/ui/pages/fans.slint:211
msgctxt "PageFans"
msgid "Mid"
msgstr ""
#: rog-control-center/ui/pages/fans.slint:112 rog-control-center/ui/pages/fans.slint:171 rog-control-center/ui/pages/fans.slint:230
#: rog-control-center/ui/pages/fans.slint:111 rog-control-center/ui/pages/fans.slint:170 rog-control-center/ui/pages/fans.slint:229
msgctxt "PageFans"
msgid "GPU"
msgstr ""
#: rog-control-center/ui/pages/fans.slint:132
#: rog-control-center/ui/pages/fans.slint:131
msgctxt "PageFans"
msgid "Performance"
msgstr ""
#: rog-control-center/ui/pages/fans.slint:191
#: rog-control-center/ui/pages/fans.slint:190
msgctxt "PageFans"
msgid "Quiet"
msgstr ""
@@ -247,408 +292,398 @@ msgctxt "SystemPageData"
msgid "Power"
msgstr ""
#: rog-control-center/ui/pages/system.slint:106
#: rog-control-center/ui/pages/system.slint:110
msgctxt "PageSystem"
msgid "Base system settings"
msgstr ""
#: rog-control-center/ui/pages/system.slint:111
#: rog-control-center/ui/pages/system.slint:115
msgctxt "PageSystem"
msgid "Charge limit"
msgstr ""
#: rog-control-center/ui/pages/system.slint:123
#: rog-control-center/ui/pages/system.slint:127
msgctxt "PageSystem"
msgid "Throttle Policy"
msgstr ""
#: rog-control-center/ui/pages/system.slint:133
#: rog-control-center/ui/pages/system.slint:137
msgctxt "PageSystem"
msgid "Advanced"
msgstr ""
#: rog-control-center/ui/pages/system.slint:145
#: rog-control-center/ui/pages/system.slint:149
msgctxt "PageSystem"
msgid "Panel Overdrive"
msgstr ""
#: rog-control-center/ui/pages/system.slint:153
#: rog-control-center/ui/pages/system.slint:157
msgctxt "PageSystem"
msgid "MiniLED Mode"
msgstr ""
#: rog-control-center/ui/pages/system.slint:161
#: rog-control-center/ui/pages/system.slint:165
msgctxt "PageSystem"
msgid "POST boot sound"
msgstr ""
#: rog-control-center/ui/pages/system.slint:179
#: rog-control-center/ui/pages/system.slint:183
msgctxt "PageSystem"
msgid "System performance settings"
msgstr ""
#: rog-control-center/ui/pages/system.slint:184
#: rog-control-center/ui/pages/system.slint:188
msgctxt "ppt_pl1_spl"
msgid "ppt_pl1_spl"
msgid "PL1, sustained power limit"
msgstr ""
#: rog-control-center/ui/pages/system.slint:194
#: rog-control-center/ui/pages/system.slint:198
msgctxt "ppt_pl2_sppt"
msgid "ppt_pl2_sppt"
msgid "PL2, turbo power limit"
msgstr ""
#: rog-control-center/ui/pages/system.slint:204
#: rog-control-center/ui/pages/system.slint:208
msgctxt "ppt_fppt"
msgid "ppt_fppt"
msgid "FPPT, Fast Power Limit"
msgstr ""
#: rog-control-center/ui/pages/system.slint:214
#: rog-control-center/ui/pages/system.slint:218
msgctxt "ppt_apu_sppt"
msgid "ppt_apu_sppt"
msgid "SPPT, APU slow power limit"
msgstr ""
#: rog-control-center/ui/pages/system.slint:224
#: rog-control-center/ui/pages/system.slint:228
msgctxt "ppt_platform_sppt"
msgid "ppt_platform_sppt"
msgid "Slow package power tracking limit"
msgstr ""
#: rog-control-center/ui/pages/system.slint:234
#: rog-control-center/ui/pages/system.slint:238
msgctxt "nv_dynamic_boost"
msgid "nv_dynamic_boost"
msgid "dGPU boost overclock"
msgstr ""
#: rog-control-center/ui/pages/system.slint:244
#: rog-control-center/ui/pages/system.slint:248
msgctxt "nv_temp_target"
msgid "nv_temp_target"
msgstr ""
#: rog-control-center/ui/pages/system.slint:290
msgctxt "PageSystem"
msgid "Energy Performance Preference linked to Throttle Policy"
msgid "dGPU temperature max"
msgstr ""
#: rog-control-center/ui/pages/system.slint:294
msgctxt "PageSystem"
msgid "Energy Performance Preference linked to Throttle Policy"
msgstr ""
#: rog-control-center/ui/pages/system.slint:298
msgctxt "PageSystem"
msgid "Change EPP based on Throttle Policy"
msgstr ""
#: rog-control-center/ui/pages/system.slint:302
#: rog-control-center/ui/pages/system.slint:306
msgctxt "PageSystem"
msgid "EPP for Balanced Policy"
msgstr ""
#: rog-control-center/ui/pages/system.slint:312
#: rog-control-center/ui/pages/system.slint:316
msgctxt "PageSystem"
msgid "EPP for Performance Policy"
msgstr ""
#: rog-control-center/ui/pages/system.slint:322
#: rog-control-center/ui/pages/system.slint:326
msgctxt "PageSystem"
msgid "EPP for Quiet Policy"
msgstr ""
#: rog-control-center/ui/pages/system.slint:340
#: rog-control-center/ui/pages/system.slint:344
msgctxt "PageSystem"
msgid "Throttle Policy for power state"
msgstr ""
#: rog-control-center/ui/pages/system.slint:344
#: rog-control-center/ui/pages/system.slint:350
msgctxt "PageSystem"
msgid "Throttle Policy on Battery"
msgstr ""
#: rog-control-center/ui/pages/system.slint:354
#: rog-control-center/ui/pages/system.slint:360 rog-control-center/ui/pages/system.slint:381
msgctxt "PageSystem"
msgid "Enabled"
msgstr ""
#: rog-control-center/ui/pages/system.slint:371
msgctxt "PageSystem"
msgid "Throttle Policy on AC"
msgstr ""
#: rog-control-center/ui/pages/aura.slint:27
msgctxt "PageAura"
msgid "Brightness"
msgstr ""
#: rog-control-center/ui/pages/aura.slint:38
msgctxt "PageAura"
msgid "Aura mode"
msgstr ""
#: rog-control-center/ui/pages/aura.slint:56
msgctxt "PageAura"
msgid "Colour 1"
msgstr ""
#: rog-control-center/ui/pages/aura.slint:82
msgctxt "PageAura"
msgid "Colour 2"
msgstr ""
#: rog-control-center/ui/pages/aura.slint:114
msgctxt "PageAura"
msgid "Zone"
msgstr ""
#: rog-control-center/ui/pages/aura.slint:137
msgctxt "PageAura"
msgid "Direction"
msgstr ""
#: rog-control-center/ui/pages/aura.slint:159
msgctxt "PageAura"
msgid "Speed"
msgstr ""
#: rog-control-center/ui/pages/aura.slint:180
msgctxt "PageAura"
msgid "Power Settings"
msgstr ""
#: rog-control-center/ui/widgets/aura_power.slint:32
msgctxt "AuraPowerGroup"
msgid "Boot"
msgstr ""
#: rog-control-center/ui/widgets/aura_power.slint:42
msgctxt "AuraPowerGroup"
msgid "Awake"
msgstr ""
#: rog-control-center/ui/widgets/aura_power.slint:52
msgctxt "AuraPowerGroup"
msgid "Sleep"
msgstr ""
#: rog-control-center/ui/widgets/aura_power.slint:62
msgctxt "AuraPowerGroup"
msgid "Shutdown"
msgstr ""
#: rog-control-center/ui/types/aura_types.slint:46
#: rog-control-center/ui/types/aura_types.slint:51
msgctxt "Aura power zone"
msgid "Logo"
msgstr ""
#: rog-control-center/ui/types/aura_types.slint:47
#: rog-control-center/ui/types/aura_types.slint:52 rog-control-center/ui/types/aura_types.slint:62
msgctxt "Aura power zone"
msgid "Keyboard"
msgstr ""
#: rog-control-center/ui/types/aura_types.slint:48
#: rog-control-center/ui/types/aura_types.slint:53 rog-control-center/ui/types/aura_types.slint:63
msgctxt "Aura power zone"
msgid "Lightbar"
msgstr ""
#: rog-control-center/ui/types/aura_types.slint:49
#: rog-control-center/ui/types/aura_types.slint:54
msgctxt "Aura power zone"
msgid "Lid"
msgstr ""
#: rog-control-center/ui/types/aura_types.slint:50
#: rog-control-center/ui/types/aura_types.slint:55
msgctxt "Aura power zone"
msgid "Rear Glow"
msgstr ""
#: rog-control-center/ui/types/aura_types.slint:51
#: rog-control-center/ui/types/aura_types.slint:56 rog-control-center/ui/types/aura_types.slint:64
msgctxt "Aura power zone"
msgid "Keyboard and Lightbar"
msgstr ""
#: rog-control-center/ui/types/aura_types.slint:54
#: rog-control-center/ui/types/aura_types.slint:57
msgctxt "Aura power zone"
msgid "Ally"
msgstr ""
#: rog-control-center/ui/types/aura_types.slint:67
msgctxt "Aura brightness"
msgid "Off"
msgstr ""
#: rog-control-center/ui/types/aura_types.slint:55
#: rog-control-center/ui/types/aura_types.slint:68
msgctxt "Aura brightness"
msgid "Low"
msgstr ""
#: rog-control-center/ui/types/aura_types.slint:56
#: rog-control-center/ui/types/aura_types.slint:69
msgctxt "Aura brightness"
msgid "Med"
msgstr ""
#: rog-control-center/ui/types/aura_types.slint:57
#: rog-control-center/ui/types/aura_types.slint:70
msgctxt "Aura brightness"
msgid "High"
msgstr ""
#: rog-control-center/ui/types/aura_types.slint:62 rog-control-center/ui/types/aura_types.slint:77
#: rog-control-center/ui/types/aura_types.slint:75 rog-control-center/ui/types/aura_types.slint:90
msgctxt "Basic aura mode"
msgid "Static"
msgstr ""
#: rog-control-center/ui/types/aura_types.slint:63 rog-control-center/ui/types/aura_types.slint:78
#: rog-control-center/ui/types/aura_types.slint:76 rog-control-center/ui/types/aura_types.slint:91
msgctxt "Basic aura mode"
msgid "Breathe"
msgstr ""
#: rog-control-center/ui/types/aura_types.slint:64 rog-control-center/ui/types/aura_types.slint:79
#: rog-control-center/ui/types/aura_types.slint:77 rog-control-center/ui/types/aura_types.slint:92
msgctxt "Basic aura mode"
msgid "Strobe"
msgstr ""
#: rog-control-center/ui/types/aura_types.slint:65
#: rog-control-center/ui/types/aura_types.slint:78
msgctxt "Basic aura mode"
msgid "Rainbow"
msgstr ""
#: rog-control-center/ui/types/aura_types.slint:66
#: rog-control-center/ui/types/aura_types.slint:79
msgctxt "Basic aura mode"
msgid "Star"
msgstr ""
#: rog-control-center/ui/types/aura_types.slint:67
#: rog-control-center/ui/types/aura_types.slint:80
msgctxt "Basic aura mode"
msgid "Rain"
msgstr ""
#: rog-control-center/ui/types/aura_types.slint:68
#: rog-control-center/ui/types/aura_types.slint:81
msgctxt "Basic aura mode"
msgid "Highlight"
msgstr ""
#: rog-control-center/ui/types/aura_types.slint:69
#: rog-control-center/ui/types/aura_types.slint:82
msgctxt "Basic aura mode"
msgid "Laser"
msgstr ""
#: rog-control-center/ui/types/aura_types.slint:70
#: rog-control-center/ui/types/aura_types.slint:83
msgctxt "Basic aura mode"
msgid "Ripple"
msgstr ""
#: rog-control-center/ui/types/aura_types.slint:71
#: rog-control-center/ui/types/aura_types.slint:84
msgctxt "Basic aura mode"
msgid "Nothing"
msgstr ""
#: rog-control-center/ui/types/aura_types.slint:72
#: rog-control-center/ui/types/aura_types.slint:85
msgctxt "Basic aura mode"
msgid "Pulse"
msgstr ""
#: rog-control-center/ui/types/aura_types.slint:73
#: rog-control-center/ui/types/aura_types.slint:86
msgctxt "Basic aura mode"
msgid "Comet"
msgstr ""
#: rog-control-center/ui/types/aura_types.slint:74
#: rog-control-center/ui/types/aura_types.slint:87
msgctxt "Basic aura mode"
msgid "Flash"
msgstr ""
#: rog-control-center/ui/types/aura_types.slint:86
#: rog-control-center/ui/types/aura_types.slint:99
msgctxt "Aura zone"
msgid "None"
msgstr ""
#: rog-control-center/ui/types/aura_types.slint:87
#: rog-control-center/ui/types/aura_types.slint:100
msgctxt "Aura zone"
msgid "Key1"
msgstr ""
#: rog-control-center/ui/types/aura_types.slint:88
#: rog-control-center/ui/types/aura_types.slint:101
msgctxt "Aura zone"
msgid "Key2"
msgstr ""
#: rog-control-center/ui/types/aura_types.slint:89
#: rog-control-center/ui/types/aura_types.slint:102
msgctxt "Aura zone"
msgid "Key3"
msgstr ""
#: rog-control-center/ui/types/aura_types.slint:90
#: rog-control-center/ui/types/aura_types.slint:103
msgctxt "Aura zone"
msgid "Key4"
msgstr ""
#: rog-control-center/ui/types/aura_types.slint:91
#: rog-control-center/ui/types/aura_types.slint:104
msgctxt "Aura zone"
msgid "Logo"
msgstr ""
#: rog-control-center/ui/types/aura_types.slint:92
#: rog-control-center/ui/types/aura_types.slint:105
msgctxt "Aura zone"
msgid "Lightbar Left"
msgstr ""
#: rog-control-center/ui/types/aura_types.slint:93
#: rog-control-center/ui/types/aura_types.slint:106
msgctxt "Aura zone"
msgid "Lightbar Right"
msgstr ""
#: rog-control-center/ui/types/aura_types.slint:97
#: rog-control-center/ui/types/aura_types.slint:110
msgctxt "Aura direction"
msgid "Right"
msgstr ""
#: rog-control-center/ui/types/aura_types.slint:98
#: rog-control-center/ui/types/aura_types.slint:111
msgctxt "Aura direction"
msgid "Left"
msgstr ""
#: rog-control-center/ui/types/aura_types.slint:99
#: rog-control-center/ui/types/aura_types.slint:112
msgctxt "Aura direction"
msgid "Up"
msgstr ""
#: rog-control-center/ui/types/aura_types.slint:100
#: rog-control-center/ui/types/aura_types.slint:113
msgctxt "Aura direction"
msgid "Down"
msgstr ""
#: rog-control-center/ui/types/aura_types.slint:104
#: rog-control-center/ui/types/aura_types.slint:117
msgctxt "Aura speed"
msgid "Low"
msgstr ""
#: rog-control-center/ui/types/aura_types.slint:105
#: rog-control-center/ui/types/aura_types.slint:118
msgctxt "Aura speed"
msgid "Medium"
msgstr ""
#: rog-control-center/ui/types/aura_types.slint:106
#: rog-control-center/ui/types/aura_types.slint:119
msgctxt "Aura speed"
msgid "High"
msgstr ""
#: rog-control-center/ui/main_window.slint:50
#: rog-control-center/ui/widgets/aura_power.slint:33
msgctxt "AuraPowerGroup"
msgid "Boot"
msgstr ""
#: rog-control-center/ui/widgets/aura_power.slint:43
msgctxt "AuraPowerGroup"
msgid "Awake"
msgstr ""
#: rog-control-center/ui/widgets/aura_power.slint:53
msgctxt "AuraPowerGroup"
msgid "Sleep"
msgstr ""
#: rog-control-center/ui/widgets/aura_power.slint:63
msgctxt "AuraPowerGroup"
msgid "Shutdown"
msgstr ""
#: rog-control-center/ui/widgets/aura_power.slint:102
msgctxt "AuraPowerGroupOld"
msgid "Zone Selection"
msgstr ""
#: rog-control-center/ui/widgets/aura_power.slint:114
msgctxt "AuraPowerGroupOld"
msgid "Boot"
msgstr ""
#: rog-control-center/ui/widgets/aura_power.slint:124
msgctxt "AuraPowerGroupOld"
msgid "Awake"
msgstr ""
#: rog-control-center/ui/widgets/aura_power.slint:134
msgctxt "AuraPowerGroupOld"
msgid "Sleep"
msgstr ""
#: rog-control-center/ui/main_window.slint:51
msgctxt "MainWindow"
msgid "ROG"
msgstr ""
#: rog-control-center/ui/main_window.slint:52
#: rog-control-center/ui/main_window.slint:53
msgctxt "Menu1"
msgid "System Control"
msgstr ""
#: rog-control-center/ui/main_window.slint:53
#: rog-control-center/ui/main_window.slint:54
msgctxt "Menu2"
msgid "Keyboard Aura"
msgstr ""
#: rog-control-center/ui/main_window.slint:54
#: rog-control-center/ui/main_window.slint:55
msgctxt "Menu3"
msgid "AniMe Matrix"
msgstr ""
#: rog-control-center/ui/main_window.slint:55
#: rog-control-center/ui/main_window.slint:56
msgctxt "Menu4"
msgid "Fan Curves"
msgstr ""
#: rog-control-center/ui/main_window.slint:56
#: rog-control-center/ui/main_window.slint:57
msgctxt "Menu5"
msgid "App Settings"
msgstr ""
#: rog-control-center/ui/main_window.slint:57
#: rog-control-center/ui/main_window.slint:58
msgctxt "Menu6"
msgid "About"
msgstr ""
#: rog-control-center/ui/main_window.slint:69
#: rog-control-center/ui/main_window.slint:70
msgctxt "MainWindow"
msgid "Quit"
msgid "Quit App"
msgstr ""

View File

@@ -0,0 +1,654 @@
msgid ""
msgstr ""
"Project-Id-Version: PACKAGE VERSION\n"
"POT-Creation-Date: 2024-05-11 09:10+0300\n"
"PO-Revision-Date: 2024-05-11 10:20+0300\n"
"Last-Translator: Winfried <winfriedhofmann@duck.com>\n"
"Language-Team: LANGUAGE <LL@li.org>\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"
"Language: tr\n"
"Plural-Forms: nplurals=1; plural=0;\n"
#: rog-control-center/ui/pages/anime.slint:6
msgctxt "Anime Brightness"
msgid "Off"
msgstr "Kapalı"
#: rog-control-center/ui/pages/anime.slint:7
msgctxt "Anime Brightness"
msgid "Low"
msgstr "Düşük"
#: rog-control-center/ui/pages/anime.slint:8
msgctxt "Anime Brightness"
msgid "Med"
msgstr "Orta"
#: rog-control-center/ui/pages/anime.slint:9
msgctxt "Anime Brightness"
msgid "High"
msgstr "Yüksek"
#: rog-control-center/ui/pages/anime.slint:23
msgctxt "AnimePageData"
msgid "Glitch Construction"
msgstr ""
#: rog-control-center/ui/pages/anime.slint:23
msgctxt "AnimePageData"
msgid "Static Emergence"
msgstr ""
#: rog-control-center/ui/pages/anime.slint:25
msgctxt "AnimePageData"
msgid "Binary Banner Scroll"
msgstr ""
#: rog-control-center/ui/pages/anime.slint:25
msgctxt "AnimePageData"
msgid "Rog Logo Glitch"
msgstr ""
#: rog-control-center/ui/pages/anime.slint:27
msgctxt "AnimePageData"
msgid "Banner Swipe"
msgstr ""
#: rog-control-center/ui/pages/anime.slint:27
msgctxt "AnimePageData"
msgid "Starfield"
msgstr ""
#: rog-control-center/ui/pages/anime.slint:29
msgctxt "AnimePageData"
msgid "Glitch Out"
msgstr ""
#: rog-control-center/ui/pages/anime.slint:29
msgctxt "AnimePageData"
msgid "See Ya"
msgstr ""
#: rog-control-center/ui/pages/anime.slint:50
msgctxt "Anime Brightness"
msgid "Brightness"
msgstr "Parlaklık"
#: rog-control-center/ui/pages/anime.slint:66
msgctxt "PageAnime"
msgid "Enable display"
msgstr "Görüntüyü etkinleştir"
#: rog-control-center/ui/pages/anime.slint:74 rog-control-center/ui/pages/anime.slint:97
msgctxt "PageAnime"
msgid "Advanced"
msgstr "Gelişmiş"
#: rog-control-center/ui/pages/anime.slint:89
msgctxt "PageAnime"
msgid "Use built-in animations"
msgstr "Yerleşik animasyonları kullanın"
#: rog-control-center/ui/pages/anime.slint:146
msgctxt "PageAnime"
msgid "Set which builtin animations are played"
msgstr "Hangi yerleşik animasyonların oynatılacağını ayarlayın"
#: rog-control-center/ui/pages/anime.slint:150
msgctxt "Anime built-in selection"
msgid "Boot Animation"
msgstr ""
#: rog-control-center/ui/pages/anime.slint:160
msgctxt "Anime built-in selection"
msgid "Running Animation"
msgstr ""
#: rog-control-center/ui/pages/anime.slint:170
msgctxt "Anime built-in selection"
msgid "Sleep Animation"
msgstr "Uyku Animasyonu"
#: rog-control-center/ui/pages/anime.slint:180
msgctxt "Anime built-in selection"
msgid "Shutdown Animation"
msgstr "Kapatma Animasyonu"
#: rog-control-center/ui/pages/anime.slint:220
msgctxt "PageAnime"
msgid "Advanced Display Settings"
msgstr "Gelişmiş Görüntü Ayarları"
#: rog-control-center/ui/pages/anime.slint:225
msgctxt "PageAnime"
msgid "Off when lid closed"
msgstr "Kapak Kapatıldığında Kapat"
#: rog-control-center/ui/pages/anime.slint:234
msgctxt "PageAnime"
msgid "Off when suspended"
msgstr "Askıya alındığında kapat"
#: rog-control-center/ui/pages/anime.slint:243
msgctxt "PageAnime"
msgid "Off when on battery"
msgstr "Pille çalışırken kapat"
#: rog-control-center/ui/pages/app_settings.slint:29
msgctxt "PageAppSettings"
msgid "Run in background after closing"
msgstr "Kapatıldıktan sonra arka planda çalıştır"
#: rog-control-center/ui/pages/app_settings.slint:38
msgctxt "PageAppSettings"
msgid "Start app in background (UI closed)"
msgstr "Uygulamayı arka planda başlat (UI kapalı)"
#: rog-control-center/ui/pages/app_settings.slint:50
msgctxt "PageAppSettings"
msgid "Enable system tray icon"
msgstr "Sistem tepsisi simgesini etkinleştir"
#: rog-control-center/ui/pages/app_settings.slint:59
msgctxt "PageAppSettings"
msgid "Enable dGPU notifications"
msgstr "dGPU bildirimlerini etkinleştir"
#: rog-control-center/ui/pages/fans.slint:27
msgctxt "FanTab"
msgid "This fan is not avilable on this machine"
msgstr ""
#: rog-control-center/ui/pages/fans.slint:35
msgctxt "FanTab"
msgid "Enabled"
msgstr "Etkinleştirildi"
#: rog-control-center/ui/pages/fans.slint:44
msgctxt "FanTab"
msgid "Apply"
msgstr "Uygula"
#: rog-control-center/ui/pages/fans.slint:52
msgctxt "FanTab"
msgid "Cancel"
msgstr "Vazgeç"
#: rog-control-center/ui/pages/fans.slint:60
msgctxt "FanTab"
msgid "Factory Default (all fans)"
msgstr ""
#: rog-control-center/ui/pages/fans.slint:73
msgctxt "PageFans"
msgid "Balanced"
msgstr "Dengeli"
#: rog-control-center/ui/pages/fans.slint:76 rog-control-center/ui/pages/fans.slint:135 rog-control-center/ui/pages/fans.slint:194
msgctxt "PageFans"
msgid "CPU"
msgstr ""
#: rog-control-center/ui/pages/fans.slint:94 rog-control-center/ui/pages/fans.slint:153 rog-control-center/ui/pages/fans.slint:212
msgctxt "PageFans"
msgid "Mid"
msgstr ""
#: rog-control-center/ui/pages/fans.slint:112 rog-control-center/ui/pages/fans.slint:171 rog-control-center/ui/pages/fans.slint:230
msgctxt "PageFans"
msgid "GPU"
msgstr ""
#: rog-control-center/ui/pages/fans.slint:132
msgctxt "PageFans"
msgid "Performance"
msgstr "Perfomans"
#: rog-control-center/ui/pages/fans.slint:191
msgctxt "PageFans"
msgid "Quiet"
msgstr "Sessiz"
#: rog-control-center/ui/pages/system.slint:26
msgctxt "SystemPageData"
msgid "Balanced"
msgstr "Dengeli"
#: rog-control-center/ui/pages/system.slint:26 rog-control-center/ui/pages/system.slint:30
msgctxt "SystemPageData"
msgid "Performance"
msgstr "Perfomans"
#: rog-control-center/ui/pages/system.slint:26
msgctxt "SystemPageData"
msgid "Quiet"
msgstr "Sessiz"
#: rog-control-center/ui/pages/system.slint:29
msgctxt "SystemPageData"
msgid "Default"
msgstr "Varsayınal"
#: rog-control-center/ui/pages/system.slint:31
msgctxt "SystemPageData"
msgid "BalancePerformance"
msgstr ""
#: rog-control-center/ui/pages/system.slint:32
msgctxt "SystemPageData"
msgid "BalancePower"
msgstr ""
#: rog-control-center/ui/pages/system.slint:33
msgctxt "SystemPageData"
msgid "Power"
msgstr ""
#: rog-control-center/ui/pages/system.slint:106
msgctxt "PageSystem"
msgid "Base system settings"
msgstr "Temel Sistem Ayarları"
#: rog-control-center/ui/pages/system.slint:111
msgctxt "PageSystem"
msgid "Charge limit"
msgstr "Şarj Sınırı"
#: rog-control-center/ui/pages/system.slint:123
msgctxt "PageSystem"
msgid "Throttle Policy"
msgstr "Güç Politikası"
#: rog-control-center/ui/pages/system.slint:133
msgctxt "PageSystem"
msgid "Advanced"
msgstr "Gelişmiş"
#: rog-control-center/ui/pages/system.slint:145
msgctxt "PageSystem"
msgid "Panel Overdrive"
msgstr ""
#: rog-control-center/ui/pages/system.slint:153
msgctxt "PageSystem"
msgid "MiniLED Mode"
msgstr ""
#: rog-control-center/ui/pages/system.slint:161
msgctxt "PageSystem"
msgid "POST boot sound"
msgstr ""
#: rog-control-center/ui/pages/system.slint:179
msgctxt "PageSystem"
msgid "System performance settings"
msgstr "Sistem Perfomans Ayarları"
#: rog-control-center/ui/pages/system.slint:184
msgctxt "ppt_pl1_spl"
msgid "ppt_pl1_spl"
msgstr ""
#: rog-control-center/ui/pages/system.slint:194
msgctxt "ppt_pl2_sppt"
msgid "ppt_pl2_sppt"
msgstr ""
#: rog-control-center/ui/pages/system.slint:204
msgctxt "ppt_fppt"
msgid "ppt_fppt"
msgstr ""
#: rog-control-center/ui/pages/system.slint:214
msgctxt "ppt_apu_sppt"
msgid "ppt_apu_sppt"
msgstr ""
#: rog-control-center/ui/pages/system.slint:224
msgctxt "ppt_platform_sppt"
msgid "ppt_platform_sppt"
msgstr ""
#: rog-control-center/ui/pages/system.slint:234
msgctxt "nv_dynamic_boost"
msgid "nv_dynamic_boost"
msgstr ""
#: rog-control-center/ui/pages/system.slint:244
msgctxt "nv_temp_target"
msgid "nv_temp_target"
msgstr ""
#: rog-control-center/ui/pages/system.slint:290
msgctxt "PageSystem"
msgid "Energy Performance Preference linked to Throttle Policy"
msgstr "Güç Politikasına Bağlı Enerji Performansı Tercihi"
#: rog-control-center/ui/pages/system.slint:294
msgctxt "PageSystem"
msgid "Change EPP based on Throttle Policy"
msgstr "EPP'yi Güç Politikasına göre değiştirin"
#: rog-control-center/ui/pages/system.slint:302
msgctxt "PageSystem"
msgid "EPP for Balanced Policy"
msgstr "Dengeli Politika için EPP"
#: rog-control-center/ui/pages/system.slint:312
msgctxt "PageSystem"
msgid "EPP for Performance Policy"
msgstr "Performans Politikası için EPP"
#: rog-control-center/ui/pages/system.slint:322
msgctxt "PageSystem"
msgid "EPP for Quiet Policy"
msgstr "Sessiz Politikası için EPP"
#: rog-control-center/ui/pages/system.slint:340
msgctxt "PageSystem"
msgid "Throttle Policy for power state"
msgstr "Güç durumu için Güç Politikası"
#: rog-control-center/ui/pages/system.slint:344
msgctxt "PageSystem"
msgid "Throttle Policy on Battery"
msgstr "Pil Güç Politikası"
#: rog-control-center/ui/pages/system.slint:354
msgctxt "PageSystem"
msgid "Throttle Policy on AC"
msgstr "AC'de Güç Politikası"
#: rog-control-center/ui/pages/aura.slint:27
msgctxt "PageAura"
msgid "Brightness"
msgstr "Parlaklık"
#: rog-control-center/ui/pages/aura.slint:38
msgctxt "PageAura"
msgid "Aura mode"
msgstr "Renk Modu"
#: rog-control-center/ui/pages/aura.slint:56
msgctxt "PageAura"
msgid "Colour 1"
msgstr "Renk 1"
#: rog-control-center/ui/pages/aura.slint:82
msgctxt "PageAura"
msgid "Colour 2"
msgstr "Renk 2"
#: rog-control-center/ui/pages/aura.slint:114
msgctxt "PageAura"
msgid "Zone"
msgstr ""
#: rog-control-center/ui/pages/aura.slint:137
msgctxt "PageAura"
msgid "Direction"
msgstr ""
#: rog-control-center/ui/pages/aura.slint:159
msgctxt "PageAura"
msgid "Speed"
msgstr "Hız"
#: rog-control-center/ui/pages/aura.slint:180
msgctxt "PageAura"
msgid "Power Settings"
msgstr "Güç Ayarları"
#: rog-control-center/ui/widgets/aura_power.slint:32
msgctxt "AuraPowerGroup"
msgid "Boot"
msgstr ""
#: rog-control-center/ui/widgets/aura_power.slint:42
msgctxt "AuraPowerGroup"
msgid "Awake"
msgstr ""
#: rog-control-center/ui/widgets/aura_power.slint:52
msgctxt "AuraPowerGroup"
msgid "Sleep"
msgstr ""
#: rog-control-center/ui/widgets/aura_power.slint:62
msgctxt "AuraPowerGroup"
msgid "Shutdown"
msgstr ""
#: rog-control-center/ui/types/aura_types.slint:45
msgctxt "Aura power zone"
msgid "Logo"
msgstr ""
#: rog-control-center/ui/types/aura_types.slint:46
msgctxt "Aura power zone"
msgid "Keyboard"
msgstr "Klavye"
#: rog-control-center/ui/types/aura_types.slint:47
msgctxt "Aura power zone"
msgid "Lightbar"
msgstr ""
#: rog-control-center/ui/types/aura_types.slint:48
msgctxt "Aura power zone"
msgid "Lid"
msgstr ""
#: rog-control-center/ui/types/aura_types.slint:49
msgctxt "Aura power zone"
msgid "Rear Glow"
msgstr ""
#: rog-control-center/ui/types/aura_types.slint:50
msgctxt "Aura power zone"
msgid "Keyboard and Lightbar"
msgstr "Klavye ve Aydınlatma"
#: rog-control-center/ui/types/aura_types.slint:53
msgctxt "Aura brightness"
msgid "Off"
msgstr "Kapalı"
#: rog-control-center/ui/types/aura_types.slint:54
msgctxt "Aura brightness"
msgid "Low"
msgstr "Düşük"
#: rog-control-center/ui/types/aura_types.slint:55
msgctxt "Aura brightness"
msgid "Med"
msgstr "Orta"
#: rog-control-center/ui/types/aura_types.slint:56
msgctxt "Aura brightness"
msgid "High"
msgstr "Yüksek"
#: rog-control-center/ui/types/aura_types.slint:61 rog-control-center/ui/types/aura_types.slint:76
msgctxt "Basic aura mode"
msgid "Static"
msgstr "Sabit"
#: rog-control-center/ui/types/aura_types.slint:62 rog-control-center/ui/types/aura_types.slint:77
msgctxt "Basic aura mode"
msgid "Breathe"
msgstr "Nefes Alma"
#: rog-control-center/ui/types/aura_types.slint:63 rog-control-center/ui/types/aura_types.slint:78
msgctxt "Basic aura mode"
msgid "Strobe"
msgstr "Flaş"
#: rog-control-center/ui/types/aura_types.slint:64
msgctxt "Basic aura mode"
msgid "Rainbow"
msgstr "Gökkuşağı"
#: rog-control-center/ui/types/aura_types.slint:65
msgctxt "Basic aura mode"
msgid "Star"
msgstr ""
#: rog-control-center/ui/types/aura_types.slint:66
msgctxt "Basic aura mode"
msgid "Rain"
msgstr ""
#: rog-control-center/ui/types/aura_types.slint:67
msgctxt "Basic aura mode"
msgid "Highlight"
msgstr ""
#: rog-control-center/ui/types/aura_types.slint:68
msgctxt "Basic aura mode"
msgid "Laser"
msgstr ""
#: rog-control-center/ui/types/aura_types.slint:69
msgctxt "Basic aura mode"
msgid "Ripple"
msgstr ""
#: rog-control-center/ui/types/aura_types.slint:70
msgctxt "Basic aura mode"
msgid "Nothing"
msgstr ""
#: rog-control-center/ui/types/aura_types.slint:71
msgctxt "Basic aura mode"
msgid "Pulse"
msgstr ""
#: rog-control-center/ui/types/aura_types.slint:72
msgctxt "Basic aura mode"
msgid "Comet"
msgstr ""
#: rog-control-center/ui/types/aura_types.slint:73
msgctxt "Basic aura mode"
msgid "Flash"
msgstr ""
#: rog-control-center/ui/types/aura_types.slint:85
msgctxt "Aura zone"
msgid "None"
msgstr "Hiçbiri"
#: rog-control-center/ui/types/aura_types.slint:86
msgctxt "Aura zone"
msgid "Key1"
msgstr ""
#: rog-control-center/ui/types/aura_types.slint:87
msgctxt "Aura zone"
msgid "Key2"
msgstr ""
#: rog-control-center/ui/types/aura_types.slint:88
msgctxt "Aura zone"
msgid "Key3"
msgstr ""
#: rog-control-center/ui/types/aura_types.slint:89
msgctxt "Aura zone"
msgid "Key4"
msgstr ""
#: rog-control-center/ui/types/aura_types.slint:90
msgctxt "Aura zone"
msgid "Logo"
msgstr ""
#: rog-control-center/ui/types/aura_types.slint:91
msgctxt "Aura zone"
msgid "Lightbar Left"
msgstr ""
#: rog-control-center/ui/types/aura_types.slint:92
msgctxt "Aura zone"
msgid "Lightbar Right"
msgstr ""
#: rog-control-center/ui/types/aura_types.slint:96
msgctxt "Aura direction"
msgid "Right"
msgstr "Sağ"
#: rog-control-center/ui/types/aura_types.slint:97
msgctxt "Aura direction"
msgid "Left"
msgstr "Sol"
#: rog-control-center/ui/types/aura_types.slint:98
msgctxt "Aura direction"
msgid "Up"
msgstr "Yukarı"
#: rog-control-center/ui/types/aura_types.slint:99
msgctxt "Aura direction"
msgid "Down"
msgstr "Aşağı"
#: rog-control-center/ui/types/aura_types.slint:103
msgctxt "Aura speed"
msgid "Low"
msgstr "Düşük"
#: rog-control-center/ui/types/aura_types.slint:104
msgctxt "Aura speed"
msgid "Medium"
msgstr "Orta"
#: rog-control-center/ui/types/aura_types.slint:105
msgctxt "Aura speed"
msgid "High"
msgstr "Yüksek"
#: rog-control-center/ui/main_window.slint:50
msgctxt "MainWindow"
msgid "ROG"
msgstr ""
#: rog-control-center/ui/main_window.slint:52
msgctxt "Menu1"
msgid "System Control"
msgstr "Sistem Kontrol"
#: rog-control-center/ui/main_window.slint:53
msgctxt "Menu2"
msgid "Keyboard Aura"
msgstr "Klavye Rengi"
#: rog-control-center/ui/main_window.slint:54
msgctxt "Menu3"
msgid "AniMe Matrix"
msgstr ""
#: rog-control-center/ui/main_window.slint:55
msgctxt "Menu4"
msgid "Fan Curves"
msgstr ""
#: rog-control-center/ui/main_window.slint:56
msgctxt "Menu5"
msgid "App Settings"
msgstr "Uygulama Ayarları"
#: rog-control-center/ui/main_window.slint:57
msgctxt "Menu6"
msgid "About"
msgstr "Hakkında"
#: rog-control-center/ui/main_window.slint:69
msgctxt "MainWindow"
msgid "Quit"
msgstr "Çık"

View File

@@ -0,0 +1,700 @@
# SPDX-FileCopyrightText: 2024 UM-Li <um-li@tuta.io>
msgid ""
msgstr ""
"Project-Id-Version: \n"
"POT-Creation-Date: 2024-06-09 00:20+0000\n"
"PO-Revision-Date: 2024-06-19 10:37+0200\n"
"Last-Translator: UM-Li <um-li@tuta.io>\n"
"Language-Team: Chinese <kde-i18n-doc@kde.org>\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"
"Language: zh_CN\n"
"Plural-Forms: nplurals=1; plural=0;\n"
"X-Generator: Lokalize 24.05.1\n"
#: rog-control-center/ui/pages/anime.slint:6
msgctxt "Anime Brightness"
msgid "Off"
msgstr "关"
#: rog-control-center/ui/pages/anime.slint:7
msgctxt "Anime Brightness"
msgid "Low"
msgstr "暗"
#: rog-control-center/ui/pages/anime.slint:8
msgctxt "Anime Brightness"
msgid "Med"
msgstr "中"
#: rog-control-center/ui/pages/anime.slint:9
msgctxt "Anime Brightness"
msgid "High"
msgstr "亮"
#: rog-control-center/ui/pages/anime.slint:23
msgctxt "AnimePageData"
msgid "Glitch Construction"
msgstr ""
#: rog-control-center/ui/pages/anime.slint:23
msgctxt "AnimePageData"
msgid "Static Emergence"
msgstr ""
#: rog-control-center/ui/pages/anime.slint:25
msgctxt "AnimePageData"
msgid "Binary Banner Scroll"
msgstr ""
#: rog-control-center/ui/pages/anime.slint:25
msgctxt "AnimePageData"
msgid "Rog Logo Glitch"
msgstr ""
#: rog-control-center/ui/pages/anime.slint:27
msgctxt "AnimePageData"
msgid "Banner Swipe"
msgstr ""
#: rog-control-center/ui/pages/anime.slint:27
msgctxt "AnimePageData"
msgid "Starfield"
msgstr ""
#: rog-control-center/ui/pages/anime.slint:29
msgctxt "AnimePageData"
msgid "Glitch Out"
msgstr ""
#: rog-control-center/ui/pages/anime.slint:29
msgctxt "AnimePageData"
msgid "See Ya"
msgstr ""
#: rog-control-center/ui/pages/anime.slint:50
msgctxt "Anime Brightness"
msgid "Brightness"
msgstr "亮度"
#: rog-control-center/ui/pages/anime.slint:66
msgctxt "PageAnime"
msgid "Enable display"
msgstr "启用"
#: rog-control-center/ui/pages/anime.slint:74 rog-control-center/ui/pages/anime.slint:97
msgctxt "PageAnime"
msgid "Advanced"
msgstr "高级"
#: rog-control-center/ui/pages/anime.slint:89
msgctxt "PageAnime"
msgid "Use built-in animations"
msgstr "使用内置动效"
#: rog-control-center/ui/pages/anime.slint:146
msgctxt "PageAnime"
msgid "Set which builtin animations are played"
msgstr "选择内置动效"
#: rog-control-center/ui/pages/anime.slint:150
msgctxt "Anime built-in selection"
msgid "Boot Animation"
msgstr "开机"
#: rog-control-center/ui/pages/anime.slint:160
msgctxt "Anime built-in selection"
msgid "Running Animation"
msgstr "运行"
#: rog-control-center/ui/pages/anime.slint:170
msgctxt "Anime built-in selection"
msgid "Sleep Animation"
msgstr "睡眠"
#: rog-control-center/ui/pages/anime.slint:180
msgctxt "Anime built-in selection"
msgid "Shutdown Animation"
msgstr "关机"
#: rog-control-center/ui/pages/anime.slint:220
msgctxt "PageAnime"
msgid "Advanced Display Settings"
msgstr "高级显示设置"
#: rog-control-center/ui/pages/anime.slint:225
msgctxt "PageAnime"
msgid "Off when lid closed"
msgstr "合上盖子时关闭"
#: rog-control-center/ui/pages/anime.slint:234
msgctxt "PageAnime"
msgid "Off when suspended"
msgstr "睡眠时关闭"
#: rog-control-center/ui/pages/anime.slint:243
msgctxt "PageAnime"
msgid "Off when on battery"
msgstr "电池供电时关闭"
#: rog-control-center/ui/pages/app_settings.slint:26
msgctxt "PageAppSettings"
msgid "Run in background after closing"
msgstr "保持在后台运行"
#: rog-control-center/ui/pages/app_settings.slint:34
msgctxt "PageAppSettings"
msgid "Start app in background (UI closed)"
msgstr "启动至后台"
#: rog-control-center/ui/pages/app_settings.slint:42
msgctxt "PageAppSettings"
msgid "Enable system tray icon"
msgstr "启用托盘图标"
#: rog-control-center/ui/pages/app_settings.slint:50
msgctxt "PageAppSettings"
msgid "Enable dGPU notifications"
msgstr "启用独显通知"
#: rog-control-center/ui/pages/aura.slint:28
msgctxt "PageAura"
msgid "Brightness"
msgstr "亮度"
#: rog-control-center/ui/pages/aura.slint:39
msgctxt "PageAura"
msgid "Aura mode"
msgstr "Aura 模式"
#: rog-control-center/ui/pages/aura.slint:59
msgctxt "PageAura"
msgid "Colour 1"
msgstr "颜色 1"
#: rog-control-center/ui/pages/aura.slint:85
msgctxt "PageAura"
msgid "Colour 2"
msgstr "颜色 2"
#: rog-control-center/ui/pages/aura.slint:119
msgctxt "PageAura"
msgid "Zone"
msgstr "区域"
#: rog-control-center/ui/pages/aura.slint:142
msgctxt "PageAura"
msgid "Direction"
msgstr "方向"
#: rog-control-center/ui/pages/aura.slint:164
msgctxt "PageAura"
msgid "Speed"
msgstr "速度"
#: rog-control-center/ui/pages/aura.slint:185
msgctxt "PageAura"
msgid "Power Settings"
msgstr "电源设置"
#: rog-control-center/ui/pages/aura.slint:270
msgctxt "PageAura"
msgid "Power Zones"
msgstr "区域供电"
#: rog-control-center/ui/pages/fans.slint:26
msgctxt "FanTab"
msgid "This fan is not avilable on this machine"
msgstr "该风扇在本机不可用"
#: rog-control-center/ui/pages/fans.slint:34
msgctxt "FanTab"
msgid "Enabled"
msgstr "启用"
#: rog-control-center/ui/pages/fans.slint:43
msgctxt "FanTab"
msgid "Apply"
msgstr "应用"
#: rog-control-center/ui/pages/fans.slint:51
msgctxt "FanTab"
msgid "Cancel"
msgstr "取消"
#: rog-control-center/ui/pages/fans.slint:59
msgctxt "FanTab"
msgid "Factory Default (all fans)"
msgstr "全部恢复出厂设置"
#: rog-control-center/ui/pages/fans.slint:72
msgctxt "PageFans"
msgid "Balanced"
msgstr "平衡"
#: rog-control-center/ui/pages/fans.slint:75 rog-control-center/ui/pages/fans.slint:134 rog-control-center/ui/pages/fans.slint:193
msgctxt "PageFans"
msgid "CPU"
msgstr "CPU"
#: rog-control-center/ui/pages/fans.slint:93 rog-control-center/ui/pages/fans.slint:152 rog-control-center/ui/pages/fans.slint:211
msgctxt "PageFans"
msgid "Mid"
msgstr "中部"
#: rog-control-center/ui/pages/fans.slint:111 rog-control-center/ui/pages/fans.slint:170 rog-control-center/ui/pages/fans.slint:229
msgctxt "PageFans"
msgid "GPU"
msgstr "GPU"
#: rog-control-center/ui/pages/fans.slint:131
msgctxt "PageFans"
msgid "Performance"
msgstr "性能"
#: rog-control-center/ui/pages/fans.slint:190
msgctxt "PageFans"
msgid "Quiet"
msgstr "省电"
#: rog-control-center/ui/pages/system.slint:26
msgctxt "SystemPageData"
msgid "Balanced"
msgstr "平衡"
#: rog-control-center/ui/pages/system.slint:26 rog-control-center/ui/pages/system.slint:30
msgctxt "SystemPageData"
msgid "Performance"
msgstr "性能"
#: rog-control-center/ui/pages/system.slint:26
msgctxt "SystemPageData"
msgid "Quiet"
msgstr "省电"
#: rog-control-center/ui/pages/system.slint:29
msgctxt "SystemPageData"
msgid "Default"
msgstr "默认"
#: rog-control-center/ui/pages/system.slint:31
msgctxt "SystemPageData"
msgid "BalancePerformance"
msgstr "平衡(侧重性能)"
#: rog-control-center/ui/pages/system.slint:32
msgctxt "SystemPageData"
msgid "BalancePower"
msgstr "平衡(侧重省电)"
#: rog-control-center/ui/pages/system.slint:33
msgctxt "SystemPageData"
msgid "Power"
msgstr "省电"
#: rog-control-center/ui/pages/system.slint:110
msgctxt "PageSystem"
msgid "Base system settings"
msgstr "基本设置"
#: rog-control-center/ui/pages/system.slint:115
msgctxt "PageSystem"
msgid "Charge limit"
msgstr "充电上限"
#: rog-control-center/ui/pages/system.slint:127
msgctxt "PageSystem"
msgid "Throttle Policy"
msgstr "电源管理方案"
#: rog-control-center/ui/pages/system.slint:137
msgctxt "PageSystem"
msgid "Advanced"
msgstr "高级"
#: rog-control-center/ui/pages/system.slint:149
msgctxt "PageSystem"
msgid "Panel Overdrive"
msgstr "屏幕快显"
#: rog-control-center/ui/pages/system.slint:157
msgctxt "PageSystem"
msgid "MiniLED Mode"
msgstr "MiniLED 模式"
#: rog-control-center/ui/pages/system.slint:165
msgctxt "PageSystem"
msgid "POST boot sound"
msgstr "POST 开机音效"
#: rog-control-center/ui/pages/system.slint:183
msgctxt "PageSystem"
msgid "System performance settings"
msgstr "性能设置"
#: rog-control-center/ui/pages/system.slint:188
msgctxt "ppt_pl1_spl"
msgid "PL1, sustained power limit"
msgstr ""
#: rog-control-center/ui/pages/system.slint:198
msgctxt "ppt_pl2_sppt"
msgid "PL2, turbo power limit"
msgstr ""
#: rog-control-center/ui/pages/system.slint:208
msgctxt "ppt_fppt"
msgid "FPPT, Fast Power Limit"
msgstr ""
#: rog-control-center/ui/pages/system.slint:218
msgctxt "ppt_apu_sppt"
msgid "SPPT, APU slow power limit"
msgstr ""
#: rog-control-center/ui/pages/system.slint:228
msgctxt "ppt_platform_sppt"
msgid "Slow package power tracking limit"
msgstr ""
#: rog-control-center/ui/pages/system.slint:238
#, fuzzy
msgctxt "nv_dynamic_boost"
msgid "dGPU boost overclock"
msgstr "独显动态增强"
#: rog-control-center/ui/pages/system.slint:248
msgctxt "nv_temp_target"
msgid "dGPU temperature max"
msgstr "独显最高温度"
#: rog-control-center/ui/pages/system.slint:294
msgctxt "PageSystem"
msgid "Energy Performance Preference linked to Throttle Policy"
msgstr "绑定至电源管理方案的 EPP"
#: rog-control-center/ui/pages/system.slint:298
msgctxt "PageSystem"
msgid "Change EPP based on Throttle Policy"
msgstr "基于电源管理方案更改 EPP"
#: rog-control-center/ui/pages/system.slint:306
msgctxt "PageSystem"
msgid "EPP for Balanced Policy"
msgstr "平衡"
#: rog-control-center/ui/pages/system.slint:316
msgctxt "PageSystem"
msgid "EPP for Performance Policy"
msgstr "性能"
#: rog-control-center/ui/pages/system.slint:326
msgctxt "PageSystem"
msgid "EPP for Quiet Policy"
msgstr "省电"
#: rog-control-center/ui/pages/system.slint:344
msgctxt "PageSystem"
msgid "Throttle Policy for power state"
msgstr "基于供电状态的电源管理方案"
#: rog-control-center/ui/pages/system.slint:350
msgctxt "PageSystem"
msgid "Throttle Policy on Battery"
msgstr "电池供电"
#: rog-control-center/ui/pages/system.slint:360 rog-control-center/ui/pages/system.slint:381
msgctxt "PageSystem"
msgid "Enabled"
msgstr "启用"
#: rog-control-center/ui/pages/system.slint:371
msgctxt "PageSystem"
msgid "Throttle Policy on AC"
msgstr "交流供电"
#: rog-control-center/ui/types/aura_types.slint:49
msgctxt "Aura power zone"
msgid "Logo"
msgstr "徽标"
#: rog-control-center/ui/types/aura_types.slint:50 rog-control-center/ui/types/aura_types.slint:59
msgctxt "Aura power zone"
msgid "Keyboard"
msgstr "键盘"
#: rog-control-center/ui/types/aura_types.slint:51 rog-control-center/ui/types/aura_types.slint:60
msgctxt "Aura power zone"
msgid "Lightbar"
msgstr "灯带"
#: rog-control-center/ui/types/aura_types.slint:52
msgctxt "Aura power zone"
msgid "Lid"
msgstr "盖子"
#: rog-control-center/ui/types/aura_types.slint:53
msgctxt "Aura power zone"
msgid "Rear Glow"
msgstr "后灯"
#: rog-control-center/ui/types/aura_types.slint:54 rog-control-center/ui/types/aura_types.slint:61
msgctxt "Aura power zone"
msgid "Keyboard and Lightbar"
msgstr "键盘和灯带"
#: rog-control-center/ui/types/aura_types.slint:64
msgctxt "Aura brightness"
msgid "Off"
msgstr "关"
#: rog-control-center/ui/types/aura_types.slint:65
msgctxt "Aura brightness"
msgid "Low"
msgstr "暗"
#: rog-control-center/ui/types/aura_types.slint:66
msgctxt "Aura brightness"
msgid "Med"
msgstr "中"
#: rog-control-center/ui/types/aura_types.slint:67
msgctxt "Aura brightness"
msgid "High"
msgstr "亮"
#: rog-control-center/ui/types/aura_types.slint:72 rog-control-center/ui/types/aura_types.slint:87
#, fuzzy
msgctxt "Basic aura mode"
msgid "Static"
msgstr "恒亮"
#: rog-control-center/ui/types/aura_types.slint:73 rog-control-center/ui/types/aura_types.slint:88
#, fuzzy
msgctxt "Basic aura mode"
msgid "Breathe"
msgstr "呼吸"
#: rog-control-center/ui/types/aura_types.slint:74 rog-control-center/ui/types/aura_types.slint:89
#, fuzzy
msgctxt "Basic aura mode"
msgid "Strobe"
msgstr "频谱"
#: rog-control-center/ui/types/aura_types.slint:75
#, fuzzy
msgctxt "Basic aura mode"
msgid "Rainbow"
msgstr "彩虹"
#: rog-control-center/ui/types/aura_types.slint:76
#, fuzzy
msgctxt "Basic aura mode"
msgid "Star"
msgstr "星光"
#: rog-control-center/ui/types/aura_types.slint:77
#, fuzzy
msgctxt "Basic aura mode"
msgid "Rain"
msgstr "落雨"
#: rog-control-center/ui/types/aura_types.slint:78
#, fuzzy
msgctxt "Basic aura mode"
msgid "Highlight"
msgstr "高亮"
#: rog-control-center/ui/types/aura_types.slint:79
#, fuzzy
msgctxt "Basic aura mode"
msgid "Laser"
msgstr "激光"
#: rog-control-center/ui/types/aura_types.slint:80
#, fuzzy
msgctxt "Basic aura mode"
msgid "Ripple"
msgstr "涟漪"
#: rog-control-center/ui/types/aura_types.slint:81
#, fuzzy
msgctxt "Basic aura mode"
msgid "Nothing"
msgstr "无"
#: rog-control-center/ui/types/aura_types.slint:82
#, fuzzy
msgctxt "Basic aura mode"
msgid "Pulse"
msgstr "脉冲"
#: rog-control-center/ui/types/aura_types.slint:83
#, fuzzy
msgctxt "Basic aura mode"
msgid "Comet"
msgstr "彗星"
#: rog-control-center/ui/types/aura_types.slint:84
#, fuzzy
msgctxt "Basic aura mode"
msgid "Flash"
msgstr "闪烁"
#: rog-control-center/ui/types/aura_types.slint:96
msgctxt "Aura zone"
msgid "None"
msgstr "无"
#: rog-control-center/ui/types/aura_types.slint:97
msgctxt "Aura zone"
msgid "Key1"
msgstr "按键 1"
#: rog-control-center/ui/types/aura_types.slint:98
msgctxt "Aura zone"
msgid "Key2"
msgstr "按键 2"
#: rog-control-center/ui/types/aura_types.slint:99
msgctxt "Aura zone"
msgid "Key3"
msgstr "按键 3"
#: rog-control-center/ui/types/aura_types.slint:100
msgctxt "Aura zone"
msgid "Key4"
msgstr "按键 4"
#: rog-control-center/ui/types/aura_types.slint:101
msgctxt "Aura zone"
msgid "Logo"
msgstr "徽标"
#: rog-control-center/ui/types/aura_types.slint:102
msgctxt "Aura zone"
msgid "Lightbar Left"
msgstr "左灯带"
#: rog-control-center/ui/types/aura_types.slint:103
msgctxt "Aura zone"
msgid "Lightbar Right"
msgstr "右灯带"
#: rog-control-center/ui/types/aura_types.slint:107
msgctxt "Aura direction"
msgid "Right"
msgstr "右"
#: rog-control-center/ui/types/aura_types.slint:108
msgctxt "Aura direction"
msgid "Left"
msgstr "左"
#: rog-control-center/ui/types/aura_types.slint:109
msgctxt "Aura direction"
msgid "Up"
msgstr "上"
#: rog-control-center/ui/types/aura_types.slint:110
msgctxt "Aura direction"
msgid "Down"
msgstr "下"
#: rog-control-center/ui/types/aura_types.slint:114
msgctxt "Aura speed"
msgid "Low"
msgstr "慢"
#: rog-control-center/ui/types/aura_types.slint:115
msgctxt "Aura speed"
msgid "Medium"
msgstr "中"
#: rog-control-center/ui/types/aura_types.slint:116
msgctxt "Aura speed"
msgid "High"
msgstr "快"
#: rog-control-center/ui/widgets/aura_power.slint:33
msgctxt "AuraPowerGroup"
msgid "Boot"
msgstr "开机"
#: rog-control-center/ui/widgets/aura_power.slint:43
msgctxt "AuraPowerGroup"
msgid "Awake"
msgstr "唤醒"
#: rog-control-center/ui/widgets/aura_power.slint:53
msgctxt "AuraPowerGroup"
msgid "Sleep"
msgstr "睡眠"
#: rog-control-center/ui/widgets/aura_power.slint:63
msgctxt "AuraPowerGroup"
msgid "Shutdown"
msgstr "关机"
#: rog-control-center/ui/widgets/aura_power.slint:102
msgctxt "AuraPowerGroupOld"
msgid "Zone Selection"
msgstr "区域"
#: rog-control-center/ui/widgets/aura_power.slint:114
msgctxt "AuraPowerGroupOld"
msgid "Boot"
msgstr "开机"
#: rog-control-center/ui/widgets/aura_power.slint:124
msgctxt "AuraPowerGroupOld"
msgid "Awake"
msgstr "唤醒"
#: rog-control-center/ui/widgets/aura_power.slint:134
msgctxt "AuraPowerGroupOld"
msgid "Sleep"
msgstr "睡眠"
#: rog-control-center/ui/main_window.slint:51
msgctxt "MainWindow"
msgid "ROG"
msgstr "ROG"
#: rog-control-center/ui/main_window.slint:53
msgctxt "Menu1"
msgid "System Control"
msgstr "系统设置"
#: rog-control-center/ui/main_window.slint:54
msgctxt "Menu2"
msgid "Keyboard Aura"
msgstr "Aura 键盘灯效"
#: rog-control-center/ui/main_window.slint:55
msgctxt "Menu3"
msgid "AniMe Matrix"
msgstr "AniMe 光显矩阵"
#: rog-control-center/ui/main_window.slint:56
msgctxt "Menu4"
msgid "Fan Curves"
msgstr "风扇曲线"
#: rog-control-center/ui/main_window.slint:57
msgctxt "Menu5"
msgid "App Settings"
msgstr "应用设置"
#: rog-control-center/ui/main_window.slint:58
msgctxt "Menu6"
msgid "About"
msgstr "关于"
#: rog-control-center/ui/main_window.slint:70
msgctxt "MainWindow"
msgid "Quit App"
msgstr "退出"

View File

@@ -5,6 +5,7 @@ import { SideBar } from "widgets/sidebar.slint";
import { PageAbout } from "pages/about.slint";
import { PageFans } from "pages/fans.slint";
import { PageAnime, AnimePageData } from "pages/anime.slint";
import { RogItem } from "widgets/common.slint";
import { PageAura } from "pages/aura.slint";
import { Node } from "widgets/graph.slint";
export { Node }
@@ -66,7 +67,7 @@ export component MainWindow inherits Window {
Text {
vertical-alignment: center;
horizontal-alignment: center;
text: @tr("Quit");
text: @tr("Quit App");
}
TouchArea {
@@ -178,4 +179,39 @@ export component MainWindow inherits Window {
}
}
}
if SomeError.error_message != "": Rectangle {
x: 0px;
y: 0px;
width: root.width;
height: root.height;
padding: 10px;
background: Palette.background;
border-color: Palette.border;
border-width: 3px;
border-radius: 10px;
VerticalBox {
RogItem {
min-height: 50px;
max-height: 100px;
Text {
text <=> SomeError.error_message;
font-size: 18px;
}
}
Text {
text <=> SomeError.error_help;
horizontal-alignment: TextHorizontalAlignment.center;
vertical-alignment: TextVerticalAlignment.center;
}
}
}
}
export global SomeError {
in property <string> error_message: "";
in property <string> error_help: "";
}

View File

@@ -22,45 +22,35 @@ export component PageAppSettings inherits VerticalLayout {
mainview := VerticalLayout {
padding: 10px;
spacing: 10px;
HorizontalLayout {
spacing: 10px;
max-height: 32px;
SystemToggle {
text: @tr("Run in background after closing");
checked <=> AppSettingsPageData.run_in_background;
toggled => {
AppSettingsPageData.set_run_in_background(AppSettingsPageData.run_in_background)
}
}
SystemToggle {
width: parent.width * 1px / 2px;
text: @tr("Start app in background (UI closed)");
checked <=> AppSettingsPageData.startup_in_background;
toggled => {
AppSettingsPageData.set_startup_in_background(AppSettingsPageData.startup_in_background)
}
SystemToggle {
text: @tr("Run in background after closing");
checked <=> AppSettingsPageData.run_in_background;
toggled => {
AppSettingsPageData.set_run_in_background(AppSettingsPageData.run_in_background)
}
}
HorizontalLayout {
max-height: 32px;
spacing: 10px;
SystemToggle {
text: @tr("Enable system tray icon");
checked <=> AppSettingsPageData.enable_tray_icon;
toggled => {
AppSettingsPageData.set_enable_tray_icon(AppSettingsPageData.enable_tray_icon)
}
SystemToggle {
text: @tr("Start app in background (UI closed)");
checked <=> AppSettingsPageData.startup_in_background;
toggled => {
AppSettingsPageData.set_startup_in_background(AppSettingsPageData.startup_in_background)
}
}
SystemToggle {
width: parent.width * 1px / 2px;
text: @tr("Enable dGPU notifications");
checked <=> AppSettingsPageData.enable_dgpu_notifications;
toggled => {
AppSettingsPageData.set_enable_dgpu_notifications(AppSettingsPageData.enable_dgpu_notifications)
}
SystemToggle {
text: @tr("Enable system tray icon");
checked <=> AppSettingsPageData.enable_tray_icon;
toggled => {
AppSettingsPageData.set_enable_tray_icon(AppSettingsPageData.enable_tray_icon)
}
}
SystemToggle {
text: @tr("Enable dGPU notifications");
checked <=> AppSettingsPageData.enable_dgpu_notifications;
toggled => {
AppSettingsPageData.set_enable_dgpu_notifications(AppSettingsPageData.enable_dgpu_notifications)
}
}

View File

@@ -3,7 +3,7 @@ import { Palette, Button, ComboBox, VerticalBox, GroupBox } from "std-widgets.sl
import { StyleMetrics, Slider, HorizontalBox, TextEdit, SpinBox, LineEdit, ScrollView } from "std-widgets.slint";
import { ColourSlider } from "../widgets/colour_picker.slint";
import { AuraPageData, AuraDevType, PowerZones, LaptopAuraPower, AuraEffect } from "../types/aura_types.slint";
import { AuraPowerGroup } from "../widgets/aura_power.slint";
import { AuraPowerGroup, AuraPowerGroupOld } from "../widgets/aura_power.slint";
export component PageAura inherits Rectangle {
property <bool> show_fade_cover: false;
@@ -17,187 +17,191 @@ export component PageAura inherits Rectangle {
c2.final_colour = AuraPageData.led_mode_data.colour2;
c2.external_colour_change();
}
VerticalLayout {
padding: 10px;
spacing: 10px;
alignment: LayoutAlignment.start;
HorizontalLayout {
ScrollView {
VerticalLayout {
padding: 10px;
spacing: 10px;
SystemDropdown {
text: @tr("Brightness");
current_index <=> AuraPageData.brightness;
current_value: AuraPageData.brightness_names[self.current-index];
model <=> AuraPageData.brightness_names;
selected => {
AuraPageData.set_brightness(AuraPageData.brightness)
}
}
SystemDropdown {
width: parent.width * 1px / 2px;
text: @tr("Aura mode");
current_index <=> AuraPageData.current_available_mode;
current_value: AuraPageData.available_mode_names[self.current-index];
model <=> AuraPageData.available_mode_names;
selected => {
AuraPageData.led_mode_data.mode = AuraPageData.led_mode;
AuraPageData.led_mode_data.mode = AuraPageData.current_available_mode;
self.current_value = AuraPageData.available_mode_names[self.current-index];
AuraPageData.set_led_mode(AuraPageData.current_available_mode);
}
}
}
RogItem {
alignment: LayoutAlignment.start;
HorizontalLayout {
spacing: 10px;
VerticalBox {
Text {
text: @tr("Colour 1");
vertical-alignment: TextVerticalAlignment.center;
horizontal-alignment: TextHorizontalAlignment.center;
}
HorizontalBox {
c1 := ColourSlider {
enabled: AuraPageData.led_mode == 0 || AuraPageData.led_mode == 1 || AuraPageData.led_mode == 4 || AuraPageData.led_mode == 6 || AuraPageData.led_mode == 7 || AuraPageData.led_mode == 8 || AuraPageData.led_mode == 10 || AuraPageData.led_mode == 11 || AuraPageData.led_mode == 12;
final_colour <=> AuraPageData.color1;
colourbox <=> AuraPageData.colorbox1;
set_hex_from_colour(c1) => {
return AuraPageData.set_hex_from_colour(c1);
}
hex_to_colour(s) => {
return AuraPageData.set_hex_to_colour(s);
}
released => {
AuraPageData.led_mode_data.colour1 = AuraPageData.color1;
AuraPageData.set_led_mode_data(AuraPageData.led_mode_data);
}
}
SystemDropdown {
text: @tr("Brightness");
current_index <=> AuraPageData.brightness;
current_value: AuraPageData.brightness_names[self.current-index];
model <=> AuraPageData.brightness_names;
selected => {
AuraPageData.set_brightness(AuraPageData.brightness)
}
}
VerticalBox {
Text {
text: @tr("Colour 2");
vertical-alignment: TextVerticalAlignment.center;
horizontal-alignment: TextHorizontalAlignment.center;
SystemDropdown {
width: root.width * 1px / 2px;
text: @tr("Aura mode");
current_index <=> AuraPageData.current_available_mode;
current_value: AuraPageData.available_mode_names[self.current-index];
model <=> AuraPageData.available_mode_names;
selected => {
AuraPageData.led_mode_data.mode = AuraPageData.led_mode;
AuraPageData.led_mode_data.mode = AuraPageData.current_available_mode;
self.current_value = AuraPageData.available_mode_names[self.current-index];
AuraPageData.set_led_mode(AuraPageData.current_available_mode);
}
}
}
RogItem {
min-height: 220px;
max-height: 400px;
HorizontalLayout {
spacing: 10px;
VerticalBox {
Text {
text: @tr("Colour 1");
vertical-alignment: TextVerticalAlignment.center;
horizontal-alignment: TextHorizontalAlignment.center;
}
HorizontalBox {
c1 := ColourSlider {
enabled: AuraPageData.led_mode == 0 || AuraPageData.led_mode == 1 || AuraPageData.led_mode == 4 || AuraPageData.led_mode == 6 || AuraPageData.led_mode == 7 || AuraPageData.led_mode == 8 || AuraPageData.led_mode == 10 || AuraPageData.led_mode == 11 || AuraPageData.led_mode == 12;
final_colour <=> AuraPageData.color1;
colourbox <=> AuraPageData.colorbox1;
set_hex_from_colour(c1) => {
return AuraPageData.set_hex_from_colour(c1);
}
hex_to_colour(s) => {
return AuraPageData.set_hex_to_colour(s);
}
released => {
AuraPageData.led_mode_data.colour1 = AuraPageData.color1;
AuraPageData.set_led_mode_data(AuraPageData.led_mode_data);
}
}
}
}
HorizontalBox {
c2 := ColourSlider {
enabled: AuraPageData.led_mode == 1 || AuraPageData.led_mode == 4;
final_colour <=> AuraPageData.color2;
colourbox <=> AuraPageData.colorbox2;
set_hex_from_colour(c1) => {
return AuraPageData.set_hex_from_colour(c1);
}
hex_to_colour(s) => {
return AuraPageData.set_hex_to_colour(s);
}
released => {
AuraPageData.led_mode_data.colour2 = AuraPageData.color2;
AuraPageData.set_led_mode_data(AuraPageData.led_mode_data);
VerticalBox {
Text {
text: @tr("Colour 2");
vertical-alignment: TextVerticalAlignment.center;
horizontal-alignment: TextHorizontalAlignment.center;
}
HorizontalBox {
c2 := ColourSlider {
enabled: AuraPageData.led_mode == 1 || AuraPageData.led_mode == 4;
final_colour <=> AuraPageData.color2;
colourbox <=> AuraPageData.colorbox2;
set_hex_from_colour(c1) => {
return AuraPageData.set_hex_from_colour(c1);
}
hex_to_colour(s) => {
return AuraPageData.set_hex_to_colour(s);
}
released => {
AuraPageData.led_mode_data.colour2 = AuraPageData.color2;
AuraPageData.set_led_mode_data(AuraPageData.led_mode_data);
}
}
}
}
}
}
}
HorizontalLayout {
spacing: 10px;
RogItem {
padding: 0px;
VerticalBox {
Text {
text: @tr("Zone");
vertical-alignment: TextVerticalAlignment.center;
horizontal-alignment: TextHorizontalAlignment.center;
}
HorizontalLayout {
spacing: 10px;
min-height: 80px;
max-height: 90px;
RogItem {
padding: 0px;
VerticalBox {
Text {
text: @tr("Zone");
vertical-alignment: TextVerticalAlignment.center;
horizontal-alignment: TextHorizontalAlignment.center;
}
ComboBox {
// enabled: AuraPageData.led_mode == ;
ComboBox {
// enabled: AuraPageData.led_mode == ;
enabled: false;
current_index <=> AuraPageData.zone;
current_value: AuraPageData.zone_names[self.current-index];
model <=> AuraPageData.zone_names;
selected => {
AuraPageData.led_mode_data.zone = self.current-index;
AuraPageData.set_led_mode_data(AuraPageData.led_mode_data);
current_index <=> AuraPageData.zone;
current_value: AuraPageData.zone_names[self.current-index];
model <=> AuraPageData.zone_names;
selected => {
AuraPageData.led_mode_data.zone = self.current-index;
AuraPageData.set_led_mode_data(AuraPageData.led_mode_data);
}
}
}
}
RogItem {
padding: 0px;
VerticalBox {
Text {
text: @tr("Direction");
vertical-alignment: TextVerticalAlignment.center;
horizontal-alignment: TextHorizontalAlignment.center;
}
ComboBox {
enabled: AuraPageData.led_mode == 3;
current_index <=> AuraPageData.direction;
current_value: AuraPageData.direction_names[self.current-index];
model <=> AuraPageData.direction_names;
selected => {
AuraPageData.led_mode_data.direction = self.current-index;
AuraPageData.set_led_mode_data(AuraPageData.led_mode_data);
}
}
}
}
RogItem {
padding: 0px;
VerticalBox {
Text {
text: @tr("Speed");
vertical-alignment: TextVerticalAlignment.center;
horizontal-alignment: TextHorizontalAlignment.center;
}
ComboBox {
enabled: AuraPageData.led_mode == 1 || AuraPageData.led_mode == 2 || AuraPageData.led_mode == 3 || AuraPageData.led_mode == 4 || AuraPageData.led_mode == 5 || AuraPageData.led_mode == 6 || AuraPageData.led_mode == 7 || AuraPageData.led_mode == 8;
current_index <=> AuraPageData.speed;
current_value: AuraPageData.speed_names[self.current-index];
model <=> AuraPageData.speed_names;
selected => {
AuraPageData.led_mode_data.speed = self.current-index;
AuraPageData.set_led_mode_data(AuraPageData.led_mode_data);
}
}
}
}
}
RogItem {
padding: 0px;
VerticalBox {
Text {
text: @tr("Direction");
vertical-alignment: TextVerticalAlignment.center;
horizontal-alignment: TextHorizontalAlignment.center;
}
ComboBox {
enabled: AuraPageData.led_mode == 3;
current_index <=> AuraPageData.direction;
current_value: AuraPageData.direction_names[self.current-index];
model <=> AuraPageData.direction_names;
selected => {
AuraPageData.led_mode_data.direction = self.current-index;
AuraPageData.set_led_mode_data(AuraPageData.led_mode_data);
}
}
}
}
RogItem {
padding: 0px;
VerticalBox {
Text {
text: @tr("Speed");
vertical-alignment: TextVerticalAlignment.center;
horizontal-alignment: TextHorizontalAlignment.center;
}
ComboBox {
enabled: AuraPageData.led_mode == 1 || AuraPageData.led_mode == 2 || AuraPageData.led_mode == 3 || AuraPageData.led_mode == 4 || AuraPageData.led_mode == 5 || AuraPageData.led_mode == 6 || AuraPageData.led_mode == 7 || AuraPageData.led_mode == 8;
current_index <=> AuraPageData.speed;
current_value: AuraPageData.speed_names[self.current-index];
model <=> AuraPageData.speed_names;
selected => {
AuraPageData.led_mode_data.speed = self.current-index;
AuraPageData.set_led_mode_data(AuraPageData.led_mode_data);
}
HorizontalLayout {
Button {
text: @tr("Power Settings");
clicked => {
root.show_fade_cover = true;
root.show_aura_power = true;
}
}
}
}
HorizontalBox {
Button {
text: @tr("Power Settings");
clicked => {
root.show_fade_cover = true;
root.show_aura_power = true;
}
if root.show_fade_cover: Rectangle {
background: Palette.background;
opacity: 0.8;
TouchArea {
height: 100%;
width: 100%;
}
}
}
if root.show_fade_cover: Rectangle {
width: 100%;
height: 100%;
background: Palette.background;
opacity: 0.8;
TouchArea {
height: 100%;
width: 100%;
}
}
if root.show_aura_power && AuraPageData.aura_type == AuraDevType.New: Rectangle {
if root.show_aura_power && AuraPageData.device_type == AuraDevType.New: Rectangle {
width: 100%;
height: 100%;
opacity: 1;
@@ -206,11 +210,12 @@ export component PageAura inherits Rectangle {
padding: 30px;
padding-top: 10px;
spacing: 10px;
alignment: LayoutAlignment.start;
for state[idx] in AuraPageData.led_power.states: zone := AuraPowerGroup {
group-title: AuraPageData.power_zone_names[state.zone_name_idx];
// TODO: use the zone name
boot_checked: state.boot;
boot_checked: state.boot;
boot_toggled => {
AuraPageData.led_power.states[idx].boot = zone.boot_checked;
AuraPageData.set_led_power(AuraPageData.led_power);
@@ -245,4 +250,57 @@ export component PageAura inherits Rectangle {
}
}
}
if root.show_aura_power && AuraPageData.device_type == AuraDevType.Old: Rectangle {
width: 100%;
height: 100%;
opacity: 1;
ScrollView {
VerticalLayout {
padding: 30px;
padding-top: 10px;
spacing: 10px;
alignment: LayoutAlignment.start;
Text {
text: "TODO: In progress";
}
for state[idx] in AuraPageData.led_power.states: old_zone := AuraPowerGroupOld {
group-title: @tr("Power Zones");
zone_strings <=> AuraPageData.power_zone_names_old;
selected_zone => {
AuraPageData.led_power.states[idx].zone = AuraPageData.supported_power_zones[old_zone.current_zone];
AuraPageData.set_led_power(AuraPageData.led_power);
}
boot_checked: state.boot;
boot_toggled => {
AuraPageData.led_power.states[idx].boot = old_zone.boot_checked;
AuraPageData.set_led_power(AuraPageData.led_power);
}
awake_checked: state.awake;
awake_toggled => {
AuraPageData.led_power.states[idx].awake = old_zone.awake_checked;
AuraPageData.set_led_power(AuraPageData.led_power);
}
sleep_checked: state.sleep;
sleep_toggled => {
AuraPageData.led_power.states[idx].sleep = old_zone.sleep_checked;
AuraPageData.set_led_power(AuraPageData.led_power);
}
}
}
Button {
x: root.width - self.width - 6px;
y: 6px;
text: "X";
height: 40px;
clicked => {
root.show_aura_power = false;
root.show_fade_cover = false;
}
}
}
}
}

View File

@@ -19,7 +19,6 @@ component FanTab inherits Rectangle {
HorizontalLayout {
if root.tab_enabled: Graph {
nodes <=> root.nodes;
}
if !root.tab_enabled: Rectangle {
Text {

View File

@@ -43,8 +43,12 @@ export global SystemPageData {
callback set_throttle_policy_linked_epp(bool);
in-out property <int> throttle_policy_on_ac: 0;
callback set_throttle_policy_on_ac(int);
in-out property <bool> change_throttle_policy_on_ac: true;
callback set_change_throttle_policy_on_ac(bool);
in-out property <int> throttle_policy_on_battery: 0;
callback set_throttle_policy_on_battery(int);
in-out property <bool> change_throttle_policy_on_battery: true;
callback set_change_throttle_policy_on_battery(bool);
in-out property <bool> panel_od;
callback set_panel_od(bool);
in-out property <bool> boot_sound;
@@ -181,7 +185,7 @@ export component PageSystem inherits Rectangle {
}
if SystemPageData.available.ppt-pl1-spl: SystemSlider {
text: @tr("ppt_pl1_spl" => "ppt_pl1_spl");
text: @tr("ppt_pl1_spl" => "PL1, sustained power limit");
minimum: 5;
maximum: 250;
value <=> SystemPageData.ppt_pl1_spl;
@@ -191,7 +195,7 @@ export component PageSystem inherits Rectangle {
}
if SystemPageData.available.ppt-pl2-sppt: SystemSlider {
text: @tr("ppt_pl2_sppt" => "ppt_pl2_sppt");
text: @tr("ppt_pl2_sppt" => "PL2, turbo power limit");
minimum: 5;
maximum: 250;
value <=> SystemPageData.ppt_pl2_sppt;
@@ -201,7 +205,7 @@ export component PageSystem inherits Rectangle {
}
if SystemPageData.available.ppt-fppt: SystemSlider {
text: @tr("ppt_fppt" => "ppt_fppt");
text: @tr("ppt_fppt" => "FPPT, Fast Power Limit");
minimum: 5;
maximum: 250;
value <=> SystemPageData.ppt_fppt;
@@ -211,7 +215,7 @@ export component PageSystem inherits Rectangle {
}
if SystemPageData.available.ppt-apu-sppt: SystemSlider {
text: @tr("ppt_apu_sppt" => "ppt_apu_sppt");
text: @tr("ppt_apu_sppt" => "SPPT, APU slow power limit");
minimum: 5;
maximum: 130;
value <=> SystemPageData.ppt_apu_sppt;
@@ -221,7 +225,7 @@ export component PageSystem inherits Rectangle {
}
if SystemPageData.available.ppt-platform-sppt: SystemSlider {
text: @tr("ppt_platform_sppt" => "ppt_platform_sppt");
text: @tr("ppt_platform_sppt" => "Slow package power tracking limit");
maximum: 130;
minimum: 5;
value <=> SystemPageData.ppt_platform_sppt;
@@ -231,7 +235,7 @@ export component PageSystem inherits Rectangle {
}
if SystemPageData.available.nv-dynamic-boost: SystemSlider {
text: @tr("nv_dynamic_boost" => "nv_dynamic_boost");
text: @tr("nv_dynamic_boost" => "dGPU boost overclock");
minimum: 5;
maximum: 25;
value <=> SystemPageData.nv_dynamic_boost;
@@ -241,7 +245,7 @@ export component PageSystem inherits Rectangle {
}
if SystemPageData.available.nv-temp-target: SystemSlider {
text: @tr("nv_temp_target" => "nv_temp_target");
text: @tr("nv_temp_target" => "dGPU temperature max");
minimum: 75;
maximum: 87;
value <=> SystemPageData.nv_temp_target;
@@ -340,23 +344,45 @@ export component PageSystem inherits Rectangle {
text: @tr("Throttle Policy for power state");
}
SystemDropdown {
text: @tr("Throttle Policy on Battery");
current_index <=> SystemPageData.throttle_policy_on_battery;
current_value: SystemPageData.throttle_policy_choices[SystemPageData.throttle_policy_on_battery];
model <=> SystemPageData.throttle_policy_choices;
selected => {
SystemPageData.set_throttle_policy_on_battery(SystemPageData.throttle_policy_on_battery)
HorizontalLayout {
spacing: 10px;
SystemDropdown {
text: @tr("Throttle Policy on Battery");
current_index <=> SystemPageData.throttle_policy_on_battery;
current_value: SystemPageData.throttle_policy_choices[SystemPageData.throttle_policy_on_battery];
model <=> SystemPageData.throttle_policy_choices;
selected => {
SystemPageData.set_throttle_policy_on_battery(SystemPageData.throttle_policy_on_battery)
}
}
SystemToggle {
text: @tr("Enabled");
checked <=> SystemPageData.change_throttle_policy_on_battery;
toggled => {
SystemPageData.set_change_throttle_policy_on_battery(SystemPageData.change_throttle_policy_on_battery);
}
}
}
SystemDropdown {
text: @tr("Throttle Policy on AC");
current_index <=> SystemPageData.throttle_policy_on_ac;
current_value: SystemPageData.throttle_policy_choices[SystemPageData.throttle_policy_on_ac];
model <=> SystemPageData.throttle_policy_choices;
selected => {
SystemPageData.set_throttle_policy_on_ac(SystemPageData.throttle_policy_on_ac)
HorizontalLayout {
spacing: 10px;
SystemDropdown {
text: @tr("Throttle Policy on AC");
current_index <=> SystemPageData.throttle_policy_on_ac;
current_value: SystemPageData.throttle_policy_choices[SystemPageData.throttle_policy_on_ac];
model <=> SystemPageData.throttle_policy_choices;
selected => {
SystemPageData.set_throttle_policy_on_ac(SystemPageData.throttle_policy_on_ac)
}
}
SystemToggle {
text: @tr("Enabled");
checked <=> SystemPageData.change_throttle_policy_on_ac;
toggled => {
SystemPageData.set_change_throttle_policy_on_ac(SystemPageData.change_throttle_policy_on_ac);
}
}
}
}

View File

@@ -2,6 +2,9 @@ export enum AuraDevType {
New,
Old,
Tuf,
ScsiExtDisk,
Unknown,
Ally,
}
export struct AuraEffect {
@@ -25,7 +28,8 @@ export enum PowerZones {
Lightbar,
Lid,
RearGlow,
KeyboardAndLightbar
KeyboardAndLightbar,
Ally,
}
export struct AuraPowerState {
@@ -42,6 +46,7 @@ export struct LaptopAuraPower {
}
export global AuraPageData {
// The ordering must match the rog-aura crate
in-out property <[string]> power_zone_names: [
@tr("Aura power zone" => "Logo"),
@tr("Aura power zone" => "Keyboard"),
@@ -49,6 +54,14 @@ export global AuraPageData {
@tr("Aura power zone" => "Lid"),
@tr("Aura power zone" => "Rear Glow"),
@tr("Aura power zone" => "Keyboard and Lightbar"),
@tr("Aura power zone" => "Ally"),
];
// Exists only for the older 0x1866 keybaords. On page setup it must
// be set to match the supported_power_zones
in-out property <[string]> power_zone_names_old: [
@tr("Aura power zone" => "Keyboard"),
@tr("Aura power zone" => "Lightbar"),
@tr("Aura power zone" => "Keyboard and Lightbar"),
];
in-out property <[string]> brightness_names: [
@tr("Aura brightness" => "Off"),
@@ -135,13 +148,12 @@ export global AuraPageData {
}
callback set_hex_from_colour(color) -> string;
callback set_hex_to_colour(string) -> color;
in-out property <AuraDevType> aura_type: AuraDevType.New;
in-out property <AuraDevType> device_type: AuraDevType.Old;
// List of indexes to power_zone_names. Must correspond to rog-aura crate
in-out property <[PowerZones]> supported_power_zones: [
PowerZones.Keyboard,
PowerZones.RearGlow,
PowerZones.Lid,
PowerZones.Lightbar,
PowerZones.Logo
PowerZones.KeyboardAndLightbar,
];
in-out property <LaptopAuraPower> led_power: {
states: [{

View File

@@ -1,5 +1,6 @@
import { Palette, VerticalBox, HorizontalBox, GroupBox } from "std-widgets.slint";
import { SystemToggleVert } from "common.slint";
import { SystemToggleVert, SystemDropdown } from "common.slint";
import { PowerZones } from "../types/aura_types.slint";
export component AuraPowerGroup inherits Rectangle {
min-width: row.min-width;
@@ -68,3 +69,74 @@ export component AuraPowerGroup inherits Rectangle {
}
}
}
export component AuraPowerGroupOld inherits Rectangle {
min-width: row.min-width;
border-radius: 20px;
background: Palette.alternate-background;
opacity: 0.9;
in-out property <int> current_zone;
in-out property <[int]> zones;
in-out property <[string]> zone_strings;
in-out property <string> group-title;
in-out property <bool> boot_checked;
in-out property <bool> awake_checked;
in-out property <bool> sleep_checked;
callback boot_toggled(bool);
callback awake_toggled(bool);
callback sleep_toggled(bool);
callback selected_zone(int);
VerticalBox {
spacing: 10px;
Text {
font-size: 18px;
color: Palette.alternate-foreground;
horizontal-alignment: TextHorizontalAlignment.center;
text <=> root.group-title;
}
row := HorizontalBox {
alignment: LayoutAlignment.center;
SystemDropdown {
text: @tr("Zone Selection");
current_index <=> root.current_zone;
current_value: root.zone_strings[root.current_zone];
model <=> root.zone_strings;
selected => {
root.selected_zone(root.current_zone);
}
}
SystemToggleVert {
min-width: 96px;
max-height: 42px;
text: @tr("Boot");
checked <=> root.boot_checked;
toggled => {
root.boot_toggled(self.checked);
}
}
SystemToggleVert {
min-width: 96px;
max-height: 42px;
text: @tr("Awake");
checked <=> root.awake_checked;
toggled => {
root.awake_toggled(self.checked);
}
}
SystemToggleVert {
min-width: 96px;
max-height: 42px;
text: @tr("Sleep");
checked <=> root.sleep_checked;
toggled => {
root.sleep_toggled(self.checked);
}
}
}
}
}

View File

@@ -6,6 +6,7 @@ export component ColourSlider inherits VerticalLayout {
property <string> hex: "#FF0000";
in-out property <float> c1value <=> c1.value;
in-out property <float> c2value <=> c2.value;
in-out property <float> c3value <=> c3.value;
property <color> base_colour: Colors.red;
in-out property <color> final_colour: Colors.red;
in-out property <brush> colourbox: final_colour;
@@ -53,39 +54,52 @@ export component ColourSlider inherits VerticalLayout {
hsv(350, 1, 1),
hsv(360, 1, 1),
];
property <[color]> base_shade: [
blend_lightness(base_colour, 1.0),
blend_lightness(base_colour, 0.9),
blend_lightness(base_colour, 0.8),
blend_lightness(base_colour, 0.7),
blend_lightness(base_colour, 0.6),
blend_lightness(base_colour, 0.5),
blend_lightness(base_colour, 0.4),
blend_lightness(base_colour, 0.3),
blend_lightness(base_colour, 0.2),
blend_lightness(base_colour, 0.1),
blend_lightness(base_colour, 0.0)
property <[color]> base_saturation: [
hsv(base_colour.to-hsv().hue, 1, 1),
hsv(base_colour.to-hsv().hue, 0.9, 1),
hsv(base_colour.to-hsv().hue, 0.8, 1),
hsv(base_colour.to-hsv().hue, 0.7, 1),
hsv(base_colour.to-hsv().hue, 0.6, 1),
hsv(base_colour.to-hsv().hue, 0.5, 1),
hsv(base_colour.to-hsv().hue, 0.4, 1),
hsv(base_colour.to-hsv().hue, 0.3, 1),
hsv(base_colour.to-hsv().hue, 0.2, 1),
hsv(base_colour.to-hsv().hue, 0.1, 1),
hsv(base_colour.to-hsv().hue, 0, 1),
];
function blend_lightness(c1: color,f: float) -> color {
rgb(c1.red * f, c1.green * f, c1.blue * f)
}
//
function set_base_colour(){
root.base_colour = base_colours[c1.value].mix(base_colours[c1.value + 1], c1.value - Math.floor(c1.value));
root.final_colour = blend_lightness(base_colour, ((base_shade.length - c2.value) / base_shade.length));
property <[color]> base_value: [
hsv(base_colour.to-hsv().hue, 1, 1),
hsv(base_colour.to-hsv().hue, 1, 0.9),
hsv(base_colour.to-hsv().hue, 1, 0.8),
hsv(base_colour.to-hsv().hue, 1, 0.7),
hsv(base_colour.to-hsv().hue, 1, 0.6),
hsv(base_colour.to-hsv().hue, 1, 0.5),
hsv(base_colour.to-hsv().hue, 1, 0.4),
hsv(base_colour.to-hsv().hue, 1, 0.3),
hsv(base_colour.to-hsv().hue, 1, 0.2),
hsv(base_colour.to-hsv().hue, 1, 0.1),
hsv(base_colour.to-hsv().hue, 1, 0),
];
function set_base_colour() {
root.base_colour = hsv(c1.value / base_colours.length * 360, 1, 1);
root.final_colour = hsv(base_colour.to-hsv().hue, ((base_saturation.length - c2.value) / base_saturation.length), ((base_value.length - c3.value) / base_value.length));
root.colourbox = root.final_colour;
}
//
callback external_colour_change();
external_colour_change => {
if (root.final_colour.to-hsv().hue < 0) {
c1.value = (root.base_colours.length - 1) * ((root.final_colour.to-hsv().hue + 360) / 360);
c1.value = root.base_colours.length * (root.final_colour.to-hsv().hue + 360) / 360;
} else {
c1.value = (root.base_colours.length - 1) * (root.final_colour.to-hsv().hue / 360);
c1.value = root.base_colours.length * root.final_colour.to-hsv().hue / 360;
}
c2.value = root.base_shade.length - (root.base_shade.length * root.final_colour.to-hsv().value);
// c1.value = root.base_colours.length * 360 / root.final_colour.to-hsv().hue;
c2.value = root.base_saturation.length - root.base_saturation.length * root.final_colour.to-hsv().saturation;
c3.value = root.base_value.length - root.base_value.length * root.final_colour.to-hsv().value;
root.set_base_colour();
hex = set_hex_from_colour(final_colour);
}
Rectangle {
height: 32px;
@@ -100,7 +114,7 @@ export component ColourSlider inherits VerticalLayout {
width: parent.width;
height: parent.height;
minimum: 0;
maximum: root.base_colours.length - 1;
maximum: root.base_colours.length;
// One less than the array length
changed => {
set_base_colour();
@@ -118,14 +132,38 @@ export component ColourSlider inherits VerticalLayout {
border-radius: 7px;
border-color: Palette.border;
// 11 colours
background: !root.enabled ? Palette.alternate-background : @linear-gradient(90deg, base_shade[0], base_shade[1], base_shade[2], base_shade[3], base_shade[4], base_shade[5], base_shade[6], base_shade[7], base_shade[8], base_shade[9], base_shade[10]);
background: !root.enabled ? Palette.alternate-background : @linear-gradient(90deg, base_saturation[0], base_saturation[1], base_saturation[2], base_saturation[3], base_saturation[4], base_saturation[5], base_saturation[6], base_saturation[7], base_saturation[8], base_saturation[9], base_saturation[10]);
clip: true;
c2 := Slider {
enabled <=> root.enabled;
width: parent.width;
height: parent.height;
minimum: 0;
maximum: 11;
maximum: root.base_saturation.length;
changed => {
set_base_colour();
hex = set_hex_from_colour(final_colour);
}
released => {
root.released();
}
}
}
Rectangle {
height: 32px;
border-width: 2px;
border-radius: 7px;
border-color: Palette.border;
// 11 colours
background: !root.enabled ? Palette.alternate-background : @linear-gradient(90deg, base_value[0], base_value[1], base_value[2], base_value[3], base_value[4], base_value[5], base_value[6], base_value[7], base_value[8], base_value[9], base_value[10]);
clip: true;
c3 := Slider {
enabled <=> root.enabled;
width: parent.width;
height: parent.height;
minimum: 0;
maximum: root.base_value.length;
changed => {
set_base_colour();
hex = set_hex_from_colour(final_colour);

View File

@@ -5,7 +5,8 @@ export component RogItem inherits Rectangle {
border-color: Palette.border;
border-width: 3px;
border-radius: 10px;
min-height: 46px;
min-height: 48px;
max-height: 56px;
}
export component SystemSlider inherits RogItem {
@@ -16,7 +17,7 @@ export component SystemSlider inherits RogItem {
callback released(int);
HorizontalLayout {
HorizontalLayout {
width: 30%;
width: 50%;
alignment: LayoutAlignment.space-between;
padding-left: 10px;
Text {
@@ -54,6 +55,7 @@ export component SystemToggle inherits RogItem {
in-out property <bool> checked;
callback toggled(bool);
HorizontalLayout {
spacing: 6px;
HorizontalLayout {
alignment: LayoutAlignment.start;
padding-left: 10px;

View File

@@ -26,16 +26,20 @@ export component Graph inherits Rectangle {
y: root.graph_padding;
function scale_x_to_graph(x: length) -> length {
((x - node_min.x) / (node_max.x - node_min.x)) * graph.width
}//
}
//
function scale_y_to_graph(y: length) -> length {
((y - node_min.y) / (node_max.y - node_min.y)) * graph.height
}//
}
//
function scale_x_to_node(x: length) -> length {
(x / graph.width) * (node_max.x - node_min.x)
}//
}
//
function scale_y_to_node(y: length) -> length {
(y / graph.height) * (node_max.y - node_min.y)
}//
}
//
for n in 11: Path {
viewbox-width: self.width / 1px;
@@ -43,21 +47,23 @@ export component Graph inherits Rectangle {
stroke: Palette.alternate-foreground.darker(200%);
stroke-width: 1px;
MoveTo {
x: scale_x_to_graph(n*10px) / 1px;
y: 0; // scale_y_to_graph(n*1px) / 1px;
x: scale_x_to_graph(n * 10px) / 1px;
y: 0;
// scale_y_to_graph(n*1px) / 1px;
}
LineTo {
x: scale_x_to_graph(n*10px) / 1px;
y: graph.height / 1px; //scale_y_to_graph(n*1px) / 1px;
x: scale_x_to_graph(n * 10px) / 1px;
y: graph.height / 1px;
//scale_y_to_graph(n*1px) / 1px;
}
}
for n in 11: Text {
color: Palette.accent-background;
font-size <=> root.axis_font_size;
text: "\{n*10}c";
x: scale_x_to_graph(n*10px) - self.width / 3;
text: "\{n * 10}c";
x: scale_x_to_graph(n * 10px) - self.width / 3;
y: graph.height + 2px;
}
@@ -67,22 +73,24 @@ export component Graph inherits Rectangle {
stroke: Palette.alternate-foreground.darker(200%);
stroke-width: 1px;
MoveTo {
x: 0; //scale_x_to_graph(n*10px) / 1px;
y: scale_y_to_graph(n*25.5px) / 1px;
x: 0;
//scale_x_to_graph(n*10px) / 1px;
y: scale_y_to_graph(n * 25.5px) / 1px;
}
LineTo {
x: graph.width / 1px; //scale_x_to_graph(n*10px) / 1px;
y: scale_y_to_graph(n*25.5px) / 1px;
x: graph.width / 1px;
//scale_x_to_graph(n*10px) / 1px;
y: scale_y_to_graph(n * 25.5px) / 1px;
}
}
for n in 11: Text {
color: Palette.accent-background;
font-size <=> root.axis_font_size;
text: "\{n*10}%";
text: "\{n * 10}%";
x: - self.width;
y: graph.height - scale_y_to_graph(n*25.5px) - self.height / 2;
y: graph.height - scale_y_to_graph(n * 25.5px) - self.height / 2;
}
for l[idx] in nodes: path := Rectangle {
@@ -115,7 +123,8 @@ export component Graph inherits Rectangle {
tip.background: Palette.accent-background;
tip.opacity: 1.0;
}
]//
]
//
point := Rectangle {
background: Palette.control-foreground;
x: scale_x_to_graph(n.x) - self.width / 2;
@@ -133,7 +142,6 @@ export component Graph inherits Rectangle {
} else if n.x + scale_x_to_node(self.mouse-x - self.pressed-x) < nodes[idx - 1].x {
n.x = nodes[idx - 1].x + pad;
}
if n.y + scale_y_to_node(self.height - self.mouse-y - self.pressed-y) > nodes[idx + 1].y {
n.y = nodes[idx + 1].y - pad;
} else if n.y + scale_y_to_node(self.height - self.mouse-y - self.pressed-y) < nodes[idx - 1].y {
@@ -145,7 +153,6 @@ export component Graph inherits Rectangle {
} else if n.x + scale_x_to_node(self.mouse-x - self.pressed-x) > nodes[idx + 1].x {
n.x = nodes[idx + 1].x - pad;
}
if n.y - scale_y_to_node(self.mouse-y - self.pressed-y) < 0.0 {
n.y = 1px;
} else if n.y + scale_y_to_node(self.height - self.mouse-y - self.pressed-y) > nodes[idx + 1].y {
@@ -157,14 +164,14 @@ export component Graph inherits Rectangle {
} else if n.x + scale_x_to_node(self.mouse-x - self.pressed-x) < nodes[idx - 1].x {
n.x = nodes[idx - 1].x + pad;
}
if n.y - scale_y_to_node(self.mouse-y - self.pressed-y) > scale_y_to_node(graph.height) {
n.y = scale_y_to_node(graph.height - 1px);
} else if n.y + scale_y_to_node(self.height - self.mouse-y - self.pressed-y) < nodes[idx - 1].y {
n.y = nodes[idx - 1].y + pad;
}
}
}//
}
//
moved => {
if (self.pressed) {
n.x += scale_x_to_node(self.mouse-x - self.pressed-x);
@@ -190,27 +197,32 @@ export component Graph inherits Rectangle {
height: label.preferred-height;
function x_pos() -> length {
scale_x_to_graph(n.x) - label.preferred-width - 8px
}//
}
//
function final_x_pos() -> length {
if x_pos() > 0 {
x_pos()
} else {
x_pos() + label.preferred-width
}
}//
}
//
function y_pos() -> length {
graph.height - scale_y_to_graph(n.y) - self.height - 4px
}//
}
//
function final_y_pos() -> length {
if y_pos() > 0 {
y_pos()
} else {
y_pos() + label.preferred-height
}
}//
}
//
function fan_pct() -> int {
Math.floor(n.y / 1px) / 255 * 100
}//
}
//
label := Text {
color: Palette.accent-foreground;
font-size: 16px;

View File

@@ -7,3 +7,44 @@ pub mod zbus_platform;
pub mod zbus_slash;
pub const VERSION: &str = env!("CARGO_PKG_VERSION");
pub fn list_iface_blocking() -> Result<Vec<String>, Box<dyn std::error::Error>> {
let conn = zbus::blocking::Connection::system()?;
let f = zbus::blocking::fdo::ObjectManagerProxy::new(&conn, "org.asuslinux.Daemon", "/")?;
let interfaces = f.get_managed_objects()?;
let mut ifaces = Vec::new();
for v in interfaces.iter() {
for k in v.1.keys() {
ifaces.push(k.to_string());
}
}
Ok(ifaces)
}
pub fn has_iface_blocking(iface: &str) -> Result<bool, Box<dyn std::error::Error>> {
let conn = zbus::blocking::Connection::system()?;
let f = zbus::blocking::fdo::ObjectManagerProxy::new(&conn, "org.asuslinux.Daemon", "/")?;
let interfaces = f.get_managed_objects()?;
for v in interfaces.iter() {
for k in v.1.keys() {
if k.as_str() == iface {
return Ok(true);
}
}
}
Ok(false)
}
pub async fn has_iface(iface: &str) -> Result<bool, Box<dyn std::error::Error>> {
let conn = zbus::Connection::system().await?;
let f = zbus::fdo::ObjectManagerProxy::new(&conn, "org.asuslinux.Daemon", "/").await?;
let interfaces = f.get_managed_objects().await?;
for v in interfaces.iter() {
for k in v.1.keys() {
if k.as_str() == iface {
return Ok(true);
}
}
}
Ok(false)
}

View File

@@ -36,9 +36,6 @@ trait Platform {
/// NextThrottleThermalPolicy method
fn next_throttle_thermal_policy(&self) -> zbus::Result<()>;
/// SupportedInterfaces method
fn supported_interfaces(&self) -> zbus::Result<Vec<String>>;
/// SupportedProperties method
fn supported_properties(&self) -> zbus::Result<Vec<Properties>>;
@@ -146,12 +143,24 @@ trait Platform {
#[zbus(property)]
fn set_throttle_policy_on_ac(&self, throttle_policy: ThrottlePolicy) -> zbus::Result<()>;
/// ChangeThrottlePolicyOnAc property
#[zbus(property)]
fn change_throttle_policy_on_ac(&self) -> zbus::Result<bool>;
#[zbus(property)]
fn set_change_throttle_policy_on_ac(&self, change: bool) -> zbus::Result<()>;
/// ThrottlePolicyOnBattery property
#[zbus(property)]
fn throttle_policy_on_battery(&self) -> zbus::Result<ThrottlePolicy>;
#[zbus(property)]
fn set_throttle_policy_on_battery(&self, throttle_policy: ThrottlePolicy) -> zbus::Result<()>;
/// ChangeThrottlePolicyOnAc property
#[zbus(property)]
fn change_throttle_policy_on_battery(&self) -> zbus::Result<bool>;
#[zbus(property)]
fn set_change_throttle_policy_on_battery(&self, change: bool) -> zbus::Result<()>;
/// ThrottleQuietEpp property
#[zbus(property)]
fn throttle_quiet_epp(&self) -> zbus::Result<CPUEPP>;

View File

@@ -0,0 +1,288 @@
use std::fs::{read_dir, File};
use std::io::Read;
use std::path::Path;
use crate::error::PlatformError;
const BASE_DIR: &str = "/sys/class/firmware-attributes/asus-armoury/attributes/";
fn read_i32(path: &Path) -> Result<i32, PlatformError> {
if let Ok(mut f) = File::open(path) {
let mut buf = String::new();
f.read_to_string(&mut buf)?;
buf.trim()
.parse::<i32>()
.map_err(|_| PlatformError::ParseNum)
} else {
Err(PlatformError::ParseNum)
}
}
fn read_string(path: &Path) -> Result<String, PlatformError> {
let mut f = File::open(path)?;
let mut buf = String::new();
f.read_to_string(&mut buf)?;
Ok(buf.trim().to_string())
}
#[derive(Debug, Default, PartialEq, PartialOrd)]
pub enum AttrValue {
Integer(i32),
String(String),
EnumInt(Vec<i32>),
EnumStr(Vec<String>),
#[default]
None,
}
#[derive(Debug, Default)]
pub struct Attribute {
name: String,
help: String,
current_value: AttrValue,
default_value: AttrValue,
possible_values: AttrValue,
min_value: AttrValue,
max_value: AttrValue,
scalar_increment: Option<i32>,
}
impl Attribute {
pub fn name(&self) -> &str {
&self.name
}
pub fn help(&self) -> &str {
&self.help
}
pub fn current_value(&self) -> &AttrValue {
&self.current_value
}
pub fn default_value(&self) -> &AttrValue {
&self.default_value
}
pub fn possible_values(&self) -> &AttrValue {
&self.possible_values
}
pub fn min_value(&self) -> &AttrValue {
&self.min_value
}
pub fn max_value(&self) -> &AttrValue {
&self.max_value
}
pub fn scalar_increment(&self) -> Option<i32> {
self.scalar_increment
}
fn read_values(
base_path: &Path,
) -> (
AttrValue,
AttrValue,
AttrValue,
AttrValue,
AttrValue,
Option<i32>,
) {
let current_value = match read_string(&base_path.join("current_value")) {
Ok(val) => {
if let Ok(int) = val.parse::<i32>() {
AttrValue::Integer(int)
} else {
AttrValue::String(val)
}
}
Err(_) => AttrValue::None,
};
let default_value = match read_string(&base_path.join("default_value")) {
Ok(val) => {
if let Ok(int) = val.parse::<i32>() {
AttrValue::Integer(int)
} else {
AttrValue::String(val)
}
}
Err(_) => AttrValue::None,
};
let possible_values = match read_string(&base_path.join("possible_values")) {
Ok(val) => {
if let Ok(int) = val.parse::<i32>() {
AttrValue::Integer(int)
} else if val.contains(';') {
AttrValue::EnumInt(val.split(';').filter_map(|s| s.parse().ok()).collect())
} else {
AttrValue::EnumStr(val.split(';').map(|s| s.to_string()).collect())
}
}
Err(_) => AttrValue::None,
};
let min_value = read_i32(&base_path.join("min_value"))
.ok()
.map(AttrValue::Integer)
.unwrap_or_default();
let max_value = read_i32(&base_path.join("max_value"))
.ok()
.map(AttrValue::Integer)
.unwrap_or_default();
let scalar_increment = read_i32(&base_path.join("scalar_increment")).ok();
(
current_value,
default_value,
possible_values,
min_value,
max_value,
scalar_increment,
)
}
}
pub struct FirmwareAttributes {
attrs: Vec<Attribute>,
}
#[allow(clippy::new_without_default)]
impl FirmwareAttributes {
pub fn new() -> Self {
let mut attrs = Vec::new();
if let Ok(dir) = read_dir(BASE_DIR) {
for entry in dir.flatten() {
let base_path = entry.path();
let name = base_path.file_name().unwrap().to_string_lossy().to_string();
let help = read_string(&base_path.join("display_name")).unwrap_or_default();
let (
current_value,
default_value,
possible_values,
min_value,
max_value,
scalar_increment,
) = Attribute::read_values(&base_path);
attrs.push(Attribute {
name,
help,
current_value,
default_value,
possible_values,
min_value,
max_value,
scalar_increment,
});
}
}
Self { attrs }
}
pub fn attributes(&self) -> &Vec<Attribute> {
&self.attrs
}
pub fn attributes_mut(&mut self) -> &mut Vec<Attribute> {
&mut self.attrs
}
}
macro_rules! define_attribute_getters {
($($attr:ident),*) => {
impl FirmwareAttributes {
$(
pub fn $attr(&self) -> Option<&Attribute> {
self.attrs.iter().find(|a| a.name() == stringify!($attr))
}
concat_idents::concat_idents!(attr_mut = $attr, _mut {
pub fn attr_mut(&mut self) -> Option<&mut Attribute> {
self.attrs.iter_mut().find(|a| a.name() == stringify!($attr))
}
});
)*
}
}
}
define_attribute_getters!(
apu_mem,
cores_performance,
cores_efficiency,
ppt_pl1_spl,
ppt_pl2_sppt,
ppt_apu_sppt,
ppt_platform_sppt,
ppt_fppt,
nv_dynamic_boost,
nv_temp_target,
dgpu_base_tgp,
dgpu_tgp,
charge_mode,
boot_sound,
mcu_powersave,
panel_od,
panel_hd_mode,
egpu_connected,
egpu_enable,
dgpu_disable,
gpu_mux_mode,
mini_led_mode
);
#[cfg(test)]
mod tests {
use super::*;
#[test]
fn find_attributes() {
let attrs = FirmwareAttributes::new();
for attr in attrs.attributes() {
dbg!(attr.name());
match attr.name() {
"nv_dynamic_boost" => {
assert!(!attr.help().is_empty());
assert!(matches!(attr.current_value, AttrValue::Integer(_)));
if let AttrValue::Integer(val) = attr.current_value {
assert_eq!(val, 5);
}
if let AttrValue::Integer(val) = attr.default_value {
assert_eq!(val, 25);
}
assert_eq!(attr.min_value, AttrValue::Integer(0));
assert_eq!(attr.max_value, AttrValue::Integer(25));
}
"boot_sound" => {
assert!(!attr.help().is_empty());
assert!(matches!(attr.current_value, AttrValue::Integer(0)));
// dbg!(attr.current_value());
}
_ => {}
}
}
}
#[test]
fn test_boot_sound() {
let attrs = FirmwareAttributes::new();
let attr = attrs
.attributes()
.iter()
.find(|a| a.name() == "boot_sound")
.unwrap();
assert_eq!(attr.name(), "boot_sound");
assert!(!attr.help().is_empty());
assert!(matches!(attr.current_value(), AttrValue::Integer(_)));
if let AttrValue::Integer(val) = attr.current_value() {
assert_eq!(*val, 0); // assuming value is 0
}
// Check other members if applicable
}
}

View File

@@ -17,6 +17,7 @@ pub struct HidRaw {
syspath: PathBuf,
/// The product ID. The vendor ID is not kept
prod_id: String,
device_bcd: u32,
/// Retaining a handle to the file for the duration of `HidRaw`
file: RefCell<File>,
}
@@ -52,6 +53,12 @@ impl HidRaw {
devfs_path: dev_node.to_owned(),
prod_id: id_product.to_string(),
syspath: endpoint.syspath().into(),
device_bcd: usb_device
.attribute_value("bcdDevice")
.unwrap_or_default()
.to_string_lossy()
.parse()
.unwrap_or_default(),
});
}
}
@@ -70,6 +77,12 @@ impl HidRaw {
devfs_path: dev_node.to_owned(),
prod_id: id_product.to_string(),
syspath: endpoint.syspath().into(),
device_bcd: endpoint
.attribute_value("bcdDevice")
.unwrap_or_default()
.to_string_lossy()
.parse()
.unwrap_or_default(),
});
}
}
@@ -94,6 +107,12 @@ impl HidRaw {
devfs_path: dev_node.to_owned(),
prod_id: id_product.to_string_lossy().into(),
syspath: device.syspath().into(),
device_bcd: device
.attribute_value("bcdDevice")
.unwrap_or_default()
.to_string_lossy()
.parse()
.unwrap_or_default(),
});
}
}

View File

@@ -5,12 +5,15 @@ use log::{info, warn};
use crate::error::{PlatformError, Result};
use crate::{attr_u8, has_attr, set_attr_u8_array, to_device};
/// The sysfs control for backlight levels. This is only for the 3-step
/// backlight setting, and for TUF laptops. It is not a hard requirement
/// for Aura keyboards
#[derive(Debug, Default, PartialEq, Eq, PartialOrd, Clone)]
pub struct KeyboardLed {
pub struct KeyboardBacklight {
path: PathBuf,
}
impl KeyboardLed {
impl KeyboardBacklight {
attr_u8!("brightness", path);
has_attr!("kbd_rgb_mode" path);
@@ -40,26 +43,20 @@ impl KeyboardLed {
PlatformError::Udev("match_subsystem failed".into(), err)
})?;
enumerator
.match_sysname("asus::kbd_backlight")
.map_err(|err| {
warn!("{}", err);
PlatformError::Udev("match_subsystem failed".into(), err)
})?;
if let Some(device) = (enumerator.scan_devices().map_err(|err| {
for device in enumerator.scan_devices().map_err(|err| {
warn!("{}", err);
PlatformError::Udev("scan_devices failed".into(), err)
})?)
.next()
{
info!("Found keyboard LED controls at {:?}", device.sysname());
return Ok(Self {
path: device.syspath().to_owned(),
});
})? {
let sys = device.sysname().to_string_lossy();
if sys.contains("kbd_backlight") || sys.contains("ally:rgb:gamepad") {
info!("Found keyboard LED controls at {:?}", device.sysname());
return Ok(Self {
path: device.syspath().to_owned(),
});
}
}
Err(PlatformError::MissingFunction(
"asus::kbd_backlight not found".into(),
"KeyboardLed:new(), asus::kbd_backlight not found".into(),
))
}
}

View File

@@ -3,6 +3,7 @@
pub mod cpu;
pub mod error;
pub mod firmware_attributes;
pub mod hid_raw;
pub mod keyboard_led;
pub(crate) mod macros;
@@ -44,7 +45,7 @@ pub fn read_attr_bool(device: &Device, attr_name: &str) -> Result<bool> {
pub fn write_attr_bool(device: &mut Device, attr: &str, value: bool) -> Result<()> {
device
.set_attribute_value(attr, &(value as u8).to_string())
.set_attribute_value(attr, value.to_string())
.map_err(|e| PlatformError::IoPath(attr.into(), e))
}
@@ -58,7 +59,7 @@ pub fn read_attr_u8(device: &Device, attr_name: &str) -> Result<u8> {
pub fn write_attr_u8(device: &mut Device, attr: &str, value: u8) -> Result<()> {
device
.set_attribute_value(attr, &(value).to_string())
.set_attribute_value(attr, value.to_string())
.map_err(|e| PlatformError::IoPath(attr.into(), e))
}

View File

@@ -60,13 +60,12 @@ impl AsusPower {
info!("Found a battery");
if battery.is_none() {
info!("Checking battery attributes");
if device
.attribute_value("charge_control_end_threshold")
.is_some()
if let Some(current) =
device.attribute_value("charge_control_end_threshold")
{
info!(
"Found battery power at {:?}, matched \
charge_control_end_threshold",
charge_control_end_threshold. Current level: {current:?}",
device.sysname()
);
battery = Some(device.syspath().to_path_buf());

View File

@@ -16,7 +16,6 @@ dbus = ["zbus"]
log.workspace = true
udev.workspace = true
serde.workspace = true
serde_derive.workspace = true
typeshare.workspace = true
rog_platform = { path = "../rog-platform" }

View File

@@ -1,5 +1,5 @@
use log::trace;
use serde_derive::{Deserialize, Serialize};
use log::{error, trace};
use serde::{Deserialize, Serialize};
use typeshare::typeshare;
use udev::Device;
#[cfg(feature = "dbus")]
@@ -91,7 +91,7 @@ impl std::str::FromStr for CurveData {
}
for (index, value) in input.split(',').enumerate() {
for (select, num) in value.splitn(2, |c| c == 'c' || c == ':').enumerate() {
for (select, num) in value.splitn(2, ['c', ':']).enumerate() {
if num.contains('%') {
percentages = true;
}
@@ -173,19 +173,20 @@ impl CurveData {
for (index, out) in self.pwm.iter().enumerate() {
let pwm = pwm_str(pwm_num, index);
trace!("writing {pwm}");
device.set_attribute_value(&pwm, &out.to_string())?;
device.set_attribute_value(&pwm, out.to_string())?;
}
for (index, out) in self.temp.iter().enumerate() {
let temp = temp_str(pwm_num, index);
trace!("writing {temp}");
device.set_attribute_value(&temp, &out.to_string())?;
device.set_attribute_value(&temp, out.to_string())?;
}
// Enable must be done *after* all points are written pwm3_enable
device
.set_attribute_value(format!("pwm{pwm_num}_enable"), enable.to_string())
.unwrap();
.map_err(|e| error!("Failed to set pwm{pwm_num}_enable to {enable}: {e:?}"))
.ok();
Ok(())
}
}

View File

@@ -5,7 +5,7 @@ use error::ProfileError;
use fan_curve_set::CurveData;
use log::debug;
use rog_platform::platform::ThrottlePolicy;
use serde_derive::{Deserialize, Serialize};
use serde::{Deserialize, Serialize};
use typeshare::typeshare;
pub use udev::Device;
#[cfg(feature = "dbus")]

View File

@@ -23,7 +23,6 @@ path = "src/lib.rs"
[dependencies]
serde.workspace = true
serde_derive.workspace = true
typeshare.workspace = true
zbus = { workspace = true, optional = true }
dmi_id = { path = "../dmi-id", optional = true }

View File

@@ -1,7 +1,7 @@
use std::fmt::Display;
use std::str::FromStr;
use serde_derive::{Deserialize, Serialize};
use serde::{Deserialize, Serialize};
use typeshare::typeshare;
#[cfg(feature = "dbus")]
use zbus::zvariant::Type;
@@ -12,7 +12,8 @@ use crate::error::SlashError;
#[derive(Debug, Copy, Clone, PartialEq, Eq, Deserialize, Serialize)]
pub enum SlashType {
GA403,
Unknown,
GA605,
GU605,
Unsupported,
}
@@ -22,7 +23,9 @@ impl FromStr for SlashType {
fn from_str(s: &str) -> std::result::Result<Self, Self::Err> {
Ok(match s {
"ga403" | "GA403" => Self::GA403,
_ => Self::Unknown,
"ga605" | "GA605" => Self::GA605,
"gu605" | "GU605" => Self::GU605,
_ => Self::Unsupported,
})
}
}

View File

@@ -28,12 +28,16 @@ pub type SlashUsbPacket = [u8; PACKET_SIZE];
///
/// The currently known USB device is `193B`.
#[inline]
pub fn get_slash_type() -> Result<SlashType, SlashError> {
pub fn get_maybe_slash_type() -> Result<SlashType, SlashError> {
let dmi = DMIID::new().map_err(|_| SlashError::NoDevice)?; // TODO: better error
let board_name = dmi.board_name;
if board_name.contains("GA403") {
return Ok(SlashType::GA403);
} else if board_name.contains("GA605") {
return Ok(SlashType::GA605);
} else if board_name.contains("GU605") {
return Ok(SlashType::GU605);
}
Ok(SlashType::Unsupported)
}

View File

@@ -19,6 +19,6 @@ uhid-virt = "^0.0.7"
rog_anime = { path = "../rog-anime", features = ["dbus"] }
[dependencies.sdl2]
version = "0.36"
version = "0.37"
default-features = false
# features = ["gfx"]

View File

@@ -43,7 +43,7 @@ impl AniMatrix {
vertical: 2,
horizontal: 5,
},
AnimeType::GA402 | AnimeType::Unknown => LedShape {
AnimeType::GA402 | AnimeType::Unsupported => LedShape {
vertical: 2,
horizontal: 5,
},
@@ -56,7 +56,7 @@ impl AniMatrix {
// Do a hard mapping of each (derived from wireshardk captures)
let rows = match model {
AnimeType::GA401 => GA401.to_vec(),
AnimeType::GA402 | AnimeType::Unknown => GA402.to_vec(),
AnimeType::GA402 | AnimeType::Unsupported => GA402.to_vec(),
AnimeType::GU604 => GU604.to_vec(),
};