mirror of
https://gitlab.com/asus-linux/asusctl.git
synced 2026-02-06 00:15:04 +01:00
adds support to enable/disable side leds
This commit is contained in:
@@ -83,6 +83,7 @@ impl<'a> DbusProxies<'a> {
|
||||
pub struct Signals {
|
||||
pub profile: Receiver<Profile>,
|
||||
pub led_mode: Receiver<AuraEffect>,
|
||||
pub side_leds: Receiver<bool>,
|
||||
pub led_power_state: Receiver<LedPowerStates>,
|
||||
pub anime_power_state: Receiver<AnimePowerStates>,
|
||||
pub charge: Receiver<u8>,
|
||||
@@ -109,6 +110,11 @@ impl Signals {
|
||||
proxies.led.connect_notify_led(tx)?;
|
||||
rx
|
||||
},
|
||||
side_leds: {
|
||||
let (tx, rx) = channel();
|
||||
proxies.led.connect_notify_side_leds(tx)?;
|
||||
rx
|
||||
},
|
||||
led_power_state: {
|
||||
let (tx, rx) = channel();
|
||||
proxies.led.connect_notify_power_states(tx)?;
|
||||
|
||||
@@ -56,10 +56,16 @@ trait Daemon {
|
||||
/// SetSleepEnabled method
|
||||
fn set_sleep_enabled(&self, enabled: bool) -> zbus::Result<()>;
|
||||
|
||||
/// SetSideLedsEnabled method
|
||||
fn set_side_leds_enabled(&self, enabled: bool) -> Result<()>;
|
||||
|
||||
/// NotifyLed signal
|
||||
#[dbus_proxy(signal)]
|
||||
fn notify_led(&self, data: AuraEffect) -> zbus::Result<()>;
|
||||
|
||||
#[dbus_proxy(signal)]
|
||||
fn notify_side_leds(&self, data: bool) -> zbus::Result<()>;
|
||||
|
||||
#[dbus_proxy(signal)]
|
||||
fn notify_power_states(&self, data: LedPowerStates) -> zbus::Result<()>;
|
||||
|
||||
@@ -80,6 +86,9 @@ trait Daemon {
|
||||
|
||||
#[dbus_proxy(property)]
|
||||
fn sleep_enabled(&self) -> zbus::Result<bool>;
|
||||
|
||||
#[dbus_proxy(property)]
|
||||
fn side_leds_enabled(&self) -> zbus::Result<bool>;
|
||||
}
|
||||
|
||||
pub struct LedProxy<'a>(DaemonProxy<'a>);
|
||||
@@ -120,6 +129,13 @@ impl<'a> LedProxy<'a> {
|
||||
Ok(())
|
||||
}
|
||||
|
||||
/// Set the keyboard side LEDs to enabled
|
||||
#[inline]
|
||||
pub fn set_side_leds_enabled(&self, enabled: bool) -> Result<()> {
|
||||
self.0.set_side_leds_enabled(enabled)?;
|
||||
Ok(())
|
||||
}
|
||||
|
||||
#[inline]
|
||||
pub fn next_led_mode(&self) -> Result<()> {
|
||||
self.0.next_led_mode()
|
||||
@@ -155,6 +171,11 @@ impl<'a> LedProxy<'a> {
|
||||
self.0.sleep_enabled()
|
||||
}
|
||||
|
||||
#[inline]
|
||||
pub fn side_leds_enabled(&self) -> Result<bool> {
|
||||
self.0.side_leds_enabled()
|
||||
}
|
||||
|
||||
/// Write a single colour block.
|
||||
///
|
||||
/// Intentionally blocks for 10ms after sending to allow the block to
|
||||
@@ -196,6 +217,15 @@ impl<'a> LedProxy<'a> {
|
||||
})
|
||||
}
|
||||
|
||||
#[inline]
|
||||
pub fn connect_notify_side_leds(&self, send: Sender<bool>) -> zbus::fdo::Result<()> {
|
||||
self.0.connect_notify_side_leds(move |data| {
|
||||
send.send(data)
|
||||
.map_err(|err| zbus::fdo::Error::Failed(err.to_string()))?;
|
||||
Ok(())
|
||||
})
|
||||
}
|
||||
|
||||
#[inline]
|
||||
pub fn connect_notify_power_states(
|
||||
&self,
|
||||
|
||||
Reference in New Issue
Block a user