From a1a9c7077addb2849734e9b3ad8cbef8747c9e35 Mon Sep 17 00:00:00 2001 From: "Luke D. Jones" Date: Thu, 26 Dec 2024 21:36:07 +1300 Subject: [PATCH] Rename dbus. Add asus_armoury client source --- asusctl/src/main.rs | 40 +++++++++---------- asusd-user/src/ctrl_anime.rs | 7 +--- asusd-user/src/daemon.rs | 2 +- asusd-user/src/zbus_anime.rs | 11 ++--- asusd/src/asus_armoury/attr_enum_int.rs | 11 +++-- asusd/src/asus_armoury/attr_enum_str.rs | 22 ++++------ asusd/src/asus_armoury/attr_int.rs | 14 +++---- asusd/src/aura_anime/trait_impls.rs | 2 +- asusd/src/aura_laptop/trait_impls.rs | 6 +-- asusd/src/aura_scsi/trait_impls.rs | 2 +- asusd/src/aura_slash/trait_impls.rs | 2 +- asusd/src/ctrl_fancurves.rs | 4 +- asusd/src/ctrl_platform.rs | 4 +- asusd/src/lib.rs | 8 ++-- data/asusd.conf | 22 +++++----- rog-control-center/src/ui/mod.rs | 16 ++++---- rog-control-center/src/ui/setup_aura.rs | 6 +-- .../translations/en/rog-control-center.po | 2 +- rog-dbus/src/asus_armoury/attr_enum_int.rs | 33 +++++++++++++++ rog-dbus/src/asus_armoury/attr_enum_str.rs | 25 ++++++++++++ rog-dbus/src/asus_armoury/attr_int.rs | 25 ++++++++++++ rog-dbus/src/asus_armoury/mod.rs | 3 ++ rog-dbus/src/lib.rs | 7 ++-- rog-dbus/src/scsi_aura.rs | 12 +++--- rog-dbus/src/zbus_anime.rs | 6 +-- rog-dbus/src/zbus_aura.rs | 12 +++--- rog-dbus/src/zbus_fan_curves.rs | 12 +++--- rog-dbus/src/zbus_platform.rs | 12 +++--- rog-dbus/src/zbus_slash.rs | 6 +-- 29 files changed, 203 insertions(+), 131 deletions(-) create mode 100644 rog-dbus/src/asus_armoury/attr_enum_int.rs create mode 100644 rog-dbus/src/asus_armoury/attr_enum_str.rs create mode 100644 rog-dbus/src/asus_armoury/attr_int.rs create mode 100644 rog-dbus/src/asus_armoury/mod.rs diff --git a/asusctl/src/main.rs b/asusctl/src/main.rs index f8e264f0..eddf5e8d 100644 --- a/asusctl/src/main.rs +++ b/asusctl/src/main.rs @@ -132,8 +132,7 @@ where T: ProxyImpl<'static> + From>, { let conn = zbus::blocking::Connection::system().unwrap(); - let f = - zbus::blocking::fdo::ObjectManagerProxy::new(&conn, "org.asuslinux.Daemon", "/").unwrap(); + let f = zbus::blocking::fdo::ObjectManagerProxy::new(&conn, "xyz.ljones.Asusd", "/").unwrap(); let interfaces = f.get_managed_objects().unwrap(); let mut paths = Vec::new(); for v in interfaces.iter() { @@ -155,7 +154,7 @@ where ctrl.push( T::builder(&conn) .path(path.clone())? - .destination("org.asuslinux.Daemon")? + .destination("xyz.ljones.Asusd")? .build()?, ); } @@ -201,7 +200,7 @@ fn do_parsed( println!(); if let Some(cmdlist) = CliStart::command_list() { let dev_type = - if let Ok(proxy) = find_iface::("org.asuslinux.Aura") { + if let Ok(proxy) = find_iface::("xyz.ljones.Aura") { // TODO: commands on all? proxy .first() @@ -214,32 +213,31 @@ fn do_parsed( let commands: Vec = cmdlist.lines().map(|s| s.to_owned()).collect(); for command in commands.iter().filter(|command| { if command.trim().starts_with("fan-curve") - && !supported_interfaces - .contains(&"org.asuslinux.FanCurves".to_string()) + && !supported_interfaces.contains(&"xyz.ljones.FanCurves".to_string()) { return false; } if command.trim().starts_with("aura") - && !supported_interfaces.contains(&"org.asuslinux.Aura".to_string()) + && !supported_interfaces.contains(&"xyz.ljones.Aura".to_string()) { return false; } if command.trim().starts_with("anime") - && !supported_interfaces.contains(&"org.asuslinux.Anime".to_string()) + && !supported_interfaces.contains(&"xyz.ljones.Anime".to_string()) { return false; } if command.trim().starts_with("slash") - && !supported_interfaces.contains(&"org.asuslinux.Slash".to_string()) + && !supported_interfaces.contains(&"xyz.ljones.Slash".to_string()) { return false; } if command.trim().starts_with("platform") - && !supported_interfaces.contains(&"org.asuslinux.Platform".to_string()) + && !supported_interfaces.contains(&"xyz.ljones.Platform".to_string()) { return false; } @@ -267,7 +265,7 @@ fn do_parsed( } if let Some(brightness) = &parsed.kbd_bright { - if let Ok(aura) = find_iface::("org.asuslinux.Aura") { + if let Ok(aura) = find_iface::("xyz.ljones.Aura") { for aura in aura.iter() { match brightness.level() { None => { @@ -283,7 +281,7 @@ fn do_parsed( } if parsed.next_kbd_bright { - if let Ok(aura) = find_iface::("org.asuslinux.Aura") { + if let Ok(aura) = find_iface::("xyz.ljones.Aura") { for aura in aura.iter() { let brightness = aura.brightness()?; aura.set_brightness(brightness.next())?; @@ -294,7 +292,7 @@ fn do_parsed( } if parsed.prev_kbd_bright { - if let Ok(aura) = find_iface::("org.asuslinux.Aura") { + if let Ok(aura) = find_iface::("xyz.ljones.Aura") { for aura in aura.iter() { let brightness = aura.brightness()?; aura.set_brightness(brightness.prev())?; @@ -310,7 +308,7 @@ fn do_parsed( "Supported Platform Properties:\n{:#?}", supported_properties ); - if let Ok(aura) = find_iface::("org.asuslinux.Aura") { + if let Ok(aura) = find_iface::("xyz.ljones.Aura") { // TODO: multiple RGB check let bright = aura.first().unwrap().supported_brightness()?; let modes = aura.first().unwrap().supported_basic_modes()?; @@ -363,7 +361,7 @@ fn handle_anime(cmd: &AnimeCommand) -> Result<(), Box> { println!("\n{}", lst); } } - let animes = find_iface::("org.asuslinux.Anime")?; + let animes = find_iface::("xyz.ljones.Anime")?; for proxy in animes { if let Some(enable) = cmd.enable_display { proxy.set_enable_display(enable)?; @@ -556,7 +554,7 @@ fn handle_slash(cmd: &SlashCommand) -> Result<(), Box> { } } - let slashes = find_iface::("org.asuslinux.Slash")?; + let slashes = find_iface::("xyz.ljones.Slash")?; for proxy in slashes { if cmd.enable { proxy.set_enabled(true)?; @@ -594,7 +592,7 @@ fn handle_scsi(cmd: &ScsiCommand) -> Result<(), Box> { } } - let scsis = find_iface::("org.asuslinux.ScsiAura")?; + let scsis = find_iface::("xyz.ljones.ScsiAura")?; for scsi in scsis { if let Some(enable) = cmd.enable { @@ -668,7 +666,7 @@ fn handle_led_mode(mode: &LedModeCommand) -> Result<(), Box = cmdlist.lines().map(|s| s.to_owned()).collect(); // TODO: multiple rgb check - let aura = find_iface::("org.asuslinux.Aura")?; + let aura = find_iface::("xyz.ljones.Aura")?; let modes = aura.first().unwrap().supported_basic_modes()?; for command in commands.iter().filter(|command| { for mode in &modes { @@ -698,7 +696,7 @@ fn handle_led_mode(mode: &LedModeCommand) -> Result<(), Box("org.asuslinux.Aura")?; + let aura = find_iface::("xyz.ljones.Aura")?; if mode.next_mode { for aura in aura { let mode = aura.led_mode()?; @@ -735,7 +733,7 @@ fn handle_led_mode(mode: &LedModeCommand) -> Result<(), Box Result<(), Box> { - let aura = find_iface::("org.asuslinux.Aura")?; + let aura = find_iface::("xyz.ljones.Aura")?; for aura in aura { let dev_type = aura.device_type()?; if !dev_type.is_old_laptop() && !dev_type.is_tuf_laptop() { @@ -795,7 +793,7 @@ fn handle_led_power_1_do_1866( } fn handle_led_power2(power: &LedPowerCommand2) -> Result<(), Box> { - let aura = find_iface::("org.asuslinux.Aura")?; + let aura = find_iface::("xyz.ljones.Aura")?; for aura in aura { let dev_type = aura.device_type()?; if !dev_type.is_new_laptop() { diff --git a/asusd-user/src/ctrl_anime.rs b/asusd-user/src/ctrl_anime.rs index 5a78b538..d77a60d9 100644 --- a/asusd-user/src/ctrl_anime.rs +++ b/asusd-user/src/ctrl_anime.rs @@ -151,10 +151,7 @@ impl CtrlAnime<'static> { pub async fn add_to_server(self, server: &mut zbus::Connection) { server .object_server() - .at( - &ObjectPath::from_str_unchecked("/org/asuslinux/Anime"), - self, - ) + .at(&ObjectPath::from_str_unchecked("/xyz/ljones/Anime"), self) .await .map_err(|err| { println!("CtrlAnime: add_to_server {}", err); @@ -170,7 +167,7 @@ impl CtrlAnime<'static> { // - Do actions // - Write config if required // - Unset inner_early_return -#[interface(name = "org.asuslinux.Daemon")] +#[interface(name = "xyz.ljones.Asusd")] impl CtrlAnime<'static> { pub fn insert_asus_gif( &mut self, diff --git a/asusd-user/src/daemon.rs b/asusd-user/src/daemon.rs index ae002352..31f7970a 100644 --- a/asusd-user/src/daemon.rs +++ b/asusd-user/src/daemon.rs @@ -42,7 +42,7 @@ fn main() -> Result<(), Box> { let early_return = Arc::new(AtomicBool::new(false)); // Set up the anime data and run loop/thread - if supported.contains(&"org.asuslinux.Anime".to_string()) { + if supported.contains(&"xyz.ljones.Anime".to_string()) { if let Some(cfg) = config.active_anime { let anime_type = get_anime_type(); let anime_config = ConfigAnime::new().set_name(cfg).load(); diff --git a/asusd-user/src/zbus_anime.rs b/asusd-user/src/zbus_anime.rs index f3734656..910e038b 100644 --- a/asusd-user/src/zbus_anime.rs +++ b/asusd-user/src/zbus_anime.rs @@ -1,8 +1,8 @@ -//! # `DBus` interface proxy for: `org.asuslinux.Daemon` +//! # `DBus` interface proxy for: `xyz.ljones.Asusd` //! //! 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 session bus`. +//! data. Source: `Interface '/xyz/ljones/Anime' from service +//! 'xyz.ljones.Asusd' on session bus`. //! //! You may prefer to adapt it, instead of using it verbatim. //! @@ -23,10 +23,7 @@ use zbus::proxy; -#[proxy( - interface = "org.asuslinux.Daemon", - default_path = "/org/asuslinux/Anime" -)] +#[proxy(interface = "xyz.ljones.Asusd", default_path = "/xyz/ljones/Anime")] trait Daemon { /// InsertAsusGif method fn insert_asus_gif( diff --git a/asusd/src/asus_armoury/attr_enum_int.rs b/asusd/src/asus_armoury/attr_enum_int.rs index 29051b34..4a9c4a8c 100644 --- a/asusd/src/asus_armoury/attr_enum_int.rs +++ b/asusd/src/asus_armoury/attr_enum_int.rs @@ -1,12 +1,11 @@ -use crate::{error::RogError, ASUS_ZBUS_PATH}; use log::error; use rog_platform::firmware_attributes::{AttrValue, Attribute}; use serde::{Deserialize, Serialize}; -use zbus::{ - fdo, interface, - zvariant::{ObjectPath, OwnedObjectPath, OwnedValue, Type, Value}, - Connection, -}; +use zbus::zvariant::{ObjectPath, OwnedObjectPath, OwnedValue, Type, Value}; +use zbus::{fdo, interface, Connection}; + +use crate::error::RogError; +use crate::ASUS_ZBUS_PATH; const MOD_NAME: &str = "asus_armoury"; diff --git a/asusd/src/asus_armoury/attr_enum_str.rs b/asusd/src/asus_armoury/attr_enum_str.rs index 1aed3577..ed4ba5d5 100644 --- a/asusd/src/asus_armoury/attr_enum_str.rs +++ b/asusd/src/asus_armoury/attr_enum_str.rs @@ -1,12 +1,11 @@ -use crate::{error::RogError, ASUS_ZBUS_PATH}; use log::error; use rog_platform::firmware_attributes::{AttrType, AttrValue, Attribute}; use serde::{Deserialize, Serialize}; -use zbus::{ - fdo, interface, - zvariant::{ObjectPath, OwnedObjectPath, OwnedValue, Type, Value}, - Connection, -}; +use zbus::zvariant::{ObjectPath, OwnedObjectPath, OwnedValue, Type, Value}; +use zbus::{fdo, interface, Connection}; + +use crate::error::RogError; +use crate::ASUS_ZBUS_PATH; const MOD_NAME: &str = "asus_armoury"; @@ -50,15 +49,10 @@ impl AsusArmouryAttribute { } #[zbus(property)] - fn attribute_type(&self) -> AttrType { - self.0.attribute_type() - } - - #[zbus(property)] - async fn default_value(&self) -> i32 { + async fn default_value(&self) -> String { match self.0.default_value() { - AttrValue::Integer(i) => *i, - _ => -1, + AttrValue::String(s) => *s, + _ => String::default(), } } diff --git a/asusd/src/asus_armoury/attr_int.rs b/asusd/src/asus_armoury/attr_int.rs index 84221771..5ee0184d 100644 --- a/asusd/src/asus_armoury/attr_int.rs +++ b/asusd/src/asus_armoury/attr_int.rs @@ -1,12 +1,11 @@ -use crate::{error::RogError, ASUS_ZBUS_PATH}; use log::error; use rog_platform::firmware_attributes::{AttrValue, Attribute}; use serde::{Deserialize, Serialize}; -use zbus::{ - fdo, interface, - zvariant::{ObjectPath, OwnedObjectPath, OwnedValue, Type, Value}, - Connection, -}; +use zbus::zvariant::{ObjectPath, OwnedObjectPath, OwnedValue, Type, Value}; +use zbus::{fdo, interface, Connection}; + +use crate::error::RogError; +use crate::ASUS_ZBUS_PATH; const MOD_NAME: &str = "asus_armoury"; @@ -42,7 +41,8 @@ impl AsusArmouryAttribute { } } -/// If return is `-1` on a property then there is avilable value for that property +/// If return is `-1` on a property then there is avilable value for that +/// property #[interface(name = "org.asuslinux.AsusArmoury")] impl AsusArmouryAttribute { #[zbus(property)] diff --git a/asusd/src/aura_anime/trait_impls.rs b/asusd/src/aura_anime/trait_impls.rs index c2df54ae..cf542559 100644 --- a/asusd/src/aura_anime/trait_impls.rs +++ b/asusd/src/aura_anime/trait_impls.rs @@ -60,7 +60,7 @@ impl AniMeZbus { // None of these calls can be guarnateed to succeed unless we loop until okay // If the try_lock *does* succeed then any other thread trying to lock will not // grab it until we finish. -#[interface(name = "org.asuslinux.Anime")] +#[interface(name = "xyz.ljones.Anime")] impl AniMeZbus { /// Writes a data stream of length. Will force system thread to exit until /// it is restarted diff --git a/asusd/src/aura_laptop/trait_impls.rs b/asusd/src/aura_laptop/trait_impls.rs index 961c8a95..eee5b88f 100644 --- a/asusd/src/aura_laptop/trait_impls.rs +++ b/asusd/src/aura_laptop/trait_impls.rs @@ -14,7 +14,7 @@ use crate::error::RogError; use crate::{CtrlTask, Reloadable}; pub const AURA_ZBUS_NAME: &str = "Aura"; -pub const AURA_ZBUS_PATH: &str = "/org/asuslinux"; +pub const AURA_ZBUS_PATH: &str = "/xyz/ljones"; #[derive(Clone)] pub struct AuraZbus(Aura); @@ -50,7 +50,7 @@ impl AuraZbus { /// The main interface for changing, reading, or notfying /// /// LED commands are split between Brightness, Modes, Per-Key -#[interface(name = "org.asuslinux.Aura")] +#[interface(name = "xyz.ljones.Aura")] impl AuraZbus { /// Return the device type for this Aura keyboard #[zbus(property)] @@ -227,7 +227,7 @@ impl AuraZbus { impl CtrlTask for AuraZbus { fn zbus_path() -> &'static str { - "/org/asuslinux" + "/xyz/ljones" } async fn create_tasks(&self, _: SignalEmitter<'static>) -> Result<(), RogError> { diff --git a/asusd/src/aura_scsi/trait_impls.rs b/asusd/src/aura_scsi/trait_impls.rs index c3d20515..7345dc28 100644 --- a/asusd/src/aura_scsi/trait_impls.rs +++ b/asusd/src/aura_scsi/trait_impls.rs @@ -34,7 +34,7 @@ impl ScsiZbus { } } -#[interface(name = "org.asuslinux.ScsiAura")] +#[interface(name = "xyz.ljones.ScsiAura")] impl ScsiZbus { /// Return the device type for this Aura keyboard #[zbus(property)] diff --git a/asusd/src/aura_slash/trait_impls.rs b/asusd/src/aura_slash/trait_impls.rs index 33f48409..92efa129 100644 --- a/asusd/src/aura_slash/trait_impls.rs +++ b/asusd/src/aura_slash/trait_impls.rs @@ -36,7 +36,7 @@ impl SlashZbus { } } -#[interface(name = "org.asuslinux.Slash")] +#[interface(name = "xyz.ljones.Slash")] impl SlashZbus { /// Get enabled or not #[zbus(property)] diff --git a/asusd/src/ctrl_fancurves.rs b/asusd/src/ctrl_fancurves.rs index 4d8c6375..7b7f6c1d 100644 --- a/asusd/src/ctrl_fancurves.rs +++ b/asusd/src/ctrl_fancurves.rs @@ -17,7 +17,7 @@ use crate::error::RogError; use crate::{CtrlTask, CONFIG_PATH_BASE}; pub const FAN_CURVE_ZBUS_NAME: &str = "FanCurves"; -pub const FAN_CURVE_ZBUS_PATH: &str = "/org/asuslinux"; +pub const FAN_CURVE_ZBUS_PATH: &str = "/xyz/ljones"; #[derive(Deserialize, Serialize, Debug, Default)] pub struct FanCurveConfig { @@ -101,7 +101,7 @@ impl CtrlFanCurveZbus { } } -#[interface(name = "org.asuslinux.FanCurves")] +#[interface(name = "xyz.ljones.FanCurves")] impl CtrlFanCurveZbus { /// Set all fan curves for a profile to enabled status. Will also activate a /// fan curve if in the same profile mode diff --git a/asusd/src/ctrl_platform.rs b/asusd/src/ctrl_platform.rs index 79f14ae6..168658ff 100644 --- a/asusd/src/ctrl_platform.rs +++ b/asusd/src/ctrl_platform.rs @@ -17,7 +17,7 @@ use crate::config::Config; use crate::error::RogError; use crate::{task_watch_item, task_watch_item_notify, CtrlTask, ReloadAndNotify}; -const PLATFORM_ZBUS_PATH: &str = "/org/asuslinux"; +const PLATFORM_ZBUS_PATH: &str = "/xyz/ljones"; macro_rules! platform_get_value { ($self:ident, $property:tt, $prop_name:literal) => { @@ -302,7 +302,7 @@ impl CtrlPlatform { } } -#[interface(name = "org.asuslinux.Platform")] +#[interface(name = "xyz.ljones.Platform")] impl CtrlPlatform { #[zbus(property)] async fn version(&self) -> String { diff --git a/asusd/src/lib.rs b/asusd/src/lib.rs index 2d5853a8..8272d617 100644 --- a/asusd/src/lib.rs +++ b/asusd/src/lib.rs @@ -31,11 +31,11 @@ use zbus::Connection; use crate::error::RogError; const CONFIG_PATH_BASE: &str = "/etc/asusd/"; -pub const ASUS_ZBUS_PATH: &str = "/org/asuslinux"; +pub const ASUS_ZBUS_PATH: &str = "/xyz/ljones"; -pub static DBUS_NAME: &str = "org.asuslinux.Daemon"; -pub static DBUS_PATH: &str = "/org/asuslinux/Daemon"; -pub static DBUS_IFACE: &str = "org.asuslinux.Daemon"; +pub static DBUS_NAME: &str = "xyz.ljones.Asusd"; +pub static DBUS_PATH: &str = "/xyz/ljones/Daemon"; +pub static DBUS_IFACE: &str = "xyz.ljones.Asusd"; /// This macro adds a function which spawns an `inotify` task on the passed in /// `Executor`. diff --git a/data/asusd.conf b/data/asusd.conf index dbba0cf3..e14ba477 100644 --- a/data/asusd.conf +++ b/data/asusd.conf @@ -3,24 +3,24 @@ "http://www.freedesktop.org/standards/dbus/1.0/busconfig.dtd"> - - + + - - + + - - + + - - + + - - - + + + diff --git a/rog-control-center/src/ui/mod.rs b/rog-control-center/src/ui/mod.rs index 40f96288..228d1e58 100644 --- a/rog-control-center/src/ui/mod.rs +++ b/rog-control-center/src/ui/mod.rs @@ -112,10 +112,10 @@ pub fn setup_window(config: Arc>) -> MainWindow { ui.set_sidebar_items_avilable( [ // Needs to match the order of slint sidebar items - available.contains(&"org.asuslinux.Platform".to_string()), - available.contains(&"org.asuslinux.Aura".to_string()), - available.contains(&"org.asuslinux.Anime".to_string()), - available.contains(&"org.asuslinux.FanCurves".to_string()), + available.contains(&"xyz.ljones.Platform".to_string()), + available.contains(&"xyz.ljones.Aura".to_string()), + available.contains(&"xyz.ljones.Anime".to_string()), + available.contains(&"xyz.ljones.FanCurves".to_string()), true, true, ] @@ -127,17 +127,17 @@ pub fn setup_window(config: Arc>) -> MainWindow { }); setup_app_settings_page(&ui, config.clone()); - if available.contains(&"org.asuslinux.Platform".to_string()) { + if available.contains(&"xyz.ljones.Platform".to_string()) { setup_system_page(&ui, config.clone()); setup_system_page_callbacks(&ui, config.clone()); } - if available.contains(&"org.asuslinux.Aura".to_string()) { + if available.contains(&"xyz.ljones.Aura".to_string()) { setup_aura_page(&ui, config.clone()); } - if available.contains(&"org.asuslinux.Anime".to_string()) { + if available.contains(&"xyz.ljones.Anime".to_string()) { setup_anime_page(&ui, config.clone()); } - if available.contains(&"org.asuslinux.FanCurves".to_string()) { + if available.contains(&"xyz.ljones.FanCurves".to_string()) { setup_fan_curve_page(&ui, config); } ui diff --git a/rog-control-center/src/ui/setup_aura.rs b/rog-control-center/src/ui/setup_aura.rs index f5e15f3a..627a015c 100644 --- a/rog-control-center/src/ui/setup_aura.rs +++ b/rog-control-center/src/ui/setup_aura.rs @@ -38,12 +38,12 @@ fn decode_hex(s: &str) -> RgbaColor { // TODO: return all async fn find_aura_iface() -> Result, Box> { let conn = zbus::Connection::system().await?; - let f = zbus::fdo::ObjectManagerProxy::new(&conn, "org.asuslinux.Daemon", "/").await?; + let f = zbus::fdo::ObjectManagerProxy::new(&conn, "xyz.ljones.Asusd", "/").await?; let interfaces = f.get_managed_objects().await?; let mut aura_paths = Vec::new(); for v in interfaces.iter() { for k in v.1.keys() { - if k.as_str() == "org.asuslinux.Aura" { + if k.as_str() == "xyz.ljones.Aura" { println!("Found aura device at {}, {}", v.0, k); aura_paths.push(v.0.clone()); } @@ -56,7 +56,7 @@ async fn find_aura_iface() -> Result, Box\n" "Language-Team: LANGUAGE \n" diff --git a/rog-dbus/src/asus_armoury/attr_enum_int.rs b/rog-dbus/src/asus_armoury/attr_enum_int.rs new file mode 100644 index 00000000..0befc952 --- /dev/null +++ b/rog-dbus/src/asus_armoury/attr_enum_int.rs @@ -0,0 +1,33 @@ +//! Path for iface is such as "/xyz/ljones/asus_armoury/boot_sound" +use zbus::proxy; +#[proxy( + interface = "xyz.ljones.AsusArmoury", + default_service = "xyz.ljones.Asusd" +)] +pub trait AsusArmoury { + /// CurrentValue property + #[zbus(property)] + fn current_value(&self) -> zbus::Result; + #[zbus(property)] + fn set_current_value(&self, value: i32) -> zbus::Result<()>; + + /// DefaultValue property + #[zbus(property)] + fn default_value(&self) -> zbus::Result; + + /// MaxValue property + #[zbus(property)] + fn max_value(&self) -> zbus::Result; + + /// MinValue property + #[zbus(property)] + fn min_value(&self) -> zbus::Result; + + /// Name property + #[zbus(property)] + fn name(&self) -> zbus::Result; + + /// ScalarIncrement property + #[zbus(property)] + fn scalar_increment(&self) -> zbus::Result; +} diff --git a/rog-dbus/src/asus_armoury/attr_enum_str.rs b/rog-dbus/src/asus_armoury/attr_enum_str.rs new file mode 100644 index 00000000..c73ce013 --- /dev/null +++ b/rog-dbus/src/asus_armoury/attr_enum_str.rs @@ -0,0 +1,25 @@ +//! Path for iface is such as "/xyz/ljones/asus_armoury/boot_sound" +use zbus::proxy; +#[proxy( + interface = "xyz.ljones.AsusArmoury", + default_service = "xyz.ljones.Asusd" +)] +pub trait AsusArmoury { + /// CurrentValue property + #[zbus(property)] + fn current_value(&self) -> zbus::Result; + #[zbus(property)] + fn set_current_value(&self, value: String) -> zbus::Result<()>; + + /// DefaultValue property + #[zbus(property)] + fn default_value(&self) -> zbus::Result; + + /// Name property + #[zbus(property)] + fn name(&self) -> zbus::Result; + + /// PossibleValues property + #[zbus(property)] + fn possible_values(&self) -> zbus::Result>; +} diff --git a/rog-dbus/src/asus_armoury/attr_int.rs b/rog-dbus/src/asus_armoury/attr_int.rs new file mode 100644 index 00000000..c8fa233f --- /dev/null +++ b/rog-dbus/src/asus_armoury/attr_int.rs @@ -0,0 +1,25 @@ +use zbus::proxy; +#[proxy( + interface = "xyz.ljones.AsusArmoury", + default_service = "xyz.ljones.Asusd", + default_path = "/xyz/ljones/asus_armoury/boot_sound" +)] +pub trait AsusArmoury { + /// CurrentValue property + #[zbus(property)] + fn current_value(&self) -> zbus::Result; + #[zbus(property)] + fn set_current_value(&self, value: i32) -> zbus::Result<()>; + + /// DefaultValue property + #[zbus(property)] + fn default_value(&self) -> zbus::Result; + + /// Name property + #[zbus(property)] + fn name(&self) -> zbus::Result; + + /// PossibleValues property + #[zbus(property)] + fn possible_values(&self) -> zbus::Result>; +} diff --git a/rog-dbus/src/asus_armoury/mod.rs b/rog-dbus/src/asus_armoury/mod.rs new file mode 100644 index 00000000..d772e4cc --- /dev/null +++ b/rog-dbus/src/asus_armoury/mod.rs @@ -0,0 +1,3 @@ +pub mod attr_enum_int; +pub mod attr_enum_str; +pub mod attr_int; diff --git a/rog-dbus/src/lib.rs b/rog-dbus/src/lib.rs index 787270aa..c3cc4f41 100644 --- a/rog-dbus/src/lib.rs +++ b/rog-dbus/src/lib.rs @@ -1,5 +1,6 @@ pub use asusd::{DBUS_IFACE, DBUS_NAME, DBUS_PATH}; +pub mod asus_armoury; pub mod scsi_aura; pub mod zbus_anime; pub mod zbus_aura; @@ -11,7 +12,7 @@ pub const VERSION: &str = env!("CARGO_PKG_VERSION"); pub fn list_iface_blocking() -> Result, Box> { let conn = zbus::blocking::Connection::system()?; - let f = zbus::blocking::fdo::ObjectManagerProxy::new(&conn, "org.asuslinux.Daemon", "/")?; + let f = zbus::blocking::fdo::ObjectManagerProxy::new(&conn, "xyz.ljones.Asusd", "/")?; let interfaces = f.get_managed_objects()?; let mut ifaces = Vec::new(); for v in interfaces.iter() { @@ -24,7 +25,7 @@ pub fn list_iface_blocking() -> Result, Box> pub fn has_iface_blocking(iface: &str) -> Result> { let conn = zbus::blocking::Connection::system()?; - let f = zbus::blocking::fdo::ObjectManagerProxy::new(&conn, "org.asuslinux.Daemon", "/")?; + let f = zbus::blocking::fdo::ObjectManagerProxy::new(&conn, "xyz.ljones.Asusd", "/")?; let interfaces = f.get_managed_objects()?; for v in interfaces.iter() { for k in v.1.keys() { @@ -38,7 +39,7 @@ pub fn has_iface_blocking(iface: &str) -> Result Result> { let conn = zbus::Connection::system().await?; - let f = zbus::fdo::ObjectManagerProxy::new(&conn, "org.asuslinux.Daemon", "/").await?; + let f = zbus::fdo::ObjectManagerProxy::new(&conn, "xyz.ljones.Asusd", "/").await?; let interfaces = f.get_managed_objects().await?; for v in interfaces.iter() { for k in v.1.keys() { diff --git a/rog-dbus/src/scsi_aura.rs b/rog-dbus/src/scsi_aura.rs index 39e8959f..2ee38c27 100644 --- a/rog-dbus/src/scsi_aura.rs +++ b/rog-dbus/src/scsi_aura.rs @@ -1,8 +1,8 @@ -//! # D-Bus interface proxy for: `org.asuslinux.ScsiAura` +//! # D-Bus interface proxy for: `xyz.ljones.ScsiAura` //! //! This code was generated by `zbus-xmlgen` `5.0.1` from D-Bus introspection -//! data. Source: `Interface '/org/asuslinux/M3D0AP048745_scsi' from service -//! 'org.asuslinux.Daemon' on system bus`. +//! data. Source: `Interface '/xyz/ljones/M3D0AP048745_scsi' from service +//! 'xyz.ljones.Asusd' on system bus`. //! //! You may prefer to adapt it, instead of using it verbatim. //! @@ -23,9 +23,9 @@ use rog_scsi::{AuraEffect, AuraMode}; use zbus::proxy; #[proxy( - interface = "org.asuslinux.ScsiAura", - default_service = "org.asuslinux.Daemon", - default_path = "/org/asuslinux" + interface = "xyz.ljones.ScsiAura", + default_service = "xyz.ljones.Asusd", + default_path = "/xyz/ljones" )] pub trait ScsiAura { /// AllModeData method diff --git a/rog-dbus/src/zbus_anime.rs b/rog-dbus/src/zbus_anime.rs index a748758a..ed0df009 100644 --- a/rog-dbus/src/zbus_anime.rs +++ b/rog-dbus/src/zbus_anime.rs @@ -3,9 +3,9 @@ use rog_anime::{Animations, AnimeDataBuffer, DeviceState as AnimeDeviceState}; use zbus::proxy; #[proxy( - interface = "org.asuslinux.Anime", - default_service = "org.asuslinux.Daemon", - default_path = "/org/asuslinux" + interface = "xyz.ljones.Anime", + default_service = "xyz.ljones.Asusd", + default_path = "/xyz/ljones" )] pub trait Anime { /// DeviceState method diff --git a/rog-dbus/src/zbus_aura.rs b/rog-dbus/src/zbus_aura.rs index 82bf706b..95c97fb1 100644 --- a/rog-dbus/src/zbus_aura.rs +++ b/rog-dbus/src/zbus_aura.rs @@ -1,8 +1,8 @@ -//! # `DBus` interface proxy for: `org.asuslinux.Daemon` +//! # `DBus` interface proxy for: `xyz.ljones.Asusd` //! //! This code was generated by `zbus-xmlgen` `1.0.0` from `DBus` introspection -//! data. Source: `Interface '/org/asuslinux/Aura' from service -//! 'org.asuslinux.Daemon' on system bus`. +//! data. Source: `Interface '/xyz/ljones/Aura' from service +//! 'xyz.ljones.Asusd' on system bus`. //! //! You may prefer to adapt it, instead of using it verbatim. //! @@ -30,9 +30,9 @@ use zbus::{proxy, Result}; const BLOCKING_TIME: u64 = 33; // 100ms = 10 FPS, max 50ms = 20 FPS, 40ms = 25 FPS #[proxy( - interface = "org.asuslinux.Aura", - default_service = "org.asuslinux.Daemon", - default_path = "/org/asuslinux/Aura" + interface = "xyz.ljones.Aura", + default_service = "xyz.ljones.Asusd", + default_path = "/xyz/ljones/Aura" )] pub trait Aura { /// AllModeData method diff --git a/rog-dbus/src/zbus_fan_curves.rs b/rog-dbus/src/zbus_fan_curves.rs index b0e6b4b2..f83e0161 100644 --- a/rog-dbus/src/zbus_fan_curves.rs +++ b/rog-dbus/src/zbus_fan_curves.rs @@ -1,8 +1,8 @@ -//! # `DBus` interface proxy for: `org.asuslinux.Daemon` +//! # `DBus` interface proxy for: `xyz.ljones.Asusd` //! //! This code was generated by `zbus-xmlgen` `1.0.0` from `DBus` introspection -//! data. Source: `Interface '/org/asuslinux/Profile' from service -//! 'org.asuslinux.Daemon' on system bus`. +//! data. Source: `Interface '/xyz/ljones/Profile' from service +//! 'xyz.ljones.Asusd' on system bus`. //! //! You may prefer to adapt it, instead of using it verbatim. //! @@ -26,9 +26,9 @@ use rog_profiles::FanCurvePU; use zbus::proxy; #[proxy( - interface = "org.asuslinux.FanCurves", - default_service = "org.asuslinux.Daemon", - default_path = "/org/asuslinux" + interface = "xyz.ljones.FanCurves", + default_service = "xyz.ljones.Asusd", + default_path = "/xyz/ljones" )] pub trait FanCurves { /// Get the fan-curve data for the currently active PlatformProfile diff --git a/rog-dbus/src/zbus_platform.rs b/rog-dbus/src/zbus_platform.rs index d77bdd6c..087c0f3d 100644 --- a/rog-dbus/src/zbus_platform.rs +++ b/rog-dbus/src/zbus_platform.rs @@ -1,8 +1,8 @@ -//! # `DBus` interface proxy for: `org.asuslinux.Daemon` +//! # `DBus` interface proxy for: `xyz.ljones.Asusd` //! //! This code was generated by `zbus-xmlgen` `1.0.0` from `DBus` introspection -//! data. Source: `Interface '/org/asuslinux/Platform' from service -//! 'org.asuslinux.Daemon' on system bus`. +//! data. Source: `Interface '/xyz/ljones/Platform' from service +//! 'xyz.ljones.Asusd' on system bus`. //! //! You may prefer to adapt it, instead of using it verbatim. //! @@ -25,9 +25,9 @@ use rog_platform::platform::{GpuMode, Properties, ThrottlePolicy}; use zbus::proxy; #[proxy( - interface = "org.asuslinux.Platform", - default_service = "org.asuslinux.Daemon", - default_path = "/org/asuslinux" + interface = "xyz.ljones.Platform", + default_service = "xyz.ljones.Asusd", + default_path = "/xyz/ljones" )] pub trait Platform { #[zbus(property)] diff --git a/rog-dbus/src/zbus_slash.rs b/rog-dbus/src/zbus_slash.rs index 3b231123..5d925bf3 100644 --- a/rog-dbus/src/zbus_slash.rs +++ b/rog-dbus/src/zbus_slash.rs @@ -2,9 +2,9 @@ use rog_slash::SlashMode; use zbus::proxy; #[proxy( - interface = "org.asuslinux.Slash", - default_service = "org.asuslinux.Daemon", - default_path = "/org/asuslinux" + interface = "xyz.ljones.Slash", + default_service = "xyz.ljones.Asusd", + default_path = "/xyz/ljones" )] pub trait Slash { /// EnableDisplay property