Rename dbus. Add asus_armoury client source

This commit is contained in:
Luke D. Jones
2024-12-26 21:36:07 +13:00
parent 62aa1fe04f
commit a1a9c7077a
29 changed files with 203 additions and 131 deletions

View File

@@ -132,8 +132,7 @@ where
T: ProxyImpl<'static> + From<zbus::Proxy<'static>>, T: ProxyImpl<'static> + From<zbus::Proxy<'static>>,
{ {
let conn = zbus::blocking::Connection::system().unwrap(); let conn = zbus::blocking::Connection::system().unwrap();
let f = let f = zbus::blocking::fdo::ObjectManagerProxy::new(&conn, "xyz.ljones.Asusd", "/").unwrap();
zbus::blocking::fdo::ObjectManagerProxy::new(&conn, "org.asuslinux.Daemon", "/").unwrap();
let interfaces = f.get_managed_objects().unwrap(); let interfaces = f.get_managed_objects().unwrap();
let mut paths = Vec::new(); let mut paths = Vec::new();
for v in interfaces.iter() { for v in interfaces.iter() {
@@ -155,7 +154,7 @@ where
ctrl.push( ctrl.push(
T::builder(&conn) T::builder(&conn)
.path(path.clone())? .path(path.clone())?
.destination("org.asuslinux.Daemon")? .destination("xyz.ljones.Asusd")?
.build()?, .build()?,
); );
} }
@@ -201,7 +200,7 @@ fn do_parsed(
println!(); println!();
if let Some(cmdlist) = CliStart::command_list() { if let Some(cmdlist) = CliStart::command_list() {
let dev_type = let dev_type =
if let Ok(proxy) = find_iface::<AuraProxyBlocking>("org.asuslinux.Aura") { if let Ok(proxy) = find_iface::<AuraProxyBlocking>("xyz.ljones.Aura") {
// TODO: commands on all? // TODO: commands on all?
proxy proxy
.first() .first()
@@ -214,32 +213,31 @@ fn do_parsed(
let commands: Vec<String> = cmdlist.lines().map(|s| s.to_owned()).collect(); let commands: Vec<String> = cmdlist.lines().map(|s| s.to_owned()).collect();
for command in commands.iter().filter(|command| { for command in commands.iter().filter(|command| {
if command.trim().starts_with("fan-curve") if command.trim().starts_with("fan-curve")
&& !supported_interfaces && !supported_interfaces.contains(&"xyz.ljones.FanCurves".to_string())
.contains(&"org.asuslinux.FanCurves".to_string())
{ {
return false; return false;
} }
if command.trim().starts_with("aura") if command.trim().starts_with("aura")
&& !supported_interfaces.contains(&"org.asuslinux.Aura".to_string()) && !supported_interfaces.contains(&"xyz.ljones.Aura".to_string())
{ {
return false; return false;
} }
if command.trim().starts_with("anime") if command.trim().starts_with("anime")
&& !supported_interfaces.contains(&"org.asuslinux.Anime".to_string()) && !supported_interfaces.contains(&"xyz.ljones.Anime".to_string())
{ {
return false; return false;
} }
if command.trim().starts_with("slash") if command.trim().starts_with("slash")
&& !supported_interfaces.contains(&"org.asuslinux.Slash".to_string()) && !supported_interfaces.contains(&"xyz.ljones.Slash".to_string())
{ {
return false; return false;
} }
if command.trim().starts_with("platform") if command.trim().starts_with("platform")
&& !supported_interfaces.contains(&"org.asuslinux.Platform".to_string()) && !supported_interfaces.contains(&"xyz.ljones.Platform".to_string())
{ {
return false; return false;
} }
@@ -267,7 +265,7 @@ fn do_parsed(
} }
if let Some(brightness) = &parsed.kbd_bright { if let Some(brightness) = &parsed.kbd_bright {
if let Ok(aura) = find_iface::<AuraProxyBlocking>("org.asuslinux.Aura") { if let Ok(aura) = find_iface::<AuraProxyBlocking>("xyz.ljones.Aura") {
for aura in aura.iter() { for aura in aura.iter() {
match brightness.level() { match brightness.level() {
None => { None => {
@@ -283,7 +281,7 @@ fn do_parsed(
} }
if parsed.next_kbd_bright { if parsed.next_kbd_bright {
if let Ok(aura) = find_iface::<AuraProxyBlocking>("org.asuslinux.Aura") { if let Ok(aura) = find_iface::<AuraProxyBlocking>("xyz.ljones.Aura") {
for aura in aura.iter() { for aura in aura.iter() {
let brightness = aura.brightness()?; let brightness = aura.brightness()?;
aura.set_brightness(brightness.next())?; aura.set_brightness(brightness.next())?;
@@ -294,7 +292,7 @@ fn do_parsed(
} }
if parsed.prev_kbd_bright { if parsed.prev_kbd_bright {
if let Ok(aura) = find_iface::<AuraProxyBlocking>("org.asuslinux.Aura") { if let Ok(aura) = find_iface::<AuraProxyBlocking>("xyz.ljones.Aura") {
for aura in aura.iter() { for aura in aura.iter() {
let brightness = aura.brightness()?; let brightness = aura.brightness()?;
aura.set_brightness(brightness.prev())?; aura.set_brightness(brightness.prev())?;
@@ -310,7 +308,7 @@ fn do_parsed(
"Supported Platform Properties:\n{:#?}", "Supported Platform Properties:\n{:#?}",
supported_properties supported_properties
); );
if let Ok(aura) = find_iface::<AuraProxyBlocking>("org.asuslinux.Aura") { if let Ok(aura) = find_iface::<AuraProxyBlocking>("xyz.ljones.Aura") {
// TODO: multiple RGB check // TODO: multiple RGB check
let bright = aura.first().unwrap().supported_brightness()?; let bright = aura.first().unwrap().supported_brightness()?;
let modes = aura.first().unwrap().supported_basic_modes()?; let modes = aura.first().unwrap().supported_basic_modes()?;
@@ -363,7 +361,7 @@ fn handle_anime(cmd: &AnimeCommand) -> Result<(), Box<dyn std::error::Error>> {
println!("\n{}", lst); println!("\n{}", lst);
} }
} }
let animes = find_iface::<AnimeProxyBlocking>("org.asuslinux.Anime")?; let animes = find_iface::<AnimeProxyBlocking>("xyz.ljones.Anime")?;
for proxy in animes { for proxy in animes {
if let Some(enable) = cmd.enable_display { if let Some(enable) = cmd.enable_display {
proxy.set_enable_display(enable)?; proxy.set_enable_display(enable)?;
@@ -556,7 +554,7 @@ fn handle_slash(cmd: &SlashCommand) -> Result<(), Box<dyn std::error::Error>> {
} }
} }
let slashes = find_iface::<SlashProxyBlocking>("org.asuslinux.Slash")?; let slashes = find_iface::<SlashProxyBlocking>("xyz.ljones.Slash")?;
for proxy in slashes { for proxy in slashes {
if cmd.enable { if cmd.enable {
proxy.set_enabled(true)?; proxy.set_enabled(true)?;
@@ -594,7 +592,7 @@ fn handle_scsi(cmd: &ScsiCommand) -> Result<(), Box<dyn std::error::Error>> {
} }
} }
let scsis = find_iface::<ScsiAuraProxyBlocking>("org.asuslinux.ScsiAura")?; let scsis = find_iface::<ScsiAuraProxyBlocking>("xyz.ljones.ScsiAura")?;
for scsi in scsis { for scsi in scsis {
if let Some(enable) = cmd.enable { if let Some(enable) = cmd.enable {
@@ -668,7 +666,7 @@ fn handle_led_mode(mode: &LedModeCommand) -> Result<(), Box<dyn std::error::Erro
if let Some(cmdlist) = LedModeCommand::command_list() { if let Some(cmdlist) = LedModeCommand::command_list() {
let commands: Vec<String> = cmdlist.lines().map(|s| s.to_owned()).collect(); let commands: Vec<String> = cmdlist.lines().map(|s| s.to_owned()).collect();
// TODO: multiple rgb check // TODO: multiple rgb check
let aura = find_iface::<AuraProxyBlocking>("org.asuslinux.Aura")?; let aura = find_iface::<AuraProxyBlocking>("xyz.ljones.Aura")?;
let modes = aura.first().unwrap().supported_basic_modes()?; let modes = aura.first().unwrap().supported_basic_modes()?;
for command in commands.iter().filter(|command| { for command in commands.iter().filter(|command| {
for mode in &modes { for mode in &modes {
@@ -698,7 +696,7 @@ fn handle_led_mode(mode: &LedModeCommand) -> Result<(), Box<dyn std::error::Erro
println!("Please specify either next or previous"); println!("Please specify either next or previous");
return Ok(()); return Ok(());
} }
let aura = find_iface::<AuraProxyBlocking>("org.asuslinux.Aura")?; let aura = find_iface::<AuraProxyBlocking>("xyz.ljones.Aura")?;
if mode.next_mode { if mode.next_mode {
for aura in aura { for aura in aura {
let mode = aura.led_mode()?; let mode = aura.led_mode()?;
@@ -735,7 +733,7 @@ fn handle_led_mode(mode: &LedModeCommand) -> Result<(), Box<dyn std::error::Erro
} }
fn handle_led_power1(power: &LedPowerCommand1) -> Result<(), Box<dyn std::error::Error>> { fn handle_led_power1(power: &LedPowerCommand1) -> Result<(), Box<dyn std::error::Error>> {
let aura = find_iface::<AuraProxyBlocking>("org.asuslinux.Aura")?; let aura = find_iface::<AuraProxyBlocking>("xyz.ljones.Aura")?;
for aura in aura { for aura in aura {
let dev_type = aura.device_type()?; let dev_type = aura.device_type()?;
if !dev_type.is_old_laptop() && !dev_type.is_tuf_laptop() { 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<dyn std::error::Error>> { fn handle_led_power2(power: &LedPowerCommand2) -> Result<(), Box<dyn std::error::Error>> {
let aura = find_iface::<AuraProxyBlocking>("org.asuslinux.Aura")?; let aura = find_iface::<AuraProxyBlocking>("xyz.ljones.Aura")?;
for aura in aura { for aura in aura {
let dev_type = aura.device_type()?; let dev_type = aura.device_type()?;
if !dev_type.is_new_laptop() { if !dev_type.is_new_laptop() {

View File

@@ -151,10 +151,7 @@ impl CtrlAnime<'static> {
pub async fn add_to_server(self, server: &mut zbus::Connection) { pub async fn add_to_server(self, server: &mut zbus::Connection) {
server server
.object_server() .object_server()
.at( .at(&ObjectPath::from_str_unchecked("/xyz/ljones/Anime"), self)
&ObjectPath::from_str_unchecked("/org/asuslinux/Anime"),
self,
)
.await .await
.map_err(|err| { .map_err(|err| {
println!("CtrlAnime: add_to_server {}", err); println!("CtrlAnime: add_to_server {}", err);
@@ -170,7 +167,7 @@ impl CtrlAnime<'static> {
// - Do actions // - Do actions
// - Write config if required // - Write config if required
// - Unset inner_early_return // - Unset inner_early_return
#[interface(name = "org.asuslinux.Daemon")] #[interface(name = "xyz.ljones.Asusd")]
impl CtrlAnime<'static> { impl CtrlAnime<'static> {
pub fn insert_asus_gif( pub fn insert_asus_gif(
&mut self, &mut self,

View File

@@ -42,7 +42,7 @@ fn main() -> Result<(), Box<dyn std::error::Error>> {
let early_return = Arc::new(AtomicBool::new(false)); let early_return = Arc::new(AtomicBool::new(false));
// Set up the anime data and run loop/thread // 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 { if let Some(cfg) = config.active_anime {
let anime_type = get_anime_type(); let anime_type = get_anime_type();
let anime_config = ConfigAnime::new().set_name(cfg).load(); let anime_config = ConfigAnime::new().set_name(cfg).load();

View File

@@ -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 //! This code was generated by `zbus-xmlgen` `1.0.0` from `DBus` introspection
//! data. Source: `Interface '/org/asuslinux/Anime' from service //! data. Source: `Interface '/xyz/ljones/Anime' from service
//! 'org.asuslinux.Daemon' on session bus`. //! 'xyz.ljones.Asusd' on session bus`.
//! //!
//! You may prefer to adapt it, instead of using it verbatim. //! You may prefer to adapt it, instead of using it verbatim.
//! //!
@@ -23,10 +23,7 @@
use zbus::proxy; use zbus::proxy;
#[proxy( #[proxy(interface = "xyz.ljones.Asusd", default_path = "/xyz/ljones/Anime")]
interface = "org.asuslinux.Daemon",
default_path = "/org/asuslinux/Anime"
)]
trait Daemon { trait Daemon {
/// InsertAsusGif method /// InsertAsusGif method
fn insert_asus_gif( fn insert_asus_gif(

View File

@@ -1,12 +1,11 @@
use crate::{error::RogError, ASUS_ZBUS_PATH};
use log::error; use log::error;
use rog_platform::firmware_attributes::{AttrValue, Attribute}; use rog_platform::firmware_attributes::{AttrValue, Attribute};
use serde::{Deserialize, Serialize}; use serde::{Deserialize, Serialize};
use zbus::{ use zbus::zvariant::{ObjectPath, OwnedObjectPath, OwnedValue, Type, Value};
fdo, interface, use zbus::{fdo, interface, Connection};
zvariant::{ObjectPath, OwnedObjectPath, OwnedValue, Type, Value},
Connection, use crate::error::RogError;
}; use crate::ASUS_ZBUS_PATH;
const MOD_NAME: &str = "asus_armoury"; const MOD_NAME: &str = "asus_armoury";

View File

@@ -1,12 +1,11 @@
use crate::{error::RogError, ASUS_ZBUS_PATH};
use log::error; use log::error;
use rog_platform::firmware_attributes::{AttrType, AttrValue, Attribute}; use rog_platform::firmware_attributes::{AttrType, AttrValue, Attribute};
use serde::{Deserialize, Serialize}; use serde::{Deserialize, Serialize};
use zbus::{ use zbus::zvariant::{ObjectPath, OwnedObjectPath, OwnedValue, Type, Value};
fdo, interface, use zbus::{fdo, interface, Connection};
zvariant::{ObjectPath, OwnedObjectPath, OwnedValue, Type, Value},
Connection, use crate::error::RogError;
}; use crate::ASUS_ZBUS_PATH;
const MOD_NAME: &str = "asus_armoury"; const MOD_NAME: &str = "asus_armoury";
@@ -50,15 +49,10 @@ impl AsusArmouryAttribute {
} }
#[zbus(property)] #[zbus(property)]
fn attribute_type(&self) -> AttrType { async fn default_value(&self) -> String {
self.0.attribute_type()
}
#[zbus(property)]
async fn default_value(&self) -> i32 {
match self.0.default_value() { match self.0.default_value() {
AttrValue::Integer(i) => *i, AttrValue::String(s) => *s,
_ => -1, _ => String::default(),
} }
} }

View File

@@ -1,12 +1,11 @@
use crate::{error::RogError, ASUS_ZBUS_PATH};
use log::error; use log::error;
use rog_platform::firmware_attributes::{AttrValue, Attribute}; use rog_platform::firmware_attributes::{AttrValue, Attribute};
use serde::{Deserialize, Serialize}; use serde::{Deserialize, Serialize};
use zbus::{ use zbus::zvariant::{ObjectPath, OwnedObjectPath, OwnedValue, Type, Value};
fdo, interface, use zbus::{fdo, interface, Connection};
zvariant::{ObjectPath, OwnedObjectPath, OwnedValue, Type, Value},
Connection, use crate::error::RogError;
}; use crate::ASUS_ZBUS_PATH;
const MOD_NAME: &str = "asus_armoury"; 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")] #[interface(name = "org.asuslinux.AsusArmoury")]
impl AsusArmouryAttribute { impl AsusArmouryAttribute {
#[zbus(property)] #[zbus(property)]

View File

@@ -60,7 +60,7 @@ impl AniMeZbus {
// None of these calls can be guarnateed to succeed unless we loop until okay // 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 // If the try_lock *does* succeed then any other thread trying to lock will not
// grab it until we finish. // grab it until we finish.
#[interface(name = "org.asuslinux.Anime")] #[interface(name = "xyz.ljones.Anime")]
impl AniMeZbus { impl AniMeZbus {
/// Writes a data stream of length. Will force system thread to exit until /// Writes a data stream of length. Will force system thread to exit until
/// it is restarted /// it is restarted

View File

@@ -14,7 +14,7 @@ use crate::error::RogError;
use crate::{CtrlTask, Reloadable}; use crate::{CtrlTask, Reloadable};
pub const AURA_ZBUS_NAME: &str = "Aura"; 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)] #[derive(Clone)]
pub struct AuraZbus(Aura); pub struct AuraZbus(Aura);
@@ -50,7 +50,7 @@ impl AuraZbus {
/// The main interface for changing, reading, or notfying /// The main interface for changing, reading, or notfying
/// ///
/// LED commands are split between Brightness, Modes, Per-Key /// LED commands are split between Brightness, Modes, Per-Key
#[interface(name = "org.asuslinux.Aura")] #[interface(name = "xyz.ljones.Aura")]
impl AuraZbus { impl AuraZbus {
/// Return the device type for this Aura keyboard /// Return the device type for this Aura keyboard
#[zbus(property)] #[zbus(property)]
@@ -227,7 +227,7 @@ impl AuraZbus {
impl CtrlTask for AuraZbus { impl CtrlTask for AuraZbus {
fn zbus_path() -> &'static str { fn zbus_path() -> &'static str {
"/org/asuslinux" "/xyz/ljones"
} }
async fn create_tasks(&self, _: SignalEmitter<'static>) -> Result<(), RogError> { async fn create_tasks(&self, _: SignalEmitter<'static>) -> Result<(), RogError> {

View File

@@ -34,7 +34,7 @@ impl ScsiZbus {
} }
} }
#[interface(name = "org.asuslinux.ScsiAura")] #[interface(name = "xyz.ljones.ScsiAura")]
impl ScsiZbus { impl ScsiZbus {
/// Return the device type for this Aura keyboard /// Return the device type for this Aura keyboard
#[zbus(property)] #[zbus(property)]

View File

@@ -36,7 +36,7 @@ impl SlashZbus {
} }
} }
#[interface(name = "org.asuslinux.Slash")] #[interface(name = "xyz.ljones.Slash")]
impl SlashZbus { impl SlashZbus {
/// Get enabled or not /// Get enabled or not
#[zbus(property)] #[zbus(property)]

View File

@@ -17,7 +17,7 @@ use crate::error::RogError;
use crate::{CtrlTask, CONFIG_PATH_BASE}; use crate::{CtrlTask, CONFIG_PATH_BASE};
pub const FAN_CURVE_ZBUS_NAME: &str = "FanCurves"; 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)] #[derive(Deserialize, Serialize, Debug, Default)]
pub struct FanCurveConfig { pub struct FanCurveConfig {
@@ -101,7 +101,7 @@ impl CtrlFanCurveZbus {
} }
} }
#[interface(name = "org.asuslinux.FanCurves")] #[interface(name = "xyz.ljones.FanCurves")]
impl CtrlFanCurveZbus { impl CtrlFanCurveZbus {
/// Set all fan curves for a profile to enabled status. Will also activate a /// Set all fan curves for a profile to enabled status. Will also activate a
/// fan curve if in the same profile mode /// fan curve if in the same profile mode

View File

@@ -17,7 +17,7 @@ use crate::config::Config;
use crate::error::RogError; use crate::error::RogError;
use crate::{task_watch_item, task_watch_item_notify, CtrlTask, ReloadAndNotify}; 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 { macro_rules! platform_get_value {
($self:ident, $property:tt, $prop_name:literal) => { ($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 { impl CtrlPlatform {
#[zbus(property)] #[zbus(property)]
async fn version(&self) -> String { async fn version(&self) -> String {

View File

@@ -31,11 +31,11 @@ use zbus::Connection;
use crate::error::RogError; use crate::error::RogError;
const CONFIG_PATH_BASE: &str = "/etc/asusd/"; 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_NAME: &str = "xyz.ljones.Asusd";
pub static DBUS_PATH: &str = "/org/asuslinux/Daemon"; pub static DBUS_PATH: &str = "/xyz/ljones/Daemon";
pub static DBUS_IFACE: &str = "org.asuslinux.Daemon"; pub static DBUS_IFACE: &str = "xyz.ljones.Asusd";
/// This macro adds a function which spawns an `inotify` task on the passed in /// This macro adds a function which spawns an `inotify` task on the passed in
/// `Executor`. /// `Executor`.

View File

@@ -3,24 +3,24 @@
"http://www.freedesktop.org/standards/dbus/1.0/busconfig.dtd"> "http://www.freedesktop.org/standards/dbus/1.0/busconfig.dtd">
<busconfig> <busconfig>
<policy group="adm"> <policy group="adm">
<allow send_destination="org.asuslinux.Daemon"/> <allow send_destination="xyz.ljones.Asusd"/>
<allow receive_sender="org.asuslinux.Daemon"/> <allow receive_sender="xyz.ljones.Asusd"/>
</policy> </policy>
<policy group="sudo"> <policy group="sudo">
<allow send_destination="org.asuslinux.Daemon"/> <allow send_destination="xyz.ljones.Asusd"/>
<allow receive_sender="org.asuslinux.Daemon"/> <allow receive_sender="xyz.ljones.Asusd"/>
</policy> </policy>
<policy group="users"> <policy group="users">
<allow send_destination="org.asuslinux.Daemon"/> <allow send_destination="xyz.ljones.Asusd"/>
<allow receive_sender="org.asuslinux.Daemon"/> <allow receive_sender="xyz.ljones.Asusd"/>
</policy> </policy>
<policy group="wheel"> <policy group="wheel">
<allow send_destination="org.asuslinux.Daemon"/> <allow send_destination="xyz.ljones.Asusd"/>
<allow receive_sender="org.asuslinux.Daemon"/> <allow receive_sender="xyz.ljones.Asusd"/>
</policy> </policy>
<policy user="root"> <policy user="root">
<allow own="org.asuslinux.Daemon"/> <allow own="xyz.ljones.Asusd"/>
<allow send_destination="org.asuslinux.Daemon"/> <allow send_destination="xyz.ljones.Asusd"/>
<allow receive_sender="org.asuslinux.Daemon"/> <allow receive_sender="xyz.ljones.Asusd"/>
</policy> </policy>
</busconfig> </busconfig>

View File

@@ -112,10 +112,10 @@ pub fn setup_window(config: Arc<Mutex<Config>>) -> MainWindow {
ui.set_sidebar_items_avilable( ui.set_sidebar_items_avilable(
[ [
// Needs to match the order of slint sidebar items // Needs to match the order of slint sidebar items
available.contains(&"org.asuslinux.Platform".to_string()), available.contains(&"xyz.ljones.Platform".to_string()),
available.contains(&"org.asuslinux.Aura".to_string()), available.contains(&"xyz.ljones.Aura".to_string()),
available.contains(&"org.asuslinux.Anime".to_string()), available.contains(&"xyz.ljones.Anime".to_string()),
available.contains(&"org.asuslinux.FanCurves".to_string()), available.contains(&"xyz.ljones.FanCurves".to_string()),
true, true,
true, true,
] ]
@@ -127,17 +127,17 @@ pub fn setup_window(config: Arc<Mutex<Config>>) -> MainWindow {
}); });
setup_app_settings_page(&ui, config.clone()); 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(&ui, config.clone());
setup_system_page_callbacks(&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()); 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()); 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); setup_fan_curve_page(&ui, config);
} }
ui ui

View File

@@ -38,12 +38,12 @@ fn decode_hex(s: &str) -> RgbaColor<u8> {
// TODO: return all // TODO: return all
async fn find_aura_iface() -> Result<AuraProxy<'static>, Box<dyn std::error::Error>> { async fn find_aura_iface() -> Result<AuraProxy<'static>, Box<dyn std::error::Error>> {
let conn = zbus::Connection::system().await?; 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 interfaces = f.get_managed_objects().await?;
let mut aura_paths = Vec::new(); let mut aura_paths = Vec::new();
for v in interfaces.iter() { for v in interfaces.iter() {
for k in v.1.keys() { 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); println!("Found aura device at {}, {}", v.0, k);
aura_paths.push(v.0.clone()); aura_paths.push(v.0.clone());
} }
@@ -56,7 +56,7 @@ async fn find_aura_iface() -> Result<AuraProxy<'static>, Box<dyn std::error::Err
if let Some(path) = aura_paths.first() { if let Some(path) = aura_paths.first() {
return Ok(AuraProxy::builder(&conn) return Ok(AuraProxy::builder(&conn)
.path(path.clone())? .path(path.clone())?
.destination("org.asuslinux.Daemon")? .destination("xyz.ljones.Asusd")?
.build() .build()
.await?); .await?);
} }

View File

@@ -2,7 +2,7 @@
msgid "" msgid ""
msgstr "" msgstr ""
"Project-Id-Version: PACKAGE VERSION\n" "Project-Id-Version: PACKAGE VERSION\n"
"POT-Creation-Date: 2024-12-25 06:28+0000\n" "POT-Creation-Date: 2024-12-26 08:35+0000\n"
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n" "Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
"Language-Team: LANGUAGE <LL@li.org>\n" "Language-Team: LANGUAGE <LL@li.org>\n"

View File

@@ -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<i32>;
#[zbus(property)]
fn set_current_value(&self, value: i32) -> zbus::Result<()>;
/// DefaultValue property
#[zbus(property)]
fn default_value(&self) -> zbus::Result<i32>;
/// MaxValue property
#[zbus(property)]
fn max_value(&self) -> zbus::Result<i32>;
/// MinValue property
#[zbus(property)]
fn min_value(&self) -> zbus::Result<i32>;
/// Name property
#[zbus(property)]
fn name(&self) -> zbus::Result<String>;
/// ScalarIncrement property
#[zbus(property)]
fn scalar_increment(&self) -> zbus::Result<i32>;
}

View File

@@ -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<String>;
#[zbus(property)]
fn set_current_value(&self, value: String) -> zbus::Result<()>;
/// DefaultValue property
#[zbus(property)]
fn default_value(&self) -> zbus::Result<String>;
/// Name property
#[zbus(property)]
fn name(&self) -> zbus::Result<String>;
/// PossibleValues property
#[zbus(property)]
fn possible_values(&self) -> zbus::Result<Vec<String>>;
}

View File

@@ -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<i32>;
#[zbus(property)]
fn set_current_value(&self, value: i32) -> zbus::Result<()>;
/// DefaultValue property
#[zbus(property)]
fn default_value(&self) -> zbus::Result<i32>;
/// Name property
#[zbus(property)]
fn name(&self) -> zbus::Result<String>;
/// PossibleValues property
#[zbus(property)]
fn possible_values(&self) -> zbus::Result<Vec<i32>>;
}

View File

@@ -0,0 +1,3 @@
pub mod attr_enum_int;
pub mod attr_enum_str;
pub mod attr_int;

View File

@@ -1,5 +1,6 @@
pub use asusd::{DBUS_IFACE, DBUS_NAME, DBUS_PATH}; pub use asusd::{DBUS_IFACE, DBUS_NAME, DBUS_PATH};
pub mod asus_armoury;
pub mod scsi_aura; pub mod scsi_aura;
pub mod zbus_anime; pub mod zbus_anime;
pub mod zbus_aura; pub mod zbus_aura;
@@ -11,7 +12,7 @@ pub const VERSION: &str = env!("CARGO_PKG_VERSION");
pub fn list_iface_blocking() -> Result<Vec<String>, Box<dyn std::error::Error>> { pub fn list_iface_blocking() -> Result<Vec<String>, Box<dyn std::error::Error>> {
let conn = zbus::blocking::Connection::system()?; 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 interfaces = f.get_managed_objects()?;
let mut ifaces = Vec::new(); let mut ifaces = Vec::new();
for v in interfaces.iter() { for v in interfaces.iter() {
@@ -24,7 +25,7 @@ pub fn list_iface_blocking() -> Result<Vec<String>, Box<dyn std::error::Error>>
pub fn has_iface_blocking(iface: &str) -> Result<bool, Box<dyn std::error::Error>> { pub fn has_iface_blocking(iface: &str) -> Result<bool, Box<dyn std::error::Error>> {
let conn = zbus::blocking::Connection::system()?; 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 interfaces = f.get_managed_objects()?;
for v in interfaces.iter() { for v in interfaces.iter() {
for k in v.1.keys() { for k in v.1.keys() {
@@ -38,7 +39,7 @@ pub fn has_iface_blocking(iface: &str) -> Result<bool, Box<dyn std::error::Error
pub async fn has_iface(iface: &str) -> Result<bool, Box<dyn std::error::Error>> { pub async fn has_iface(iface: &str) -> Result<bool, Box<dyn std::error::Error>> {
let conn = zbus::Connection::system().await?; 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 interfaces = f.get_managed_objects().await?;
for v in interfaces.iter() { for v in interfaces.iter() {
for k in v.1.keys() { for k in v.1.keys() {

View File

@@ -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 //! This code was generated by `zbus-xmlgen` `5.0.1` from D-Bus introspection
//! data. Source: `Interface '/org/asuslinux/M3D0AP048745_scsi' from service //! data. Source: `Interface '/xyz/ljones/M3D0AP048745_scsi' from service
//! 'org.asuslinux.Daemon' on system bus`. //! 'xyz.ljones.Asusd' on system bus`.
//! //!
//! You may prefer to adapt it, instead of using it verbatim. //! You may prefer to adapt it, instead of using it verbatim.
//! //!
@@ -23,9 +23,9 @@
use rog_scsi::{AuraEffect, AuraMode}; use rog_scsi::{AuraEffect, AuraMode};
use zbus::proxy; use zbus::proxy;
#[proxy( #[proxy(
interface = "org.asuslinux.ScsiAura", interface = "xyz.ljones.ScsiAura",
default_service = "org.asuslinux.Daemon", default_service = "xyz.ljones.Asusd",
default_path = "/org/asuslinux" default_path = "/xyz/ljones"
)] )]
pub trait ScsiAura { pub trait ScsiAura {
/// AllModeData method /// AllModeData method

View File

@@ -3,9 +3,9 @@ use rog_anime::{Animations, AnimeDataBuffer, DeviceState as AnimeDeviceState};
use zbus::proxy; use zbus::proxy;
#[proxy( #[proxy(
interface = "org.asuslinux.Anime", interface = "xyz.ljones.Anime",
default_service = "org.asuslinux.Daemon", default_service = "xyz.ljones.Asusd",
default_path = "/org/asuslinux" default_path = "/xyz/ljones"
)] )]
pub trait Anime { pub trait Anime {
/// DeviceState method /// DeviceState method

View File

@@ -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 //! This code was generated by `zbus-xmlgen` `1.0.0` from `DBus` introspection
//! data. Source: `Interface '/org/asuslinux/Aura' from service //! data. Source: `Interface '/xyz/ljones/Aura' from service
//! 'org.asuslinux.Daemon' on system bus`. //! 'xyz.ljones.Asusd' on system bus`.
//! //!
//! You may prefer to adapt it, instead of using it verbatim. //! 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 const BLOCKING_TIME: u64 = 33; // 100ms = 10 FPS, max 50ms = 20 FPS, 40ms = 25 FPS
#[proxy( #[proxy(
interface = "org.asuslinux.Aura", interface = "xyz.ljones.Aura",
default_service = "org.asuslinux.Daemon", default_service = "xyz.ljones.Asusd",
default_path = "/org/asuslinux/Aura" default_path = "/xyz/ljones/Aura"
)] )]
pub trait Aura { pub trait Aura {
/// AllModeData method /// AllModeData method

View File

@@ -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 //! This code was generated by `zbus-xmlgen` `1.0.0` from `DBus` introspection
//! data. Source: `Interface '/org/asuslinux/Profile' from service //! data. Source: `Interface '/xyz/ljones/Profile' from service
//! 'org.asuslinux.Daemon' on system bus`. //! 'xyz.ljones.Asusd' on system bus`.
//! //!
//! You may prefer to adapt it, instead of using it verbatim. //! You may prefer to adapt it, instead of using it verbatim.
//! //!
@@ -26,9 +26,9 @@ use rog_profiles::FanCurvePU;
use zbus::proxy; use zbus::proxy;
#[proxy( #[proxy(
interface = "org.asuslinux.FanCurves", interface = "xyz.ljones.FanCurves",
default_service = "org.asuslinux.Daemon", default_service = "xyz.ljones.Asusd",
default_path = "/org/asuslinux" default_path = "/xyz/ljones"
)] )]
pub trait FanCurves { pub trait FanCurves {
/// Get the fan-curve data for the currently active PlatformProfile /// Get the fan-curve data for the currently active PlatformProfile

View File

@@ -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 //! This code was generated by `zbus-xmlgen` `1.0.0` from `DBus` introspection
//! data. Source: `Interface '/org/asuslinux/Platform' from service //! data. Source: `Interface '/xyz/ljones/Platform' from service
//! 'org.asuslinux.Daemon' on system bus`. //! 'xyz.ljones.Asusd' on system bus`.
//! //!
//! You may prefer to adapt it, instead of using it verbatim. //! 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; use zbus::proxy;
#[proxy( #[proxy(
interface = "org.asuslinux.Platform", interface = "xyz.ljones.Platform",
default_service = "org.asuslinux.Daemon", default_service = "xyz.ljones.Asusd",
default_path = "/org/asuslinux" default_path = "/xyz/ljones"
)] )]
pub trait Platform { pub trait Platform {
#[zbus(property)] #[zbus(property)]

View File

@@ -2,9 +2,9 @@ use rog_slash::SlashMode;
use zbus::proxy; use zbus::proxy;
#[proxy( #[proxy(
interface = "org.asuslinux.Slash", interface = "xyz.ljones.Slash",
default_service = "org.asuslinux.Daemon", default_service = "xyz.ljones.Asusd",
default_path = "/org/asuslinux" default_path = "/xyz/ljones"
)] )]
pub trait Slash { pub trait Slash {
/// EnableDisplay property /// EnableDisplay property