mirror of
https://gitlab.com/asus-linux/asusctl.git
synced 2026-02-06 00:15:04 +01:00
2b58e259de
- Add extra config options and dbus methods - Add power state signals for anime and led - Refactor to use channels for dbus signal handler send/recv - Split out profiles independant parts to a rog-profiles crate - Cleanup dependencies - Fix some dbus Supported issues
61 lines
1.8 KiB
Rust
61 lines
1.8 KiB
Rust
use log::warn;
|
|
use serde_derive::{Deserialize, Serialize};
|
|
use zbus::dbus_interface;
|
|
use zvariant::ObjectPath;
|
|
use zvariant_derive::Type;
|
|
|
|
use crate::{
|
|
ctrl_anime::CtrlAnime, ctrl_charge::CtrlCharge, ctrl_leds::controller::CtrlKbdLed,
|
|
ctrl_profiles::controller::CtrlFanAndCpu, ctrl_rog_bios::CtrlRogBios, GetSupported,
|
|
};
|
|
|
|
use rog_types::supported::{
|
|
AnimeSupportedFunctions, ChargeSupportedFunctions, FanCpuSupportedFunctions,
|
|
LedSupportedFunctions, RogBiosSupportedFunctions,
|
|
};
|
|
|
|
#[derive(Serialize, Deserialize, Type)]
|
|
pub struct SupportedFunctions {
|
|
pub anime_ctrl: AnimeSupportedFunctions,
|
|
pub charge_ctrl: ChargeSupportedFunctions,
|
|
pub fan_cpu_ctrl: FanCpuSupportedFunctions,
|
|
pub keyboard_led: LedSupportedFunctions,
|
|
pub rog_bios_ctrl: RogBiosSupportedFunctions,
|
|
}
|
|
|
|
#[dbus_interface(name = "org.asuslinux.Daemon")]
|
|
impl SupportedFunctions {
|
|
fn supported_functions(&self) -> &SupportedFunctions {
|
|
self
|
|
}
|
|
}
|
|
|
|
impl crate::ZbusAdd for SupportedFunctions {
|
|
fn add_to_server(self, server: &mut zbus::ObjectServer) {
|
|
server
|
|
.at(
|
|
&ObjectPath::from_str_unchecked("/org/asuslinux/Supported"),
|
|
self,
|
|
)
|
|
.map_err(|err| {
|
|
warn!("SupportedFunctions: add_to_server {}", err);
|
|
err
|
|
})
|
|
.ok();
|
|
}
|
|
}
|
|
|
|
impl GetSupported for SupportedFunctions {
|
|
type A = SupportedFunctions;
|
|
|
|
fn get_supported() -> Self::A {
|
|
SupportedFunctions {
|
|
anime_ctrl: CtrlAnime::get_supported(),
|
|
keyboard_led: CtrlKbdLed::get_supported(),
|
|
charge_ctrl: CtrlCharge::get_supported(),
|
|
fan_cpu_ctrl: CtrlFanAndCpu::get_supported(),
|
|
rog_bios_ctrl: CtrlRogBios::get_supported(),
|
|
}
|
|
}
|
|
}
|