mirror of
https://gitlab.com/asus-linux/asusctl.git
synced 2026-02-06 00:15:04 +01:00
Compare commits
21 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 22e26adfb6 | |||
| 4730e645ba | |||
| d203fab70d | |||
| 792fae3ed7 | |||
| e443ab00c9 | |||
| aee54f5756 | |||
| 00904e9603 | |||
| b1212585e2 | |||
| faca084cff | |||
| 89dc0b3501 | |||
| ea988279a8 | |||
| 219bd559b6 | |||
| ad1ef9b8a2 | |||
| 59795c605c | |||
| a36ac2b6d3 | |||
| a20837f252 | |||
| 1353fe3fdb | |||
| 770bd12a5c | |||
| af2f5592f0 | |||
| 9686c41ac4 | |||
| 7122fbaca8 |
@@ -12,7 +12,7 @@ echo '+cargo clippy --all -- -D warnings'
|
||||
cargo clippy --all -- -D warnings
|
||||
|
||||
echo '+cargo test --all'
|
||||
cargo test --all --test-threads=1
|
||||
cargo test --all -- --test-threads=1
|
||||
|
||||
echo '+cargo cranky'
|
||||
cargo cranky
|
||||
|
||||
+1
-1
@@ -52,7 +52,7 @@ test:
|
||||
<<: *rust_cache
|
||||
script:
|
||||
- mkdir -p .git/hooks > /dev/null
|
||||
- cargo test --all --test-threads=1
|
||||
- cargo test --all -- --test-threads=1
|
||||
|
||||
release:
|
||||
only:
|
||||
|
||||
+29
-5
@@ -1,12 +1,36 @@
|
||||
# Changelog
|
||||
|
||||
All notable changes to this project will be documented in this file.
|
||||
|
||||
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
|
||||
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
|
||||
|
||||
## [Unreleased]
|
||||
|
||||
## [v6.0.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
|
||||
|
||||
Generated
+648
-206
File diff suppressed because it is too large
Load Diff
+4
-6
@@ -1,5 +1,5 @@
|
||||
[workspace.package]
|
||||
version = "6.0.8"
|
||||
version = "6.0.10"
|
||||
rust-version = "1.77"
|
||||
license = "MPL-2.0"
|
||||
readme = "README.md"
|
||||
@@ -47,8 +47,8 @@ dirs = "^4.0"
|
||||
smol = "^1.3"
|
||||
mio = "0.8.11"
|
||||
|
||||
zbus = "4.1"
|
||||
logind-zbus = { version = "4.0.2" } #, default-features = false, features = ["non_blocking"] }
|
||||
zbus = "4.2"
|
||||
logind-zbus = { version = "4.0.3" } #, default-features = false, features = ["non_blocking"] }
|
||||
|
||||
serde = "^1.0"
|
||||
serde_derive = "^1.0"
|
||||
@@ -71,9 +71,7 @@ gif = "^0.12.0"
|
||||
|
||||
versions = "6.2"
|
||||
|
||||
notify-rust = { git = "https://github.com/flukejones/notify-rust.git", rev = "54176413b81189a3e4edbdc20a0b4f7e2e35c063", default-features = false, features = [
|
||||
"z",
|
||||
] }
|
||||
notify-rust = { version = "4.11.0", features = ["z", "async"] }
|
||||
|
||||
[profile.release]
|
||||
# thin = 57s, asusd = 9.0M
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
VERSION := $(shell /usr/bin/grep -Pm1 'version = "(\d.\d.\d)"' Cargo.toml | cut -d'"' -f2)
|
||||
VERSION := $(shell /usr/bin/grep -Pm1 'version = "(\d+.\d+.\d+)"' Cargo.toml | cut -d'"' -f2)
|
||||
|
||||
INSTALL = install
|
||||
INSTALL_PROGRAM = ${INSTALL} -D -m 0755
|
||||
|
||||
@@ -3,7 +3,7 @@ use std::error::Error;
|
||||
use std::path::Path;
|
||||
use std::process::exit;
|
||||
|
||||
use rog_anime::usb::get_anime_type;
|
||||
use rog_anime::usb::get_maybe_anime_type;
|
||||
use rog_anime::{AnimeDiagonal, AnimeType};
|
||||
use rog_dbus::zbus_anime::AnimeProxyBlocking;
|
||||
use zbus::blocking::Connection;
|
||||
@@ -26,7 +26,7 @@ fn main() -> Result<(), Box<dyn Error>> {
|
||||
AnimeType::GA401,
|
||||
)?;
|
||||
|
||||
let anime_type = get_anime_type()?;
|
||||
let anime_type = get_maybe_anime_type()?;
|
||||
|
||||
proxy.write(matrix.into_data_buffer(anime_type)?).unwrap();
|
||||
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
use std::thread::sleep;
|
||||
use std::time::Duration;
|
||||
|
||||
use rog_anime::usb::get_anime_type;
|
||||
use rog_anime::usb::get_maybe_anime_type;
|
||||
use rog_anime::{AnimeDiagonal, AnimeType};
|
||||
use rog_dbus::zbus_anime::AnimeProxyBlocking;
|
||||
use zbus::blocking::Connection;
|
||||
@@ -29,7 +29,7 @@ fn main() {
|
||||
}
|
||||
}
|
||||
|
||||
let anime_type = get_anime_type().unwrap();
|
||||
let anime_type = get_maybe_anime_type().unwrap();
|
||||
proxy
|
||||
.write(matrix.into_data_buffer(anime_type).unwrap())
|
||||
.unwrap();
|
||||
|
||||
@@ -2,7 +2,7 @@ use std::env;
|
||||
use std::path::Path;
|
||||
use std::thread::sleep;
|
||||
|
||||
use rog_anime::usb::get_anime_type;
|
||||
use rog_anime::usb::get_maybe_anime_type;
|
||||
use rog_anime::{ActionData, ActionLoader, Sequences};
|
||||
use rog_dbus::zbus_anime::AnimeProxyBlocking;
|
||||
use zbus::blocking::Connection;
|
||||
@@ -19,7 +19,7 @@ fn main() {
|
||||
|
||||
let path = Path::new(&args[1]);
|
||||
let brightness = args[2].parse::<f32>().unwrap();
|
||||
let anime_type = get_anime_type().unwrap();
|
||||
let anime_type = get_maybe_anime_type().unwrap();
|
||||
let mut seq = Sequences::new(anime_type);
|
||||
seq.insert(
|
||||
0,
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
use std::convert::TryFrom;
|
||||
|
||||
use rog_anime::usb::get_anime_type;
|
||||
use rog_anime::usb::get_maybe_anime_type;
|
||||
use rog_anime::{AnimeDataBuffer, AnimeGrid};
|
||||
use rog_dbus::zbus_anime::AnimeProxyBlocking;
|
||||
use zbus::blocking::Connection;
|
||||
@@ -14,7 +14,7 @@ fn main() {
|
||||
let conn = Connection::system().unwrap();
|
||||
let proxy = AnimeProxyBlocking::new(&conn).unwrap();
|
||||
|
||||
let anime_type = get_anime_type().unwrap();
|
||||
let anime_type = get_maybe_anime_type().unwrap();
|
||||
let mut matrix = AnimeGrid::new(anime_type);
|
||||
let tmp = matrix.get_mut();
|
||||
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
use rog_anime::usb::get_anime_type;
|
||||
use rog_anime::usb::get_maybe_anime_type;
|
||||
use rog_anime::AnimeDataBuffer;
|
||||
use rog_dbus::zbus_anime::AnimeProxyBlocking;
|
||||
use zbus::blocking::Connection;
|
||||
@@ -9,7 +9,7 @@ use zbus::blocking::Connection;
|
||||
fn main() {
|
||||
let conn = Connection::system().unwrap();
|
||||
let proxy = AnimeProxyBlocking::new(&conn).unwrap();
|
||||
let anime_type = get_anime_type().unwrap();
|
||||
let anime_type = get_maybe_anime_type().unwrap();
|
||||
let mut matrix = AnimeDataBuffer::new(anime_type);
|
||||
matrix.data_mut()[1] = 100; // start = 1
|
||||
for n in matrix.data_mut()[2..32].iter_mut() {
|
||||
|
||||
@@ -4,7 +4,7 @@ use std::error::Error;
|
||||
use std::path::Path;
|
||||
use std::process::exit;
|
||||
|
||||
use rog_anime::usb::get_anime_type;
|
||||
use rog_anime::usb::get_maybe_anime_type;
|
||||
use rog_anime::{AnimeDataBuffer, AnimeImage, Vec2};
|
||||
use rog_dbus::zbus_anime::AnimeProxyBlocking;
|
||||
use zbus::blocking::Connection;
|
||||
@@ -20,7 +20,7 @@ fn main() -> Result<(), Box<dyn Error>> {
|
||||
exit(-1);
|
||||
}
|
||||
|
||||
let anime_type = get_anime_type()?;
|
||||
let anime_type = get_maybe_anime_type()?;
|
||||
let matrix = AnimeImage::from_png(
|
||||
Path::new(&args[1]),
|
||||
args[2].parse::<f32>().unwrap(),
|
||||
|
||||
@@ -7,7 +7,7 @@ use std::process::exit;
|
||||
use std::thread::sleep;
|
||||
use std::time::Duration;
|
||||
|
||||
use rog_anime::usb::get_anime_type;
|
||||
use rog_anime::usb::get_maybe_anime_type;
|
||||
use rog_anime::{AnimeDataBuffer, AnimeImage, Vec2};
|
||||
use rog_dbus::zbus_anime::AnimeProxyBlocking;
|
||||
use zbus::blocking::Connection;
|
||||
@@ -23,7 +23,7 @@ fn main() -> Result<(), Box<dyn Error>> {
|
||||
exit(-1);
|
||||
}
|
||||
|
||||
let anime_type = get_anime_type()?;
|
||||
let anime_type = get_maybe_anime_type()?;
|
||||
let mut matrix = AnimeImage::from_png(
|
||||
Path::new(&args[1]),
|
||||
args[2].parse::<f32>().unwrap(),
|
||||
|
||||
+5
-4
@@ -9,7 +9,7 @@ use aura_cli::{LedPowerCommand1, LedPowerCommand2};
|
||||
use dmi_id::DMIID;
|
||||
use fan_curve_cli::FanCurveCommand;
|
||||
use gumdrop::{Opt, Options};
|
||||
use rog_anime::usb::get_anime_type;
|
||||
use rog_anime::usb::get_maybe_anime_type;
|
||||
use rog_anime::{AnimTime, AnimeDataBuffer, AnimeDiagonal, AnimeGif, AnimeImage, AnimeType, Vec2};
|
||||
use rog_aura::keyboard::{AuraPowerState, LaptopAuraPower};
|
||||
use rog_aura::{self, AuraDeviceType, AuraEffect, PowerZones};
|
||||
@@ -36,6 +36,8 @@ mod fan_curve_cli;
|
||||
mod slash_cli;
|
||||
|
||||
fn main() {
|
||||
let self_version = env!("CARGO_PKG_VERSION");
|
||||
println!("Starting version {self_version}");
|
||||
let args: Vec<String> = args().skip(1).collect();
|
||||
|
||||
let missing_argument_k = gumdrop::Error::missing_argument(Opt::Short('k'));
|
||||
@@ -57,7 +59,6 @@ fn main() {
|
||||
println!("\nError: {e}\n");
|
||||
print_info();
|
||||
}) {
|
||||
let self_version = env!("CARGO_PKG_VERSION");
|
||||
let asusd_version = platform_proxy.version().unwrap();
|
||||
if asusd_version != self_version {
|
||||
println!("Version mismatch: asusctl = {self_version}, asusd = {asusd_version}");
|
||||
@@ -364,8 +365,8 @@ fn handle_anime(conn: &Connection, cmd: &AnimeCommand) -> Result<(), Box<dyn std
|
||||
println!("Did Alice _really_ make it back from Wonderland?");
|
||||
}
|
||||
|
||||
let mut anime_type = get_anime_type()?;
|
||||
if let AnimeType::Unknown = anime_type {
|
||||
let mut anime_type = get_maybe_anime_type()?;
|
||||
if let AnimeType::Unsupported = anime_type {
|
||||
if let Some(model) = cmd.override_type {
|
||||
anime_type = model;
|
||||
}
|
||||
|
||||
@@ -6,7 +6,7 @@ use std::sync::{Arc, Mutex};
|
||||
use asusd_user::config::*;
|
||||
use asusd_user::ctrl_anime::{CtrlAnime, CtrlAnimeInner};
|
||||
use config_traits::{StdConfig, StdConfigLoad};
|
||||
use rog_anime::usb::get_anime_type;
|
||||
use rog_anime::usb::get_maybe_anime_type;
|
||||
use rog_aura::aura_detection::LedSupportData;
|
||||
use rog_aura::keyboard::KeyLayout;
|
||||
use rog_dbus::zbus_anime::AnimeProxyBlocking;
|
||||
@@ -44,7 +44,7 @@ fn main() -> Result<(), Box<dyn std::error::Error>> {
|
||||
// Set up the anime data and run loop/thread
|
||||
if supported.contains(&"org.asuslinux.Anime".to_string()) {
|
||||
if let Some(cfg) = config.active_anime {
|
||||
let anime_type = get_anime_type()?;
|
||||
let anime_type = get_maybe_anime_type()?;
|
||||
let anime_config = ConfigAnime::new().set_name(cfg).load();
|
||||
let anime = anime_config.create(anime_type)?;
|
||||
let anime_config = Arc::new(Mutex::new(anime_config));
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
use std::time::Duration;
|
||||
|
||||
use config_traits::{StdConfig, StdConfigLoad2};
|
||||
use config_traits::{StdConfig, StdConfigLoad};
|
||||
use rog_anime::error::AnimeError;
|
||||
use rog_anime::usb::Brightness;
|
||||
use rog_anime::{
|
||||
@@ -10,60 +10,6 @@ use serde_derive::{Deserialize, Serialize};
|
||||
|
||||
const CONFIG_FILE: &str = "anime.ron";
|
||||
|
||||
#[derive(Deserialize, Serialize)]
|
||||
pub struct AnimeConfigV460 {
|
||||
pub system: Vec<ActionLoader>,
|
||||
pub boot: Vec<ActionLoader>,
|
||||
pub wake: Vec<ActionLoader>,
|
||||
pub sleep: Vec<ActionLoader>,
|
||||
pub shutdown: Vec<ActionLoader>,
|
||||
pub brightness: f32,
|
||||
}
|
||||
|
||||
impl From<AnimeConfigV460> for AnimeConfig {
|
||||
fn from(c: AnimeConfigV460) -> AnimeConfig {
|
||||
AnimeConfig {
|
||||
system: c.system,
|
||||
boot: c.boot,
|
||||
wake: c.wake,
|
||||
shutdown: c.shutdown,
|
||||
..Default::default()
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#[derive(Deserialize, Serialize, Debug)]
|
||||
pub struct AnimeConfigV472 {
|
||||
pub model_override: Option<AnimeType>,
|
||||
pub system: Vec<ActionLoader>,
|
||||
pub boot: Vec<ActionLoader>,
|
||||
pub wake: Vec<ActionLoader>,
|
||||
pub sleep: Vec<ActionLoader>,
|
||||
pub shutdown: Vec<ActionLoader>,
|
||||
pub brightness: f32,
|
||||
pub display_enabled: bool,
|
||||
pub display_brightness: Brightness,
|
||||
pub builtin_anims_enabled: bool,
|
||||
pub builtin_anims: Animations,
|
||||
}
|
||||
|
||||
impl From<AnimeConfigV472> for AnimeConfig {
|
||||
fn from(c: AnimeConfigV472) -> AnimeConfig {
|
||||
AnimeConfig {
|
||||
system: c.system,
|
||||
boot: c.boot,
|
||||
wake: c.wake,
|
||||
shutdown: c.shutdown,
|
||||
model_override: c.model_override,
|
||||
display_enabled: c.display_enabled,
|
||||
display_brightness: c.display_brightness,
|
||||
builtin_anims_enabled: c.builtin_anims_enabled,
|
||||
builtin_anims: c.builtin_anims,
|
||||
..Default::default()
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#[derive(Deserialize, Serialize, Default)]
|
||||
pub struct AnimeConfigCached {
|
||||
pub system: Vec<ActionData>,
|
||||
@@ -108,7 +54,6 @@ impl AnimeConfigCached {
|
||||
/// Config for base system actions for the anime display
|
||||
#[derive(Deserialize, Serialize, Debug, Clone)]
|
||||
pub struct AnimeConfig {
|
||||
pub model_override: Option<AnimeType>,
|
||||
pub system: Vec<ActionLoader>,
|
||||
pub boot: Vec<ActionLoader>,
|
||||
pub wake: Vec<ActionLoader>,
|
||||
@@ -127,7 +72,6 @@ pub struct AnimeConfig {
|
||||
impl Default for AnimeConfig {
|
||||
fn default() -> Self {
|
||||
AnimeConfig {
|
||||
model_override: None,
|
||||
system: Vec::new(),
|
||||
boot: Vec::new(),
|
||||
wake: Vec::new(),
|
||||
@@ -159,7 +103,7 @@ impl StdConfig for AnimeConfig {
|
||||
}
|
||||
}
|
||||
|
||||
impl StdConfigLoad2<AnimeConfigV460, AnimeConfigV472> for AnimeConfig {}
|
||||
impl StdConfigLoad for AnimeConfig {}
|
||||
|
||||
impl From<&AnimeConfig> for DeviceState {
|
||||
fn from(config: &AnimeConfig) -> Self {
|
||||
|
||||
+15
-11
@@ -8,11 +8,11 @@ use std::sync::Arc;
|
||||
use std::thread::sleep;
|
||||
|
||||
use ::zbus::export::futures_util::lock::Mutex;
|
||||
use config_traits::{StdConfig, StdConfigLoad2};
|
||||
use config_traits::{StdConfig, StdConfigLoad};
|
||||
use log::{error, info, warn};
|
||||
use rog_anime::error::AnimeError;
|
||||
use rog_anime::usb::{
|
||||
get_anime_type, pkt_flush, pkt_set_brightness, pkt_set_enable_display,
|
||||
get_maybe_anime_type, pkt_flush, pkt_set_brightness, pkt_set_enable_display,
|
||||
pkt_set_enable_powersave_anim, pkts_for_init, Brightness,
|
||||
};
|
||||
use rog_anime::{ActionData, AnimeDataBuffer, AnimePacketType, AnimeType};
|
||||
@@ -64,6 +64,12 @@ pub struct CtrlAnime {
|
||||
impl CtrlAnime {
|
||||
#[inline]
|
||||
pub fn new() -> Result<CtrlAnime, RogError> {
|
||||
let anime_type = get_maybe_anime_type()?;
|
||||
if matches!(anime_type, AnimeType::Unsupported) {
|
||||
info!("No Anime Matrix capable laptop found");
|
||||
return Err(RogError::Anime(AnimeError::NoDevice));
|
||||
}
|
||||
|
||||
let usb = USBRaw::new(0x193b).ok();
|
||||
let hid = HidRaw::new("193b").ok();
|
||||
let node = if usb.is_some() {
|
||||
@@ -90,18 +96,16 @@ impl CtrlAnime {
|
||||
// }
|
||||
// }
|
||||
|
||||
let config = AnimeConfig::new().load();
|
||||
let mut anime_type = get_anime_type()?;
|
||||
if let AnimeType::Unknown = anime_type {
|
||||
if let Some(model) = config.model_override {
|
||||
warn!("Overriding the Animatrix type as {model:?}");
|
||||
anime_type = model;
|
||||
}
|
||||
}
|
||||
let mut config = AnimeConfig::new().load();
|
||||
|
||||
info!("Device has an AniMe Matrix display: {anime_type:?}");
|
||||
let mut cache = AnimeConfigCached::default();
|
||||
cache.init_from_config(&config, anime_type)?;
|
||||
if let Err(e) = cache.init_from_config(&config, anime_type) {
|
||||
error!("Trying to cache the Anime Config failed, will reset to default config: {e:?}");
|
||||
config.rename_file_old();
|
||||
config = AnimeConfig::new();
|
||||
config.write();
|
||||
}
|
||||
|
||||
let ctrl = CtrlAnime {
|
||||
node,
|
||||
|
||||
@@ -9,6 +9,8 @@ use rog_aura::{
|
||||
};
|
||||
use serde_derive::{Deserialize, Serialize};
|
||||
|
||||
use crate::error::RogError;
|
||||
|
||||
#[derive(Deserialize, Serialize, Default, Debug, Clone)]
|
||||
// #[serde(default)]
|
||||
pub struct AuraConfig {
|
||||
@@ -130,6 +132,37 @@ impl AuraConfig {
|
||||
}
|
||||
None
|
||||
}
|
||||
|
||||
/// Create a default for the `current_mode` if multizone and no config
|
||||
/// exists.
|
||||
pub(super) fn create_multizone_default(
|
||||
&mut self,
|
||||
supported_data: &LedSupportData,
|
||||
) -> Result<(), RogError> {
|
||||
let mut default = vec![];
|
||||
for (i, tmp) in supported_data.basic_zones.iter().enumerate() {
|
||||
default.push(AuraEffect {
|
||||
mode: self.current_mode,
|
||||
zone: *tmp,
|
||||
colour1: *GRADIENT.get(i).unwrap_or(&GRADIENT[0]),
|
||||
colour2: *GRADIENT.get(GRADIENT.len() - i).unwrap_or(&GRADIENT[6]),
|
||||
speed: Speed::Med,
|
||||
direction: Direction::Left,
|
||||
});
|
||||
}
|
||||
if default.is_empty() {
|
||||
return Err(RogError::AuraEffectNotSupported);
|
||||
}
|
||||
|
||||
if let Some(multizones) = self.multizone.as_mut() {
|
||||
multizones.insert(self.current_mode, default);
|
||||
} else {
|
||||
let mut tmp = BTreeMap::new();
|
||||
tmp.insert(self.current_mode, default);
|
||||
self.multizone = Some(tmp);
|
||||
}
|
||||
Ok(())
|
||||
}
|
||||
}
|
||||
|
||||
#[cfg(test)]
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
use std::collections::{BTreeMap, HashSet};
|
||||
use std::collections::HashSet;
|
||||
|
||||
use config_traits::{StdConfig, StdConfigLoad};
|
||||
use dmi_id::DMIID;
|
||||
@@ -7,9 +7,7 @@ use log::{debug, info, warn};
|
||||
use rog_aura::aura_detection::LedSupportData;
|
||||
use rog_aura::keyboard::{LedUsbPackets, UsbPackets};
|
||||
use rog_aura::usb::{LED_APPLY, LED_SET};
|
||||
use rog_aura::{
|
||||
AuraDeviceType, AuraEffect, Direction, LedBrightness, Speed, GRADIENT, LED_MSG_LEN,
|
||||
};
|
||||
use rog_aura::{AuraDeviceType, AuraEffect, LedBrightness, LED_MSG_LEN};
|
||||
use rog_platform::hid_raw::HidRaw;
|
||||
use rog_platform::keyboard_led::KeyboardBacklight;
|
||||
use udev::Device;
|
||||
@@ -180,7 +178,7 @@ impl CtrlKbdLed {
|
||||
info!("AuraControl found device at: {:?}", dev_node);
|
||||
let dev = HidRaw::from_device(device)?;
|
||||
let mut controller = Self::from_hidraw(dev, dbus_path.clone())?;
|
||||
controller.config = Self::init_config(&prod_id);
|
||||
controller.config = Self::load_and_update_config(&prod_id);
|
||||
interfaces.insert(dbus_path);
|
||||
return Ok(Some(controller));
|
||||
}
|
||||
@@ -225,7 +223,7 @@ impl CtrlKbdLed {
|
||||
led_node: LEDNode::KbdLed(kbd_backlight),
|
||||
supported_data: LedSupportData::get_data("tuf"),
|
||||
per_key_mode_active: false,
|
||||
config: Self::init_config("tuf"),
|
||||
config: Self::load_and_update_config("tuf"),
|
||||
dbus_path: dbus_path_for_tuf(),
|
||||
};
|
||||
devices.push(ctrl);
|
||||
@@ -244,7 +242,7 @@ impl CtrlKbdLed {
|
||||
/// The generated data from this function has a default config. This config
|
||||
/// should be overwritten. The reason for the default config is because
|
||||
/// of async issues between this and udev/hidraw
|
||||
pub fn from_hidraw(device: HidRaw, dbus_path: OwnedObjectPath) -> Result<Self, RogError> {
|
||||
fn from_hidraw(device: HidRaw, dbus_path: OwnedObjectPath) -> Result<Self, RogError> {
|
||||
let rgb_led = KeyboardBacklight::new()
|
||||
.map_err(|e| {
|
||||
log::error!(
|
||||
@@ -274,7 +272,8 @@ impl CtrlKbdLed {
|
||||
Ok(ctrl)
|
||||
}
|
||||
|
||||
pub fn init_config(prod_id: &str) -> AuraConfig {
|
||||
/// Reload the config from disk then verify and update it if required
|
||||
fn load_and_update_config(prod_id: &str) -> AuraConfig {
|
||||
// New loads data from the DB also
|
||||
let mut config_init = AuraConfig::new(prod_id);
|
||||
// config_init.set_filename(prod_id);
|
||||
@@ -289,6 +288,12 @@ impl CtrlKbdLed {
|
||||
// Then replace just incase the initialised data contains new modes added
|
||||
config_loaded.builtins = config_init.builtins;
|
||||
|
||||
// Check the powerzones and replace, if the len is different then the support
|
||||
// file was updated
|
||||
if config_loaded.enabled.states.len() != config_init.enabled.states.len() {
|
||||
config_loaded.enabled.states = config_init.enabled.states;
|
||||
}
|
||||
|
||||
if let (Some(mut multizone_init), Some(multizone_loaded)) =
|
||||
(config_init.multizone, config_loaded.multizone.as_mut())
|
||||
{
|
||||
@@ -374,7 +379,8 @@ impl CtrlKbdLed {
|
||||
Ok(())
|
||||
}
|
||||
|
||||
pub fn write_mode(&mut self, mode: &AuraEffect) -> Result<(), RogError> {
|
||||
/// Write the AuraEffect to the device
|
||||
pub fn write_effect_and_apply(&mut self, mode: &AuraEffect) -> Result<(), RogError> {
|
||||
if let LEDNode::KbdLed(platform) = &self.led_node {
|
||||
let buf = [
|
||||
1,
|
||||
@@ -414,53 +420,25 @@ impl CtrlKbdLed {
|
||||
}
|
||||
if create {
|
||||
info!("No user-set config for zone founding, attempting a default");
|
||||
self.create_multizone_default()?;
|
||||
self.config.create_multizone_default(&self.supported_data)?;
|
||||
}
|
||||
|
||||
if let Some(multizones) = self.config.multizone.as_mut() {
|
||||
if let Some(set) = multizones.get(&mode) {
|
||||
for mode in set.clone() {
|
||||
self.write_mode(&mode)?;
|
||||
self.write_effect_and_apply(&mode)?;
|
||||
}
|
||||
}
|
||||
}
|
||||
} else {
|
||||
let mode = self.config.current_mode;
|
||||
if let Some(effect) = self.config.builtins.get(&mode).cloned() {
|
||||
self.write_mode(&effect)?;
|
||||
self.write_effect_and_apply(&effect)?;
|
||||
}
|
||||
}
|
||||
|
||||
Ok(())
|
||||
}
|
||||
|
||||
/// Create a default for the `current_mode` if multizone and no config
|
||||
/// exists.
|
||||
fn create_multizone_default(&mut self) -> Result<(), RogError> {
|
||||
let mut default = vec![];
|
||||
for (i, tmp) in self.supported_data.basic_zones.iter().enumerate() {
|
||||
default.push(AuraEffect {
|
||||
mode: self.config.current_mode,
|
||||
zone: *tmp,
|
||||
colour1: *GRADIENT.get(i).unwrap_or(&GRADIENT[0]),
|
||||
colour2: *GRADIENT.get(GRADIENT.len() - i).unwrap_or(&GRADIENT[6]),
|
||||
speed: Speed::Med,
|
||||
direction: Direction::Left,
|
||||
});
|
||||
}
|
||||
if default.is_empty() {
|
||||
return Err(RogError::AuraEffectNotSupported);
|
||||
}
|
||||
|
||||
if let Some(multizones) = self.config.multizone.as_mut() {
|
||||
multizones.insert(self.config.current_mode, default);
|
||||
} else {
|
||||
let mut tmp = BTreeMap::new();
|
||||
tmp.insert(self.config.current_mode, default);
|
||||
self.config.multizone = Some(tmp);
|
||||
}
|
||||
Ok(())
|
||||
}
|
||||
}
|
||||
|
||||
#[cfg(test)]
|
||||
@@ -502,12 +480,18 @@ mod tests {
|
||||
};
|
||||
|
||||
assert!(controller.config.multizone.is_none());
|
||||
assert!(controller.create_multizone_default().is_err());
|
||||
assert!(controller
|
||||
.config
|
||||
.create_multizone_default(&controller.supported_data)
|
||||
.is_err());
|
||||
assert!(controller.config.multizone.is_none());
|
||||
|
||||
controller.supported_data.basic_zones.push(AuraZone::Key1);
|
||||
controller.supported_data.basic_zones.push(AuraZone::Key2);
|
||||
assert!(controller.create_multizone_default().is_ok());
|
||||
assert!(controller
|
||||
.config
|
||||
.create_multizone_default(&controller.supported_data)
|
||||
.is_ok());
|
||||
assert!(controller.config.multizone.is_some());
|
||||
|
||||
let m = controller.config.multizone.unwrap();
|
||||
|
||||
@@ -146,7 +146,7 @@ impl CtrlAuraZbus {
|
||||
)));
|
||||
}
|
||||
|
||||
ctrl.write_mode(&effect)?;
|
||||
ctrl.write_effect_and_apply(&effect)?;
|
||||
if ctrl.config.brightness == LedBrightness::Off {
|
||||
ctrl.config.brightness = LedBrightness::Med;
|
||||
}
|
||||
|
||||
@@ -2,10 +2,11 @@ pub mod config;
|
||||
pub mod trait_impls;
|
||||
|
||||
use config_traits::{StdConfig, StdConfigLoad};
|
||||
use log::info;
|
||||
use rog_platform::hid_raw::HidRaw;
|
||||
use rog_platform::usb_raw::USBRaw;
|
||||
use rog_slash::error::SlashError;
|
||||
use rog_slash::usb::{get_slash_type, pkt_set_mode, pkt_set_options, pkts_for_init};
|
||||
use rog_slash::usb::{get_maybe_slash_type, pkt_set_mode, pkt_set_options, pkts_for_init};
|
||||
use rog_slash::{SlashMode, SlashType};
|
||||
|
||||
use crate::ctrl_slash::config::SlashConfig;
|
||||
@@ -39,8 +40,9 @@ pub struct CtrlSlash {
|
||||
impl CtrlSlash {
|
||||
#[inline]
|
||||
pub fn new() -> Result<CtrlSlash, RogError> {
|
||||
let slash_type = get_slash_type()?;
|
||||
if matches!(slash_type, SlashType::Unknown | SlashType::Unsupported) {
|
||||
let slash_type = get_maybe_slash_type()?;
|
||||
if matches!(slash_type, SlashType::Unsupported) {
|
||||
info!("No Slash capable laptop found");
|
||||
return Err(RogError::Slash(SlashError::NoDevice));
|
||||
}
|
||||
|
||||
@@ -51,7 +53,7 @@ impl CtrlSlash {
|
||||
} else if hid.is_some() {
|
||||
unsafe { Node::Hid(hid.unwrap_unchecked()) }
|
||||
} else {
|
||||
return Err(RogError::NotSupported);
|
||||
return Err(RogError::Slash(SlashError::NoDevice));
|
||||
};
|
||||
|
||||
let ctrl = CtrlSlash {
|
||||
|
||||
@@ -146,11 +146,7 @@ where
|
||||
|
||||
/// Renames the existing file to `<file>-old`
|
||||
fn rename_file_old(&self) {
|
||||
warn!(
|
||||
"Renaming {} to {}-old and recreating config",
|
||||
self.file_name(),
|
||||
self.file_name()
|
||||
);
|
||||
warn!("Renaming {} to {}-old", self.file_name(), self.file_name());
|
||||
let mut cfg_old = self.file_path().to_string_lossy().to_string();
|
||||
cfg_old.push_str("-old");
|
||||
std::fs::rename(self.file_path(), cfg_old).unwrap_or_else(|err| {
|
||||
|
||||
@@ -7,6 +7,7 @@ ENV{DMI_FAMILY}=="*ROG*", GOTO="asusd_start"
|
||||
ENV{DMI_FAMILY}=="*Zephyrus*", GOTO="asusd_start"
|
||||
ENV{DMI_FAMILY}=="*Strix*", GOTO="asusd_start"
|
||||
ENV{DMI_FAMILY}=="*Vivo*ook*", GOTO="asusd_start"
|
||||
ENV{DMI_FAMILY}=="*Zenbook*", GOTO="asusd_start"
|
||||
# No match so
|
||||
GOTO="asusd_end"
|
||||
|
||||
|
||||
@@ -62,7 +62,7 @@ pub enum AnimeType {
|
||||
GA401,
|
||||
GA402,
|
||||
GU604,
|
||||
Unknown,
|
||||
Unsupported,
|
||||
}
|
||||
|
||||
impl FromStr for AnimeType {
|
||||
@@ -73,7 +73,7 @@ impl FromStr for AnimeType {
|
||||
"ga401" | "GA401" => Self::GA401,
|
||||
"ga402" | "GA402" => Self::GA402,
|
||||
"gu604" | "GU604" => Self::GU604,
|
||||
_ => Self::Unknown,
|
||||
_ => Self::Unsupported,
|
||||
})
|
||||
}
|
||||
}
|
||||
@@ -165,7 +165,7 @@ impl TryFrom<AnimeDataBuffer> for AnimePacketType {
|
||||
|
||||
let mut buffers = match anime.anime {
|
||||
AnimeType::GA401 => vec![[0; 640]; 2],
|
||||
AnimeType::GA402 | AnimeType::GU604 | AnimeType::Unknown => vec![[0; 640]; 3],
|
||||
AnimeType::GA402 | AnimeType::GU604 | AnimeType::Unsupported => vec![[0; 640]; 3],
|
||||
};
|
||||
|
||||
for (idx, chunk) in anime.data.as_slice().chunks(PANE_LEN).enumerate() {
|
||||
@@ -176,7 +176,7 @@ impl TryFrom<AnimeDataBuffer> for AnimePacketType {
|
||||
|
||||
if matches!(
|
||||
anime.anime,
|
||||
AnimeType::GA402 | AnimeType::GU604 | AnimeType::Unknown
|
||||
AnimeType::GA402 | AnimeType::GU604 | AnimeType::Unsupported
|
||||
) {
|
||||
buffers[2][..7].copy_from_slice(&USB_PREFIX3);
|
||||
}
|
||||
|
||||
@@ -3,6 +3,8 @@
|
||||
use std::path::Path;
|
||||
use std::time::Duration;
|
||||
|
||||
use log::error;
|
||||
|
||||
use crate::data::AnimeDataBuffer;
|
||||
use crate::error::{AnimeError, Result};
|
||||
use crate::AnimeType;
|
||||
@@ -49,7 +51,10 @@ impl AnimeDiagonal {
|
||||
bright: f32,
|
||||
anime_type: AnimeType,
|
||||
) -> Result<Self> {
|
||||
let data = std::fs::read(path)?;
|
||||
let data = std::fs::read(path).map_err(|e| {
|
||||
error!("Could not open {path:?}: {e:?}");
|
||||
e
|
||||
})?;
|
||||
let data = std::io::Cursor::new(data);
|
||||
let decoder = png_pong::Decoder::new(data)?.into_steps();
|
||||
let png_pong::Step { raster, delay: _ } = decoder.last().ok_or(AnimeError::NoFrames)??;
|
||||
|
||||
@@ -4,6 +4,7 @@ use std::path::Path;
|
||||
use std::time::Duration;
|
||||
|
||||
use glam::Vec2;
|
||||
use log::error;
|
||||
use serde_derive::{Deserialize, Serialize};
|
||||
|
||||
use crate::error::{AnimeError, Result};
|
||||
@@ -107,7 +108,10 @@ impl AnimeGif {
|
||||
// Configure the decoder such that it will expand the image to RGBA.
|
||||
decoder.set_color_output(gif::ColorOutput::RGBA);
|
||||
// Read the file header
|
||||
let file = File::open(file_name)?;
|
||||
let file = File::open(file_name).map_err(|e| {
|
||||
error!("Could not open {file_name:?}: {e:?}");
|
||||
e
|
||||
})?;
|
||||
let mut decoder = decoder.read_info(file)?;
|
||||
|
||||
let mut frames = Vec::default();
|
||||
@@ -186,12 +190,14 @@ impl AnimeGif {
|
||||
anime_type: AnimeType,
|
||||
) -> Result<Self> {
|
||||
let mut frames = Vec::new();
|
||||
|
||||
let mut decoder = gif::DecodeOptions::new();
|
||||
// Configure the decoder such that it will expand the image to RGBA.
|
||||
decoder.set_color_output(gif::ColorOutput::RGBA);
|
||||
// Read the file header
|
||||
let file = File::open(file_name)?;
|
||||
let file = File::open(file_name).map_err(|e| {
|
||||
error!("Could not open {file_name:?}: {e:?}");
|
||||
e
|
||||
})?;
|
||||
let mut decoder = decoder.read_info(file)?;
|
||||
|
||||
let height = decoder.height();
|
||||
|
||||
@@ -3,6 +3,7 @@ use std::path::Path;
|
||||
|
||||
pub use glam::Vec2;
|
||||
use glam::{Mat3, Vec3};
|
||||
use log::error;
|
||||
|
||||
use crate::data::AnimeDataBuffer;
|
||||
use crate::error::{AnimeError, Result};
|
||||
@@ -421,7 +422,10 @@ impl AnimeImage {
|
||||
bright: f32,
|
||||
anime_type: AnimeType,
|
||||
) -> Result<Self> {
|
||||
let data = std::fs::read(path)?;
|
||||
let data = std::fs::read(path).map_err(|e| {
|
||||
error!("Could not open {path:?}: {e:?}");
|
||||
e
|
||||
})?;
|
||||
let data = std::io::Cursor::new(data);
|
||||
let decoder = png_pong::Decoder::new(data)?.into_steps();
|
||||
let png_pong::Step { raster, delay: _ } = decoder.last().ok_or(AnimeError::NoFrames)??;
|
||||
|
||||
@@ -241,13 +241,13 @@ impl From<AnimShutdown> for i32 {
|
||||
}
|
||||
}
|
||||
|
||||
/// `get_anime_type` is very broad, matching on part of the laptop board name
|
||||
/// only. For this reason `find_node()` must be used also to verify if the USB
|
||||
/// device is available.
|
||||
/// `get_maybe_anime_type` is very broad, matching on part of the laptop board
|
||||
/// name only. For this reason `find_node()` must be used also to verify if the
|
||||
/// USB device is available.
|
||||
///
|
||||
/// The currently known USB device is `19b6`.
|
||||
#[inline]
|
||||
pub fn get_anime_type() -> Result<AnimeType, AnimeError> {
|
||||
pub fn get_maybe_anime_type() -> Result<AnimeType, AnimeError> {
|
||||
let dmi = DMIID::new().map_err(|_| AnimeError::NoDevice)?; // TODO: better error
|
||||
let board_name = dmi.board_name;
|
||||
|
||||
@@ -258,8 +258,8 @@ pub fn get_anime_type() -> Result<AnimeType, AnimeError> {
|
||||
} else if board_name.contains("GU604V") {
|
||||
return Ok(AnimeType::GU604);
|
||||
}
|
||||
log::warn!("AniMe Matrix device found but not yet supported, will default to a GA402 layout");
|
||||
Ok(AnimeType::Unknown)
|
||||
log::warn!("AniMe Matrix device found but could be a slash");
|
||||
Ok(AnimeType::Unsupported)
|
||||
}
|
||||
|
||||
/// Get the two device initialization packets. These are required for device
|
||||
|
||||
@@ -71,15 +71,6 @@
|
||||
advanced_type: None,
|
||||
power_zones: [Keyboard],
|
||||
),
|
||||
(
|
||||
device_name: "G512",
|
||||
product_id: "",
|
||||
layout_name: "g512",
|
||||
basic_modes: [Static, Breathe, Strobe, Rainbow, Pulse],
|
||||
basic_zones: [Key1, Key2, Key3, Key4],
|
||||
advanced_type: None,
|
||||
power_zones: [Keyboard],
|
||||
),
|
||||
(
|
||||
device_name: "G512L",
|
||||
product_id: "",
|
||||
@@ -89,6 +80,15 @@
|
||||
advanced_type: None,
|
||||
power_zones: [Keyboard, Lightbar],
|
||||
),
|
||||
(
|
||||
device_name: "G512LI",
|
||||
product_id: "",
|
||||
layout_name: "g512",
|
||||
basic_modes: [Static, Breathe, Strobe, Rainbow, Pulse],
|
||||
basic_zones: [],
|
||||
advanced_type: None,
|
||||
power_zones: [Keyboard, Lightbar],
|
||||
),
|
||||
(
|
||||
device_name: "G513I",
|
||||
product_id: "",
|
||||
@@ -101,29 +101,20 @@
|
||||
(
|
||||
device_name: "G513Q",
|
||||
product_id: "",
|
||||
layout_name: "g513i-per-key",
|
||||
basic_modes: [Static, Breathe, Strobe, Rainbow, Star, Rain, Highlight, Laser, Ripple, Pulse, Comet, Flash],
|
||||
basic_zones: [],
|
||||
advanced_type: PerKey,
|
||||
power_zones: [Keyboard],
|
||||
),
|
||||
(
|
||||
device_name: "G513QE",
|
||||
product_id: "",
|
||||
layout_name: "g513i",
|
||||
basic_modes: [Static, Breathe, Strobe, Rainbow, Pulse],
|
||||
basic_zones: [Key1, Key2, Key3, Key4],
|
||||
advanced_type: None,
|
||||
power_zones: [Keyboard],
|
||||
power_zones: [Keyboard, Lightbar],
|
||||
),
|
||||
(
|
||||
device_name: "G513QY",
|
||||
device_name: "G513QR",
|
||||
product_id: "",
|
||||
layout_name: "g513i-per-key",
|
||||
basic_modes: [Static, Breathe, Strobe, Rainbow, Pulse],
|
||||
basic_zones: [Key1, Key2, Key3, Key4],
|
||||
basic_modes: [Static, Breathe, Strobe, Rainbow, Star, Rain, Highlight, Laser, Ripple, Pulse, Comet, Flash],
|
||||
basic_zones: [],
|
||||
advanced_type: PerKey,
|
||||
power_zones: [Keyboard],
|
||||
power_zones: [Keyboard, Lightbar],
|
||||
),
|
||||
(
|
||||
device_name: "G513RC",
|
||||
@@ -134,6 +125,15 @@
|
||||
advanced_type: Zoned([ZonedKbLeft, ZonedKbLeftMid, ZonedKbRightMid, ZonedKbRight, LightbarRight, LightbarRightCorner, LightbarRightBottom, LightbarLeftBottom, LightbarLeftCorner, LightbarLeft]),
|
||||
power_zones: [Keyboard, Lightbar],
|
||||
),
|
||||
(
|
||||
device_name: "G513RS",
|
||||
product_id: "",
|
||||
layout_name: "g513i-per-key",
|
||||
basic_modes: [Static, Breathe, Strobe, Rainbow, Star, Rain, Highlight, Laser, Ripple, Pulse, Comet, Flash],
|
||||
basic_zones: [],
|
||||
advanced_type: PerKey,
|
||||
power_zones: [Keyboard, Lightbar],
|
||||
),
|
||||
(
|
||||
device_name: "G513RW",
|
||||
product_id: "",
|
||||
@@ -440,6 +440,15 @@
|
||||
advanced_type: PerKey,
|
||||
power_zones: [Keyboard, Lightbar, Logo, RearGlow],
|
||||
),
|
||||
(
|
||||
device_name: "GA401I",
|
||||
product_id: "",
|
||||
layout_name: "ga401q",
|
||||
basic_modes: [Static, Breathe, Pulse],
|
||||
basic_zones: [],
|
||||
advanced_type: None,
|
||||
power_zones: [Keyboard],
|
||||
),
|
||||
(
|
||||
device_name: "GA401Q",
|
||||
product_id: "",
|
||||
|
||||
@@ -70,11 +70,9 @@ impl LedSupportData {
|
||||
// product_family");
|
||||
|
||||
if let Some(data) = LedSupportFile::load_from_supoprt_db() {
|
||||
if let Some(data) = data.match_device(&dmi.board_name, product_id) {
|
||||
return data;
|
||||
}
|
||||
return data.match_device(&dmi.board_name, product_id);
|
||||
}
|
||||
info!("Using generic LED control for keyboard brightness only");
|
||||
info!("Using generic LED control for keyboard brightness only. No aura_support file found");
|
||||
let mut data = LedSupportData::default();
|
||||
data.power_zones.push(PowerZones::Keyboard);
|
||||
data
|
||||
@@ -91,7 +89,7 @@ impl LedSupportFile {
|
||||
|
||||
/// The list is stored in ordered format, so the iterator must be reversed
|
||||
/// to ensure we match to *whole names* first before doing a glob match
|
||||
fn match_device(&self, device_name: &str, product_id: &str) -> Option<LedSupportData> {
|
||||
fn match_device(&self, device_name: &str, product_id: &str) -> LedSupportData {
|
||||
for config in self.0.iter().rev() {
|
||||
if device_name.contains(&config.device_name) {
|
||||
info!("Matched to {}", config.device_name);
|
||||
@@ -99,15 +97,27 @@ impl LedSupportFile {
|
||||
info!("Checking product ID");
|
||||
if config.product_id == product_id {
|
||||
info!("Matched to {}", config.product_id);
|
||||
return Some(config.clone());
|
||||
return config.clone();
|
||||
} else {
|
||||
continue;
|
||||
}
|
||||
}
|
||||
return Some(config.clone());
|
||||
return config.clone();
|
||||
}
|
||||
}
|
||||
None
|
||||
warn!(
|
||||
"the aura_support.ron file has no entry for this model: {device_name}, {product_id}. \
|
||||
Using a default"
|
||||
);
|
||||
LedSupportData {
|
||||
device_name: device_name.to_owned(),
|
||||
product_id: product_id.to_owned(),
|
||||
layout_name: "Default".to_owned(),
|
||||
basic_modes: vec![AuraModeNum::Static],
|
||||
basic_zones: vec![],
|
||||
advanced_type: AdvancedAuraType::None,
|
||||
power_zones: vec![PowerZones::Keyboard],
|
||||
}
|
||||
}
|
||||
|
||||
/// Load `LedSupportFile` from the `aura_support.ron` file at
|
||||
|
||||
@@ -12,8 +12,12 @@ edition.workspace = true
|
||||
default = []
|
||||
mocking = []
|
||||
x11 = ["slint/backend-winit-x11"]
|
||||
# Requires RUSTFLAGS="--cfg tokio_unstable"
|
||||
tokio-debug = ["console-subscriber"]
|
||||
|
||||
[dependencies]
|
||||
console-subscriber = { version = "0.2.0", optional = true }
|
||||
|
||||
nix = { version = "^0.28.0", features = ["fs"] }
|
||||
tempfile = "3.3.0"
|
||||
betrayer = { version = "0.2.0" }
|
||||
@@ -25,7 +29,7 @@ rog_dbus = { path = "../rog-dbus" }
|
||||
rog_aura = { path = "../rog-aura" }
|
||||
rog_profiles = { path = "../rog-profiles" }
|
||||
rog_platform = { path = "../rog-platform" }
|
||||
supergfxctl = { git = "https://gitlab.com/asus-linux/supergfxctl.git", rev = "4eb6e97c22b68ae8d1e80500709b0c0580776ad3", default-features = false }
|
||||
supergfxctl = { git = "https://gitlab.com/asus-linux/supergfxctl.git", default-features = false }
|
||||
dmi_id = { path = "../dmi-id" }
|
||||
|
||||
gumdrop.workspace = true
|
||||
|
||||
@@ -25,6 +25,10 @@ use tokio::runtime::Runtime;
|
||||
|
||||
#[tokio::main]
|
||||
async fn main() -> Result<()> {
|
||||
dbg!(notify_rust::get_capabilities().unwrap());
|
||||
#[cfg(feature = "tokio-debug")]
|
||||
console_subscriber::init();
|
||||
|
||||
let self_version = env!("CARGO_PKG_VERSION");
|
||||
let conn = zbus::blocking::Connection::system()?;
|
||||
let proxy = rog_dbus::zbus_platform::PlatformProxyBlocking::new(&conn)?;
|
||||
|
||||
@@ -9,8 +9,8 @@ use std::process::Command;
|
||||
use std::sync::{Arc, Mutex};
|
||||
use std::time::Duration;
|
||||
|
||||
use log::{error, info, warn};
|
||||
use notify_rust::{Hint, Notification, NotificationHandle, Urgency};
|
||||
use log::{debug, error, info, warn};
|
||||
use notify_rust::{Hint, Notification, Timeout, Urgency};
|
||||
use rog_dbus::zbus_platform::PlatformProxy;
|
||||
use rog_platform::platform::GpuMode;
|
||||
use rog_platform::power::AsusPower;
|
||||
@@ -45,6 +45,52 @@ impl Default for EnabledNotifications {
|
||||
}
|
||||
}
|
||||
|
||||
fn start_dpu_status_mon(config: Arc<Mutex<Config>>) {
|
||||
use supergfxctl::pci_device::Device;
|
||||
let dev = Device::find().unwrap_or_default();
|
||||
let mut found_dgpu = false; // just for logging
|
||||
for dev in dev {
|
||||
if dev.is_dgpu() {
|
||||
info!(
|
||||
"Found dGPU: {}, starting status notifications",
|
||||
dev.pci_id()
|
||||
);
|
||||
let enabled_notifications_copy = config.clone();
|
||||
// Plain old thread is perfectly fine since most of this is potentially blocking
|
||||
std::thread::spawn(move || {
|
||||
let mut last_status = GfxPower::Unknown;
|
||||
loop {
|
||||
std::thread::sleep(Duration::from_millis(1500));
|
||||
if let Ok(status) = dev.get_runtime_status() {
|
||||
if status != GfxPower::Unknown && status != last_status {
|
||||
if let Ok(config) = enabled_notifications_copy.lock() {
|
||||
if !config.notifications.receive_notify_gfx_status
|
||||
|| !config.notifications.enabled
|
||||
{
|
||||
continue;
|
||||
}
|
||||
}
|
||||
// Required check because status cycles through
|
||||
// active/unknown/suspended
|
||||
do_gpu_status_notif("dGPU status changed:", &status)
|
||||
.show()
|
||||
.unwrap()
|
||||
.on_close(|_| ());
|
||||
debug!("dGPU status changed: {:?}", &status);
|
||||
}
|
||||
last_status = status;
|
||||
}
|
||||
}
|
||||
});
|
||||
found_dgpu = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if !found_dgpu {
|
||||
warn!("Did not find a dGPU on this system, dGPU status won't be avilable");
|
||||
}
|
||||
}
|
||||
|
||||
pub fn start_notifications(
|
||||
config: Arc<Mutex<Config>>,
|
||||
rt: &Runtime,
|
||||
@@ -100,23 +146,24 @@ pub fn start_notifications(
|
||||
}
|
||||
});
|
||||
|
||||
let enabled_notifications_copy = config.clone();
|
||||
let no_supergfx = move |e: &zbus::Error| {
|
||||
error!("zbus signal: receive_notify_gfx_status: {e}");
|
||||
warn!("Attempting to start plain dgpu status monitor");
|
||||
start_dpu_status_mon(enabled_notifications_copy.clone());
|
||||
};
|
||||
|
||||
// GPU MUX Mode notif
|
||||
let enabled_notifications_copy = config.clone();
|
||||
tokio::spawn(async move {
|
||||
let conn = zbus::Connection::system()
|
||||
.await
|
||||
.map_err(|e| {
|
||||
error!("zbus signal: receive_notify_gpu_mux_mode: {e}");
|
||||
e
|
||||
})
|
||||
.unwrap();
|
||||
let proxy = PlatformProxy::new(&conn)
|
||||
.await
|
||||
.map_err(|e| {
|
||||
error!("zbus signal: receive_notify_gpu_mux_mode: {e}");
|
||||
e
|
||||
})
|
||||
.unwrap();
|
||||
let conn = zbus::Connection::system().await.map_err(|e| {
|
||||
error!("zbus signal: receive_notify_gpu_mux_mode: {e}");
|
||||
e
|
||||
})?;
|
||||
let proxy = PlatformProxy::new(&conn).await.map_err(|e| {
|
||||
error!("zbus signal: receive_notify_gpu_mux_mode: {e}");
|
||||
e
|
||||
})?;
|
||||
|
||||
let mut actual_mux_mode = GpuMode::Error;
|
||||
if let Ok(mode) = proxy.gpu_mux_mode().await {
|
||||
@@ -138,68 +185,28 @@ pub fn start_notifications(
|
||||
do_mux_notification("Reboot required. BIOS GPU MUX mode set to", &mode).ok();
|
||||
}
|
||||
}
|
||||
Ok::<(), zbus::Error>(())
|
||||
});
|
||||
|
||||
use supergfxctl::pci_device::Device;
|
||||
let dev = Device::find().unwrap_or_default();
|
||||
let mut found_dgpu = false; // just for logging
|
||||
for dev in dev {
|
||||
if dev.is_dgpu() {
|
||||
let enabled_notifications_copy = config.clone();
|
||||
// Plain old thread is perfectly fine since most of this is potentially blocking
|
||||
rt.spawn_blocking(move || {
|
||||
let mut last_status = GfxPower::Unknown;
|
||||
loop {
|
||||
if let Ok(status) = dev.get_runtime_status() {
|
||||
if status != GfxPower::Unknown && status != last_status {
|
||||
if let Ok(config) = enabled_notifications_copy.lock() {
|
||||
if !config.notifications.receive_notify_gfx_status
|
||||
|| !config.notifications.enabled
|
||||
{
|
||||
continue;
|
||||
}
|
||||
}
|
||||
// Required check because status cycles through
|
||||
// active/unknown/suspended
|
||||
do_gpu_status_notif("dGPU status changed:", &status).ok();
|
||||
}
|
||||
last_status = status;
|
||||
}
|
||||
std::thread::sleep(Duration::from_millis(500));
|
||||
}
|
||||
});
|
||||
found_dgpu = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if !found_dgpu {
|
||||
warn!("Did not find a dGPU on this system, dGPU status won't be avilable");
|
||||
}
|
||||
|
||||
let enabled_notifications_copy = config.clone();
|
||||
// GPU Mode change/action notif
|
||||
tokio::spawn(async move {
|
||||
let conn = zbus::Connection::system()
|
||||
.await
|
||||
.map_err(|e| {
|
||||
error!("zbus signal: receive_notify_action: {e}");
|
||||
e
|
||||
})
|
||||
.unwrap();
|
||||
let proxy = SuperProxy::builder(&conn)
|
||||
.build()
|
||||
.await
|
||||
.map_err(|e| {
|
||||
error!("zbus signal: receive_notify_action: {e}");
|
||||
e
|
||||
})
|
||||
.unwrap();
|
||||
let conn = zbus::Connection::system().await.map_err(|e| {
|
||||
no_supergfx(&e);
|
||||
e
|
||||
})?;
|
||||
let proxy = SuperProxy::builder(&conn).build().await.map_err(|e| {
|
||||
no_supergfx(&e);
|
||||
e
|
||||
})?;
|
||||
let _ = proxy.mode().await.map_err(|e| {
|
||||
no_supergfx(&e);
|
||||
e
|
||||
})?;
|
||||
|
||||
if proxy.mode().await.is_err() {
|
||||
info!("supergfxd not running or not responding");
|
||||
return;
|
||||
}
|
||||
|
||||
if let Ok(mut p) = proxy.receive_notify_action().await {
|
||||
let proxy_copy = proxy.clone();
|
||||
let mut p = proxy.receive_notify_action().await?;
|
||||
tokio::spawn(async move {
|
||||
info!("Started zbus signal thread: receive_notify_action");
|
||||
while let Some(e) = p.next().await {
|
||||
if let Ok(out) = e.args() {
|
||||
@@ -218,7 +225,36 @@ pub fn start_notifications(
|
||||
.ok();
|
||||
}
|
||||
}
|
||||
};
|
||||
});
|
||||
|
||||
let mut p = proxy_copy.receive_notify_gfx_status().await?;
|
||||
tokio::spawn(async move {
|
||||
info!("Started zbus signal thread: receive_notify_gfx_status");
|
||||
let mut last_status = GfxPower::Unknown;
|
||||
while let Some(e) = p.next().await {
|
||||
if let Ok(out) = e.args() {
|
||||
let status = out.status;
|
||||
if status != GfxPower::Unknown && status != last_status {
|
||||
if let Ok(config) = enabled_notifications_copy.lock() {
|
||||
if !config.notifications.receive_notify_gfx_status
|
||||
|| !config.notifications.enabled
|
||||
{
|
||||
continue;
|
||||
}
|
||||
}
|
||||
// Required check because status cycles through
|
||||
// active/unknown/suspended
|
||||
do_gpu_status_notif("dGPU status changed:", &status)
|
||||
.show_async()
|
||||
.await
|
||||
.unwrap()
|
||||
.on_close(|_| ());
|
||||
}
|
||||
last_status = status;
|
||||
}
|
||||
}
|
||||
});
|
||||
Ok::<(), zbus::Error>(())
|
||||
});
|
||||
|
||||
Ok(vec![blocking])
|
||||
@@ -241,19 +277,15 @@ where
|
||||
T: Display,
|
||||
{
|
||||
let mut notif = Notification::new();
|
||||
|
||||
notif
|
||||
.summary(NOTIF_HEADER)
|
||||
.body(&format!("{message} {data}"))
|
||||
.timeout(-1)
|
||||
//.hint(Hint::Resident(true))
|
||||
.appname(NOTIF_HEADER)
|
||||
.summary(&format!("{message} {data}"))
|
||||
.timeout(Timeout::Milliseconds(3000))
|
||||
.hint(Hint::Category("device".into()));
|
||||
|
||||
notif
|
||||
}
|
||||
|
||||
fn do_gpu_status_notif(message: &str, data: &GfxPower) -> Result<NotificationHandle> {
|
||||
// eww
|
||||
fn do_gpu_status_notif(message: &str, data: &GfxPower) -> Notification {
|
||||
let mut notif = base_notification(message, &<&str>::from(data).to_owned());
|
||||
let icon = match data {
|
||||
GfxPower::Suspended => "asus_notif_blue",
|
||||
@@ -263,7 +295,7 @@ fn do_gpu_status_notif(message: &str, data: &GfxPower) -> Result<NotificationHan
|
||||
GfxPower::Unknown => "gpu-integrated",
|
||||
};
|
||||
notif.icon(icon);
|
||||
Ok(Notification::show(¬if)?)
|
||||
notif
|
||||
}
|
||||
|
||||
fn do_gfx_action_notif(message: &str, action: GfxUserAction, mode: GpuMode) -> Result<()> {
|
||||
@@ -274,13 +306,12 @@ fn do_gfx_action_notif(message: &str, action: GfxUserAction, mode: GpuMode) -> R
|
||||
|
||||
let mut notif = Notification::new();
|
||||
notif
|
||||
.summary(NOTIF_HEADER)
|
||||
.body(&format!("Changing to {mode}. {message}"))
|
||||
.timeout(2000)
|
||||
.appname(NOTIF_HEADER)
|
||||
.summary(&format!("Changing to {mode}. {message}"))
|
||||
//.hint(Hint::Resident(true))
|
||||
.hint(Hint::Category("device".into()))
|
||||
.urgency(Urgency::Critical)
|
||||
.timeout(-1)
|
||||
.timeout(Timeout::Never)
|
||||
.icon("dialog-warning")
|
||||
.hint(Hint::Transient(true));
|
||||
|
||||
|
||||
@@ -12,7 +12,7 @@ use std::time::Duration;
|
||||
use betrayer::{Icon, Menu, MenuItem, TrayEvent, TrayIcon, TrayIconBuilder};
|
||||
use log::{debug, error, info, warn};
|
||||
use rog_platform::platform::Properties;
|
||||
use supergfxctl::pci_device::{GfxMode, GfxPower};
|
||||
use supergfxctl::pci_device::{Device, GfxMode, GfxPower};
|
||||
use supergfxctl::zbus_proxy::DaemonProxyBlocking as GfxProxy;
|
||||
use versions::Versioning;
|
||||
|
||||
@@ -71,7 +71,7 @@ fn build_menu() -> Menu<TrayAction> {
|
||||
Menu::new([
|
||||
MenuItem::separator(),
|
||||
MenuItem::button("Open", TrayAction::Open),
|
||||
MenuItem::button("Quit", TrayAction::Quit),
|
||||
MenuItem::button("Quit App", TrayAction::Quit),
|
||||
])
|
||||
}
|
||||
|
||||
@@ -126,6 +126,20 @@ fn set_tray_icon_and_tip(
|
||||
}
|
||||
}
|
||||
|
||||
fn find_dgpu() -> Option<Device> {
|
||||
use supergfxctl::pci_device::Device;
|
||||
let dev = Device::find().unwrap_or_default();
|
||||
for dev in dev {
|
||||
if dev.is_dgpu() {
|
||||
info!("Found dGPU: {}", dev.pci_id());
|
||||
// Plain old thread is perfectly fine since most of this is potentially blocking
|
||||
return Some(dev);
|
||||
}
|
||||
}
|
||||
warn!("Did not find a dGPU on this system, dGPU status won't be avilable");
|
||||
None
|
||||
}
|
||||
|
||||
/// The tray is controlled somewhat by `Arc<Mutex<SystemState>>`
|
||||
pub fn init_tray(_supported_properties: Vec<Properties>, config: Arc<Mutex<Config>>) {
|
||||
std::thread::spawn(move || {
|
||||
@@ -155,27 +169,30 @@ pub fn init_tray(_supported_properties: Vec<Properties>, config: Arc<Mutex<Confi
|
||||
gpu_integrated,
|
||||
});
|
||||
|
||||
let mut has_supergfx = true;
|
||||
let mut has_supergfx = false;
|
||||
let conn = zbus::blocking::Connection::system().unwrap();
|
||||
if let Ok(gfx_proxy) = GfxProxy::new(&conn) {
|
||||
let mut supergfx_active = false;
|
||||
if gfx_proxy.mode().is_ok() {
|
||||
supergfx_active = true;
|
||||
if let Ok(version) = gfx_proxy.version() {
|
||||
if let Some(version) = Versioning::new(&version) {
|
||||
let curr_gfx = Versioning::new("5.2.0").unwrap();
|
||||
warn!("supergfxd version = {version}");
|
||||
if version < curr_gfx {
|
||||
// Don't allow mode changing if too old a version
|
||||
warn!("supergfxd found but is too old to use");
|
||||
has_supergfx = false;
|
||||
match gfx_proxy.mode() {
|
||||
Ok(_) => {
|
||||
has_supergfx = true;
|
||||
if let Ok(version) = gfx_proxy.version() {
|
||||
if let Some(version) = Versioning::new(&version) {
|
||||
let curr_gfx = Versioning::new("5.2.0").unwrap();
|
||||
warn!("supergfxd version = {version}");
|
||||
if version < curr_gfx {
|
||||
// Don't allow mode changing if too old a version
|
||||
warn!("supergfxd found but is too old to use");
|
||||
has_supergfx = false;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
};
|
||||
Err(e) => warn!("Couldn't get mode form supergfxd: {e:?}"),
|
||||
}
|
||||
|
||||
info!("Started ROGTray");
|
||||
let mut last_power = GfxPower::Unknown;
|
||||
let dev = find_dgpu();
|
||||
loop {
|
||||
sleep(Duration::from_millis(1000));
|
||||
if let Ok(lock) = config.try_lock() {
|
||||
@@ -187,11 +204,23 @@ pub fn init_tray(_supported_properties: Vec<Properties>, config: Arc<Mutex<Confi
|
||||
if let Ok(mode) = gfx_proxy.mode() {
|
||||
if let Ok(power) = gfx_proxy.power() {
|
||||
if last_power != power {
|
||||
set_tray_icon_and_tip(mode, power, &mut tray, supergfx_active);
|
||||
set_tray_icon_and_tip(mode, power, &mut tray, has_supergfx);
|
||||
last_power = power;
|
||||
}
|
||||
}
|
||||
}
|
||||
} else if let Some(dev) = dev.as_ref() {
|
||||
if let Ok(power) = dev.get_runtime_status() {
|
||||
if last_power != power {
|
||||
set_tray_icon_and_tip(
|
||||
GfxMode::Hybrid,
|
||||
power,
|
||||
&mut tray,
|
||||
has_supergfx,
|
||||
);
|
||||
last_power = power;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
use std::sync::{Arc, Mutex};
|
||||
|
||||
use log::{error, info};
|
||||
use log::{debug, error, info};
|
||||
use rog_aura::keyboard::LaptopAuraPower;
|
||||
use rog_aura::{AuraDeviceType, PowerZones};
|
||||
use rog_dbus::zbus_aura::AuraProxy;
|
||||
@@ -76,7 +76,7 @@ pub fn setup_aura_page(ui: &MainWindow, _states: Arc<Mutex<Config>>) {
|
||||
tokio::spawn(async move {
|
||||
let Ok(aura) = find_aura_iface().await else {
|
||||
info!("This device appears to have no aura interfaces");
|
||||
return;
|
||||
return Ok::<(), zbus::Error>(());
|
||||
};
|
||||
|
||||
set_ui_props_async!(handle, aura, AuraPageData, brightness);
|
||||
@@ -226,5 +226,7 @@ pub fn setup_aura_page(ui: &MainWindow, _states: Arc<Mutex<Config>>) {
|
||||
}
|
||||
}
|
||||
});
|
||||
debug!("Aura setup tasks complete");
|
||||
Ok(())
|
||||
});
|
||||
}
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
msgid ""
|
||||
msgstr ""
|
||||
"Project-Id-Version: PACKAGE VERSION\n"
|
||||
"POT-Creation-Date: 2024-05-16 21:41+0000\n"
|
||||
"POT-Creation-Date: 2024-05-24 06:49+0000\n"
|
||||
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
|
||||
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
|
||||
"Language-Team: LANGUAGE <LL@li.org>\n"
|
||||
@@ -137,61 +137,6 @@ msgctxt "PageAnime"
|
||||
msgid "Off when on battery"
|
||||
msgstr ""
|
||||
|
||||
#: rog-control-center/ui/pages/fans.slint:26
|
||||
msgctxt "FanTab"
|
||||
msgid "This fan is not avilable on this machine"
|
||||
msgstr ""
|
||||
|
||||
#: rog-control-center/ui/pages/fans.slint:34
|
||||
msgctxt "FanTab"
|
||||
msgid "Enabled"
|
||||
msgstr ""
|
||||
|
||||
#: rog-control-center/ui/pages/fans.slint:43
|
||||
msgctxt "FanTab"
|
||||
msgid "Apply"
|
||||
msgstr ""
|
||||
|
||||
#: rog-control-center/ui/pages/fans.slint:51
|
||||
msgctxt "FanTab"
|
||||
msgid "Cancel"
|
||||
msgstr ""
|
||||
|
||||
#: rog-control-center/ui/pages/fans.slint:59
|
||||
msgctxt "FanTab"
|
||||
msgid "Factory Default (all fans)"
|
||||
msgstr ""
|
||||
|
||||
#: rog-control-center/ui/pages/fans.slint:72
|
||||
msgctxt "PageFans"
|
||||
msgid "Balanced"
|
||||
msgstr ""
|
||||
|
||||
#: rog-control-center/ui/pages/fans.slint:75 rog-control-center/ui/pages/fans.slint:134 rog-control-center/ui/pages/fans.slint:193
|
||||
msgctxt "PageFans"
|
||||
msgid "CPU"
|
||||
msgstr ""
|
||||
|
||||
#: rog-control-center/ui/pages/fans.slint:93 rog-control-center/ui/pages/fans.slint:152 rog-control-center/ui/pages/fans.slint:211
|
||||
msgctxt "PageFans"
|
||||
msgid "Mid"
|
||||
msgstr ""
|
||||
|
||||
#: rog-control-center/ui/pages/fans.slint:111 rog-control-center/ui/pages/fans.slint:170 rog-control-center/ui/pages/fans.slint:229
|
||||
msgctxt "PageFans"
|
||||
msgid "GPU"
|
||||
msgstr ""
|
||||
|
||||
#: rog-control-center/ui/pages/fans.slint:131
|
||||
msgctxt "PageFans"
|
||||
msgid "Performance"
|
||||
msgstr ""
|
||||
|
||||
#: rog-control-center/ui/pages/fans.slint:190
|
||||
msgctxt "PageFans"
|
||||
msgid "Quiet"
|
||||
msgstr ""
|
||||
|
||||
#: rog-control-center/ui/pages/app_settings.slint:26
|
||||
msgctxt "PageAppSettings"
|
||||
msgid "Run in background after closing"
|
||||
@@ -257,6 +202,61 @@ msgctxt "PageAura"
|
||||
msgid "Power Zones"
|
||||
msgstr ""
|
||||
|
||||
#: rog-control-center/ui/pages/fans.slint:26
|
||||
msgctxt "FanTab"
|
||||
msgid "This fan is not avilable on this machine"
|
||||
msgstr ""
|
||||
|
||||
#: rog-control-center/ui/pages/fans.slint:34
|
||||
msgctxt "FanTab"
|
||||
msgid "Enabled"
|
||||
msgstr ""
|
||||
|
||||
#: rog-control-center/ui/pages/fans.slint:43
|
||||
msgctxt "FanTab"
|
||||
msgid "Apply"
|
||||
msgstr ""
|
||||
|
||||
#: rog-control-center/ui/pages/fans.slint:51
|
||||
msgctxt "FanTab"
|
||||
msgid "Cancel"
|
||||
msgstr ""
|
||||
|
||||
#: rog-control-center/ui/pages/fans.slint:59
|
||||
msgctxt "FanTab"
|
||||
msgid "Factory Default (all fans)"
|
||||
msgstr ""
|
||||
|
||||
#: rog-control-center/ui/pages/fans.slint:72
|
||||
msgctxt "PageFans"
|
||||
msgid "Balanced"
|
||||
msgstr ""
|
||||
|
||||
#: rog-control-center/ui/pages/fans.slint:75 rog-control-center/ui/pages/fans.slint:134 rog-control-center/ui/pages/fans.slint:193
|
||||
msgctxt "PageFans"
|
||||
msgid "CPU"
|
||||
msgstr ""
|
||||
|
||||
#: rog-control-center/ui/pages/fans.slint:93 rog-control-center/ui/pages/fans.slint:152 rog-control-center/ui/pages/fans.slint:211
|
||||
msgctxt "PageFans"
|
||||
msgid "Mid"
|
||||
msgstr ""
|
||||
|
||||
#: rog-control-center/ui/pages/fans.slint:111 rog-control-center/ui/pages/fans.slint:170 rog-control-center/ui/pages/fans.slint:229
|
||||
msgctxt "PageFans"
|
||||
msgid "GPU"
|
||||
msgstr ""
|
||||
|
||||
#: rog-control-center/ui/pages/fans.slint:131
|
||||
msgctxt "PageFans"
|
||||
msgid "Performance"
|
||||
msgstr ""
|
||||
|
||||
#: rog-control-center/ui/pages/fans.slint:190
|
||||
msgctxt "PageFans"
|
||||
msgid "Quiet"
|
||||
msgstr ""
|
||||
|
||||
#: rog-control-center/ui/pages/system.slint:26
|
||||
msgctxt "SystemPageData"
|
||||
msgid "Balanced"
|
||||
@@ -334,37 +334,37 @@ msgstr ""
|
||||
|
||||
#: rog-control-center/ui/pages/system.slint:188
|
||||
msgctxt "ppt_pl1_spl"
|
||||
msgid "ppt_pl1_spl"
|
||||
msgid "PL1, sustained power limit"
|
||||
msgstr ""
|
||||
|
||||
#: rog-control-center/ui/pages/system.slint:198
|
||||
msgctxt "ppt_pl2_sppt"
|
||||
msgid "ppt_pl2_sppt"
|
||||
msgid "PL2, turbo power limit"
|
||||
msgstr ""
|
||||
|
||||
#: rog-control-center/ui/pages/system.slint:208
|
||||
msgctxt "ppt_fppt"
|
||||
msgid "ppt_fppt"
|
||||
msgid "FPPT, Fast Power Limit"
|
||||
msgstr ""
|
||||
|
||||
#: rog-control-center/ui/pages/system.slint:218
|
||||
msgctxt "ppt_apu_sppt"
|
||||
msgid "ppt_apu_sppt"
|
||||
msgid "SPPT, APU slow power limit"
|
||||
msgstr ""
|
||||
|
||||
#: rog-control-center/ui/pages/system.slint:228
|
||||
msgctxt "ppt_platform_sppt"
|
||||
msgid "ppt_platform_sppt"
|
||||
msgid "Slow package power tracking limit"
|
||||
msgstr ""
|
||||
|
||||
#: rog-control-center/ui/pages/system.slint:238
|
||||
msgctxt "nv_dynamic_boost"
|
||||
msgid "nv_dynamic_boost"
|
||||
msgid "dGPU boost overclock"
|
||||
msgstr ""
|
||||
|
||||
#: rog-control-center/ui/pages/system.slint:248
|
||||
msgctxt "nv_temp_target"
|
||||
msgid "nv_temp_target"
|
||||
msgid "dGPU temperature max"
|
||||
msgstr ""
|
||||
|
||||
#: rog-control-center/ui/pages/system.slint:294
|
||||
@@ -679,6 +679,6 @@ msgstr ""
|
||||
|
||||
#: rog-control-center/ui/main_window.slint:70
|
||||
msgctxt "MainWindow"
|
||||
msgid "Quit"
|
||||
msgid "Quit App"
|
||||
msgstr ""
|
||||
|
||||
|
||||
@@ -67,7 +67,7 @@ export component MainWindow inherits Window {
|
||||
Text {
|
||||
vertical-alignment: center;
|
||||
horizontal-alignment: center;
|
||||
text: @tr("Quit");
|
||||
text: @tr("Quit App");
|
||||
}
|
||||
|
||||
TouchArea {
|
||||
|
||||
@@ -185,7 +185,7 @@ export component PageSystem inherits Rectangle {
|
||||
}
|
||||
|
||||
if SystemPageData.available.ppt-pl1-spl: SystemSlider {
|
||||
text: @tr("ppt_pl1_spl" => "ppt_pl1_spl");
|
||||
text: @tr("ppt_pl1_spl" => "PL1, sustained power limit");
|
||||
minimum: 5;
|
||||
maximum: 250;
|
||||
value <=> SystemPageData.ppt_pl1_spl;
|
||||
@@ -195,7 +195,7 @@ export component PageSystem inherits Rectangle {
|
||||
}
|
||||
|
||||
if SystemPageData.available.ppt-pl2-sppt: SystemSlider {
|
||||
text: @tr("ppt_pl2_sppt" => "ppt_pl2_sppt");
|
||||
text: @tr("ppt_pl2_sppt" => "PL2, turbo power limit");
|
||||
minimum: 5;
|
||||
maximum: 250;
|
||||
value <=> SystemPageData.ppt_pl2_sppt;
|
||||
@@ -205,7 +205,7 @@ export component PageSystem inherits Rectangle {
|
||||
}
|
||||
|
||||
if SystemPageData.available.ppt-fppt: SystemSlider {
|
||||
text: @tr("ppt_fppt" => "ppt_fppt");
|
||||
text: @tr("ppt_fppt" => "FPPT, Fast Power Limit");
|
||||
minimum: 5;
|
||||
maximum: 250;
|
||||
value <=> SystemPageData.ppt_fppt;
|
||||
@@ -215,7 +215,7 @@ export component PageSystem inherits Rectangle {
|
||||
}
|
||||
|
||||
if SystemPageData.available.ppt-apu-sppt: SystemSlider {
|
||||
text: @tr("ppt_apu_sppt" => "ppt_apu_sppt");
|
||||
text: @tr("ppt_apu_sppt" => "SPPT, APU slow power limit");
|
||||
minimum: 5;
|
||||
maximum: 130;
|
||||
value <=> SystemPageData.ppt_apu_sppt;
|
||||
@@ -225,7 +225,7 @@ export component PageSystem inherits Rectangle {
|
||||
}
|
||||
|
||||
if SystemPageData.available.ppt-platform-sppt: SystemSlider {
|
||||
text: @tr("ppt_platform_sppt" => "ppt_platform_sppt");
|
||||
text: @tr("ppt_platform_sppt" => "Slow package power tracking limit");
|
||||
maximum: 130;
|
||||
minimum: 5;
|
||||
value <=> SystemPageData.ppt_platform_sppt;
|
||||
@@ -235,7 +235,7 @@ export component PageSystem inherits Rectangle {
|
||||
}
|
||||
|
||||
if SystemPageData.available.nv-dynamic-boost: SystemSlider {
|
||||
text: @tr("nv_dynamic_boost" => "nv_dynamic_boost");
|
||||
text: @tr("nv_dynamic_boost" => "dGPU boost overclock");
|
||||
minimum: 5;
|
||||
maximum: 25;
|
||||
value <=> SystemPageData.nv_dynamic_boost;
|
||||
@@ -245,7 +245,7 @@ export component PageSystem inherits Rectangle {
|
||||
}
|
||||
|
||||
if SystemPageData.available.nv-temp-target: SystemSlider {
|
||||
text: @tr("nv_temp_target" => "nv_temp_target");
|
||||
text: @tr("nv_temp_target" => "dGPU temperature max");
|
||||
minimum: 75;
|
||||
maximum: 87;
|
||||
value <=> SystemPageData.nv_temp_target;
|
||||
|
||||
@@ -17,7 +17,7 @@ export component SystemSlider inherits RogItem {
|
||||
callback released(int);
|
||||
HorizontalLayout {
|
||||
HorizontalLayout {
|
||||
width: 30%;
|
||||
width: 50%;
|
||||
alignment: LayoutAlignment.space-between;
|
||||
padding-left: 10px;
|
||||
Text {
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
use log::trace;
|
||||
use log::{error, trace};
|
||||
use serde_derive::{Deserialize, Serialize};
|
||||
use typeshare::typeshare;
|
||||
use udev::Device;
|
||||
@@ -185,7 +185,8 @@ impl CurveData {
|
||||
// Enable must be done *after* all points are written pwm3_enable
|
||||
device
|
||||
.set_attribute_value(format!("pwm{pwm_num}_enable"), enable.to_string())
|
||||
.unwrap();
|
||||
.map_err(|e| error!("Failed to set pwm{pwm_num}_enable to {enable}: {e:?}"))
|
||||
.ok();
|
||||
Ok(())
|
||||
}
|
||||
}
|
||||
|
||||
@@ -12,7 +12,7 @@ use crate::error::SlashError;
|
||||
#[derive(Debug, Copy, Clone, PartialEq, Eq, Deserialize, Serialize)]
|
||||
pub enum SlashType {
|
||||
GA403,
|
||||
Unknown,
|
||||
GA605,
|
||||
Unsupported,
|
||||
}
|
||||
|
||||
@@ -22,7 +22,8 @@ impl FromStr for SlashType {
|
||||
fn from_str(s: &str) -> std::result::Result<Self, Self::Err> {
|
||||
Ok(match s {
|
||||
"ga403" | "GA403" => Self::GA403,
|
||||
_ => Self::Unknown,
|
||||
"ga605" | "GA605" => Self::GA605,
|
||||
_ => Self::Unsupported,
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
@@ -28,12 +28,14 @@ pub type SlashUsbPacket = [u8; PACKET_SIZE];
|
||||
///
|
||||
/// The currently known USB device is `193B`.
|
||||
#[inline]
|
||||
pub fn get_slash_type() -> Result<SlashType, SlashError> {
|
||||
pub fn get_maybe_slash_type() -> Result<SlashType, SlashError> {
|
||||
let dmi = DMIID::new().map_err(|_| SlashError::NoDevice)?; // TODO: better error
|
||||
let board_name = dmi.board_name;
|
||||
|
||||
if board_name.contains("GA403") {
|
||||
return Ok(SlashType::GA403);
|
||||
} else if board_name.contains("GA605") {
|
||||
return Ok(SlashType::GA605);
|
||||
}
|
||||
Ok(SlashType::Unsupported)
|
||||
}
|
||||
|
||||
@@ -43,7 +43,7 @@ impl AniMatrix {
|
||||
vertical: 2,
|
||||
horizontal: 5,
|
||||
},
|
||||
AnimeType::GA402 | AnimeType::Unknown => LedShape {
|
||||
AnimeType::GA402 | AnimeType::Unsupported => LedShape {
|
||||
vertical: 2,
|
||||
horizontal: 5,
|
||||
},
|
||||
@@ -56,7 +56,7 @@ impl AniMatrix {
|
||||
// Do a hard mapping of each (derived from wireshardk captures)
|
||||
let rows = match model {
|
||||
AnimeType::GA401 => GA401.to_vec(),
|
||||
AnimeType::GA402 | AnimeType::Unknown => GA402.to_vec(),
|
||||
AnimeType::GA402 | AnimeType::Unsupported => GA402.to_vec(),
|
||||
AnimeType::GU604 => GU604.to_vec(),
|
||||
};
|
||||
|
||||
|
||||
Reference in New Issue
Block a user