Add GA503Q led modes

This commit is contained in:
Luke D. Jones
2021-05-30 10:19:25 +12:00
parent 62a18d4e57
commit b9c4ff9ca7
12 changed files with 41 additions and 31 deletions

View File

@@ -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

View File

@@ -158,10 +158,10 @@ fn main() -> Result<(), Box<dyn std::error::Error>> {
}
}
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 {

View File

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

View File

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

View File

@@ -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"]

View File

@@ -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<bool>;
/// Get the status of if factory system-status animations are enabled
#[dbus_proxy(property)]
fn boot_enabled(&self) -> zbus::Result<bool>;
/// 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<bool> {
self.0.awake_enabled()
}
/// Get the status of if factory system-status animations are enabled
#[inline]
pub fn boot_enabled(&self) -> Result<bool> {
self.0.boot_enabled()

View File

@@ -47,6 +47,7 @@ impl<'a> ChargeProxy<'a> {
Ok(ChargeProxy(DaemonProxy::new(&conn)?))
}
#[inline]
pub fn proxy(&self) -> &DaemonProxy<'a> {
&self.0
}

View File

@@ -55,6 +55,7 @@ impl<'a> GfxProxy<'a> {
Ok(GfxProxy(DaemonProxy::new(&conn)?))
}
#[inline]
pub fn proxy(&self) -> &DaemonProxy<'a> {
&self.0
}

View File

@@ -84,6 +84,7 @@ impl<'a> LedProxy<'a> {
Ok(LedProxy(DaemonProxy::new(&conn)?))
}
#[inline]
pub fn proxy(&self) -> &DaemonProxy<'a> {
&self.0
}

View File

@@ -63,6 +63,7 @@ impl<'a> ProfileProxy<'a> {
Ok(ProfileProxy(DaemonProxy::new(&conn)?))
}
#[inline]
pub fn proxy(&self) -> &DaemonProxy<'a> {
&self.0
}

View File

@@ -57,6 +57,7 @@ impl<'a> RogBiosProxy<'a> {
Ok(RogBiosProxy(DaemonProxy::new(&conn)?))
}
#[inline]
pub fn proxy(&self) -> &DaemonProxy<'a> {
&self.0
}

View File

@@ -39,6 +39,7 @@ impl<'a> SupportProxy<'a> {
Ok(SupportProxy(DaemonProxy::new(&conn)?))
}
#[inline]
pub fn proxy(&self) -> &DaemonProxy<'a> {
&self.0
}