Compare commits

...

52 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
Christophe Ninucci
7122fbaca8 add Zenbook to asusd.rules 2024-04-14 11:30:39 +02:00
74 changed files with 3322 additions and 1583 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 --test-threads=1
cargo test --all -- --test-threads=1
echo '+cargo cranky'
cargo cranky

View File

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

View File

@@ -1,12 +1,56 @@
# 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

2346
Cargo.lock generated

File diff suppressed because it is too large Load Diff

View File

@@ -1,5 +1,5 @@
[workspace.package]
version = "6.0.8"
version = "6.0.12"
rust-version = "1.77"
license = "MPL-2.0"
readme = "README.md"
@@ -36,7 +36,7 @@ default-members = [
]
[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
@@ -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,7 @@ 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/). This is especially required for 2023+ devices and possibly some lat 2022 devices.
**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)

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

@@ -9,7 +9,7 @@ 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};
@@ -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}");
@@ -364,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;
}
@@ -572,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;
}
}
@@ -749,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),
}
}

View File

@@ -22,7 +22,6 @@ 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,7 +6,7 @@ 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;
@@ -44,7 +44,7 @@ fn main() -> Result<(), Box<dyn std::error::Error>> {
// Set up the anime data and run loop/thread
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, 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";

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,11 +8,11 @@ use std::sync::Arc;
use std::thread::sleep;
use ::zbus::export::futures_util::lock::Mutex;
use config_traits::{StdConfig, StdConfigLoad2};
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};
@@ -64,6 +64,12 @@ pub struct CtrlAnime {
impl CtrlAnime {
#[inline]
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() {
@@ -90,18 +96,16 @@ impl CtrlAnime {
// }
// }
let config = AnimeConfig::new().load();
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,6 +135,37 @@ 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)]

View File

@@ -1,4 +1,4 @@
use std::collections::{BTreeMap, HashSet};
use std::collections::HashSet;
use config_traits::{StdConfig, StdConfigLoad};
use dmi_id::DMIID;
@@ -7,9 +7,7 @@ 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::KeyboardBacklight;
use udev::Device;
@@ -180,7 +178,7 @@ impl CtrlKbdLed {
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::init_config(&prod_id);
controller.config = Self::load_and_update_config(&prod_id);
interfaces.insert(dbus_path);
return Ok(Some(controller));
}
@@ -225,7 +223,7 @@ impl CtrlKbdLed {
led_node: LEDNode::KbdLed(kbd_backlight),
supported_data: LedSupportData::get_data("tuf"),
per_key_mode_active: false,
config: Self::init_config("tuf"),
config: Self::load_and_update_config("tuf"),
dbus_path: dbus_path_for_tuf(),
};
devices.push(ctrl);
@@ -244,7 +242,7 @@ 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> {
fn from_hidraw(device: HidRaw, dbus_path: OwnedObjectPath) -> Result<Self, RogError> {
let rgb_led = KeyboardBacklight::new()
.map_err(|e| {
log::error!(
@@ -274,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);
@@ -289,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())
{
@@ -312,6 +317,23 @@ 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> {
@@ -320,13 +342,17 @@ impl CtrlKbdLed {
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(())
}
@@ -374,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,
@@ -414,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)]
@@ -502,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();

View File

@@ -146,7 +146,7 @@ impl CtrlAuraZbus {
)));
}
ctrl.write_mode(&effect)?;
ctrl.write_effect_and_apply(&effect)?;
if ctrl.config.brightness == LedBrightness::Off {
ctrl.config.brightness = LedBrightness::Med;
}
@@ -296,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,6 +5,7 @@ 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;
@@ -94,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()?;
@@ -132,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();

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

@@ -2,10 +2,11 @@ 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;
@@ -39,8 +40,9 @@ pub struct CtrlSlash {
impl CtrlSlash {
#[inline]
pub fn new() -> Result<CtrlSlash, RogError> {
let slash_type = get_slash_type()?;
if matches!(slash_type, SlashType::Unknown | SlashType::Unsupported) {
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));
}
@@ -51,7 +53,7 @@ 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 {

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

@@ -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,7 +21,7 @@
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],
@@ -30,7 +30,7 @@
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],
@@ -39,7 +39,7 @@
device_name: "FX506",
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],
@@ -48,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],
@@ -57,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],
@@ -66,25 +75,16 @@
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",
product_id: "",
layout_name: "g512",
basic_modes: [Static, Breathe, Strobe, Rainbow, Pulse],
basic_zones: [Key1, Key2, Key3, Key4],
advanced_type: None,
power_zones: [Keyboard],
),
(
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, Lightbar],
@@ -93,7 +93,7 @@
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],
@@ -101,89 +101,44 @@
(
device_name: "G513Q",
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: "G513QE",
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],
power_zones: [Keyboard, Lightbar],
),
(
device_name: "G513QY",
device_name: "G513QR",
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: "G513R",
product_id: "",
layout_name: "g513i-per-key",
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: "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: "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, Lightbar],
),
(
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: "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],
@@ -192,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],
@@ -201,7 +156,7 @@
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],
@@ -210,16 +165,16 @@
device_name: "G533Q",
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],
@@ -228,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],
@@ -246,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],
@@ -255,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],
@@ -264,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],
@@ -273,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],
@@ -318,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],
@@ -327,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],
@@ -336,7 +327,7 @@
device_name: "G713RW",
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, BarLeft, BarRight],
advanced_type: None,
power_zones: [Keyboard, Lightbar],
@@ -345,25 +336,16 @@
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],
@@ -372,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],
@@ -381,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],
@@ -390,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_modes: [Static, Breathe, RainbowCycle, RainbowWave, Star, Rain, Highlight, Laser, Ripple, Pulse, Comet, Flash],
basic_zones: [],
advanced_type: PerKey,
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],
@@ -408,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],
@@ -417,7 +399,7 @@
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],
@@ -426,7 +408,7 @@
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],
@@ -435,11 +417,20 @@
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_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: "",
@@ -453,7 +444,16 @@
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: "GA402NU-0002",
product_id: "",
layout_name: "ga401q",
basic_modes: [Static, Breathe, Pulse],
basic_zones: [],
advanced_type: None,
power_zones: [Keyboard],
@@ -462,7 +462,7 @@
device_name: "GA402R",
product_id: "",
layout_name: "ga401q",
basic_modes: [Static, Breathe, Pulse, Rainbow],
basic_modes: [Static, Breathe, RainbowCycle, RainbowWave, Pulse],
basic_zones: [],
advanced_type: None,
power_zones: [Keyboard],
@@ -471,16 +471,16 @@
device_name: "GA402X",
product_id: "",
layout_name: "ga401q",
basic_modes: [Static, Breathe, Pulse, Rainbow],
basic_modes: [Static, Breathe, RainbowCycle, RainbowWave, Pulse],
basic_zones: [],
advanced_type: None,
power_zones: [Keyboard],
),
(
device_name: "GA402XV",
device_name: "GA402XV-NC012",
product_id: "",
layout_name: "ga401q",
basic_modes: [Static, Breathe, Strobe, Comet],
basic_modes: [Static, Breathe, Pulse],
basic_zones: [],
advanced_type: None,
power_zones: [Keyboard],
@@ -498,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],
@@ -516,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],
@@ -525,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],
@@ -534,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],
@@ -543,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],
@@ -552,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],
@@ -561,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],
@@ -570,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],
@@ -579,43 +579,25 @@
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: "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],
@@ -624,7 +606,7 @@
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],
@@ -633,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],
@@ -642,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],
@@ -651,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],
@@ -687,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],
@@ -705,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],
@@ -714,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],
@@ -723,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],
@@ -732,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],
@@ -741,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],
@@ -750,7 +732,7 @@
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],
@@ -759,7 +741,7 @@
device_name: "GX650R",
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],
@@ -768,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],
@@ -777,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],
@@ -800,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",
@@ -831,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

@@ -2,7 +2,7 @@ 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};
@@ -70,11 +70,9 @@ impl LedSupportData {
// 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");
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
@@ -91,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);
@@ -99,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
@@ -161,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;
@@ -202,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();
@@ -224,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,
@@ -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

@@ -102,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
@@ -110,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
@@ -187,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))
@@ -217,8 +223,13 @@ 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::LaptopPost2021 | AuraDeviceType::Ally => self.new_to_bytes(),
AuraDeviceType::LaptopPre2021 => {
if self.states.len() == 1 {
self.states

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,
}
}
@@ -128,5 +134,7 @@ pub enum PowerZones {
RearGlow = 4,
/// Exists for the older 0x1866 models
KeyboardAndLightbar = 5,
/// Ally specific for creating correct packet
Ally = 6,
None = 255,
}

View File

@@ -12,9 +12,13 @@ edition.workspace = true
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" }
@@ -25,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
@@ -34,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,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

@@ -25,6 +25,9 @@ use tokio::runtime::Runtime;
#[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)?;
@@ -71,13 +74,7 @@ async fn main() -> Result<()> {
.format_timestamp(None)
.init();
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();

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;
@@ -45,6 +45,52 @@ impl Default for EnabledNotifications {
}
}
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,
@@ -100,23 +146,24 @@ pub fn start_notifications(
}
});
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 {
@@ -138,68 +185,25 @@ pub fn start_notifications(
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
rt.spawn_blocking(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;
}
std::thread::sleep(Duration::from_millis(500));
}
});
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() {
@@ -218,7 +222,36 @@ pub fn start_notifications(
.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(vec![blocking])
@@ -241,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",
@@ -263,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<()> {
@@ -274,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 || {
@@ -155,27 +169,30 @@ pub fn init_tray(_supported_properties: Vec<Properties>, config: Arc<Mutex<Confi
gpu_integrated,
});
let mut has_supergfx = true;
let mut has_supergfx = false;
let conn = zbus::blocking::Connection::system().unwrap();
if let Ok(gfx_proxy) = GfxProxy::new(&conn) {
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.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;
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;
let dev = find_dgpu();
loop {
sleep(Duration::from_millis(1000));
if let Ok(lock) = config.try_lock() {
@@ -187,11 +204,23 @@ pub fn init_tray(_supported_properties: Vec<Properties>, config: Arc<Mutex<Confi
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);
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

@@ -65,6 +65,7 @@ impl From<PowerZones> for SlintPowerZones {
PowerZones::Lid => SlintPowerZones::Lid,
PowerZones::RearGlow => SlintPowerZones::RearGlow,
PowerZones::KeyboardAndLightbar => SlintPowerZones::KeyboardAndLightbar,
PowerZones::Ally => SlintPowerZones::Ally,
PowerZones::None => SlintPowerZones::Keyboard,
}
}
@@ -79,6 +80,7 @@ impl From<SlintPowerZones> for PowerZones {
SlintPowerZones::Lid => PowerZones::Lid,
SlintPowerZones::RearGlow => PowerZones::RearGlow,
SlintPowerZones::KeyboardAndLightbar => PowerZones::KeyboardAndLightbar,
SlintPowerZones::Ally => PowerZones::Ally,
}
}
}
@@ -151,6 +153,7 @@ impl From<SlintDeviceType> for AuraDeviceType {
SlintDeviceType::Tuf => Self::LaptopTuf,
SlintDeviceType::ScsiExtDisk => Self::ScsiExtDisk,
SlintDeviceType::Unknown => Self::Unknown,
SlintDeviceType::Ally => Self::Ally,
}
}
}
@@ -163,6 +166,7 @@ impl From<AuraDeviceType> for SlintDeviceType {
AuraDeviceType::LaptopTuf => SlintDeviceType::Tuf,
AuraDeviceType::ScsiExtDisk => SlintDeviceType::ScsiExtDisk,
AuraDeviceType::Unknown => SlintDeviceType::Unknown,
AuraDeviceType::Ally => SlintDeviceType::Ally,
}
}
}

View File

@@ -1,6 +1,6 @@
use std::sync::{Arc, Mutex};
use log::{error, info};
use log::{debug, error, info};
use rog_aura::keyboard::LaptopAuraPower;
use rog_aura::{AuraDeviceType, PowerZones};
use rog_dbus::zbus_aura::AuraProxy;
@@ -76,7 +76,7 @@ pub fn setup_aura_page(ui: &MainWindow, _states: Arc<Mutex<Config>>) {
tokio::spawn(async move {
let Ok(aura) = find_aura_iface().await else {
info!("This device appears to have no aura interfaces");
return;
return Ok::<(), zbus::Error>(());
};
set_ui_props_async!(handle, aura, AuraPageData, brightness);
@@ -226,5 +226,7 @@ pub fn setup_aura_page(ui: &MainWindow, _states: Arc<Mutex<Config>>) {
}
}
});
debug!("Aura setup tasks complete");
Ok(())
});
}

View File

@@ -2,7 +2,7 @@
msgid ""
msgstr ""
"Project-Id-Version: PACKAGE VERSION\n"
"POT-Creation-Date: 2024-05-16 21:41+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,61 +137,6 @@ msgctxt "PageAnime"
msgid "Off when on battery"
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 ""
#: 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 ""
#: 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/app_settings.slint:26
msgctxt "PageAppSettings"
msgid "Run in background after closing"
@@ -257,6 +202,61 @@ 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 ""
#: 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 ""
#: 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"
@@ -334,37 +334,37 @@ msgstr ""
#: 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:198
msgctxt "ppt_pl2_sppt"
msgid "ppt_pl2_sppt"
msgid "PL2, turbo power limit"
msgstr ""
#: 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:218
msgctxt "ppt_apu_sppt"
msgid "ppt_apu_sppt"
msgid "SPPT, APU slow power limit"
msgstr ""
#: 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:238
msgctxt "nv_dynamic_boost"
msgid "nv_dynamic_boost"
msgid "dGPU boost overclock"
msgstr ""
#: rog-control-center/ui/pages/system.slint:248
msgctxt "nv_temp_target"
msgid "nv_temp_target"
msgid "dGPU temperature max"
msgstr ""
#: rog-control-center/ui/pages/system.slint:294
@@ -412,192 +412,197 @@ msgctxt "PageSystem"
msgid "Throttle Policy on AC"
msgstr ""
#: rog-control-center/ui/types/aura_types.slint:49
#: rog-control-center/ui/types/aura_types.slint:51
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
#: 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:51 rog-control-center/ui/types/aura_types.slint:60
#: 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:52
#: rog-control-center/ui/types/aura_types.slint:54
msgctxt "Aura power zone"
msgid "Lid"
msgstr ""
#: rog-control-center/ui/types/aura_types.slint:53
#: 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:54 rog-control-center/ui/types/aura_types.slint:61
#: 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: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"
#: 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:68
msgctxt "Aura brightness"
msgid "Low"
msgstr ""
#: rog-control-center/ui/types/aura_types.slint:69
msgctxt "Aura brightness"
msgid "Med"
msgstr ""
#: rog-control-center/ui/types/aura_types.slint:70
msgctxt "Aura brightness"
msgid "High"
msgstr ""
#: rog-control-center/ui/types/aura_types.slint:72 rog-control-center/ui/types/aura_types.slint:87
#: 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:73 rog-control-center/ui/types/aura_types.slint:88
#: 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:74 rog-control-center/ui/types/aura_types.slint:89
#: 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:75
#: rog-control-center/ui/types/aura_types.slint:78
msgctxt "Basic aura mode"
msgid "Rainbow"
msgstr ""
#: rog-control-center/ui/types/aura_types.slint:76
#: rog-control-center/ui/types/aura_types.slint:79
msgctxt "Basic aura mode"
msgid "Star"
msgstr ""
#: rog-control-center/ui/types/aura_types.slint:77
#: rog-control-center/ui/types/aura_types.slint:80
msgctxt "Basic aura mode"
msgid "Rain"
msgstr ""
#: rog-control-center/ui/types/aura_types.slint:78
#: rog-control-center/ui/types/aura_types.slint:81
msgctxt "Basic aura mode"
msgid "Highlight"
msgstr ""
#: rog-control-center/ui/types/aura_types.slint:79
#: rog-control-center/ui/types/aura_types.slint:82
msgctxt "Basic aura mode"
msgid "Laser"
msgstr ""
#: rog-control-center/ui/types/aura_types.slint:80
#: rog-control-center/ui/types/aura_types.slint:83
msgctxt "Basic aura mode"
msgid "Ripple"
msgstr ""
#: rog-control-center/ui/types/aura_types.slint:81
#: rog-control-center/ui/types/aura_types.slint:84
msgctxt "Basic aura mode"
msgid "Nothing"
msgstr ""
#: rog-control-center/ui/types/aura_types.slint:82
#: rog-control-center/ui/types/aura_types.slint:85
msgctxt "Basic aura mode"
msgid "Pulse"
msgstr ""
#: rog-control-center/ui/types/aura_types.slint:83
#: rog-control-center/ui/types/aura_types.slint:86
msgctxt "Basic aura mode"
msgid "Comet"
msgstr ""
#: rog-control-center/ui/types/aura_types.slint:84
#: rog-control-center/ui/types/aura_types.slint:87
msgctxt "Basic aura mode"
msgid "Flash"
msgstr ""
#: rog-control-center/ui/types/aura_types.slint:96
#: rog-control-center/ui/types/aura_types.slint:99
msgctxt "Aura zone"
msgid "None"
msgstr ""
#: rog-control-center/ui/types/aura_types.slint:97
#: rog-control-center/ui/types/aura_types.slint:100
msgctxt "Aura zone"
msgid "Key1"
msgstr ""
#: rog-control-center/ui/types/aura_types.slint:98
#: rog-control-center/ui/types/aura_types.slint:101
msgctxt "Aura zone"
msgid "Key2"
msgstr ""
#: rog-control-center/ui/types/aura_types.slint:99
#: rog-control-center/ui/types/aura_types.slint:102
msgctxt "Aura zone"
msgid "Key3"
msgstr ""
#: rog-control-center/ui/types/aura_types.slint:100
#: rog-control-center/ui/types/aura_types.slint:103
msgctxt "Aura zone"
msgid "Key4"
msgstr ""
#: rog-control-center/ui/types/aura_types.slint:101
#: rog-control-center/ui/types/aura_types.slint:104
msgctxt "Aura zone"
msgid "Logo"
msgstr ""
#: rog-control-center/ui/types/aura_types.slint:102
#: rog-control-center/ui/types/aura_types.slint:105
msgctxt "Aura zone"
msgid "Lightbar Left"
msgstr ""
#: rog-control-center/ui/types/aura_types.slint:103
#: rog-control-center/ui/types/aura_types.slint:106
msgctxt "Aura zone"
msgid "Lightbar Right"
msgstr ""
#: rog-control-center/ui/types/aura_types.slint:107
#: rog-control-center/ui/types/aura_types.slint:110
msgctxt "Aura direction"
msgid "Right"
msgstr ""
#: rog-control-center/ui/types/aura_types.slint:108
#: rog-control-center/ui/types/aura_types.slint:111
msgctxt "Aura direction"
msgid "Left"
msgstr ""
#: rog-control-center/ui/types/aura_types.slint:109
#: rog-control-center/ui/types/aura_types.slint:112
msgctxt "Aura direction"
msgid "Up"
msgstr ""
#: rog-control-center/ui/types/aura_types.slint:110
#: rog-control-center/ui/types/aura_types.slint:113
msgctxt "Aura direction"
msgid "Down"
msgstr ""
#: rog-control-center/ui/types/aura_types.slint:114
#: rog-control-center/ui/types/aura_types.slint:117
msgctxt "Aura speed"
msgid "Low"
msgstr ""
#: rog-control-center/ui/types/aura_types.slint:115
#: rog-control-center/ui/types/aura_types.slint:118
msgctxt "Aura speed"
msgid "Medium"
msgstr ""
#: rog-control-center/ui/types/aura_types.slint:116
#: rog-control-center/ui/types/aura_types.slint:119
msgctxt "Aura speed"
msgid "High"
msgstr ""
@@ -679,6 +684,6 @@ msgstr ""
#: rog-control-center/ui/main_window.slint:70
msgctxt "MainWindow"
msgid "Quit"
msgid "Quit App"
msgstr ""

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

@@ -67,7 +67,7 @@ export component MainWindow inherits Window {
Text {
vertical-alignment: center;
horizontal-alignment: center;
text: @tr("Quit");
text: @tr("Quit App");
}
TouchArea {

View File

@@ -185,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;
@@ -195,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;
@@ -205,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;
@@ -215,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;
@@ -225,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;
@@ -235,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;
@@ -245,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;

View File

@@ -4,6 +4,7 @@ export enum AuraDevType {
Tuf,
ScsiExtDisk,
Unknown,
Ally,
}
export struct AuraEffect {
@@ -28,6 +29,7 @@ export enum PowerZones {
Lid,
RearGlow,
KeyboardAndLightbar,
Ally,
}
export struct AuraPowerState {
@@ -52,6 +54,7 @@ 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

View File

@@ -17,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 {

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

@@ -43,23 +43,17 @@ impl KeyboardBacklight {
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(
"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

@@ -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(),
};