mirror of
https://gitlab.com/asus-linux/asusctl.git
synced 2026-02-06 00:15:04 +01:00
Dbus cleanup
Use DBUS_NAME instead of DBUS_IFACE when requesting the name Add missing method_return()s Give different names for the bytearray arguments so that pydbus is not confused
This commit is contained in:
@@ -11,7 +11,7 @@ use dbus::{channel::Sender, nonblock::Process};
|
|||||||
|
|
||||||
use dbus_tokio::connection;
|
use dbus_tokio::connection;
|
||||||
use log::{error, info, warn};
|
use log::{error, info, warn};
|
||||||
use rog_client::{DBUS_IFACE, DBUS_PATH};
|
use rog_aura::{DBUS_IFACE, DBUS_NAME, DBUS_PATH};
|
||||||
use std::error::Error;
|
use std::error::Error;
|
||||||
use std::sync::{mpsc, Arc};
|
use std::sync::{mpsc, Arc};
|
||||||
use std::time::{Duration, Instant};
|
use std::time::{Duration, Instant};
|
||||||
@@ -84,7 +84,7 @@ pub async fn start_daemon() -> Result<(), Box<dyn Error>> {
|
|||||||
});
|
});
|
||||||
|
|
||||||
connection
|
connection
|
||||||
.request_name(DBUS_IFACE, false, true, true)
|
.request_name(DBUS_NAME, false, true, true)
|
||||||
.await?;
|
.await?;
|
||||||
|
|
||||||
let (aura_command_send, aura_command_recv) = mpsc::sync_channel::<AuraCommand>(1);
|
let (aura_command_send, aura_command_recv) = mpsc::sync_channel::<AuraCommand>(1);
|
||||||
|
|||||||
@@ -50,10 +50,10 @@ pub(super) fn dbus_create_ledmultizone_method(effect: NestedVecType) -> Method<M
|
|||||||
}
|
}
|
||||||
})
|
})
|
||||||
.outarg::<&str, _>("reply")
|
.outarg::<&str, _>("reply")
|
||||||
.inarg::<Vec<u8>, _>("bytearray")
|
.inarg::<Vec<u8>, _>("bytearray1")
|
||||||
.inarg::<Vec<u8>, _>("bytearray")
|
.inarg::<Vec<u8>, _>("bytearray2")
|
||||||
.inarg::<Vec<u8>, _>("bytearray")
|
.inarg::<Vec<u8>, _>("bytearray3")
|
||||||
.inarg::<Vec<u8>, _>("bytearray")
|
.inarg::<Vec<u8>, _>("bytearray4")
|
||||||
}
|
}
|
||||||
|
|
||||||
pub(super) fn dbus_create_ledeffect_method(effect: NestedVecType) -> Method<MTSync, ()> {
|
pub(super) fn dbus_create_ledeffect_method(effect: NestedVecType) -> Method<MTSync, ()> {
|
||||||
@@ -78,23 +78,23 @@ pub(super) fn dbus_create_ledeffect_method(effect: NestedVecType) -> Method<MTSy
|
|||||||
iter.read()?,
|
iter.read()?,
|
||||||
];
|
];
|
||||||
*lock = Some(byte_array);
|
*lock = Some(byte_array);
|
||||||
Ok(vec![])
|
Ok(vec!(m.msg.method_return()))
|
||||||
} else {
|
} else {
|
||||||
Err(MethodErr::failed("Could not lock daemon for access"))
|
Err(MethodErr::failed("Could not lock daemon for access"))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
.inarg::<Vec<u8>, _>("bytearray")
|
.inarg::<Vec<u8>, _>("bytearray1")
|
||||||
.inarg::<Vec<u8>, _>("bytearray")
|
.inarg::<Vec<u8>, _>("bytearray2")
|
||||||
.inarg::<Vec<u8>, _>("bytearray")
|
.inarg::<Vec<u8>, _>("bytearray3")
|
||||||
.inarg::<Vec<u8>, _>("bytearray")
|
.inarg::<Vec<u8>, _>("bytearray4")
|
||||||
.inarg::<Vec<u8>, _>("bytearray")
|
.inarg::<Vec<u8>, _>("bytearray5")
|
||||||
.inarg::<Vec<u8>, _>("bytearray")
|
.inarg::<Vec<u8>, _>("bytearray6")
|
||||||
.inarg::<Vec<u8>, _>("bytearray")
|
.inarg::<Vec<u8>, _>("bytearray7")
|
||||||
.inarg::<Vec<u8>, _>("bytearray")
|
.inarg::<Vec<u8>, _>("bytearray8")
|
||||||
.inarg::<Vec<u8>, _>("bytearray")
|
.inarg::<Vec<u8>, _>("bytearray9")
|
||||||
.inarg::<Vec<u8>, _>("bytearray")
|
.inarg::<Vec<u8>, _>("bytearray10")
|
||||||
.inarg::<Vec<u8>, _>("bytearray")
|
.inarg::<Vec<u8>, _>("bytearray11")
|
||||||
}
|
}
|
||||||
|
|
||||||
pub(super) fn dbus_create_animatrix_method(effect: NestedVecType) -> Method<MTSync, ()> {
|
pub(super) fn dbus_create_animatrix_method(effect: NestedVecType) -> Method<MTSync, ()> {
|
||||||
@@ -107,14 +107,14 @@ pub(super) fn dbus_create_animatrix_method(effect: NestedVecType) -> Method<MTSy
|
|||||||
let mut iter = m.msg.iter_init();
|
let mut iter = m.msg.iter_init();
|
||||||
let byte_array: Vec<Vec<u8>> = vec![iter.read()?, iter.read()?];
|
let byte_array: Vec<Vec<u8>> = vec![iter.read()?, iter.read()?];
|
||||||
*lock = Some(byte_array);
|
*lock = Some(byte_array);
|
||||||
Ok(vec![])
|
Ok(vec!(m.msg.method_return()))
|
||||||
} else {
|
} else {
|
||||||
Err(MethodErr::failed("Could not lock daemon for access"))
|
Err(MethodErr::failed("Could not lock daemon for access"))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
.inarg::<Vec<u8>, _>("bytearray")
|
.inarg::<Vec<u8>, _>("bytearray1")
|
||||||
.inarg::<Vec<u8>, _>("bytearray")
|
.inarg::<Vec<u8>, _>("bytearray2")
|
||||||
}
|
}
|
||||||
|
|
||||||
pub(super) fn dbus_create_fan_mode_method(fan_mode: FanModeType) -> Method<MTSync, ()> {
|
pub(super) fn dbus_create_fan_mode_method(fan_mode: FanModeType) -> Method<MTSync, ()> {
|
||||||
|
|||||||
Reference in New Issue
Block a user