mirror of
https://gitlab.com/asus-linux/asusctl.git
synced 2026-02-06 00:15:04 +01:00
Major update to supergfx and others
This commit is contained in:
@@ -1,10 +1,10 @@
|
||||
pub static DBUS_NAME: &str = "org.asuslinux.Daemon";
|
||||
pub static DBUS_NAME_GFX: &str = "org.supergfxctl.Daemon";
|
||||
pub static DBUS_PATH: &str = "/org/asuslinux/Daemon";
|
||||
pub static DBUS_IFACE: &str = "org.asuslinux.Daemon";
|
||||
|
||||
pub mod zbus_anime;
|
||||
pub mod zbus_charge;
|
||||
pub mod zbus_gfx;
|
||||
pub mod zbus_led;
|
||||
pub mod zbus_profile;
|
||||
pub mod zbus_rogbios;
|
||||
@@ -13,7 +13,6 @@ pub mod zbus_supported;
|
||||
use rog_anime::AnimePowerStates;
|
||||
use rog_aura::{AuraEffect, LedPowerStates};
|
||||
use rog_profiles::Profile;
|
||||
use supergfxctl::gfx_vendors::{GfxRequiredUserAction, GfxVendors};
|
||||
use std::sync::mpsc::{channel, Receiver};
|
||||
use zbus::{Connection, Result, SignalReceiver};
|
||||
|
||||
@@ -21,7 +20,6 @@ pub static VERSION: &str = env!("CARGO_PKG_VERSION");
|
||||
pub struct DbusProxies<'a> {
|
||||
anime: zbus_anime::AnimeProxy<'a>,
|
||||
charge: zbus_charge::ChargeProxy<'a>,
|
||||
gfx: zbus_gfx::GfxProxy<'a>,
|
||||
led: zbus_led::LedProxy<'a>,
|
||||
profile: zbus_profile::ProfileProxy<'a>,
|
||||
rog_bios: zbus_rogbios::RogBiosProxy<'a>,
|
||||
@@ -38,7 +36,6 @@ impl<'a> DbusProxies<'a> {
|
||||
anime: zbus_anime::AnimeProxy::new(&conn)?,
|
||||
led: zbus_led::LedProxy::new(&conn)?,
|
||||
charge: zbus_charge::ChargeProxy::new(&conn)?,
|
||||
gfx: zbus_gfx::GfxProxy::new(&conn)?,
|
||||
profile: zbus_profile::ProfileProxy::new(&conn)?,
|
||||
rog_bios: zbus_rogbios::RogBiosProxy::new(&conn)?,
|
||||
supported: zbus_supported::SupportProxy::new(&conn)?,
|
||||
@@ -52,7 +49,6 @@ impl<'a> DbusProxies<'a> {
|
||||
recv.receive_for(self.anime.proxy());
|
||||
recv.receive_for(self.led.proxy());
|
||||
recv.receive_for(self.charge.proxy());
|
||||
recv.receive_for(self.gfx.proxy());
|
||||
recv.receive_for(self.profile.proxy());
|
||||
recv.receive_for(self.rog_bios.proxy());
|
||||
recv.receive_for(self.supported.proxy());
|
||||
@@ -67,10 +63,6 @@ impl<'a> DbusProxies<'a> {
|
||||
&self.charge
|
||||
}
|
||||
|
||||
pub fn gfx(&self) -> &zbus_gfx::GfxProxy<'a> {
|
||||
&self.gfx
|
||||
}
|
||||
|
||||
pub fn led(&self) -> &zbus_led::LedProxy<'a> {
|
||||
&self.led
|
||||
}
|
||||
@@ -90,8 +82,6 @@ impl<'a> DbusProxies<'a> {
|
||||
|
||||
// Signals separated out
|
||||
pub struct Signals {
|
||||
pub gfx_vendor: Receiver<GfxVendors>,
|
||||
pub gfx_action: Receiver<GfxRequiredUserAction>,
|
||||
pub profile: Receiver<Profile>,
|
||||
pub led_mode: Receiver<AuraEffect>,
|
||||
pub led_power_state: Receiver<LedPowerStates>,
|
||||
@@ -105,16 +95,6 @@ impl Signals {
|
||||
#[inline]
|
||||
pub fn new(proxies: &DbusProxies) -> Result<Self> {
|
||||
Ok(Signals {
|
||||
gfx_vendor: {
|
||||
let (tx, rx) = channel();
|
||||
proxies.gfx.connect_notify_gfx(tx)?;
|
||||
rx
|
||||
},
|
||||
gfx_action: {
|
||||
let (tx, rx) = channel();
|
||||
proxies.gfx.connect_notify_action(tx)?;
|
||||
rx
|
||||
},
|
||||
profile: {
|
||||
let (tx, rx) = channel();
|
||||
proxies.profile.connect_notify_profile(tx)?;
|
||||
@@ -182,26 +162,9 @@ impl<'a> RogDbusClient<'a> {
|
||||
recv.receive_for(self.proxies.anime.proxy());
|
||||
recv.receive_for(self.proxies.led.proxy());
|
||||
recv.receive_for(self.proxies.charge.proxy());
|
||||
recv.receive_for(self.proxies.gfx.proxy());
|
||||
recv.receive_for(self.proxies.profile.proxy());
|
||||
recv.receive_for(self.proxies.rog_bios.proxy());
|
||||
recv.receive_for(self.proxies.supported.proxy());
|
||||
recv
|
||||
}
|
||||
|
||||
/*
|
||||
* GFX
|
||||
*/
|
||||
pub fn gfx_wait_changed(&self) -> Result<GfxRequiredUserAction> {
|
||||
loop {
|
||||
if let Ok(res) = self.proxies.gfx.proxy().next_signal() {
|
||||
if res.is_none() {
|
||||
if let Ok(stuff) = self.signals.gfx_action.try_recv() {
|
||||
return Ok(stuff);
|
||||
}
|
||||
// return Ok("Failed for unknown reason".to_owned());
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user