Compare commits

...

33 Commits

Author SHA1 Message Date
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
Luke D. Jones 1cba693469 Update G713 aura spec 2024-06-07 09:22:59 +12:00
Luke D. Jones 166149b351 Remove a debug statement 2024-05-26 21:21:54 +12:00
Luke Jones 1b11b6d8fb Merge branch 'main' into 'main'
Resolve "AniMe Broken on GA402XZ"

Closes #512

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

Closes #480

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

Closes #505

See merge request asus-linux/asusctl!188
2024-05-17 10:09:12 +00:00
Luke D. Jones 1353fe3fdb Rename and recreate the default Anime config if cache setup fails 2024-05-17 21:54:37 +12:00
Luke D. Jones 770bd12a5c Add G513RS to laptop DB 2024-05-17 18:56:51 +12:00
Luke Jones af2f5592f0 Merge pull request #29 from chrnin/fix/udev-for-zenbook
add Zenbook to asusd.rules
2024-05-17 11:37:36 +12:00
Luke D. Jones 9686c41ac4 Fix pipeline 2024-05-17 11:35:36 +12:00
Luke D. Jones fbdb0514d2 Prep new release 2024-05-17 10:18:54 +12:00
Luke D. Jones 1f5650d26b Add tests, G513L laptop 2024-05-17 09:41:40 +12:00
Luke D. Jones 14db97c476 Update G513 model DB entry 2024-05-15 10:04:02 +12:00
Christophe Ninucci 7122fbaca8 add Zenbook to asusd.rules 2024-04-14 11:30:39 +02:00
61 changed files with 1574 additions and 917 deletions
+2 -2
View File
@@ -12,7 +12,7 @@ echo '+cargo clippy --all -- -D warnings'
cargo clippy --all -- -D warnings cargo clippy --all -- -D warnings
echo '+cargo test --all' echo '+cargo test --all'
cargo test --all cargo test --all -- --test-threads=1
echo '+cargo cranky' echo '+cargo cranky'
cargo cranky cargo cranky
+1 -1
View File
@@ -52,7 +52,7 @@ test:
<<: *rust_cache <<: *rust_cache
script: script:
- mkdir -p .git/hooks > /dev/null - mkdir -p .git/hooks > /dev/null
- cargo test --all - cargo test --all -- --test-threads=1
release: release:
only: only:
+51 -5
View File
@@ -1,12 +1,58 @@
# Changelog # 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] ## [Unreleased]
## [v6.0.11]
### Changed
- Renamed `Strobe` effect to `RainbowCycle` to prevent confusion over what it is
- Ranamed `Rainbow` effect to `RainbowWave`
- Cleaned up serde crate deps
- Fixed AniMe on GA402XZ
- Update some of the G713 device aura features
- Update some of the G513 device aura features
## [v6.0.10]
### Added
- Add the GA401I model to aura_support.
### Changed
- Aura support return a default aura definition instead of nothing
- Minor updates in aura controller to ensure configs are updated if the support file changes
- Don't panic if -ENODEV on fan_curve enable
- Adjust the G513Q support to match what is on the asus website.
- Adjust init sequence of anime to prevent accidental use of Slash as Anime
- Enable notifs and tray icon without supergfx
## [v6.0.9]
### Added
- Add G513RS to laptop DB.
- Add G512LI to laptop DB.
### Changed
- Rename and recreate the default Anime config if cache setup fails
### Fixed
- Nuke the issue of GUI taking 100% of a CPU core
## [v6.0.8]
### Added
- Add G512L laptop DB entry
### Changed
- Add more tests to verify things
### Fix
- asusctl incorrectly assumes fan-curves unsupported. Now fixed.
- try to fix ROGCC using CPU time.
## [v6.0.7] ## [v6.0.7]
### Changed ### Changed
Generated
+765 -374
View File
File diff suppressed because it is too large Load Diff
+5 -8
View File
@@ -1,5 +1,5 @@
[workspace.package] [workspace.package]
version = "6.0.7" version = "6.0.11"
rust-version = "1.77" rust-version = "1.77"
license = "MPL-2.0" license = "MPL-2.0"
readme = "README.md" readme = "README.md"
@@ -47,11 +47,10 @@ dirs = "^4.0"
smol = "^1.3" smol = "^1.3"
mio = "0.8.11" mio = "0.8.11"
zbus = "4.1" zbus = "4.2"
logind-zbus = { version = "4.0.2" } #, default-features = false, features = ["non_blocking"] } logind-zbus = { version = "4.0.3" } #, default-features = false, features = ["non_blocking"] }
serde = "^1.0" serde = { version = "^1.0", features = ["serde_derive"] }
serde_derive = "^1.0"
ron = "*" ron = "*"
typeshare = "1.0.0" typeshare = "1.0.0"
@@ -71,9 +70,7 @@ gif = "^0.12.0"
versions = "6.2" versions = "6.2"
notify-rust = { git = "https://github.com/flukejones/notify-rust.git", rev = "54176413b81189a3e4edbdc20a0b4f7e2e35c063", default-features = false, features = [ notify-rust = { version = "4.11.0", features = ["z", "async"] }
"z",
] }
[profile.release] [profile.release]
# thin = 57s, asusd = 9.0M # thin = 57s, asusd = 9.0M
+1 -1
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 = install
INSTALL_PROGRAM = ${INSTALL} -D -m 0755 INSTALL_PROGRAM = ${INSTALL} -D -m 0755
+2 -2
View File
@@ -3,7 +3,7 @@ use std::error::Error;
use std::path::Path; use std::path::Path;
use std::process::exit; 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_anime::{AnimeDiagonal, AnimeType};
use rog_dbus::zbus_anime::AnimeProxyBlocking; use rog_dbus::zbus_anime::AnimeProxyBlocking;
use zbus::blocking::Connection; use zbus::blocking::Connection;
@@ -26,7 +26,7 @@ fn main() -> Result<(), Box<dyn Error>> {
AnimeType::GA401, AnimeType::GA401,
)?; )?;
let anime_type = get_anime_type()?; let anime_type = get_maybe_anime_type()?;
proxy.write(matrix.into_data_buffer(anime_type)?).unwrap(); proxy.write(matrix.into_data_buffer(anime_type)?).unwrap();
+2 -2
View File
@@ -1,7 +1,7 @@
use std::thread::sleep; use std::thread::sleep;
use std::time::Duration; 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_anime::{AnimeDiagonal, AnimeType};
use rog_dbus::zbus_anime::AnimeProxyBlocking; use rog_dbus::zbus_anime::AnimeProxyBlocking;
use zbus::blocking::Connection; 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 proxy
.write(matrix.into_data_buffer(anime_type).unwrap()) .write(matrix.into_data_buffer(anime_type).unwrap())
.unwrap(); .unwrap();
+2 -2
View File
@@ -2,7 +2,7 @@ use std::env;
use std::path::Path; use std::path::Path;
use std::thread::sleep; 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_anime::{ActionData, ActionLoader, Sequences};
use rog_dbus::zbus_anime::AnimeProxyBlocking; use rog_dbus::zbus_anime::AnimeProxyBlocking;
use zbus::blocking::Connection; use zbus::blocking::Connection;
@@ -19,7 +19,7 @@ fn main() {
let path = Path::new(&args[1]); let path = Path::new(&args[1]);
let brightness = args[2].parse::<f32>().unwrap(); 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); let mut seq = Sequences::new(anime_type);
seq.insert( seq.insert(
0, 0,
+2 -2
View File
@@ -1,6 +1,6 @@
use std::convert::TryFrom; 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_anime::{AnimeDataBuffer, AnimeGrid};
use rog_dbus::zbus_anime::AnimeProxyBlocking; use rog_dbus::zbus_anime::AnimeProxyBlocking;
use zbus::blocking::Connection; use zbus::blocking::Connection;
@@ -14,7 +14,7 @@ fn main() {
let conn = Connection::system().unwrap(); let conn = Connection::system().unwrap();
let proxy = AnimeProxyBlocking::new(&conn).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 mut matrix = AnimeGrid::new(anime_type);
let tmp = matrix.get_mut(); let tmp = matrix.get_mut();
+2 -2
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_anime::AnimeDataBuffer;
use rog_dbus::zbus_anime::AnimeProxyBlocking; use rog_dbus::zbus_anime::AnimeProxyBlocking;
use zbus::blocking::Connection; use zbus::blocking::Connection;
@@ -9,7 +9,7 @@ use zbus::blocking::Connection;
fn main() { fn main() {
let conn = Connection::system().unwrap(); let conn = Connection::system().unwrap();
let proxy = AnimeProxyBlocking::new(&conn).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); let mut matrix = AnimeDataBuffer::new(anime_type);
matrix.data_mut()[1] = 100; // start = 1 matrix.data_mut()[1] = 100; // start = 1
for n in matrix.data_mut()[2..32].iter_mut() { for n in matrix.data_mut()[2..32].iter_mut() {
+2 -2
View File
@@ -4,7 +4,7 @@ use std::error::Error;
use std::path::Path; use std::path::Path;
use std::process::exit; 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_anime::{AnimeDataBuffer, AnimeImage, Vec2};
use rog_dbus::zbus_anime::AnimeProxyBlocking; use rog_dbus::zbus_anime::AnimeProxyBlocking;
use zbus::blocking::Connection; use zbus::blocking::Connection;
@@ -20,7 +20,7 @@ fn main() -> Result<(), Box<dyn Error>> {
exit(-1); exit(-1);
} }
let anime_type = get_anime_type()?; let anime_type = get_maybe_anime_type()?;
let matrix = AnimeImage::from_png( let matrix = AnimeImage::from_png(
Path::new(&args[1]), Path::new(&args[1]),
args[2].parse::<f32>().unwrap(), args[2].parse::<f32>().unwrap(),
+2 -2
View File
@@ -7,7 +7,7 @@ use std::process::exit;
use std::thread::sleep; use std::thread::sleep;
use std::time::Duration; 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_anime::{AnimeDataBuffer, AnimeImage, Vec2};
use rog_dbus::zbus_anime::AnimeProxyBlocking; use rog_dbus::zbus_anime::AnimeProxyBlocking;
use zbus::blocking::Connection; use zbus::blocking::Connection;
@@ -23,7 +23,7 @@ fn main() -> Result<(), Box<dyn Error>> {
exit(-1); exit(-1);
} }
let anime_type = get_anime_type()?; let anime_type = get_maybe_anime_type()?;
let mut matrix = AnimeImage::from_png( let mut matrix = AnimeImage::from_png(
Path::new(&args[1]), Path::new(&args[1]),
args[2].parse::<f32>().unwrap(), args[2].parse::<f32>().unwrap(),
+6 -6
View File
@@ -219,9 +219,9 @@ pub enum SetAuraBuiltin {
#[options(help = "pulse between one or two colours")] #[options(help = "pulse between one or two colours")]
Breathe(TwoColourSpeed), // 1 Breathe(TwoColourSpeed), // 1
#[options(help = "strobe through all colours")] #[options(help = "strobe through all colours")]
Strobe(SingleSpeed), // 2 RainbowCycle(SingleSpeed), // 2
#[options(help = "rainbow cycling in one of four directions")] #[options(help = "rainbow cycling in one of four directions")]
Rainbow(SingleSpeedDirection), // 3 RainbowWave(SingleSpeedDirection), // 3
#[options(help = "rain pattern mimicking raindrops")] #[options(help = "rain pattern mimicking raindrops")]
Stars(TwoColourSpeed), // 4 Stars(TwoColourSpeed), // 4
#[options(help = "rain pattern of three preset colours")] #[options(help = "rain pattern of three preset colours")]
@@ -312,14 +312,14 @@ impl From<&SetAuraBuiltin> for AuraEffect {
data.mode = AuraModeNum::Breathe; data.mode = AuraModeNum::Breathe;
data data
} }
SetAuraBuiltin::Strobe(x) => { SetAuraBuiltin::RainbowCycle(x) => {
let mut data: AuraEffect = x.into(); let mut data: AuraEffect = x.into();
data.mode = AuraModeNum::Strobe; data.mode = AuraModeNum::RainbowCycle;
data data
} }
SetAuraBuiltin::Rainbow(x) => { SetAuraBuiltin::RainbowWave(x) => {
let mut data: AuraEffect = x.into(); let mut data: AuraEffect = x.into();
data.mode = AuraModeNum::Rainbow; data.mode = AuraModeNum::RainbowWave;
data data
} }
SetAuraBuiltin::Stars(x) => { SetAuraBuiltin::Stars(x) => {
+10 -11
View File
@@ -5,12 +5,11 @@ use std::process::Command;
use std::thread::sleep; use std::thread::sleep;
use anime_cli::{AnimeActions, AnimeCommand}; use anime_cli::{AnimeActions, AnimeCommand};
use asusd::ctrl_fancurves::FAN_CURVE_ZBUS_NAME;
use aura_cli::{LedPowerCommand1, LedPowerCommand2}; use aura_cli::{LedPowerCommand1, LedPowerCommand2};
use dmi_id::DMIID; use dmi_id::DMIID;
use fan_curve_cli::FanCurveCommand; use fan_curve_cli::FanCurveCommand;
use gumdrop::{Opt, Options}; 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_anime::{AnimTime, AnimeDataBuffer, AnimeDiagonal, AnimeGif, AnimeImage, AnimeType, Vec2};
use rog_aura::keyboard::{AuraPowerState, LaptopAuraPower}; use rog_aura::keyboard::{AuraPowerState, LaptopAuraPower};
use rog_aura::{self, AuraDeviceType, AuraEffect, PowerZones}; use rog_aura::{self, AuraDeviceType, AuraEffect, PowerZones};
@@ -37,6 +36,8 @@ mod fan_curve_cli;
mod slash_cli; mod slash_cli;
fn main() { fn main() {
let self_version = env!("CARGO_PKG_VERSION");
println!("Starting version {self_version}");
let args: Vec<String> = args().skip(1).collect(); let args: Vec<String> = args().skip(1).collect();
let missing_argument_k = gumdrop::Error::missing_argument(Opt::Short('k')); let missing_argument_k = gumdrop::Error::missing_argument(Opt::Short('k'));
@@ -58,7 +59,6 @@ fn main() {
println!("\nError: {e}\n"); println!("\nError: {e}\n");
print_info(); print_info();
}) { }) {
let self_version = env!("CARGO_PKG_VERSION");
let asusd_version = platform_proxy.version().unwrap(); let asusd_version = platform_proxy.version().unwrap();
if asusd_version != self_version { if asusd_version != self_version {
println!("Version mismatch: asusctl = {self_version}, asusd = {asusd_version}"); println!("Version mismatch: asusctl = {self_version}, asusd = {asusd_version}");
@@ -172,7 +172,7 @@ fn do_parsed(
handle_throttle_profile(&conn, supported_properties, cmd)? handle_throttle_profile(&conn, supported_properties, cmd)?
} }
Some(CliCommand::FanCurve(cmd)) => { Some(CliCommand::FanCurve(cmd)) => {
handle_fan_curve(&conn, supported_interfaces, cmd)?; handle_fan_curve(&conn, cmd)?;
} }
Some(CliCommand::Graphics(_)) => do_gfx(), Some(CliCommand::Graphics(_)) => do_gfx(),
Some(CliCommand::Anime(cmd)) => handle_anime(&conn, cmd)?, Some(CliCommand::Anime(cmd)) => handle_anime(&conn, cmd)?,
@@ -365,8 +365,8 @@ fn handle_anime(conn: &Connection, cmd: &AnimeCommand) -> Result<(), Box<dyn std
println!("Did Alice _really_ make it back from Wonderland?"); println!("Did Alice _really_ make it back from Wonderland?");
} }
let mut anime_type = get_anime_type()?; let mut anime_type = get_maybe_anime_type()?;
if let AnimeType::Unknown = anime_type { if let AnimeType::Unsupported = anime_type {
if let Some(model) = cmd.override_type { if let Some(model) = cmd.override_type {
anime_type = model; anime_type = model;
} }
@@ -807,13 +807,13 @@ fn handle_throttle_profile(
fn handle_fan_curve( fn handle_fan_curve(
conn: &Connection, conn: &Connection,
supported: &[String],
cmd: &FanCurveCommand, cmd: &FanCurveCommand,
) -> Result<(), Box<dyn std::error::Error>> { ) -> Result<(), Box<dyn std::error::Error>> {
if !supported.contains(&FAN_CURVE_ZBUS_NAME.to_string()) { let Ok(fan_proxy) = FanCurvesProxyBlocking::new(conn).map_err(|e| {
println!("Fan-curves not supported by either this kernel or by the laptop."); println!("Fan-curves not supported by either this kernel or by the laptop: {e:?}");
}) else {
return Err(ProfileError::NotSupported.into()); return Err(ProfileError::NotSupported.into());
} };
if !cmd.get_enabled && !cmd.default && cmd.mod_profile.is_none() { if !cmd.get_enabled && !cmd.default && cmd.mod_profile.is_none() {
if !cmd.help { if !cmd.help {
@@ -838,7 +838,6 @@ fn handle_fan_curve(
} }
let plat_proxy = PlatformProxyBlocking::new(conn)?; let plat_proxy = PlatformProxyBlocking::new(conn)?;
let fan_proxy = FanCurvesProxyBlocking::new(conn)?;
if cmd.get_enabled { if cmd.get_enabled {
let profile = plat_proxy.throttle_thermal_policy()?; let profile = plat_proxy.throttle_thermal_policy()?;
let curves = fan_proxy.fan_curve_data(profile)?; let curves = fan_proxy.fan_curve_data(profile)?;
-1
View File
@@ -22,7 +22,6 @@ smol.workspace = true
# serialisation # serialisation
serde.workspace = true serde.workspace = true
serde_derive.workspace = true
ron.workspace = true ron.workspace = true
rog_anime = { path = "../rog-anime" } rog_anime = { path = "../rog-anime" }
+1 -1
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::effects::{AdvancedEffects as AuraSequences, Breathe, DoomFlicker, Effect, Static};
use rog_aura::keyboard::LedCode; use rog_aura::keyboard::LedCode;
use rog_aura::{Colour, Speed}; use rog_aura::{Colour, Speed};
use serde_derive::{Deserialize, Serialize}; use serde::{Deserialize, Serialize};
use crate::error::Error; use crate::error::Error;
+1 -1
View File
@@ -9,7 +9,7 @@ use rog_anime::error::AnimeError;
use rog_anime::{ActionData, ActionLoader, AnimTime, Fade, Sequences, Vec2}; use rog_anime::{ActionData, ActionLoader, AnimTime, Fade, Sequences, Vec2};
use rog_dbus::zbus_anime::AnimeProxyBlocking; use rog_dbus::zbus_anime::AnimeProxyBlocking;
use ron::ser::PrettyConfig; use ron::ser::PrettyConfig;
use serde_derive::{Deserialize, Serialize}; use serde::{Deserialize, Serialize};
use zbus::interface; use zbus::interface;
use zbus::zvariant::{ObjectPath, Type}; use zbus::zvariant::{ObjectPath, Type};
+2 -2
View File
@@ -6,7 +6,7 @@ use std::sync::{Arc, Mutex};
use asusd_user::config::*; use asusd_user::config::*;
use asusd_user::ctrl_anime::{CtrlAnime, CtrlAnimeInner}; use asusd_user::ctrl_anime::{CtrlAnime, CtrlAnimeInner};
use config_traits::{StdConfig, StdConfigLoad}; 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::aura_detection::LedSupportData;
use rog_aura::keyboard::KeyLayout; use rog_aura::keyboard::KeyLayout;
use rog_dbus::zbus_anime::AnimeProxyBlocking; 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 // Set up the anime data and run loop/thread
if supported.contains(&"org.asuslinux.Anime".to_string()) { if supported.contains(&"org.asuslinux.Anime".to_string()) {
if let Some(cfg) = config.active_anime { 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_config = ConfigAnime::new().set_name(cfg).load();
let anime = anime_config.create(anime_type)?; let anime = anime_config.create(anime_type)?;
let anime_config = Arc::new(Mutex::new(anime_config)); let anime_config = Arc::new(Mutex::new(anime_config));
-1
View File
@@ -38,7 +38,6 @@ logind-zbus.workspace = true
# serialisation # serialisation
serde.workspace = true serde.workspace = true
serde_derive.workspace = true
concat-idents.workspace = true concat-idents.workspace = true
+1 -1
View File
@@ -1,7 +1,7 @@
use config_traits::{StdConfig, StdConfigLoad1}; use config_traits::{StdConfig, StdConfigLoad1};
use rog_platform::cpu::CPUEPP; use rog_platform::cpu::CPUEPP;
use rog_platform::platform::ThrottlePolicy; use rog_platform::platform::ThrottlePolicy;
use serde_derive::{Deserialize, Serialize}; use serde::{Deserialize, Serialize};
const CONFIG_FILE: &str = "asusd.ron"; const CONFIG_FILE: &str = "asusd.ron";
+3 -59
View File
@@ -1,69 +1,15 @@
use std::time::Duration; use std::time::Duration;
use config_traits::{StdConfig, StdConfigLoad2}; use config_traits::{StdConfig, StdConfigLoad};
use rog_anime::error::AnimeError; use rog_anime::error::AnimeError;
use rog_anime::usb::Brightness; use rog_anime::usb::Brightness;
use rog_anime::{ use rog_anime::{
ActionData, ActionLoader, AnimTime, Animations, AnimeType, DeviceState, Fade, Vec2, ActionData, ActionLoader, AnimTime, Animations, AnimeType, DeviceState, Fade, Vec2,
}; };
use serde_derive::{Deserialize, Serialize}; use serde::{Deserialize, Serialize};
const CONFIG_FILE: &str = "anime.ron"; 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)] #[derive(Deserialize, Serialize, Default)]
pub struct AnimeConfigCached { pub struct AnimeConfigCached {
pub system: Vec<ActionData>, pub system: Vec<ActionData>,
@@ -108,7 +54,6 @@ impl AnimeConfigCached {
/// Config for base system actions for the anime display /// Config for base system actions for the anime display
#[derive(Deserialize, Serialize, Debug, Clone)] #[derive(Deserialize, Serialize, Debug, Clone)]
pub struct AnimeConfig { pub struct AnimeConfig {
pub model_override: Option<AnimeType>,
pub system: Vec<ActionLoader>, pub system: Vec<ActionLoader>,
pub boot: Vec<ActionLoader>, pub boot: Vec<ActionLoader>,
pub wake: Vec<ActionLoader>, pub wake: Vec<ActionLoader>,
@@ -127,7 +72,6 @@ pub struct AnimeConfig {
impl Default for AnimeConfig { impl Default for AnimeConfig {
fn default() -> Self { fn default() -> Self {
AnimeConfig { AnimeConfig {
model_override: None,
system: Vec::new(), system: Vec::new(),
boot: Vec::new(), boot: Vec::new(),
wake: 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 { impl From<&AnimeConfig> for DeviceState {
fn from(config: &AnimeConfig) -> Self { fn from(config: &AnimeConfig) -> Self {
+15 -11
View File
@@ -8,11 +8,11 @@ use std::sync::Arc;
use std::thread::sleep; use std::thread::sleep;
use ::zbus::export::futures_util::lock::Mutex; use ::zbus::export::futures_util::lock::Mutex;
use config_traits::{StdConfig, StdConfigLoad2}; use config_traits::{StdConfig, StdConfigLoad};
use log::{error, info, warn}; use log::{error, info, warn};
use rog_anime::error::AnimeError; use rog_anime::error::AnimeError;
use rog_anime::usb::{ 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, pkt_set_enable_powersave_anim, pkts_for_init, Brightness,
}; };
use rog_anime::{ActionData, AnimeDataBuffer, AnimePacketType, AnimeType}; use rog_anime::{ActionData, AnimeDataBuffer, AnimePacketType, AnimeType};
@@ -64,6 +64,12 @@ pub struct CtrlAnime {
impl CtrlAnime { impl CtrlAnime {
#[inline] #[inline]
pub fn new() -> Result<CtrlAnime, RogError> { pub fn new() -> Result<CtrlAnime, RogError> {
let anime_type = get_maybe_anime_type()?;
if matches!(anime_type, AnimeType::Unsupported) {
info!("No Anime Matrix capable laptop found");
return Err(RogError::Anime(AnimeError::NoDevice));
}
let usb = USBRaw::new(0x193b).ok(); let usb = USBRaw::new(0x193b).ok();
let hid = HidRaw::new("193b").ok(); let hid = HidRaw::new("193b").ok();
let node = if usb.is_some() { let node = if usb.is_some() {
@@ -90,18 +96,16 @@ impl CtrlAnime {
// } // }
// } // }
let config = AnimeConfig::new().load(); let mut 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;
}
}
info!("Device has an AniMe Matrix display: {anime_type:?}"); info!("Device has an AniMe Matrix display: {anime_type:?}");
let mut cache = AnimeConfigCached::default(); 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 { let ctrl = CtrlAnime {
node, node,
+102 -2
View File
@@ -7,7 +7,9 @@ use rog_aura::keyboard::LaptopAuraPower;
use rog_aura::{ use rog_aura::{
AuraDeviceType, AuraEffect, AuraModeNum, AuraZone, Direction, LedBrightness, Speed, GRADIENT, 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)] #[derive(Deserialize, Serialize, Default, Debug, Clone)]
// #[serde(default)] // #[serde(default)]
@@ -130,16 +132,51 @@ impl AuraConfig {
} }
None 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)] #[cfg(test)]
mod tests { mod tests {
use rog_aura::{AuraEffect, AuraModeNum, AuraZone, Colour}; use rog_aura::keyboard::AuraPowerState;
use rog_aura::{
AuraEffect, AuraModeNum, AuraZone, Colour, Direction, LedBrightness, PowerZones, Speed,
};
use super::AuraConfig; use super::AuraConfig;
#[test] #[test]
fn set_multizone_4key_config() { fn set_multizone_4key_config() {
std::env::set_var("BOARD_NAME", "");
let mut config = AuraConfig::new("19b6"); let mut config = AuraConfig::new("19b6");
let effect = AuraEffect { let effect = AuraEffect {
@@ -230,6 +267,7 @@ mod tests {
#[test] #[test]
fn set_multizone_multimode_config() { fn set_multizone_multimode_config() {
std::env::set_var("BOARD_NAME", "");
let mut config = AuraConfig::new("19b6"); let mut config = AuraConfig::new("19b6");
let effect = AuraEffect { let effect = AuraEffect {
@@ -274,4 +312,66 @@ mod tests {
let sta = res.get(&AuraModeNum::Pulse).unwrap(); let sta = res.get(&AuraModeNum::Pulse).unwrap();
assert_eq!(sta.len(), 1); assert_eq!(sta.len(), 1);
} }
#[test]
fn verify_0x1866_g531i() {
std::env::set_var("BOARD_NAME", "G513I");
let mut config = AuraConfig::new("1866");
assert_eq!(config.brightness, LedBrightness::Med);
assert_eq!(config.builtins.len(), 5);
assert_eq!(
config.builtins.first_entry().unwrap().get(),
&AuraEffect {
mode: AuraModeNum::Static,
zone: AuraZone::None,
colour1: Colour { r: 166, g: 0, b: 0 },
colour2: Colour { r: 0, g: 0, b: 0 },
speed: Speed::Med,
direction: Direction::Right
}
);
assert_eq!(config.enabled.states.len(), 1);
assert_eq!(
config.enabled.states[0],
AuraPowerState {
zone: PowerZones::KeyboardAndLightbar,
boot: true,
awake: true,
sleep: true,
shutdown: true
}
);
}
#[test]
fn verify_0x19b6_g634j() {
std::env::set_var("BOARD_NAME", "G634J");
let mut config = AuraConfig::new("19b6");
assert_eq!(config.brightness, LedBrightness::Med);
assert_eq!(config.builtins.len(), 12);
assert_eq!(
config.builtins.first_entry().unwrap().get(),
&AuraEffect {
mode: AuraModeNum::Static,
zone: AuraZone::None,
colour1: Colour { r: 166, g: 0, b: 0 },
colour2: Colour { r: 0, g: 0, b: 0 },
speed: Speed::Med,
direction: Direction::Right
}
);
assert_eq!(config.enabled.states.len(), 4);
assert_eq!(
config.enabled.states[0],
AuraPowerState {
zone: PowerZones::Keyboard,
boot: true,
awake: true,
sleep: true,
shutdown: true
}
);
}
} }
+26 -42
View File
@@ -1,4 +1,4 @@
use std::collections::{BTreeMap, HashSet}; use std::collections::HashSet;
use config_traits::{StdConfig, StdConfigLoad}; use config_traits::{StdConfig, StdConfigLoad};
use dmi_id::DMIID; use dmi_id::DMIID;
@@ -7,9 +7,7 @@ use log::{debug, info, warn};
use rog_aura::aura_detection::LedSupportData; use rog_aura::aura_detection::LedSupportData;
use rog_aura::keyboard::{LedUsbPackets, UsbPackets}; use rog_aura::keyboard::{LedUsbPackets, UsbPackets};
use rog_aura::usb::{LED_APPLY, LED_SET}; use rog_aura::usb::{LED_APPLY, LED_SET};
use rog_aura::{ use rog_aura::{AuraDeviceType, AuraEffect, LedBrightness, LED_MSG_LEN};
AuraDeviceType, AuraEffect, Direction, LedBrightness, Speed, GRADIENT, LED_MSG_LEN,
};
use rog_platform::hid_raw::HidRaw; use rog_platform::hid_raw::HidRaw;
use rog_platform::keyboard_led::KeyboardBacklight; use rog_platform::keyboard_led::KeyboardBacklight;
use udev::Device; use udev::Device;
@@ -180,7 +178,7 @@ impl CtrlKbdLed {
info!("AuraControl found device at: {:?}", dev_node); info!("AuraControl found device at: {:?}", dev_node);
let dev = HidRaw::from_device(device)?; let dev = HidRaw::from_device(device)?;
let mut controller = Self::from_hidraw(dev, dbus_path.clone())?; 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); interfaces.insert(dbus_path);
return Ok(Some(controller)); return Ok(Some(controller));
} }
@@ -225,7 +223,7 @@ impl CtrlKbdLed {
led_node: LEDNode::KbdLed(kbd_backlight), led_node: LEDNode::KbdLed(kbd_backlight),
supported_data: LedSupportData::get_data("tuf"), supported_data: LedSupportData::get_data("tuf"),
per_key_mode_active: false, per_key_mode_active: false,
config: Self::init_config("tuf"), config: Self::load_and_update_config("tuf"),
dbus_path: dbus_path_for_tuf(), dbus_path: dbus_path_for_tuf(),
}; };
devices.push(ctrl); devices.push(ctrl);
@@ -244,7 +242,7 @@ impl CtrlKbdLed {
/// The generated data from this function has a default config. This config /// The generated data from this function has a default config. This config
/// should be overwritten. The reason for the default config is because /// should be overwritten. The reason for the default config is because
/// of async issues between this and udev/hidraw /// 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() let rgb_led = KeyboardBacklight::new()
.map_err(|e| { .map_err(|e| {
log::error!( log::error!(
@@ -274,7 +272,8 @@ impl CtrlKbdLed {
Ok(ctrl) 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 // New loads data from the DB also
let mut config_init = AuraConfig::new(prod_id); let mut config_init = AuraConfig::new(prod_id);
// config_init.set_filename(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 // Then replace just incase the initialised data contains new modes added
config_loaded.builtins = config_init.builtins; 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)) = if let (Some(mut multizone_init), Some(multizone_loaded)) =
(config_init.multizone, config_loaded.multizone.as_mut()) (config_init.multizone, config_loaded.multizone.as_mut())
{ {
@@ -374,7 +379,8 @@ impl CtrlKbdLed {
Ok(()) 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 { if let LEDNode::KbdLed(platform) = &self.led_node {
let buf = [ let buf = [
1, 1,
@@ -414,53 +420,25 @@ impl CtrlKbdLed {
} }
if create { if create {
info!("No user-set config for zone founding, attempting a default"); 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(multizones) = self.config.multizone.as_mut() {
if let Some(set) = multizones.get(&mode) { if let Some(set) = multizones.get(&mode) {
for mode in set.clone() { for mode in set.clone() {
self.write_mode(&mode)?; self.write_effect_and_apply(&mode)?;
} }
} }
} }
} else { } else {
let mode = self.config.current_mode; let mode = self.config.current_mode;
if let Some(effect) = self.config.builtins.get(&mode).cloned() { if let Some(effect) = self.config.builtins.get(&mode).cloned() {
self.write_mode(&effect)?; self.write_effect_and_apply(&effect)?;
} }
} }
Ok(()) 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)] #[cfg(test)]
@@ -502,12 +480,18 @@ mod tests {
}; };
assert!(controller.config.multizone.is_none()); 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()); assert!(controller.config.multizone.is_none());
controller.supported_data.basic_zones.push(AuraZone::Key1); controller.supported_data.basic_zones.push(AuraZone::Key1);
controller.supported_data.basic_zones.push(AuraZone::Key2); 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()); assert!(controller.config.multizone.is_some());
let m = controller.config.multizone.unwrap(); let m = controller.config.multizone.unwrap();
+1 -1
View File
@@ -146,7 +146,7 @@ impl CtrlAuraZbus {
))); )));
} }
ctrl.write_mode(&effect)?; ctrl.write_effect_and_apply(&effect)?;
if ctrl.config.brightness == LedBrightness::Off { if ctrl.config.brightness == LedBrightness::Off {
ctrl.config.brightness = LedBrightness::Med; ctrl.config.brightness = LedBrightness::Med;
} }
+1 -1
View File
@@ -8,7 +8,7 @@ use rog_platform::platform::{RogPlatform, ThrottlePolicy};
use rog_profiles::error::ProfileError; use rog_profiles::error::ProfileError;
use rog_profiles::fan_curve_set::CurveData; use rog_profiles::fan_curve_set::CurveData;
use rog_profiles::{find_fan_curve_node, FanCurvePU, FanCurveProfiles}; use rog_profiles::{find_fan_curve_node, FanCurvePU, FanCurveProfiles};
use serde_derive::{Deserialize, Serialize}; use serde::{Deserialize, Serialize};
use tokio::sync::Mutex; use tokio::sync::Mutex;
use zbus::{interface, Connection, SignalContext}; use zbus::{interface, Connection, SignalContext};
+1 -1
View File
@@ -1,6 +1,6 @@
use config_traits::{StdConfig, StdConfigLoad}; use config_traits::{StdConfig, StdConfigLoad};
use rog_slash::{DeviceState, SlashMode}; use rog_slash::{DeviceState, SlashMode};
use serde_derive::{Deserialize, Serialize}; use serde::{Deserialize, Serialize};
const CONFIG_FILE: &str = "slash.ron"; const CONFIG_FILE: &str = "slash.ron";
+6 -4
View File
@@ -2,10 +2,11 @@ pub mod config;
pub mod trait_impls; pub mod trait_impls;
use config_traits::{StdConfig, StdConfigLoad}; use config_traits::{StdConfig, StdConfigLoad};
use log::info;
use rog_platform::hid_raw::HidRaw; use rog_platform::hid_raw::HidRaw;
use rog_platform::usb_raw::USBRaw; use rog_platform::usb_raw::USBRaw;
use rog_slash::error::SlashError; 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 rog_slash::{SlashMode, SlashType};
use crate::ctrl_slash::config::SlashConfig; use crate::ctrl_slash::config::SlashConfig;
@@ -39,8 +40,9 @@ pub struct CtrlSlash {
impl CtrlSlash { impl CtrlSlash {
#[inline] #[inline]
pub fn new() -> Result<CtrlSlash, RogError> { pub fn new() -> Result<CtrlSlash, RogError> {
let slash_type = get_slash_type()?; let slash_type = get_maybe_slash_type()?;
if matches!(slash_type, SlashType::Unknown | SlashType::Unsupported) { if matches!(slash_type, SlashType::Unsupported) {
info!("No Slash capable laptop found");
return Err(RogError::Slash(SlashError::NoDevice)); return Err(RogError::Slash(SlashError::NoDevice));
} }
@@ -51,7 +53,7 @@ impl CtrlSlash {
} else if hid.is_some() { } else if hid.is_some() {
unsafe { Node::Hid(hid.unwrap_unchecked()) } unsafe { Node::Hid(hid.unwrap_unchecked()) }
} else { } else {
return Err(RogError::NotSupported); return Err(RogError::Slash(SlashError::NoDevice));
}; };
let ctrl = CtrlSlash { let ctrl = CtrlSlash {
+1 -5
View File
@@ -146,11 +146,7 @@ where
/// Renames the existing file to `<file>-old` /// Renames the existing file to `<file>-old`
fn rename_file_old(&self) { fn rename_file_old(&self) {
warn!( warn!("Renaming {} to {}-old", self.file_name(), self.file_name());
"Renaming {} to {}-old and recreating config",
self.file_name(),
self.file_name()
);
let mut cfg_old = self.file_path().to_string_lossy().to_string(); let mut cfg_old = self.file_path().to_string_lossy().to_string();
cfg_old.push_str("-old"); cfg_old.push_str("-old");
std::fs::rename(self.file_path(), cfg_old).unwrap_or_else(|err| { std::fs::rename(self.file_path(), cfg_old).unwrap_or_else(|err| {
+1
View File
@@ -7,6 +7,7 @@ ENV{DMI_FAMILY}=="*ROG*", GOTO="asusd_start"
ENV{DMI_FAMILY}=="*Zephyrus*", GOTO="asusd_start" ENV{DMI_FAMILY}=="*Zephyrus*", GOTO="asusd_start"
ENV{DMI_FAMILY}=="*Strix*", GOTO="asusd_start" ENV{DMI_FAMILY}=="*Strix*", GOTO="asusd_start"
ENV{DMI_FAMILY}=="*Vivo*ook*", GOTO="asusd_start" ENV{DMI_FAMILY}=="*Vivo*ook*", GOTO="asusd_start"
ENV{DMI_FAMILY}=="*Zenbook*", GOTO="asusd_start"
# No match so # No match so
GOTO="asusd_end" GOTO="asusd_end"
-1
View File
@@ -28,7 +28,6 @@ gif.workspace = true
log.workspace = true log.workspace = true
serde.workspace = true serde.workspace = true
serde_derive.workspace = true
glam.workspace = true glam.workspace = true
typeshare.workspace = true typeshare.workspace = true
+5 -5
View File
@@ -4,7 +4,7 @@ use std::thread::sleep;
use std::time::{Duration, Instant}; use std::time::{Duration, Instant};
use log::info; use log::info;
use serde_derive::{Deserialize, Serialize}; use serde::{Deserialize, Serialize};
use typeshare::typeshare; use typeshare::typeshare;
#[cfg(feature = "dbus")] #[cfg(feature = "dbus")]
use zbus::zvariant::{OwnedValue, Type, Value}; use zbus::zvariant::{OwnedValue, Type, Value};
@@ -62,7 +62,7 @@ pub enum AnimeType {
GA401, GA401,
GA402, GA402,
GU604, GU604,
Unknown, Unsupported,
} }
impl FromStr for AnimeType { impl FromStr for AnimeType {
@@ -73,7 +73,7 @@ impl FromStr for AnimeType {
"ga401" | "GA401" => Self::GA401, "ga401" | "GA401" => Self::GA401,
"ga402" | "GA402" => Self::GA402, "ga402" | "GA402" => Self::GA402,
"gu604" | "GU604" => Self::GU604, "gu604" | "GU604" => Self::GU604,
_ => Self::Unknown, _ => Self::Unsupported,
}) })
} }
} }
@@ -165,7 +165,7 @@ impl TryFrom<AnimeDataBuffer> for AnimePacketType {
let mut buffers = match anime.anime { let mut buffers = match anime.anime {
AnimeType::GA401 => vec![[0; 640]; 2], 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() { for (idx, chunk) in anime.data.as_slice().chunks(PANE_LEN).enumerate() {
@@ -176,7 +176,7 @@ impl TryFrom<AnimeDataBuffer> for AnimePacketType {
if matches!( if matches!(
anime.anime, anime.anime,
AnimeType::GA402 | AnimeType::GU604 | AnimeType::Unknown AnimeType::GA402 | AnimeType::GU604 | AnimeType::Unsupported
) { ) {
buffers[2][..7].copy_from_slice(&USB_PREFIX3); buffers[2][..7].copy_from_slice(&USB_PREFIX3);
} }
+6 -1
View File
@@ -3,6 +3,8 @@
use std::path::Path; use std::path::Path;
use std::time::Duration; use std::time::Duration;
use log::error;
use crate::data::AnimeDataBuffer; use crate::data::AnimeDataBuffer;
use crate::error::{AnimeError, Result}; use crate::error::{AnimeError, Result};
use crate::AnimeType; use crate::AnimeType;
@@ -49,7 +51,10 @@ impl AnimeDiagonal {
bright: f32, bright: f32,
anime_type: AnimeType, anime_type: AnimeType,
) -> Result<Self> { ) -> 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 data = std::io::Cursor::new(data);
let decoder = png_pong::Decoder::new(data)?.into_steps(); let decoder = png_pong::Decoder::new(data)?.into_steps();
let png_pong::Step { raster, delay: _ } = decoder.last().ok_or(AnimeError::NoFrames)??; let png_pong::Step { raster, delay: _ } = decoder.last().ok_or(AnimeError::NoFrames)??;
+10 -4
View File
@@ -4,7 +4,8 @@ use std::path::Path;
use std::time::Duration; use std::time::Duration;
use glam::Vec2; use glam::Vec2;
use serde_derive::{Deserialize, Serialize}; use log::error;
use serde::{Deserialize, Serialize};
use crate::error::{AnimeError, Result}; use crate::error::{AnimeError, Result};
use crate::{AnimeDataBuffer, AnimeDiagonal, AnimeImage, AnimeType, Pixel}; 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. // Configure the decoder such that it will expand the image to RGBA.
decoder.set_color_output(gif::ColorOutput::RGBA); decoder.set_color_output(gif::ColorOutput::RGBA);
// Read the file header // 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 decoder = decoder.read_info(file)?;
let mut frames = Vec::default(); let mut frames = Vec::default();
@@ -186,12 +190,14 @@ impl AnimeGif {
anime_type: AnimeType, anime_type: AnimeType,
) -> Result<Self> { ) -> Result<Self> {
let mut frames = Vec::new(); let mut frames = Vec::new();
let mut decoder = gif::DecodeOptions::new(); let mut decoder = gif::DecodeOptions::new();
// Configure the decoder such that it will expand the image to RGBA. // Configure the decoder such that it will expand the image to RGBA.
decoder.set_color_output(gif::ColorOutput::RGBA); decoder.set_color_output(gif::ColorOutput::RGBA);
// Read the file header // 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 decoder = decoder.read_info(file)?;
let height = decoder.height(); let height = decoder.height();
+5 -1
View File
@@ -3,6 +3,7 @@ use std::path::Path;
pub use glam::Vec2; pub use glam::Vec2;
use glam::{Mat3, Vec3}; use glam::{Mat3, Vec3};
use log::error;
use crate::data::AnimeDataBuffer; use crate::data::AnimeDataBuffer;
use crate::error::{AnimeError, Result}; use crate::error::{AnimeError, Result};
@@ -421,7 +422,10 @@ impl AnimeImage {
bright: f32, bright: f32,
anime_type: AnimeType, anime_type: AnimeType,
) -> Result<Self> { ) -> 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 data = std::io::Cursor::new(data);
let decoder = png_pong::Decoder::new(data)?.into_steps(); let decoder = png_pong::Decoder::new(data)?.into_steps();
let png_pong::Step { raster, delay: _ } = decoder.last().ok_or(AnimeError::NoFrames)??; let png_pong::Step { raster, delay: _ } = decoder.last().ok_or(AnimeError::NoFrames)??;
+1 -1
View File
@@ -3,7 +3,7 @@ use std::path::PathBuf;
use std::time::Duration; use std::time::Duration;
use glam::Vec2; use glam::Vec2;
use serde_derive::{Deserialize, Serialize}; use serde::{Deserialize, Serialize};
use crate::error::Result; use crate::error::Result;
use crate::{AnimTime, AnimeDataBuffer, AnimeDiagonal, AnimeGif, AnimeImage, AnimeType}; use crate::{AnimTime, AnimeDataBuffer, AnimeDiagonal, AnimeGif, AnimeImage, AnimeType};
+8 -8
View File
@@ -11,7 +11,7 @@
use std::str::FromStr; use std::str::FromStr;
use dmi_id::DMIID; use dmi_id::DMIID;
use serde_derive::{Deserialize, Serialize}; use serde::{Deserialize, Serialize};
use typeshare::typeshare; use typeshare::typeshare;
#[cfg(feature = "dbus")] #[cfg(feature = "dbus")]
use zbus::zvariant::{OwnedValue, Type, Value}; 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 /// `get_maybe_anime_type` is very broad, matching on part of the laptop board
/// only. For this reason `find_node()` must be used also to verify if the USB /// name only. For this reason `find_node()` must be used also to verify if the
/// device is available. /// USB device is available.
/// ///
/// The currently known USB device is `19b6`. /// The currently known USB device is `19b6`.
#[inline] #[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 dmi = DMIID::new().map_err(|_| AnimeError::NoDevice)?; // TODO: better error
let board_name = dmi.board_name; let board_name = dmi.board_name;
if board_name.contains("GA401I") || board_name.contains("GA401Q") { if board_name.contains("GA401I") || board_name.contains("GA401Q") {
return Ok(AnimeType::GA401); return Ok(AnimeType::GA401);
} else if board_name.contains("GA402R") { } else if board_name.contains("GA402R") || board_name.contains("GA402X") {
return Ok(AnimeType::GA402); return Ok(AnimeType::GA402);
} else if board_name.contains("GU604V") { } else if board_name.contains("GU604V") {
return Ok(AnimeType::GU604); return Ok(AnimeType::GU604);
} }
log::warn!("AniMe Matrix device found but not yet supported, will default to a GA402 layout"); log::warn!("AniMe Matrix device found but could be a slash");
Ok(AnimeType::Unknown) Ok(AnimeType::Unsupported)
} }
/// Get the two device initialization packets. These are required for device /// Get the two device initialization packets. These are required for device
-1
View File
@@ -18,7 +18,6 @@ dbus = ["zbus"]
[dependencies] [dependencies]
serde.workspace = true serde.workspace = true
serde_derive.workspace = true
zbus = { workspace = true, optional = true } zbus = { workspace = true, optional = true }
dmi_id = { path = "../dmi-id" } dmi_id = { path = "../dmi-id" }
+148 -103
View File
@@ -3,7 +3,7 @@
device_name: "FA506I", device_name: "FA506I",
product_id: "", product_id: "",
layout_name: "fa506i", layout_name: "fa506i",
basic_modes: [Static, Breathe, Strobe, Pulse], basic_modes: [Static, Breathe, RainbowCycle, Pulse],
basic_zones: [], basic_zones: [],
advanced_type: None, advanced_type: None,
power_zones: [Keyboard], power_zones: [Keyboard],
@@ -12,7 +12,7 @@
device_name: "FA506Q", device_name: "FA506Q",
product_id: "", product_id: "",
layout_name: "fa506i", layout_name: "fa506i",
basic_modes: [Static, Breathe, Strobe, Rainbow], basic_modes: [Static, Breathe, RainbowCycle, RainbowWave],
basic_zones: [], basic_zones: [],
advanced_type: None, advanced_type: None,
power_zones: [Keyboard], power_zones: [Keyboard],
@@ -21,7 +21,7 @@
device_name: "FA507", device_name: "FA507",
product_id: "", product_id: "",
layout_name: "fa507", layout_name: "fa507",
basic_modes: [Static, Breathe, Strobe, Pulse], basic_modes: [Static, Breathe, RainbowCycle, Pulse],
basic_zones: [], basic_zones: [],
advanced_type: None, advanced_type: None,
power_zones: [Keyboard], power_zones: [Keyboard],
@@ -30,7 +30,7 @@
device_name: "FX505", device_name: "FX505",
product_id: "", product_id: "",
layout_name: "fx505d", layout_name: "fx505d",
basic_modes: [Static, Breathe, Strobe, Rainbow, Pulse], basic_modes: [Static, Breathe, RainbowCycle, Pulse],
basic_zones: [], basic_zones: [],
advanced_type: None, advanced_type: None,
power_zones: [Keyboard], power_zones: [Keyboard],
@@ -39,7 +39,7 @@
device_name: "FX506", device_name: "FX506",
product_id: "", product_id: "",
layout_name: "fa506i", layout_name: "fa506i",
basic_modes: [Static, Breathe, Strobe, Pulse], basic_modes: [Static, Breathe, RainbowCycle, Pulse],
basic_zones: [], basic_zones: [],
advanced_type: None, advanced_type: None,
power_zones: [Keyboard], power_zones: [Keyboard],
@@ -48,7 +48,7 @@
device_name: "FX507Z", device_name: "FX507Z",
product_id: "", product_id: "",
layout_name: "fa506i", layout_name: "fa506i",
basic_modes: [Static, Breathe, Strobe, Pulse], basic_modes: [Static, Breathe, RainbowCycle, Pulse],
basic_zones: [], basic_zones: [],
advanced_type: None, advanced_type: None,
power_zones: [Keyboard], power_zones: [Keyboard],
@@ -57,7 +57,7 @@
device_name: "FX516P", device_name: "FX516P",
product_id: "", product_id: "",
layout_name: "fa506i", layout_name: "fa506i",
basic_modes: [Static, Breathe, Strobe], basic_modes: [Static, Breathe, RainbowCycle],
basic_zones: [], basic_zones: [],
advanced_type: None, advanced_type: None,
power_zones: [Keyboard], power_zones: [Keyboard],
@@ -66,25 +66,34 @@
device_name: "FX705D", device_name: "FX705D",
product_id: "", product_id: "",
layout_name: "fx505d", layout_name: "fx505d",
basic_modes: [Static, Breathe, Strobe, Pulse], basic_modes: [Static, Breathe, RainbowCycle, Pulse],
basic_zones: [], basic_zones: [],
advanced_type: None, advanced_type: None,
power_zones: [Keyboard], power_zones: [Keyboard],
), ),
( (
device_name: "G512", device_name: "G512L",
product_id: "", product_id: "",
layout_name: "g512", layout_name: "g512",
basic_modes: [Static, Breathe, Strobe, Rainbow, Pulse], basic_modes: [Static, Breathe, RainbowCycle, RainbowWave, Pulse],
basic_zones: [Key1, Key2, Key3, Key4], basic_zones: [Key1, Key2, Key3, Key4],
advanced_type: None, advanced_type: None,
power_zones: [Keyboard], power_zones: [Keyboard, Lightbar],
),
(
device_name: "G512LI",
product_id: "",
layout_name: "g512",
basic_modes: [Static, Breathe, RainbowCycle, RainbowWave, Pulse],
basic_zones: [],
advanced_type: None,
power_zones: [Keyboard, Lightbar],
), ),
( (
device_name: "G513I", device_name: "G513I",
product_id: "", product_id: "",
layout_name: "g513i", layout_name: "g513i",
basic_modes: [Static, Breathe, Strobe, Rainbow, Pulse], basic_modes: [Static, Breathe, RainbowCycle, RainbowWave, Pulse],
basic_zones: [Key1, Key2, Key3, Key4], basic_zones: [Key1, Key2, Key3, Key4],
advanced_type: Zoned([ZonedKbLeft, ZonedKbLeftMid, ZonedKbRightMid, ZonedKbRight, LightbarRight, LightbarRightCorner, LightbarRightBottom, LightbarLeftBottom, LightbarLeftCorner, LightbarLeft]), advanced_type: Zoned([ZonedKbLeft, ZonedKbLeftMid, ZonedKbRightMid, ZonedKbRight, LightbarRight, LightbarRightCorner, LightbarRightBottom, LightbarLeftBottom, LightbarLeftCorner, LightbarLeft]),
power_zones: [Keyboard, Lightbar], power_zones: [Keyboard, Lightbar],
@@ -92,53 +101,62 @@
( (
device_name: "G513Q", device_name: "G513Q",
product_id: "", 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", layout_name: "g513i",
basic_modes: [Static, Breathe, Strobe, Rainbow, Pulse], basic_modes: [Static, Breathe, RainbowCycle, RainbowWave, Pulse],
basic_zones: [Key1, Key2, Key3, Key4], basic_zones: [Key1, Key2, Key3, Key4],
advanced_type: None, advanced_type: None,
power_zones: [Keyboard], power_zones: [Keyboard, Lightbar],
), ),
( (
device_name: "G513QY", device_name: "G513QR",
product_id: "", product_id: "",
layout_name: "g513i-per-key", layout_name: "g513i-per-key",
basic_modes: [Static, Breathe, Strobe, Rainbow, Pulse], basic_modes: [Static, Breathe, RainbowCycle, RainbowWave, Star, Rain, Highlight, Laser, Ripple, Pulse, Comet, Flash],
basic_zones: [Key1, Key2, Key3, Key4], basic_zones: [],
advanced_type: PerKey, advanced_type: PerKey,
power_zones: [Keyboard], power_zones: [Keyboard, Lightbar],
), ),
( (
device_name: "G513R", device_name: "G513RC",
product_id: "", product_id: "",
layout_name: "g513i", layout_name: "g513i",
basic_modes: [Static, Breathe, Strobe, Rainbow, Pulse], basic_modes: [Static, Breathe, RainbowCycle, RainbowWave, Pulse],
basic_zones: [], basic_zones: [],
advanced_type: Zoned([ZonedKbLeft, ZonedKbLeftMid, ZonedKbRightMid, ZonedKbRight, LightbarRight, LightbarRightCorner, LightbarRightBottom, LightbarLeftBottom, LightbarLeftCorner, LightbarLeft]), advanced_type: Zoned([ZonedKbLeft, ZonedKbLeftMid, ZonedKbRightMid, ZonedKbRight, LightbarRight, LightbarRightCorner, LightbarRightBottom, LightbarLeftBottom, LightbarLeftCorner, LightbarLeft]),
power_zones: [Keyboard, Lightbar], power_zones: [Keyboard, Lightbar],
), ),
(
device_name: "G513RM",
product_id: "",
layout_name: "g513i",
basic_modes: [Static, Breathe, RainbowCycle, RainbowWave, Pulse],
basic_zones: [Key1, Key2, Key3, Key4],
advanced_type: None,
power_zones: [Keyboard, Lightbar],
),
(
device_name: "G513RS",
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: "G513RW", device_name: "G513RW",
product_id: "", product_id: "",
layout_name: "g513i-per-key", 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: [], basic_zones: [],
advanced_type: PerKey, advanced_type: PerKey,
power_zones: [Keyboard], power_zones: [Keyboard, Lightbar],
), ),
( (
device_name: "G531", device_name: "G531",
product_id: "", product_id: "",
layout_name: "g513i-per-key", 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: [], basic_zones: [],
advanced_type: PerKey, advanced_type: PerKey,
power_zones: [Keyboard], power_zones: [Keyboard],
@@ -147,7 +165,7 @@
device_name: "G531GD", device_name: "G531GD",
product_id: "", product_id: "",
layout_name: "gx502", layout_name: "gx502",
basic_modes: [Static, Breathe, Strobe, Rainbow, Pulse], basic_modes: [Static, Breathe, RainbowCycle, RainbowWave, Pulse],
basic_zones: [], basic_zones: [],
advanced_type: None, advanced_type: None,
power_zones: [Keyboard], power_zones: [Keyboard],
@@ -156,7 +174,7 @@
device_name: "G531GT", device_name: "G531GT",
product_id: "", product_id: "",
layout_name: "gx502", layout_name: "gx502",
basic_modes: [Static, Breathe, Strobe, Rainbow], basic_modes: [Static, Breathe, RainbowCycle, RainbowWave],
basic_zones: [], basic_zones: [],
advanced_type: None, advanced_type: None,
power_zones: [Keyboard], power_zones: [Keyboard],
@@ -165,7 +183,7 @@
device_name: "G531GU", device_name: "G531GU",
product_id: "", product_id: "",
layout_name: "gx502", layout_name: "gx502",
basic_modes: [Static, Breathe, Strobe, Rainbow], basic_modes: [Static, Breathe, RainbowCycle, RainbowWave],
basic_zones: [Key1, Key2, Key3, Key4], basic_zones: [Key1, Key2, Key3, Key4],
advanced_type: None, advanced_type: None,
power_zones: [Keyboard], power_zones: [Keyboard],
@@ -174,7 +192,7 @@
device_name: "G531GV", device_name: "G531GV",
product_id: "", product_id: "",
layout_name: "gx502", layout_name: "gx502",
basic_modes: [Static, Breathe, Strobe, Rainbow], basic_modes: [Static, Breathe, RainbowCycle, RainbowWave],
basic_zones: [Key1, Key2, Key3, Key4], basic_zones: [Key1, Key2, Key3, Key4],
advanced_type: None, advanced_type: None,
power_zones: [Keyboard], power_zones: [Keyboard],
@@ -183,7 +201,7 @@
device_name: "G531GW", device_name: "G531GW",
product_id: "", product_id: "",
layout_name: "gx502", 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], basic_zones: [Key1, Key2, Key3, Key4],
advanced_type: None, advanced_type: None,
power_zones: [Keyboard], power_zones: [Keyboard],
@@ -192,7 +210,7 @@
device_name: "G532", device_name: "G532",
product_id: "", product_id: "",
layout_name: "gx502", 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: [], basic_zones: [],
advanced_type: PerKey, advanced_type: PerKey,
power_zones: [Keyboard], power_zones: [Keyboard],
@@ -201,16 +219,16 @@
device_name: "G533Q", device_name: "G533Q",
product_id: "1866", product_id: "1866",
layout_name: "g533q-per-key", 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: [], basic_zones: [],
advanced_type: PerKey, advanced_type: PerKey,
power_zones: [Keyboard], power_zones: [Keyboard, Lightbar],
), ),
( (
device_name: "G533Z", device_name: "G533Z",
product_id: "", product_id: "",
layout_name: "g533q-per-key", 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: [], basic_zones: [],
advanced_type: PerKey, advanced_type: PerKey,
power_zones: [Keyboard], power_zones: [Keyboard],
@@ -219,7 +237,7 @@
device_name: "G614J", device_name: "G614J",
product_id: "", product_id: "",
layout_name: "g634j-per-key", layout_name: "g634j-per-key",
basic_modes: [Static, Breathe, Pulse, Strobe, Rainbow], basic_modes: [Static, Breathe, Pulse, RainbowCycle, RainbowWave],
basic_zones: [], basic_zones: [],
advanced_type: None, advanced_type: None,
power_zones: [Keyboard, Lightbar], power_zones: [Keyboard, Lightbar],
@@ -228,7 +246,7 @@
device_name: "G634J", device_name: "G634J",
product_id: "", product_id: "",
layout_name: "g634j-per-key", 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: [], basic_zones: [],
advanced_type: PerKey, advanced_type: PerKey,
power_zones: [Keyboard, Lightbar, Logo, RearGlow], power_zones: [Keyboard, Lightbar, Logo, RearGlow],
@@ -237,7 +255,7 @@
device_name: "G712LI", device_name: "G712LI",
product_id: "", product_id: "",
layout_name: "gl503", layout_name: "gl503",
basic_modes: [Static, Breathe, Strobe, Rainbow, Pulse], basic_modes: [Static, Breathe, RainbowCycle, RainbowWave, Pulse],
basic_zones: [], basic_zones: [],
advanced_type: None, advanced_type: None,
power_zones: [Keyboard], power_zones: [Keyboard],
@@ -246,7 +264,7 @@
device_name: "G712LV", device_name: "G712LV",
product_id: "", product_id: "",
layout_name: "ga401q", layout_name: "ga401q",
basic_modes: [Static, Breathe, Strobe, Rainbow, Pulse], basic_modes: [Static, Breathe, RainbowCycle, RainbowWave, Pulse],
basic_zones: [Key1, Key2, Key3, Key4], basic_zones: [Key1, Key2, Key3, Key4],
advanced_type: None, advanced_type: None,
power_zones: [Keyboard], power_zones: [Keyboard],
@@ -255,7 +273,7 @@
device_name: "G712LW", device_name: "G712LW",
product_id: "", product_id: "",
layout_name: "ga401q", layout_name: "ga401q",
basic_modes: [Static, Breathe, Strobe, Rainbow, Pulse], basic_modes: [Static, Breathe, RainbowCycle, RainbowWave, Pulse],
basic_zones: [Key1, Key2, Key3, Key4], basic_zones: [Key1, Key2, Key3, Key4],
advanced_type: None, advanced_type: None,
power_zones: [Keyboard], power_zones: [Keyboard],
@@ -264,43 +282,61 @@
device_name: "G713IC", device_name: "G713IC",
product_id: "", product_id: "",
layout_name: "gx502", layout_name: "gx502",
basic_modes: [Static, Breathe, Strobe, Rainbow, Star, Rain, Highlight, Laser, Ripple, Pulse, Comet, Flash], basic_modes: [Static, Breathe, RainbowCycle, RainbowWave, Pulse],
basic_zones: [], basic_zones: [Key1, Key2, Key3, Key4],
advanced_type: PerKey, advanced_type: None,
power_zones: [Keyboard], power_zones: [Keyboard, Lightbar],
), ),
( (
device_name: "G713P", device_name: "G713P",
product_id: "", product_id: "",
layout_name: "ga401q", layout_name: "ga401q",
basic_modes: [Static, Breathe, Strobe, Rainbow, Pulse], basic_modes: [Static, Breathe, RainbowCycle, RainbowWave, Pulse],
basic_zones: [Key1, Key2, Key3, Key4], basic_zones: [Key1, Key2, Key3, Key4],
advanced_type: None, advanced_type: None,
power_zones: [Keyboard], power_zones: [Keyboard],
), ),
( (
device_name: "G713QM", device_name: "G713QC",
product_id: "", product_id: "",
layout_name: "ga401q", layout_name: "gx502",
basic_modes: [Static, Breathe, Strobe, Rainbow, Pulse], basic_modes: [Static, Breathe, RainbowCycle, RainbowWave, Pulse],
basic_zones: [Key1, Key2, Key3, Key4], basic_zones: [Key1, Key2, Key3, Key4],
advanced_type: None, advanced_type: None,
power_zones: [Keyboard], 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: "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", device_name: "G713QR",
product_id: "", product_id: "",
layout_name: "gx502", 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: [], basic_zones: [],
advanced_type: PerKey, advanced_type: PerKey,
power_zones: [Keyboard], power_zones: [Keyboard, Lightbar],
), ),
( (
device_name: "G713RC", device_name: "G713RC",
product_id: "", product_id: "",
layout_name: "gx502", layout_name: "gx502",
basic_modes: [Static, Breathe, Strobe, Rainbow, Pulse], basic_modes: [Static, Breathe, RainbowCycle, RainbowWave, Pulse],
basic_zones: [], basic_zones: [],
advanced_type: Zoned([ZonedKbLeft, ZonedKbLeftMid, ZonedKbRightMid, ZonedKbRight, LightbarRight, LightbarRightCorner, LightbarRightBottom, LightbarLeftBottom, LightbarLeftCorner, LightbarLeft]), advanced_type: Zoned([ZonedKbLeft, ZonedKbLeftMid, ZonedKbRightMid, ZonedKbRight, LightbarRight, LightbarRightCorner, LightbarRightBottom, LightbarLeftBottom, LightbarLeftCorner, LightbarLeft]),
power_zones: [Keyboard, Lightbar], power_zones: [Keyboard, Lightbar],
@@ -309,7 +345,7 @@
device_name: "G713RM", device_name: "G713RM",
product_id: "", product_id: "",
layout_name: "ga401q", layout_name: "ga401q",
basic_modes: [Static, Breathe, Strobe, Rainbow, Pulse], basic_modes: [Static, Breathe, RainbowCycle, RainbowWave, Pulse],
basic_zones: [Key1, Key2, Key3, Key4], basic_zones: [Key1, Key2, Key3, Key4],
advanced_type: None, advanced_type: None,
power_zones: [Keyboard], power_zones: [Keyboard],
@@ -318,7 +354,7 @@
device_name: "G713RS", device_name: "G713RS",
product_id: "", product_id: "",
layout_name: "gx502", 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: [], basic_zones: [],
advanced_type: PerKey, advanced_type: PerKey,
power_zones: [Keyboard], power_zones: [Keyboard],
@@ -327,7 +363,7 @@
device_name: "G713RW", device_name: "G713RW",
product_id: "", product_id: "",
layout_name: "ga401q", 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], basic_zones: [Key1, Key2, Key3, Key4, BarLeft, BarRight],
advanced_type: None, advanced_type: None,
power_zones: [Keyboard, Lightbar], power_zones: [Keyboard, Lightbar],
@@ -336,7 +372,7 @@
device_name: "G731", device_name: "G731",
product_id: "", product_id: "",
layout_name: "g533q", 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], basic_zones: [Key1, Key2, Key3, Key4],
advanced_type: PerKey, advanced_type: PerKey,
power_zones: [Keyboard], power_zones: [Keyboard],
@@ -345,7 +381,7 @@
device_name: "G731GT", device_name: "G731GT",
product_id: "", product_id: "",
layout_name: "g533q", layout_name: "g533q",
basic_modes: [Static, Breathe, Strobe, Rainbow], basic_modes: [Static, Breathe, RainbowCycle, RainbowWave],
basic_zones: [], basic_zones: [],
advanced_type: None, advanced_type: None,
power_zones: [Keyboard], power_zones: [Keyboard],
@@ -354,7 +390,7 @@
device_name: "G731GU", device_name: "G731GU",
product_id: "", product_id: "",
layout_name: "g533q", layout_name: "g533q",
basic_modes: [Static, Breathe, Strobe, Rainbow], basic_modes: [Static, Breathe, RainbowCycle, RainbowWave],
basic_zones: [], basic_zones: [],
advanced_type: None, advanced_type: None,
power_zones: [Keyboard], power_zones: [Keyboard],
@@ -363,7 +399,7 @@
device_name: "G731GV", device_name: "G731GV",
product_id: "", product_id: "",
layout_name: "g533q", layout_name: "g533q",
basic_modes: [Static, Breathe, Strobe, Rainbow], basic_modes: [Static, Breathe, RainbowCycle, RainbowWave],
basic_zones: [Key1, Key2, Key3, Key4], basic_zones: [Key1, Key2, Key3, Key4],
advanced_type: None, advanced_type: None,
power_zones: [Keyboard], power_zones: [Keyboard],
@@ -372,7 +408,7 @@
device_name: "G731GW", device_name: "G731GW",
product_id: "", product_id: "",
layout_name: "g533q", layout_name: "g533q",
basic_modes: [Static, Breathe, Strobe, Rainbow], basic_modes: [Static, Breathe, RainbowCycle, RainbowWave],
basic_zones: [Key1, Key2, Key3, Key4], basic_zones: [Key1, Key2, Key3, Key4],
advanced_type: None, advanced_type: None,
power_zones: [Keyboard], power_zones: [Keyboard],
@@ -381,7 +417,7 @@
device_name: "G733C", device_name: "G733C",
product_id: "", product_id: "",
layout_name: "g513i-per-key", 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: [], basic_zones: [],
advanced_type: PerKey, advanced_type: PerKey,
power_zones: [Keyboard, Lightbar, Logo, Lid], power_zones: [Keyboard, Lightbar, Logo, Lid],
@@ -390,7 +426,7 @@
device_name: "G733PZ", device_name: "G733PZ",
product_id: "", product_id: "",
layout_name: "g733pz-per-key", 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: [], basic_zones: [],
advanced_type: PerKey, advanced_type: PerKey,
power_zones: [Keyboard, Lightbar], power_zones: [Keyboard, Lightbar],
@@ -399,7 +435,7 @@
device_name: "G733Q", device_name: "G733Q",
product_id: "", product_id: "",
layout_name: "gx502", 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: [], basic_zones: [],
advanced_type: PerKey, advanced_type: PerKey,
power_zones: [Keyboard], power_zones: [Keyboard],
@@ -408,7 +444,7 @@
device_name: "G733Z", device_name: "G733Z",
product_id: "", product_id: "",
layout_name: "g513i-per-key", 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: [], basic_zones: [],
advanced_type: PerKey, advanced_type: PerKey,
power_zones: [Keyboard], power_zones: [Keyboard],
@@ -417,7 +453,7 @@
device_name: "G814J", device_name: "G814J",
product_id: "", product_id: "",
layout_name: "g814ji-per-key", 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: [], basic_zones: [],
advanced_type: PerKey, advanced_type: PerKey,
power_zones: [Keyboard, Lightbar], power_zones: [Keyboard, Lightbar],
@@ -426,11 +462,20 @@
device_name: "G834J", device_name: "G834J",
product_id: "", product_id: "",
layout_name: "g814ji-per-key", 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: [], basic_zones: [],
advanced_type: PerKey, advanced_type: PerKey,
power_zones: [Keyboard, Lightbar, Logo, RearGlow], 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", device_name: "GA401Q",
product_id: "", product_id: "",
@@ -444,7 +489,7 @@
device_name: "GA402N", device_name: "GA402N",
product_id: "", product_id: "",
layout_name: "ga401q", layout_name: "ga401q",
basic_modes: [Static, Breathe, Pulse, Rainbow, Strobe], basic_modes: [Static, Breathe, Pulse, RainbowWave, RainbowCycle],
basic_zones: [], basic_zones: [],
advanced_type: None, advanced_type: None,
power_zones: [Keyboard], power_zones: [Keyboard],
@@ -453,7 +498,7 @@
device_name: "GA402R", device_name: "GA402R",
product_id: "", product_id: "",
layout_name: "ga401q", layout_name: "ga401q",
basic_modes: [Static, Breathe, Pulse, Rainbow], basic_modes: [Static, Breathe, Pulse, RainbowWave],
basic_zones: [], basic_zones: [],
advanced_type: None, advanced_type: None,
power_zones: [Keyboard], power_zones: [Keyboard],
@@ -462,7 +507,7 @@
device_name: "GA402X", device_name: "GA402X",
product_id: "", product_id: "",
layout_name: "ga401q", layout_name: "ga401q",
basic_modes: [Static, Breathe, Pulse, Rainbow], basic_modes: [Static, Breathe, Pulse, RainbowWave],
basic_zones: [], basic_zones: [],
advanced_type: None, advanced_type: None,
power_zones: [Keyboard], power_zones: [Keyboard],
@@ -471,7 +516,7 @@
device_name: "GA402XV", device_name: "GA402XV",
product_id: "", product_id: "",
layout_name: "ga401q", layout_name: "ga401q",
basic_modes: [Static, Breathe, Strobe, Comet], basic_modes: [Static, Breathe, RainbowCycle, Comet],
basic_zones: [], basic_zones: [],
advanced_type: None, advanced_type: None,
power_zones: [Keyboard], power_zones: [Keyboard],
@@ -489,7 +534,7 @@
device_name: "GA503Q", device_name: "GA503Q",
product_id: "", product_id: "",
layout_name: "ga401q", layout_name: "ga401q",
basic_modes: [Static, Breathe, Pulse, Rainbow, Strobe], basic_modes: [Static, Breathe, Pulse, RainbowWave, RainbowCycle],
basic_zones: [], basic_zones: [],
advanced_type: None, advanced_type: None,
power_zones: [Keyboard], power_zones: [Keyboard],
@@ -507,7 +552,7 @@
device_name: "GA503R", device_name: "GA503R",
product_id: "", product_id: "",
layout_name: "ga401q", layout_name: "ga401q",
basic_modes: [Static, Breathe, Pulse, Rainbow, Strobe], basic_modes: [Static, Breathe, Pulse, RainbowWave, RainbowCycle],
basic_zones: [], basic_zones: [],
advanced_type: None, advanced_type: None,
power_zones: [Keyboard], power_zones: [Keyboard],
@@ -516,7 +561,7 @@
device_name: "GL503", device_name: "GL503",
product_id: "", product_id: "",
layout_name: "gl503", layout_name: "gl503",
basic_modes: [Static, Breathe, Strobe, Rainbow, Pulse], basic_modes: [Static, Breathe, RainbowCycle, RainbowWave, Pulse],
basic_zones: [Key1, Key2, Key3, Key4], basic_zones: [Key1, Key2, Key3, Key4],
advanced_type: None, advanced_type: None,
power_zones: [Keyboard], power_zones: [Keyboard],
@@ -525,7 +570,7 @@
device_name: "GL503V", device_name: "GL503V",
product_id: "", product_id: "",
layout_name: "gl503", layout_name: "gl503",
basic_modes: [Static, Breathe, Strobe, Rainbow, Pulse], basic_modes: [Static, Breathe, RainbowCycle, RainbowWave, Pulse],
basic_zones: [Key1, Key2, Key3, Key4], basic_zones: [Key1, Key2, Key3, Key4],
advanced_type: None, advanced_type: None,
power_zones: [Keyboard], power_zones: [Keyboard],
@@ -534,7 +579,7 @@
device_name: "GL504G", device_name: "GL504G",
product_id: "", product_id: "",
layout_name: "gl503", 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], basic_zones: [Key1, Key2, Key3, Key4, Logo, BarLeft, BarRight],
advanced_type: None, advanced_type: None,
power_zones: [Keyboard], power_zones: [Keyboard],
@@ -543,7 +588,7 @@
device_name: "GL531", device_name: "GL531",
product_id: "", product_id: "",
layout_name: "g512", 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: [], basic_zones: [],
advanced_type: PerKey, advanced_type: PerKey,
power_zones: [Keyboard], power_zones: [Keyboard],
@@ -552,7 +597,7 @@
device_name: "GL553V", device_name: "GL553V",
product_id: "", product_id: "",
layout_name: "g533q", layout_name: "g533q",
basic_modes: [Static, Breathe, Strobe], basic_modes: [Static, Breathe, RainbowCycle],
basic_zones: [Key1, Key2, Key3, Key4], basic_zones: [Key1, Key2, Key3, Key4],
advanced_type: None, advanced_type: None,
power_zones: [Keyboard], power_zones: [Keyboard],
@@ -561,7 +606,7 @@
device_name: "GL703G", device_name: "GL703G",
product_id: "", product_id: "",
layout_name: "gl503", layout_name: "gl503",
basic_modes: [Static, Breathe, Strobe, Rainbow], basic_modes: [Static, Breathe, RainbowCycle, RainbowWave],
basic_zones: [], basic_zones: [],
advanced_type: None, advanced_type: None,
power_zones: [Keyboard], power_zones: [Keyboard],
@@ -570,7 +615,7 @@
device_name: "GM501G", device_name: "GM501G",
product_id: "", product_id: "",
layout_name: "fa507", layout_name: "fa507",
basic_modes: [Static, Breathe, Strobe, Rainbow, Pulse], basic_modes: [Static, Breathe, RainbowCycle, RainbowWave, Pulse],
basic_zones: [Key1, Key2, Key3, Key4], basic_zones: [Key1, Key2, Key3, Key4],
advanced_type: None, advanced_type: None,
power_zones: [Keyboard], power_zones: [Keyboard],
@@ -579,7 +624,7 @@
device_name: "GU502", device_name: "GU502",
product_id: "", product_id: "",
layout_name: "gx502", 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: [], basic_zones: [],
advanced_type: PerKey, advanced_type: PerKey,
power_zones: [Keyboard], power_zones: [Keyboard],
@@ -588,7 +633,7 @@
device_name: "GU502L", device_name: "GU502L",
product_id: "", product_id: "",
layout_name: "gx502", 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: [], basic_zones: [],
advanced_type: PerKey, advanced_type: PerKey,
power_zones: [Keyboard], power_zones: [Keyboard],
@@ -597,7 +642,7 @@
device_name: "GU502LU", device_name: "GU502LU",
product_id: "", product_id: "",
layout_name: "gx502", layout_name: "gx502",
basic_modes: [Static, Breathe, Strobe, Pulse], basic_modes: [Static, Breathe, RainbowCycle, Pulse],
basic_zones: [], basic_zones: [],
advanced_type: None, advanced_type: None,
power_zones: [Keyboard], power_zones: [Keyboard],
@@ -606,7 +651,7 @@
device_name: "GU603H", device_name: "GU603H",
product_id: "", product_id: "",
layout_name: "ga401q", layout_name: "ga401q",
basic_modes: [Static, Breathe, Strobe, Rainbow, Pulse], basic_modes: [Static, Breathe, RainbowCycle, RainbowWave, Pulse],
basic_zones: [], basic_zones: [],
advanced_type: Zoned([SingleZone]), advanced_type: Zoned([SingleZone]),
power_zones: [Keyboard], power_zones: [Keyboard],
@@ -615,7 +660,7 @@
device_name: "GU603V", device_name: "GU603V",
product_id: "", product_id: "",
layout_name: "ga401q", layout_name: "ga401q",
basic_modes: [Static, Breathe, Strobe, Rainbow, Pulse], basic_modes: [Static, Breathe, RainbowCycle, RainbowWave, Pulse],
basic_zones: [], basic_zones: [],
advanced_type: Zoned([SingleZone]), advanced_type: Zoned([SingleZone]),
power_zones: [Keyboard], power_zones: [Keyboard],
@@ -624,7 +669,7 @@
device_name: "GU603Z", device_name: "GU603Z",
product_id: "", product_id: "",
layout_name: "ga401q", layout_name: "ga401q",
basic_modes: [Static, Breathe, Strobe, Rainbow, Pulse], basic_modes: [Static, Breathe, RainbowCycle, RainbowWave, Pulse],
basic_zones: [], basic_zones: [],
advanced_type: Zoned([SingleZone]), advanced_type: Zoned([SingleZone]),
power_zones: [Keyboard], power_zones: [Keyboard],
@@ -633,7 +678,7 @@
device_name: "GU604V", device_name: "GU604V",
product_id: "", product_id: "",
layout_name: "ga401q", layout_name: "ga401q",
basic_modes: [Static, Breathe, Strobe, Rainbow, Pulse], basic_modes: [Static, Breathe, RainbowCycle, RainbowWave, Pulse],
basic_zones: [], basic_zones: [],
advanced_type: Zoned([SingleZone]), advanced_type: Zoned([SingleZone]),
power_zones: [Keyboard], power_zones: [Keyboard],
@@ -642,7 +687,7 @@
device_name: "GU605M", device_name: "GU605M",
product_id: "", product_id: "",
layout_name: "ga401q", layout_name: "ga401q",
basic_modes: [Static, Breathe, Strobe, Rainbow, Pulse], basic_modes: [Static, Breathe, RainbowCycle, RainbowWave, Pulse],
basic_zones: [], basic_zones: [],
advanced_type: Zoned([SingleZone]), advanced_type: Zoned([SingleZone]),
power_zones: [Keyboard], power_zones: [Keyboard],
@@ -678,7 +723,7 @@
device_name: "GV601R", device_name: "GV601R",
product_id: "", product_id: "",
layout_name: "ga401q", layout_name: "ga401q",
basic_modes: [Static, Breathe, Strobe, Pulse], basic_modes: [Static, Breathe, RainbowCycle, Pulse],
basic_zones: [], basic_zones: [],
advanced_type: None, advanced_type: None,
power_zones: [Keyboard], power_zones: [Keyboard],
@@ -696,7 +741,7 @@
device_name: "GV604V", device_name: "GV604V",
product_id: "", product_id: "",
layout_name: "ga401q", layout_name: "ga401q",
basic_modes: [Static, Breathe, Strobe, Pulse], basic_modes: [Static, Breathe, RainbowCycle, Pulse],
basic_zones: [], basic_zones: [],
advanced_type: None, advanced_type: None,
power_zones: [Keyboard], power_zones: [Keyboard],
@@ -705,7 +750,7 @@
device_name: "GX502", device_name: "GX502",
product_id: "", product_id: "",
layout_name: "gx502", 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: [], basic_zones: [],
advanced_type: PerKey, advanced_type: PerKey,
power_zones: [Keyboard], power_zones: [Keyboard],
@@ -714,7 +759,7 @@
device_name: "GX531", device_name: "GX531",
product_id: "", product_id: "",
layout_name: "gx531-per-key", 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], basic_zones: [Key1, Key2, Key3, Key4],
advanced_type: None, advanced_type: None,
power_zones: [Keyboard], power_zones: [Keyboard],
@@ -723,7 +768,7 @@
device_name: "GX550L", device_name: "GX550L",
product_id: "", product_id: "",
layout_name: "gx531-per-key", 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: [], basic_zones: [],
advanced_type: PerKey, advanced_type: PerKey,
power_zones: [Keyboard], power_zones: [Keyboard],
@@ -732,7 +777,7 @@
device_name: "GX551Q", device_name: "GX551Q",
product_id: "", product_id: "",
layout_name: "gx531-per-key", layout_name: "gx531-per-key",
basic_modes: [Static, Breathe, Strobe, Rainbow, Pulse], basic_modes: [Static, Breathe, RainbowCycle, RainbowWave, Pulse],
basic_zones: [], basic_zones: [],
advanced_type: PerKey, advanced_type: PerKey,
power_zones: [Keyboard], power_zones: [Keyboard],
@@ -741,7 +786,7 @@
device_name: "GX650P", device_name: "GX650P",
product_id: "", product_id: "",
layout_name: "gx531-per-key", 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: [], basic_zones: [],
advanced_type: PerKey, advanced_type: PerKey,
power_zones: [Keyboard], power_zones: [Keyboard],
@@ -750,7 +795,7 @@
device_name: "GX650R", device_name: "GX650R",
product_id: "", product_id: "",
layout_name: "gx531-per-key", 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: [], basic_zones: [],
advanced_type: PerKey, advanced_type: PerKey,
power_zones: [Keyboard], power_zones: [Keyboard],
@@ -759,7 +804,7 @@
device_name: "GX701", device_name: "GX701",
product_id: "", product_id: "",
layout_name: "gx531-per-key", 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: [], basic_zones: [],
advanced_type: PerKey, advanced_type: PerKey,
power_zones: [Keyboard], power_zones: [Keyboard],
@@ -768,7 +813,7 @@
device_name: "GX703H", device_name: "GX703H",
product_id: "", product_id: "",
layout_name: "gx531-per-key", 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: [], basic_zones: [],
advanced_type: None, advanced_type: None,
power_zones: [Keyboard], power_zones: [Keyboard],
+25 -10
View File
@@ -1,6 +1,8 @@
use std::env;
use dmi_id::DMIID; use dmi_id::DMIID;
use log::{error, info, warn}; use log::{error, info, warn};
use serde_derive::{Deserialize, Serialize}; use serde::{Deserialize, Serialize};
use crate::keyboard::AdvancedAuraType; use crate::keyboard::AdvancedAuraType;
use crate::{AuraModeNum, AuraZone, PowerZones}; use crate::{AuraModeNum, AuraZone, PowerZones};
@@ -60,16 +62,17 @@ impl LedSupportData {
/// matches against laptops first, then will proceed with matching the /// matches against laptops first, then will proceed with matching the
/// `device_name` if there are no DMI matches. /// `device_name` if there are no DMI matches.
pub fn get_data(product_id: &str) -> Self { pub fn get_data(product_id: &str) -> Self {
let dmi = DMIID::new().unwrap_or_default(); let mut dmi = DMIID::new().unwrap_or_default();
if let Ok(board_name) = env::var("BOARD_NAME") {
dmi.board_name = board_name;
}
// let prod_family = dmi.product_family().expect("Could not get // let prod_family = dmi.product_family().expect("Could not get
// product_family"); // product_family");
if let Some(data) = LedSupportFile::load_from_supoprt_db() { if let Some(data) = LedSupportFile::load_from_supoprt_db() {
if let Some(data) = data.match_device(&dmi.board_name, product_id) { return data.match_device(&dmi.board_name, product_id);
return data;
}
} }
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(); let mut data = LedSupportData::default();
data.power_zones.push(PowerZones::Keyboard); data.power_zones.push(PowerZones::Keyboard);
data data
@@ -86,7 +89,7 @@ impl LedSupportFile {
/// The list is stored in ordered format, so the iterator must be reversed /// 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 /// 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() { for config in self.0.iter().rev() {
if device_name.contains(&config.device_name) { if device_name.contains(&config.device_name) {
info!("Matched to {}", config.device_name); info!("Matched to {}", config.device_name);
@@ -94,15 +97,27 @@ impl LedSupportFile {
info!("Checking product ID"); info!("Checking product ID");
if config.product_id == product_id { if config.product_id == product_id {
info!("Matched to {}", config.product_id); info!("Matched to {}", config.product_id);
return Some(config.clone()); return config.clone();
} else { } else {
continue; 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 /// Load `LedSupportFile` from the `aura_support.ron` file at
+13 -13
View File
@@ -1,7 +1,7 @@
use std::fmt::Display; use std::fmt::Display;
use std::str::FromStr; use std::str::FromStr;
use serde_derive::{Deserialize, Serialize}; use serde::{Deserialize, Serialize};
use typeshare::typeshare; use typeshare::typeshare;
#[cfg(feature = "dbus")] #[cfg(feature = "dbus")]
use zbus::zvariant::{OwnedValue, Type, Value}; use zbus::zvariant::{OwnedValue, Type, Value};
@@ -261,8 +261,8 @@ pub enum AuraModeNum {
#[default] #[default]
Static = 0, Static = 0,
Breathe = 1, Breathe = 1,
Strobe = 2, RainbowCycle = 2,
Rainbow = 3, RainbowWave = 3,
Star = 4, Star = 4,
Rain = 5, Rain = 5,
Highlight = 6, Highlight = 6,
@@ -290,8 +290,8 @@ impl From<&AuraModeNum> for &str {
match mode { match mode {
AuraModeNum::Static => "Static", AuraModeNum::Static => "Static",
AuraModeNum::Breathe => "Breathe", AuraModeNum::Breathe => "Breathe",
AuraModeNum::Strobe => "Strobe", AuraModeNum::RainbowCycle => "RainbowCycle",
AuraModeNum::Rainbow => "Rainbow", AuraModeNum::RainbowWave => "RainbowWave",
AuraModeNum::Star => "Stars", AuraModeNum::Star => "Stars",
AuraModeNum::Rain => "Rain", AuraModeNum::Rain => "Rain",
AuraModeNum::Highlight => "Highlight", AuraModeNum::Highlight => "Highlight",
@@ -307,8 +307,8 @@ impl From<&str> for AuraModeNum {
fn from(mode: &str) -> Self { fn from(mode: &str) -> Self {
match mode { match mode {
"Breathe" => AuraModeNum::Breathe, "Breathe" => AuraModeNum::Breathe,
"Strobe" => AuraModeNum::Strobe, "RainbowCycle" => AuraModeNum::RainbowCycle,
"Rainbow" => AuraModeNum::Rainbow, "RainbowWave" => AuraModeNum::RainbowWave,
"Stars" => AuraModeNum::Star, "Stars" => AuraModeNum::Star,
"Rain" => AuraModeNum::Rain, "Rain" => AuraModeNum::Rain,
"Highlight" => AuraModeNum::Highlight, "Highlight" => AuraModeNum::Highlight,
@@ -326,8 +326,8 @@ impl From<u8> for AuraModeNum {
fn from(mode: u8) -> Self { fn from(mode: u8) -> Self {
match mode { match mode {
1 => AuraModeNum::Breathe, 1 => AuraModeNum::Breathe,
2 => AuraModeNum::Strobe, 2 => AuraModeNum::RainbowCycle,
3 => AuraModeNum::Rainbow, 3 => AuraModeNum::RainbowWave,
4 => AuraModeNum::Star, 4 => AuraModeNum::Star,
5 => AuraModeNum::Rain, 5 => AuraModeNum::Rain,
6 => AuraModeNum::Highlight, 6 => AuraModeNum::Highlight,
@@ -434,7 +434,7 @@ impl From<AuraZone> for i32 {
/// ``` /// ```
#[typeshare] #[typeshare]
#[cfg_attr(feature = "dbus", derive(Type, Value, OwnedValue))] #[cfg_attr(feature = "dbus", derive(Type, Value, OwnedValue))]
#[derive(Debug, Clone, Deserialize, Serialize)] #[derive(Debug, Clone, PartialEq, Deserialize, Serialize)]
pub struct AuraEffect { pub struct AuraEffect {
/// The effect type /// The effect type
pub mode: AuraModeNum, pub mode: AuraModeNum,
@@ -532,10 +532,10 @@ impl AuraEffect {
| AuraModeNum::Comet | AuraModeNum::Comet
| AuraModeNum::Flash => AuraParameters::new(true, true, false, false, false), | AuraModeNum::Flash => AuraParameters::new(true, true, false, false, false),
AuraModeNum::Breathe => AuraParameters::new(true, true, true, true, false), AuraModeNum::Breathe => AuraParameters::new(true, true, true, true, false),
AuraModeNum::Strobe | AuraModeNum::Rain => { AuraModeNum::RainbowCycle | AuraModeNum::Rain => {
AuraParameters::new(true, false, false, true, false) 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::Star => AuraParameters::new(true, true, true, true, true),
AuraModeNum::Laser | AuraModeNum::Ripple => { AuraModeNum::Laser | AuraModeNum::Ripple => {
AuraParameters::new(true, true, false, true, false) AuraParameters::new(true, true, false, true, false)
@@ -710,7 +710,7 @@ mod tests {
]; ];
assert_eq!(<[u8; LED_MSG_LEN]>::from(&st)[..9], capture[..9]); assert_eq!(<[u8; LED_MSG_LEN]>::from(&st)[..9], capture[..9]);
st.mode = AuraModeNum::Rainbow; st.mode = AuraModeNum::RainbowWave;
let capture = [ let capture = [
0x5d, 0xb3, 0x07, 0x03, 0xff, 0x00, 0xcd, 0xe1, 0x01, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x5d, 0xb3, 0x07, 0x03, 0xff, 0x00, 0xcd, 0xe1, 0x01, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0,
0x0, 0x0, 0x0, 0x0,
+1 -1
View File
@@ -1,4 +1,4 @@
use serde_derive::{Deserialize, Serialize}; use serde::{Deserialize, Serialize};
mod doom; mod doom;
pub use doom::*; pub use doom::*;
+1 -1
View File
@@ -488,7 +488,7 @@ mod tests {
let rows = &data.key_rows; let rows = &data.key_rows;
for row in rows { for row in rows {
for k in &row.row { for k in &row.row {
if data.key_shapes.get(&k.1).is_some() { if data.key_shapes.contains_key(&k.1) {
unused.remove(&k.1); unused.remove(&k.1);
} else { } else {
panic!("Key {:?} was missing matching shape {}", k.0, k.1); panic!("Key {:?} was missing matching shape {}", k.0, k.1);
+5 -2
View File
@@ -12,8 +12,12 @@ edition.workspace = true
default = [] default = []
mocking = [] mocking = []
x11 = ["slint/backend-winit-x11"] x11 = ["slint/backend-winit-x11"]
# Requires RUSTFLAGS="--cfg tokio_unstable"
tokio-debug = ["console-subscriber"]
[dependencies] [dependencies]
console-subscriber = { version = "0.2.0", optional = true }
nix = { version = "^0.28.0", features = ["fs"] } nix = { version = "^0.28.0", features = ["fs"] }
tempfile = "3.3.0" tempfile = "3.3.0"
betrayer = { version = "0.2.0" } betrayer = { version = "0.2.0" }
@@ -25,7 +29,7 @@ rog_dbus = { path = "../rog-dbus" }
rog_aura = { path = "../rog-aura" } rog_aura = { path = "../rog-aura" }
rog_profiles = { path = "../rog-profiles" } rog_profiles = { path = "../rog-profiles" }
rog_platform = { path = "../rog-platform" } 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" } dmi_id = { path = "../dmi-id" }
gumdrop.workspace = true gumdrop.workspace = true
@@ -34,7 +38,6 @@ env_logger.workspace = true
tokio.workspace = true tokio.workspace = true
serde.workspace = true serde.workspace = true
serde_derive.workspace = true
zbus.workspace = true zbus.workspace = true
dirs.workspace = true dirs.workspace = true
notify-rust.workspace = true notify-rust.workspace = true
+1 -1
View File
@@ -1,7 +1,7 @@
use std::fs::create_dir; use std::fs::create_dir;
use config_traits::{StdConfig, StdConfigLoad1}; use config_traits::{StdConfig, StdConfigLoad1};
use serde_derive::{Deserialize, Serialize}; use serde::{Deserialize, Serialize};
use crate::notify::EnabledNotifications; use crate::notify::EnabledNotifications;
+3
View File
@@ -25,6 +25,9 @@ use tokio::runtime::Runtime;
#[tokio::main] #[tokio::main]
async fn main() -> Result<()> { async fn main() -> Result<()> {
#[cfg(feature = "tokio-debug")]
console_subscriber::init();
let self_version = env!("CARGO_PKG_VERSION"); let self_version = env!("CARGO_PKG_VERSION");
let conn = zbus::blocking::Connection::system()?; let conn = zbus::blocking::Connection::system()?;
let proxy = rog_dbus::zbus_platform::PlatformProxyBlocking::new(&conn)?; let proxy = rog_dbus::zbus_platform::PlatformProxyBlocking::new(&conn)?;
+118 -88
View File
@@ -9,8 +9,8 @@ use std::process::Command;
use std::sync::{Arc, Mutex}; use std::sync::{Arc, Mutex};
use std::time::Duration; use std::time::Duration;
use log::{error, info, warn}; use log::{debug, error, info, warn};
use notify_rust::{Hint, Notification, NotificationHandle, Urgency}; use notify_rust::{Hint, Notification, Timeout, Urgency};
use rog_dbus::zbus_platform::PlatformProxy; use rog_dbus::zbus_platform::PlatformProxy;
use rog_platform::platform::GpuMode; use rog_platform::platform::GpuMode;
use rog_platform::power::AsusPower; use rog_platform::power::AsusPower;
@@ -20,7 +20,6 @@ use supergfxctl::pci_device::{GfxMode, GfxPower};
use supergfxctl::zbus_proxy::DaemonProxy as SuperProxy; use supergfxctl::zbus_proxy::DaemonProxy as SuperProxy;
use tokio::runtime::Runtime; use tokio::runtime::Runtime;
use tokio::task::JoinHandle; use tokio::task::JoinHandle;
use tokio::time::sleep;
use zbus::export::futures_util::StreamExt; use zbus::export::futures_util::StreamExt;
use crate::config::Config; use crate::config::Config;
@@ -46,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( pub fn start_notifications(
config: Arc<Mutex<Config>>, config: Arc<Mutex<Config>>,
rt: &Runtime, rt: &Runtime,
@@ -101,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 // GPU MUX Mode notif
let enabled_notifications_copy = config.clone(); let enabled_notifications_copy = config.clone();
tokio::spawn(async move { tokio::spawn(async move {
let conn = zbus::Connection::system() let conn = zbus::Connection::system().await.map_err(|e| {
.await error!("zbus signal: receive_notify_gpu_mux_mode: {e}");
.map_err(|e| { 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}");
.unwrap(); e
let proxy = PlatformProxy::new(&conn) })?;
.await
.map_err(|e| {
error!("zbus signal: receive_notify_gpu_mux_mode: {e}");
e
})
.unwrap();
let mut actual_mux_mode = GpuMode::Error; let mut actual_mux_mode = GpuMode::Error;
if let Ok(mode) = proxy.gpu_mux_mode().await { if let Ok(mode) = proxy.gpu_mux_mode().await {
@@ -139,68 +185,28 @@ pub fn start_notifications(
do_mux_notification("Reboot required. BIOS GPU MUX mode set to", &mode).ok(); do_mux_notification("Reboot required. BIOS GPU MUX mode set to", &mode).ok();
} }
} }
Ok::<(), zbus::Error>(())
}); });
use supergfxctl::pci_device::Device; let enabled_notifications_copy = config.clone();
let dev = Device::find().unwrap_or_default();
let mut found_dgpu = false; // just for logging
for dev in dev {
if dev.is_dgpu() {
let enabled_notifications_copy = config.clone();
// Plain old thread is perfectly fine since most of this is potentially blocking
tokio::spawn(async move {
let mut last_status = GfxPower::Unknown;
loop {
if let Ok(status) = dev.get_runtime_status() {
if status != GfxPower::Unknown && status != last_status {
if let Ok(config) = enabled_notifications_copy.lock() {
if !config.notifications.receive_notify_gfx_status
|| !config.notifications.enabled
{
continue;
}
}
// Required check because status cycles through
// active/unknown/suspended
do_gpu_status_notif("dGPU status changed:", &status).ok();
}
last_status = status;
}
sleep(Duration::from_millis(500)).await;
}
});
found_dgpu = true;
break;
}
}
if !found_dgpu {
warn!("Did not find a dGPU on this system, dGPU status won't be avilable");
}
// GPU Mode change/action notif // GPU Mode change/action notif
tokio::spawn(async move { tokio::spawn(async move {
let conn = zbus::Connection::system() let conn = zbus::Connection::system().await.map_err(|e| {
.await no_supergfx(&e);
.map_err(|e| { e
error!("zbus signal: receive_notify_action: {e}"); })?;
e let proxy = SuperProxy::builder(&conn).build().await.map_err(|e| {
}) no_supergfx(&e);
.unwrap(); e
let proxy = SuperProxy::builder(&conn) })?;
.build() let _ = proxy.mode().await.map_err(|e| {
.await no_supergfx(&e);
.map_err(|e| { e
error!("zbus signal: receive_notify_action: {e}"); })?;
e
})
.unwrap();
if proxy.mode().await.is_err() { let proxy_copy = proxy.clone();
info!("supergfxd not running or not responding"); let mut p = proxy.receive_notify_action().await?;
return; tokio::spawn(async move {
}
if let Ok(mut p) = proxy.receive_notify_action().await {
info!("Started zbus signal thread: receive_notify_action"); info!("Started zbus signal thread: receive_notify_action");
while let Some(e) = p.next().await { while let Some(e) = p.next().await {
if let Ok(out) = e.args() { if let Ok(out) = e.args() {
@@ -219,7 +225,36 @@ pub fn start_notifications(
.ok(); .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]) Ok(vec![blocking])
@@ -242,19 +277,15 @@ where
T: Display, T: Display,
{ {
let mut notif = Notification::new(); let mut notif = Notification::new();
notif notif
.summary(NOTIF_HEADER) .appname(NOTIF_HEADER)
.body(&format!("{message} {data}")) .summary(&format!("{message} {data}"))
.timeout(-1) .timeout(Timeout::Milliseconds(3000))
//.hint(Hint::Resident(true))
.hint(Hint::Category("device".into())); .hint(Hint::Category("device".into()));
notif notif
} }
fn do_gpu_status_notif(message: &str, data: &GfxPower) -> Result<NotificationHandle> { fn do_gpu_status_notif(message: &str, data: &GfxPower) -> Notification {
// eww
let mut notif = base_notification(message, &<&str>::from(data).to_owned()); let mut notif = base_notification(message, &<&str>::from(data).to_owned());
let icon = match data { let icon = match data {
GfxPower::Suspended => "asus_notif_blue", GfxPower::Suspended => "asus_notif_blue",
@@ -264,7 +295,7 @@ fn do_gpu_status_notif(message: &str, data: &GfxPower) -> Result<NotificationHan
GfxPower::Unknown => "gpu-integrated", GfxPower::Unknown => "gpu-integrated",
}; };
notif.icon(icon); notif.icon(icon);
Ok(Notification::show(&notif)?) notif
} }
fn do_gfx_action_notif(message: &str, action: GfxUserAction, mode: GpuMode) -> Result<()> { fn do_gfx_action_notif(message: &str, action: GfxUserAction, mode: GpuMode) -> Result<()> {
@@ -275,13 +306,12 @@ fn do_gfx_action_notif(message: &str, action: GfxUserAction, mode: GpuMode) -> R
let mut notif = Notification::new(); let mut notif = Notification::new();
notif notif
.summary(NOTIF_HEADER) .appname(NOTIF_HEADER)
.body(&format!("Changing to {mode}. {message}")) .summary(&format!("Changing to {mode}. {message}"))
.timeout(2000)
//.hint(Hint::Resident(true)) //.hint(Hint::Resident(true))
.hint(Hint::Category("device".into())) .hint(Hint::Category("device".into()))
.urgency(Urgency::Critical) .urgency(Urgency::Critical)
.timeout(-1) .timeout(Timeout::Never)
.icon("dialog-warning") .icon("dialog-warning")
.hint(Hint::Transient(true)); .hint(Hint::Transient(true));
+45 -16
View File
@@ -12,7 +12,7 @@ use std::time::Duration;
use betrayer::{Icon, Menu, MenuItem, TrayEvent, TrayIcon, TrayIconBuilder}; use betrayer::{Icon, Menu, MenuItem, TrayEvent, TrayIcon, TrayIconBuilder};
use log::{debug, error, info, warn}; use log::{debug, error, info, warn};
use rog_platform::platform::Properties; 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 supergfxctl::zbus_proxy::DaemonProxyBlocking as GfxProxy;
use versions::Versioning; use versions::Versioning;
@@ -71,7 +71,7 @@ fn build_menu() -> Menu<TrayAction> {
Menu::new([ Menu::new([
MenuItem::separator(), MenuItem::separator(),
MenuItem::button("Open", TrayAction::Open), 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>>` /// The tray is controlled somewhat by `Arc<Mutex<SystemState>>`
pub fn init_tray(_supported_properties: Vec<Properties>, config: Arc<Mutex<Config>>) { pub fn init_tray(_supported_properties: Vec<Properties>, config: Arc<Mutex<Config>>) {
std::thread::spawn(move || { std::thread::spawn(move || {
@@ -155,27 +169,30 @@ pub fn init_tray(_supported_properties: Vec<Properties>, config: Arc<Mutex<Confi
gpu_integrated, gpu_integrated,
}); });
let mut has_supergfx = true; let mut has_supergfx = false;
let conn = zbus::blocking::Connection::system().unwrap(); let conn = zbus::blocking::Connection::system().unwrap();
if let Ok(gfx_proxy) = GfxProxy::new(&conn) { if let Ok(gfx_proxy) = GfxProxy::new(&conn) {
let mut supergfx_active = false; match gfx_proxy.mode() {
if gfx_proxy.mode().is_ok() { Ok(_) => {
supergfx_active = true; has_supergfx = true;
if let Ok(version) = gfx_proxy.version() { if let Ok(version) = gfx_proxy.version() {
if let Some(version) = Versioning::new(&version) { if let Some(version) = Versioning::new(&version) {
let curr_gfx = Versioning::new("5.2.0").unwrap(); let curr_gfx = Versioning::new("5.2.0").unwrap();
warn!("supergfxd version = {version}"); warn!("supergfxd version = {version}");
if version < curr_gfx { if version < curr_gfx {
// Don't allow mode changing if too old a version // Don't allow mode changing if too old a version
warn!("supergfxd found but is too old to use"); warn!("supergfxd found but is too old to use");
has_supergfx = false; has_supergfx = false;
}
} }
} }
} }
}; Err(e) => warn!("Couldn't get mode form supergfxd: {e:?}"),
}
info!("Started ROGTray"); info!("Started ROGTray");
let mut last_power = GfxPower::Unknown; let mut last_power = GfxPower::Unknown;
let dev = find_dgpu();
loop { loop {
sleep(Duration::from_millis(1000)); sleep(Duration::from_millis(1000));
if let Ok(lock) = config.try_lock() { 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(mode) = gfx_proxy.mode() {
if let Ok(power) = gfx_proxy.power() { if let Ok(power) = gfx_proxy.power() {
if last_power != 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; 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;
}
}
} }
} }
} }
+31 -12
View File
@@ -1,7 +1,8 @@
use std::sync::{Arc, Mutex}; use std::sync::{Arc, Mutex};
use log::{error, info}; use log::{debug, error, info};
use rog_aura::keyboard::LaptopAuraPower; use rog_aura::keyboard::LaptopAuraPower;
use rog_aura::{AuraDeviceType, PowerZones};
use rog_dbus::zbus_aura::AuraProxy; use rog_dbus::zbus_aura::AuraProxy;
use slint::{ComponentHandle, Model, RgbaColor, SharedString}; use slint::{ComponentHandle, Model, RgbaColor, SharedString};
@@ -75,7 +76,7 @@ pub fn setup_aura_page(ui: &MainWindow, _states: Arc<Mutex<Config>>) {
tokio::spawn(async move { tokio::spawn(async move {
let Ok(aura) = find_aura_iface().await else { let Ok(aura) = find_aura_iface().await else {
info!("This device appears to have no aura interfaces"); info!("This device appears to have no aura interfaces");
return; return Ok::<(), zbus::Error>(());
}; };
set_ui_props_async!(handle, aura, AuraPageData, brightness); set_ui_props_async!(handle, aura, AuraPageData, brightness);
@@ -84,24 +85,40 @@ pub fn setup_aura_page(ui: &MainWindow, _states: Arc<Mutex<Config>>) {
set_ui_props_async!(handle, aura, AuraPageData, led_power); set_ui_props_async!(handle, aura, AuraPageData, led_power);
set_ui_props_async!(handle, aura, AuraPageData, device_type); set_ui_props_async!(handle, aura, AuraPageData, device_type);
if let Ok(pow3r) = aura.supported_power_zones().await { if let Ok(mut pow3r) = aura.supported_power_zones().await {
let dev_type = aura
.device_type()
.await
.unwrap_or(AuraDeviceType::LaptopPost2021);
log::debug!("Available LED power modes {pow3r:?}"); log::debug!("Available LED power modes {pow3r:?}");
handle handle
.upgrade_in_event_loop(move |handle| { .upgrade_in_event_loop(move |handle| {
let power: Vec<SlintPowerZones> = pow3r.iter().map(|p| (*p).into()).collect();
let names: Vec<SharedString> = handle let names: Vec<SharedString> = handle
.global::<AuraPageData>() .global::<AuraPageData>()
.get_power_zone_names() .get_power_zone_names()
.iter() .iter()
.collect(); .collect();
let names: Vec<SharedString> =
pow3r.iter().map(|n| names[(*n) as usize].clone()).collect(); if dev_type.is_old_laptop() {
handle // Need to add the specific KeyboardAndLightbar
.global::<AuraPageData>() if pow3r.contains(&PowerZones::Keyboard)
.set_supported_power_zones(power.as_slice().into()); && pow3r.contains(&PowerZones::Lightbar)
handle {
.global::<AuraPageData>() pow3r.push(PowerZones::KeyboardAndLightbar);
.set_power_zone_names_old(names.as_slice().into()); }
let names: Vec<SharedString> =
pow3r.iter().map(|n| names[(*n) as usize].clone()).collect();
handle
.global::<AuraPageData>()
.set_power_zone_names_old(names.as_slice().into());
} else {
let power: Vec<SlintPowerZones> =
pow3r.iter().map(|p| (*p).into()).collect();
handle
.global::<AuraPageData>()
.set_supported_power_zones(power.as_slice().into());
}
}) })
.ok(); .ok();
} }
@@ -209,5 +226,7 @@ pub fn setup_aura_page(ui: &MainWindow, _states: Arc<Mutex<Config>>) {
} }
} }
}); });
debug!("Aura setup tasks complete");
Ok(())
}); });
} }
@@ -2,7 +2,7 @@
msgid "" msgid ""
msgstr "" msgstr ""
"Project-Id-Version: PACKAGE VERSION\n" "Project-Id-Version: PACKAGE VERSION\n"
"POT-Creation-Date: 2024-05-14 05:08+0000\n" "POT-Creation-Date: 2024-06-09 00:20+0000\n"
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n" "Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
"Language-Team: LANGUAGE <LL@li.org>\n" "Language-Team: LANGUAGE <LL@li.org>\n"
@@ -137,61 +137,6 @@ msgctxt "PageAnime"
msgid "Off when on battery" msgid "Off when on battery"
msgstr "" 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 #: rog-control-center/ui/pages/app_settings.slint:26
msgctxt "PageAppSettings" msgctxt "PageAppSettings"
msgid "Run in background after closing" msgid "Run in background after closing"
@@ -257,6 +202,61 @@ msgctxt "PageAura"
msgid "Power Zones" msgid "Power Zones"
msgstr "" 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 #: rog-control-center/ui/pages/system.slint:26
msgctxt "SystemPageData" msgctxt "SystemPageData"
msgid "Balanced" msgid "Balanced"
@@ -334,37 +334,37 @@ msgstr ""
#: rog-control-center/ui/pages/system.slint:188 #: rog-control-center/ui/pages/system.slint:188
msgctxt "ppt_pl1_spl" msgctxt "ppt_pl1_spl"
msgid "ppt_pl1_spl" msgid "PL1, sustained power limit"
msgstr "" msgstr ""
#: rog-control-center/ui/pages/system.slint:198 #: rog-control-center/ui/pages/system.slint:198
msgctxt "ppt_pl2_sppt" msgctxt "ppt_pl2_sppt"
msgid "ppt_pl2_sppt" msgid "PL2, turbo power limit"
msgstr "" msgstr ""
#: rog-control-center/ui/pages/system.slint:208 #: rog-control-center/ui/pages/system.slint:208
msgctxt "ppt_fppt" msgctxt "ppt_fppt"
msgid "ppt_fppt" msgid "FPPT, Fast Power Limit"
msgstr "" msgstr ""
#: rog-control-center/ui/pages/system.slint:218 #: rog-control-center/ui/pages/system.slint:218
msgctxt "ppt_apu_sppt" msgctxt "ppt_apu_sppt"
msgid "ppt_apu_sppt" msgid "SPPT, APU slow power limit"
msgstr "" msgstr ""
#: rog-control-center/ui/pages/system.slint:228 #: rog-control-center/ui/pages/system.slint:228
msgctxt "ppt_platform_sppt" msgctxt "ppt_platform_sppt"
msgid "ppt_platform_sppt" msgid "Slow package power tracking limit"
msgstr "" msgstr ""
#: rog-control-center/ui/pages/system.slint:238 #: rog-control-center/ui/pages/system.slint:238
msgctxt "nv_dynamic_boost" msgctxt "nv_dynamic_boost"
msgid "nv_dynamic_boost" msgid "dGPU boost overclock"
msgstr "" msgstr ""
#: rog-control-center/ui/pages/system.slint:248 #: rog-control-center/ui/pages/system.slint:248
msgctxt "nv_temp_target" msgctxt "nv_temp_target"
msgid "nv_temp_target" msgid "dGPU temperature max"
msgstr "" msgstr ""
#: rog-control-center/ui/pages/system.slint:294 #: rog-control-center/ui/pages/system.slint:294
@@ -642,43 +642,43 @@ msgctxt "AuraPowerGroupOld"
msgid "Sleep" msgid "Sleep"
msgstr "" msgstr ""
#: rog-control-center/ui/main_window.slint:50 #: rog-control-center/ui/main_window.slint:51
msgctxt "MainWindow" msgctxt "MainWindow"
msgid "ROG" msgid "ROG"
msgstr "" msgstr ""
#: rog-control-center/ui/main_window.slint:52 #: rog-control-center/ui/main_window.slint:53
msgctxt "Menu1" msgctxt "Menu1"
msgid "System Control" msgid "System Control"
msgstr "" msgstr ""
#: rog-control-center/ui/main_window.slint:53 #: rog-control-center/ui/main_window.slint:54
msgctxt "Menu2" msgctxt "Menu2"
msgid "Keyboard Aura" msgid "Keyboard Aura"
msgstr "" msgstr ""
#: rog-control-center/ui/main_window.slint:54 #: rog-control-center/ui/main_window.slint:55
msgctxt "Menu3" msgctxt "Menu3"
msgid "AniMe Matrix" msgid "AniMe Matrix"
msgstr "" msgstr ""
#: rog-control-center/ui/main_window.slint:55 #: rog-control-center/ui/main_window.slint:56
msgctxt "Menu4" msgctxt "Menu4"
msgid "Fan Curves" msgid "Fan Curves"
msgstr "" msgstr ""
#: rog-control-center/ui/main_window.slint:56 #: rog-control-center/ui/main_window.slint:57
msgctxt "Menu5" msgctxt "Menu5"
msgid "App Settings" msgid "App Settings"
msgstr "" msgstr ""
#: rog-control-center/ui/main_window.slint:57 #: rog-control-center/ui/main_window.slint:58
msgctxt "Menu6" msgctxt "Menu6"
msgid "About" msgid "About"
msgstr "" msgstr ""
#: rog-control-center/ui/main_window.slint:69 #: rog-control-center/ui/main_window.slint:70
msgctxt "MainWindow" msgctxt "MainWindow"
msgid "Quit" msgid "Quit App"
msgstr "" msgstr ""
+37 -1
View File
@@ -5,6 +5,7 @@ import { SideBar } from "widgets/sidebar.slint";
import { PageAbout } from "pages/about.slint"; import { PageAbout } from "pages/about.slint";
import { PageFans } from "pages/fans.slint"; import { PageFans } from "pages/fans.slint";
import { PageAnime, AnimePageData } from "pages/anime.slint"; import { PageAnime, AnimePageData } from "pages/anime.slint";
import { RogItem } from "widgets/common.slint";
import { PageAura } from "pages/aura.slint"; import { PageAura } from "pages/aura.slint";
import { Node } from "widgets/graph.slint"; import { Node } from "widgets/graph.slint";
export { Node } export { Node }
@@ -66,7 +67,7 @@ export component MainWindow inherits Window {
Text { Text {
vertical-alignment: center; vertical-alignment: center;
horizontal-alignment: center; horizontal-alignment: center;
text: @tr("Quit"); text: @tr("Quit App");
} }
TouchArea { TouchArea {
@@ -178,4 +179,39 @@ export component MainWindow inherits Window {
} }
} }
} }
if SomeError.error_message != "": Rectangle {
x: 0px;
y: 0px;
width: root.width;
height: root.height;
padding: 10px;
background: Palette.background;
border-color: Palette.border;
border-width: 3px;
border-radius: 10px;
VerticalBox {
RogItem {
min-height: 50px;
max-height: 100px;
Text {
text <=> SomeError.error_message;
font-size: 18px;
}
}
Text {
text <=> SomeError.error_help;
horizontal-alignment: TextHorizontalAlignment.center;
vertical-alignment: TextVerticalAlignment.center;
}
}
}
}
export global SomeError {
in property <string> error_message: "";
in property <string> error_help: "";
} }
+7 -7
View File
@@ -185,7 +185,7 @@ export component PageSystem inherits Rectangle {
} }
if SystemPageData.available.ppt-pl1-spl: SystemSlider { 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; minimum: 5;
maximum: 250; maximum: 250;
value <=> SystemPageData.ppt_pl1_spl; value <=> SystemPageData.ppt_pl1_spl;
@@ -195,7 +195,7 @@ export component PageSystem inherits Rectangle {
} }
if SystemPageData.available.ppt-pl2-sppt: SystemSlider { 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; minimum: 5;
maximum: 250; maximum: 250;
value <=> SystemPageData.ppt_pl2_sppt; value <=> SystemPageData.ppt_pl2_sppt;
@@ -205,7 +205,7 @@ export component PageSystem inherits Rectangle {
} }
if SystemPageData.available.ppt-fppt: SystemSlider { if SystemPageData.available.ppt-fppt: SystemSlider {
text: @tr("ppt_fppt" => "ppt_fppt"); text: @tr("ppt_fppt" => "FPPT, Fast Power Limit");
minimum: 5; minimum: 5;
maximum: 250; maximum: 250;
value <=> SystemPageData.ppt_fppt; value <=> SystemPageData.ppt_fppt;
@@ -215,7 +215,7 @@ export component PageSystem inherits Rectangle {
} }
if SystemPageData.available.ppt-apu-sppt: SystemSlider { 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; minimum: 5;
maximum: 130; maximum: 130;
value <=> SystemPageData.ppt_apu_sppt; value <=> SystemPageData.ppt_apu_sppt;
@@ -225,7 +225,7 @@ export component PageSystem inherits Rectangle {
} }
if SystemPageData.available.ppt-platform-sppt: SystemSlider { 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; maximum: 130;
minimum: 5; minimum: 5;
value <=> SystemPageData.ppt_platform_sppt; value <=> SystemPageData.ppt_platform_sppt;
@@ -235,7 +235,7 @@ export component PageSystem inherits Rectangle {
} }
if SystemPageData.available.nv-dynamic-boost: SystemSlider { 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; minimum: 5;
maximum: 25; maximum: 25;
value <=> SystemPageData.nv_dynamic_boost; value <=> SystemPageData.nv_dynamic_boost;
@@ -245,7 +245,7 @@ export component PageSystem inherits Rectangle {
} }
if SystemPageData.available.nv-temp-target: SystemSlider { 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; minimum: 75;
maximum: 87; maximum: 87;
value <=> SystemPageData.nv_temp_target; value <=> SystemPageData.nv_temp_target;
+1 -1
View File
@@ -17,7 +17,7 @@ export component SystemSlider inherits RogItem {
callback released(int); callback released(int);
HorizontalLayout { HorizontalLayout {
HorizontalLayout { HorizontalLayout {
width: 30%; width: 50%;
alignment: LayoutAlignment.space-between; alignment: LayoutAlignment.space-between;
padding-left: 10px; padding-left: 10px;
Text { Text {
-1
View File
@@ -16,7 +16,6 @@ dbus = ["zbus"]
log.workspace = true log.workspace = true
udev.workspace = true udev.workspace = true
serde.workspace = true serde.workspace = true
serde_derive.workspace = true
typeshare.workspace = true typeshare.workspace = true
rog_platform = { path = "../rog-platform" } rog_platform = { path = "../rog-platform" }
+4 -3
View File
@@ -1,5 +1,5 @@
use log::trace; use log::{error, trace};
use serde_derive::{Deserialize, Serialize}; use serde::{Deserialize, Serialize};
use typeshare::typeshare; use typeshare::typeshare;
use udev::Device; use udev::Device;
#[cfg(feature = "dbus")] #[cfg(feature = "dbus")]
@@ -185,7 +185,8 @@ impl CurveData {
// Enable must be done *after* all points are written pwm3_enable // Enable must be done *after* all points are written pwm3_enable
device device
.set_attribute_value(format!("pwm{pwm_num}_enable"), enable.to_string()) .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(()) Ok(())
} }
} }
+1 -1
View File
@@ -5,7 +5,7 @@ use error::ProfileError;
use fan_curve_set::CurveData; use fan_curve_set::CurveData;
use log::debug; use log::debug;
use rog_platform::platform::ThrottlePolicy; use rog_platform::platform::ThrottlePolicy;
use serde_derive::{Deserialize, Serialize}; use serde::{Deserialize, Serialize};
use typeshare::typeshare; use typeshare::typeshare;
pub use udev::Device; pub use udev::Device;
#[cfg(feature = "dbus")] #[cfg(feature = "dbus")]
-1
View File
@@ -23,7 +23,6 @@ path = "src/lib.rs"
[dependencies] [dependencies]
serde.workspace = true serde.workspace = true
serde_derive.workspace = true
typeshare.workspace = true typeshare.workspace = true
zbus = { workspace = true, optional = true } zbus = { workspace = true, optional = true }
dmi_id = { path = "../dmi-id", optional = true } dmi_id = { path = "../dmi-id", optional = true }
+4 -3
View File
@@ -1,7 +1,7 @@
use std::fmt::Display; use std::fmt::Display;
use std::str::FromStr; use std::str::FromStr;
use serde_derive::{Deserialize, Serialize}; use serde::{Deserialize, Serialize};
use typeshare::typeshare; use typeshare::typeshare;
#[cfg(feature = "dbus")] #[cfg(feature = "dbus")]
use zbus::zvariant::Type; use zbus::zvariant::Type;
@@ -12,7 +12,7 @@ use crate::error::SlashError;
#[derive(Debug, Copy, Clone, PartialEq, Eq, Deserialize, Serialize)] #[derive(Debug, Copy, Clone, PartialEq, Eq, Deserialize, Serialize)]
pub enum SlashType { pub enum SlashType {
GA403, GA403,
Unknown, GA605,
Unsupported, Unsupported,
} }
@@ -22,7 +22,8 @@ impl FromStr for SlashType {
fn from_str(s: &str) -> std::result::Result<Self, Self::Err> { fn from_str(s: &str) -> std::result::Result<Self, Self::Err> {
Ok(match s { Ok(match s {
"ga403" | "GA403" => Self::GA403, "ga403" | "GA403" => Self::GA403,
_ => Self::Unknown, "ga605" | "GA605" => Self::GA605,
_ => Self::Unsupported,
}) })
} }
} }
+3 -1
View File
@@ -28,12 +28,14 @@ pub type SlashUsbPacket = [u8; PACKET_SIZE];
/// ///
/// The currently known USB device is `193B`. /// The currently known USB device is `193B`.
#[inline] #[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 dmi = DMIID::new().map_err(|_| SlashError::NoDevice)?; // TODO: better error
let board_name = dmi.board_name; let board_name = dmi.board_name;
if board_name.contains("GA403") { if board_name.contains("GA403") {
return Ok(SlashType::GA403); return Ok(SlashType::GA403);
} else if board_name.contains("GA605") {
return Ok(SlashType::GA605);
} }
Ok(SlashType::Unsupported) Ok(SlashType::Unsupported)
} }
+2 -2
View File
@@ -43,7 +43,7 @@ impl AniMatrix {
vertical: 2, vertical: 2,
horizontal: 5, horizontal: 5,
}, },
AnimeType::GA402 | AnimeType::Unknown => LedShape { AnimeType::GA402 | AnimeType::Unsupported => LedShape {
vertical: 2, vertical: 2,
horizontal: 5, horizontal: 5,
}, },
@@ -56,7 +56,7 @@ impl AniMatrix {
// Do a hard mapping of each (derived from wireshardk captures) // Do a hard mapping of each (derived from wireshardk captures)
let rows = match model { let rows = match model {
AnimeType::GA401 => GA401.to_vec(), AnimeType::GA401 => GA401.to_vec(),
AnimeType::GA402 | AnimeType::Unknown => GA402.to_vec(), AnimeType::GA402 | AnimeType::Unsupported => GA402.to_vec(),
AnimeType::GU604 => GU604.to_vec(), AnimeType::GU604 => GU604.to_vec(),
}; };