From b9c4ff9ca7aa4205388a3c8e94977848507faed3 Mon Sep 17 00:00:00 2001 From: "Luke D. Jones" Date: Sun, 30 May 2021 10:19:25 +1200 Subject: [PATCH 1/2] Add GA503Q led modes --- CHANGELOG.md | 1 + asusctl/src/main.rs | 4 ++-- daemon-user/src/ctrl_anime.rs | 4 ++-- daemon/src/ctrl_anime.rs | 6 +++++ data/asusd-ledmodes.toml | 7 ++++++ rog-dbus/src/zbus_anime.rs | 44 +++++++++++++--------------------- rog-dbus/src/zbus_charge.rs | 1 + rog-dbus/src/zbus_gfx.rs | 1 + rog-dbus/src/zbus_led.rs | 1 + rog-dbus/src/zbus_profile.rs | 1 + rog-dbus/src/zbus_rogbios.rs | 1 + rog-dbus/src/zbus_supported.rs | 1 + 12 files changed, 41 insertions(+), 31 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 40b9dad8..9f7c450d 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -9,6 +9,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 - Set PM to auto for Nvidia always - Extra info output for gfx dev scan - Extra info in log for G-Sync to help prevent user confusion around gfx switching +- Add GA503Q led modes # [3.6.1] - 2021-05-25 ### Changed diff --git a/asusctl/src/main.rs b/asusctl/src/main.rs index c665a77f..59f4df84 100644 --- a/asusctl/src/main.rs +++ b/asusctl/src/main.rs @@ -158,10 +158,10 @@ fn main() -> Result<(), Box> { } } if let Some(anime_turn) = cmd.turn { - dbus.proxies().anime().toggle_on(anime_turn.into())? + dbus.proxies().anime().set_led_power(anime_turn.into())? } if let Some(anime_boot) = cmd.boot { - dbus.proxies().anime().toggle_boot_on(anime_boot.into())? + dbus.proxies().anime().set_system_animations(anime_boot.into())? } if let Some(action) = cmd.command { match action { diff --git a/daemon-user/src/ctrl_anime.rs b/daemon-user/src/ctrl_anime.rs index 283ea5a7..d2438b78 100644 --- a/daemon-user/src/ctrl_anime.rs +++ b/daemon-user/src/ctrl_anime.rs @@ -340,13 +340,13 @@ impl CtrlAnime<'static> { pub fn set_state(&mut self, on: bool) -> zbus::fdo::Result<()> { // Operations here need to be in specific order if on { - self.client.proxies().anime().toggle_on(on)?; + self.client.proxies().anime().set_led_power(on)?; // Let the inner loop run self.inner_early_return.store(false, Ordering::SeqCst); } else { // Must make the inner run loop return early self.inner_early_return.store(true, Ordering::SeqCst); - self.client.proxies().anime().toggle_on(on)?; + self.client.proxies().anime().set_led_power(on)?; } Ok(()) } diff --git a/daemon/src/ctrl_anime.rs b/daemon/src/ctrl_anime.rs index 40bee1f5..dd6313a5 100644 --- a/daemon/src/ctrl_anime.rs +++ b/daemon/src/ctrl_anime.rs @@ -379,6 +379,7 @@ impl CtrlAnimeZbus { } } + /// Set the global AniMe brightness fn set_brightness(&self, bright: f32) { 'outer: loop { if let Ok(mut lock) = self.0.try_lock() { @@ -395,6 +396,7 @@ impl CtrlAnimeZbus { } } + /// Set whether the AniMe is displaying images/data fn set_on_off(&self, status: bool) { 'outer: loop { if let Ok(mut lock) = self.0.try_lock() { @@ -413,6 +415,7 @@ impl CtrlAnimeZbus { } } + /// Set whether the AniMe will show boot, suspend, or off animations fn set_boot_on_off(&self, on: bool) { 'outer: loop { if let Ok(mut lock) = self.0.try_lock() { @@ -446,6 +449,7 @@ impl CtrlAnimeZbus { } } + /// Get status of if the AniMe LEDs are on #[dbus_interface(property)] fn awake_enabled(&self) -> bool { if let Ok(ctrl) = self.0.try_lock() { @@ -454,6 +458,7 @@ impl CtrlAnimeZbus { true } + /// Get the status of if factory system-status animations are enabled #[dbus_interface(property)] fn boot_enabled(&self) -> bool { if let Ok(ctrl) = self.0.try_lock() { @@ -462,6 +467,7 @@ impl CtrlAnimeZbus { true } + /// Notify listeners of the status of AniMe LED power and factory system-status animations #[dbus_interface(signal)] fn notify_power_states(&self, data: &AnimePowerStates) -> zbus::Result<()>; } diff --git a/data/asusd-ledmodes.toml b/data/asusd-ledmodes.toml index 9d76e2b3..a92246e6 100644 --- a/data/asusd-ledmodes.toml +++ b/data/asusd-ledmodes.toml @@ -89,6 +89,13 @@ standard = ["Static", "Breathe", "Pulse"] multizone = false per_key = false +[[led_data]] +prod_family = "ROG Zephyrus G15" +board_names = ["GA503Q"] +standard = ["Static", "Breathe", "Pulse", "Rainbow", "Strobe"] +multizone = false +per_key = false + [[led_data]] prod_family = "ROG Zephyrus" board_names = ["GX550L"] diff --git a/rog-dbus/src/zbus_anime.rs b/rog-dbus/src/zbus_anime.rs index dbcc2db1..d8525a05 100644 --- a/rog-dbus/src/zbus_anime.rs +++ b/rog-dbus/src/zbus_anime.rs @@ -1,26 +1,4 @@ -//! # DBus interface proxy for: `org.asuslinux.Daemon` -//! -//! This code was generated by `zbus-xmlgen` `1.0.0` from DBus introspection data. -//! Source: `Interface '/org/asuslinux/Anime' from service 'org.asuslinux.Daemon' on system bus`. -//! -//! You may prefer to adapt it, instead of using it verbatim. -//! -//! More information can be found in the -//! [Writing a client proxy](https://zeenix.pages.freedesktop.org/zbus/client.html) -//! section of the zbus documentation. -//! -//! This DBus object implements -//! [standard DBus interfaces](https://dbus.freedesktop.org/doc/dbus-specification.html), -//! (`org.freedesktop.DBus.*`) for which the following zbus proxies can be used: -//! -//! * [`zbus::fdo::IntrospectableProxy`] -//! * [`zbus::fdo::PeerProxy`] -//! * [`zbus::fdo::PropertiesProxy`] -//! -//! …consequently `zbus-xmlgen` did not generate code for the above interfaces. - use std::sync::mpsc::Sender; - use rog_anime::{AnimeDataBuffer, AnimePowerStates}; use zbus::{dbus_proxy, Connection, Result}; @@ -29,21 +7,27 @@ use zbus::{dbus_proxy, Connection, Result}; default_path = "/org/asuslinux/Anime" )] trait Daemon { - /// SetBootOnOff method + /// Set whether the AniMe will show boot, suspend, or off animations fn set_boot_on_off(&self, status: bool) -> zbus::Result<()>; - /// SetOnOff method + /// Set the global AniMe brightness + fn set_brightness(&self, bright: f32) -> zbus::Result<()>; + + /// Set whether the AniMe is displaying images/data fn set_on_off(&self, status: bool) -> zbus::Result<()>; - /// WriteDirect method + /// Writes a data stream of length. Will force system thread to exit until it is restarted fn write(&self, input: &[u8]) -> zbus::Result<()>; + /// Get status of if the AniMe LEDs are on #[dbus_proxy(property)] fn awake_enabled(&self) -> zbus::Result; + /// Get the status of if factory system-status animations are enabled #[dbus_proxy(property)] fn boot_enabled(&self) -> zbus::Result; + /// Notify listeners of the status of AniMe LED power and factory system-status animations #[dbus_proxy(signal)] fn notify_power_states(&self, data: AnimePowerStates) -> zbus::Result<()>; } @@ -56,30 +40,36 @@ impl<'a> AnimeProxy<'a> { Ok(AnimeProxy(DaemonProxy::new(&conn)?)) } + #[inline] pub fn proxy(&self) -> &DaemonProxy<'a> { &self.0 } + /// Set whether the AniMe will show boot, suspend, or off animations #[inline] - pub fn toggle_boot_on(&self, on: bool) -> Result<()> { + pub fn set_system_animations(&self, on: bool) -> Result<()> { self.0.set_boot_on_off(on) } + /// Set whether the AniMe is displaying images/data #[inline] - pub fn toggle_on(&self, on: bool) -> Result<()> { + pub fn set_led_power(&self, on: bool) -> Result<()> { self.0.set_on_off(on) } + /// Writes a data stream of length. Will force system thread to exit until it is restarted #[inline] pub fn write(&self, input: AnimeDataBuffer) -> Result<()> { self.0.write(input.get()) } + /// Get status of if the AniMe LEDs are on #[inline] pub fn awake_enabled(&self) -> Result { self.0.awake_enabled() } + /// Get the status of if factory system-status animations are enabled #[inline] pub fn boot_enabled(&self) -> Result { self.0.boot_enabled() diff --git a/rog-dbus/src/zbus_charge.rs b/rog-dbus/src/zbus_charge.rs index 95d7568d..9c9a8cc3 100644 --- a/rog-dbus/src/zbus_charge.rs +++ b/rog-dbus/src/zbus_charge.rs @@ -47,6 +47,7 @@ impl<'a> ChargeProxy<'a> { Ok(ChargeProxy(DaemonProxy::new(&conn)?)) } + #[inline] pub fn proxy(&self) -> &DaemonProxy<'a> { &self.0 } diff --git a/rog-dbus/src/zbus_gfx.rs b/rog-dbus/src/zbus_gfx.rs index 0c91dee8..8d530023 100644 --- a/rog-dbus/src/zbus_gfx.rs +++ b/rog-dbus/src/zbus_gfx.rs @@ -55,6 +55,7 @@ impl<'a> GfxProxy<'a> { Ok(GfxProxy(DaemonProxy::new(&conn)?)) } + #[inline] pub fn proxy(&self) -> &DaemonProxy<'a> { &self.0 } diff --git a/rog-dbus/src/zbus_led.rs b/rog-dbus/src/zbus_led.rs index f1366191..b2a67e28 100644 --- a/rog-dbus/src/zbus_led.rs +++ b/rog-dbus/src/zbus_led.rs @@ -84,6 +84,7 @@ impl<'a> LedProxy<'a> { Ok(LedProxy(DaemonProxy::new(&conn)?)) } + #[inline] pub fn proxy(&self) -> &DaemonProxy<'a> { &self.0 } diff --git a/rog-dbus/src/zbus_profile.rs b/rog-dbus/src/zbus_profile.rs index 75b87376..cc9f244e 100644 --- a/rog-dbus/src/zbus_profile.rs +++ b/rog-dbus/src/zbus_profile.rs @@ -63,6 +63,7 @@ impl<'a> ProfileProxy<'a> { Ok(ProfileProxy(DaemonProxy::new(&conn)?)) } + #[inline] pub fn proxy(&self) -> &DaemonProxy<'a> { &self.0 } diff --git a/rog-dbus/src/zbus_rogbios.rs b/rog-dbus/src/zbus_rogbios.rs index 00e45099..51a96245 100644 --- a/rog-dbus/src/zbus_rogbios.rs +++ b/rog-dbus/src/zbus_rogbios.rs @@ -57,6 +57,7 @@ impl<'a> RogBiosProxy<'a> { Ok(RogBiosProxy(DaemonProxy::new(&conn)?)) } + #[inline] pub fn proxy(&self) -> &DaemonProxy<'a> { &self.0 } diff --git a/rog-dbus/src/zbus_supported.rs b/rog-dbus/src/zbus_supported.rs index f292a3ff..f947962b 100644 --- a/rog-dbus/src/zbus_supported.rs +++ b/rog-dbus/src/zbus_supported.rs @@ -39,6 +39,7 @@ impl<'a> SupportProxy<'a> { Ok(SupportProxy(DaemonProxy::new(&conn)?)) } + #[inline] pub fn proxy(&self) -> &DaemonProxy<'a> { &self.0 } From bb910344b8b52e4954a690eb17c6eb7deff63a0f Mon Sep 17 00:00:00 2001 From: "Luke D. Jones" Date: Sun, 30 May 2021 19:20:02 +1200 Subject: [PATCH 2/2] Basic fade in/out of gifs --- CHANGELOG.md | 1 + Cargo.lock | 6 +- MANUAL.md | 22 ++++ asusctl/examples/anime-gif.rs | 4 +- asusctl/src/main.rs | 4 +- daemon-user/Cargo.toml | 2 +- daemon-user/src/ctrl_anime.rs | 111 ++++++++++-------- daemon-user/src/daemon.rs | 13 +-- daemon-user/src/user_config.rs | 33 ++++-- daemon/Cargo.toml | 2 +- daemon/src/config_anime.rs | 60 ++++++---- daemon/src/config_old.rs | 3 +- daemon/src/ctrl_anime.rs | 35 ++---- daemon/src/ctrl_gfx/controller.rs | 18 ++- daemon/src/ctrl_profiles/controller.rs | 5 +- rog-anime/Cargo.toml | 2 +- rog-anime/src/data.rs | 101 ++++++++++++++++ rog-anime/src/gif.rs | 86 +++++++++++++- rog-anime/src/sequencer.rs | 156 +++++++------------------ rog-dbus/src/zbus_anime.rs | 2 +- rog-dbus/src/zbus_rogbios.rs | 2 +- rog-types/src/supported.rs | 10 +- 22 files changed, 426 insertions(+), 252 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 9f7c450d..83d0b39f 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -10,6 +10,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 - Extra info output for gfx dev scan - Extra info in log for G-Sync to help prevent user confusion around gfx switching - Add GA503Q led modes +- Added ability to fade in/out gifs and images for anime. This does break anime configs. See manual for details. # [3.6.1] - 2021-05-25 ### Changed diff --git a/Cargo.lock b/Cargo.lock index bc7b5ad9..9c3f63d5 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -207,7 +207,7 @@ dependencies = [ [[package]] name = "daemon" -version = "3.6.2" +version = "3.6.3" dependencies = [ "env_logger", "log", @@ -232,7 +232,7 @@ dependencies = [ [[package]] name = "daemon-user" -version = "1.1.1" +version = "1.2.0" dependencies = [ "dirs 3.0.1", "rog_anime", @@ -863,7 +863,7 @@ checksum = "24d5f089152e60f62d28b835fbff2cd2e8dc0baf1ac13343bef92ab7eed84548" [[package]] name = "rog_anime" -version = "1.0.4" +version = "1.0.5" dependencies = [ "gif", "glam", diff --git a/MANUAL.md b/MANUAL.md index d06e6513..6cb9ee94 100644 --- a/MANUAL.md +++ b/MANUAL.md @@ -269,6 +269,7 @@ Each object in the array can be one of: , ], + "time":