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

@@ -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";

View File

@@ -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(),
}
}

View File

@@ -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)]

View File

@@ -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

View File

@@ -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> {

View File

@@ -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)]

View File

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

View File

@@ -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

View File

@@ -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 {

View File

@@ -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`.