mirror of
https://gitlab.com/asus-linux/asusctl.git
synced 2026-02-06 00:15:04 +01:00
Switch zbus led_mode to return AuraModeNum
This commit is contained in:
@@ -417,10 +417,11 @@ impl CtrlKbdLed {
|
||||
let next = self.supported_modes.standard[idx];
|
||||
|
||||
self.config.read();
|
||||
if self.config.builtins.contains_key(&next) {
|
||||
// if self.config.builtins.contains_key(&next) {
|
||||
self.config.current_mode = next;
|
||||
dbg!(self.config.current_mode);
|
||||
self.write_current_config_mode()?;
|
||||
}
|
||||
// }
|
||||
self.config.write();
|
||||
}
|
||||
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
use async_trait::async_trait;
|
||||
use log::warn;
|
||||
use rog_aura::{usb::AuraPowerDev, AuraEffect, LedBrightness};
|
||||
use rog_aura::{usb::AuraPowerDev, AuraEffect, LedBrightness, AuraModeNum};
|
||||
use zbus::{dbus_interface, Connection, SignalContext};
|
||||
|
||||
use super::controller::CtrlKbdLedZbus;
|
||||
@@ -175,17 +175,19 @@ impl CtrlKbdLedZbus {
|
||||
}
|
||||
|
||||
/// Return the current mode data
|
||||
#[dbus_interface(property)]
|
||||
async fn led_mode(&self) -> String {
|
||||
// #[dbus_interface(property)]
|
||||
async fn led_mode(&self) -> AuraModeNum {
|
||||
if let Ok(ctrl) = self.0.try_lock() {
|
||||
if let Some(mode) = ctrl.config.builtins.get(&ctrl.config.current_mode) {
|
||||
if let Ok(json) = serde_json::to_string(&mode) {
|
||||
return json;
|
||||
}
|
||||
}
|
||||
// if let Some(mode) = ctrl.config.builtins.get(&ctrl.config.current_mode) {
|
||||
// if let Ok(json) = serde_json::to_string(&ctrl.config.current_mode) {
|
||||
// return json;
|
||||
// }
|
||||
// }
|
||||
return ctrl.config.current_mode;
|
||||
}
|
||||
warn!("SetKeyBacklight could not deserialise");
|
||||
"SetKeyBacklight could not deserialise".to_string()
|
||||
// warn!("SetKeyBacklight could not deserialise");
|
||||
// "SetKeyBacklight could not deserialise".to_string()
|
||||
AuraModeNum::Static
|
||||
}
|
||||
|
||||
/// Return a list of available modes
|
||||
|
||||
@@ -22,7 +22,7 @@
|
||||
use zbus::{blocking::Connection, Result};
|
||||
use zbus_macros::dbus_proxy;
|
||||
|
||||
use rog_aura::{usb::AuraPowerDev, AuraEffect, KeyColourArray, LedBrightness};
|
||||
use rog_aura::{usb::AuraPowerDev, AuraEffect, KeyColourArray, LedBrightness, AuraModeNum};
|
||||
|
||||
const BLOCKING_TIME: u64 = 40; // 100ms = 10 FPS, max 50ms = 20 FPS, 40ms = 25 FPS
|
||||
|
||||
@@ -63,8 +63,8 @@ trait Led {
|
||||
fn led_brightness(&self) -> zbus::Result<i16>;
|
||||
|
||||
/// LedMode property
|
||||
#[dbus_proxy(property)]
|
||||
fn led_mode(&self) -> zbus::Result<String>;
|
||||
// #[dbus_proxy(property)]
|
||||
fn led_mode(&self) -> zbus::Result<AuraModeNum>;
|
||||
|
||||
/// LedModes property
|
||||
#[dbus_proxy(property)]
|
||||
|
||||
Reference in New Issue
Block a user