mirror of
https://gitlab.com/asus-linux/asusctl.git
synced 2026-02-06 00:15:04 +01:00
Add extra debug logging to anime path
This commit is contained in:
@@ -8,7 +8,7 @@ use std::sync::Arc;
|
||||
use std::thread::sleep;
|
||||
|
||||
use config_traits::StdConfig;
|
||||
use log::{error, info, warn};
|
||||
use log::{debug, error, info, warn};
|
||||
use rog_anime::usb::{
|
||||
pkt_flush, pkt_set_brightness, pkt_set_enable_display, pkt_set_enable_powersave_anim,
|
||||
pkts_for_init, Brightness
|
||||
@@ -59,6 +59,8 @@ impl AniMe {
|
||||
config.rename_file_old();
|
||||
*config = AniMeConfig::new();
|
||||
config.write();
|
||||
} else {
|
||||
debug!("Initialised AniMe cache");
|
||||
}
|
||||
} else {
|
||||
error!("AniMe Matrix could not init cache")
|
||||
@@ -70,7 +72,9 @@ impl AniMe {
|
||||
self.do_init_cache().await;
|
||||
let pkts = pkts_for_init();
|
||||
self.write_bytes(&pkts[0]).await?;
|
||||
self.write_bytes(&pkts[1]).await
|
||||
self.write_bytes(&pkts[1]).await?;
|
||||
debug!("Succesfully initialised AniMe matrix display");
|
||||
Ok(())
|
||||
}
|
||||
|
||||
pub async fn lock_config(&self) -> MutexGuard<AniMeConfig> {
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
use std::sync::atomic::Ordering;
|
||||
|
||||
use config_traits::StdConfig;
|
||||
use log::{error, warn};
|
||||
use log::{debug, error, warn};
|
||||
use logind_zbus::manager::ManagerProxy;
|
||||
use rog_anime::usb::{
|
||||
pkt_set_brightness, pkt_set_builtin_animations, pkt_set_enable_display,
|
||||
@@ -51,8 +51,11 @@ impl AniMeZbus {
|
||||
.object_server()
|
||||
.at(path.clone(), self)
|
||||
.await
|
||||
.map_err(|e| error!("Couldn't add server at path: {path}, {e:?}"))
|
||||
.ok();
|
||||
.map_err(|e| {
|
||||
error!("Couldn't add server at path: {path}, {e:?}");
|
||||
e
|
||||
})?;
|
||||
debug!("start_tasks was successful");
|
||||
Ok(())
|
||||
}
|
||||
}
|
||||
|
||||
@@ -319,11 +319,17 @@ impl DeviceManager {
|
||||
if let DeviceHandle::AniMe(anime) = dev_type.clone() {
|
||||
let path = dbus_path_for_anime();
|
||||
let ctrl = AniMeZbus::new(anime);
|
||||
ctrl.start_tasks(connection, path.clone()).await.unwrap();
|
||||
devices.push(AsusDevice {
|
||||
device: dev_type,
|
||||
dbus_path: path
|
||||
});
|
||||
if ctrl
|
||||
.start_tasks(connection, path.clone())
|
||||
.await
|
||||
.map_err(|e| error!("Failed to start tasks: {e:?}, not adding this device"))
|
||||
.is_ok()
|
||||
{
|
||||
devices.push(AsusDevice {
|
||||
device: dev_type,
|
||||
dbus_path: path
|
||||
});
|
||||
}
|
||||
}
|
||||
} else {
|
||||
info!("Tested device was not AniMe Matrix");
|
||||
@@ -364,7 +370,9 @@ impl DeviceManager {
|
||||
|
||||
pub async fn new(connection: Connection) -> Result<Self, RogError> {
|
||||
let conn_copy = connection.clone();
|
||||
let devices = Arc::new(Mutex::new(Self::find_all_devices(&conn_copy).await));
|
||||
let devices = Self::find_all_devices(&conn_copy).await;
|
||||
info!("Found {} valid devices on startup", devices.len());
|
||||
let devices = Arc::new(Mutex::new(devices));
|
||||
let manager = Self {
|
||||
_dbus_connection: connection
|
||||
};
|
||||
@@ -372,8 +380,6 @@ impl DeviceManager {
|
||||
// TODO: The /sysfs/ LEDs don't cause events, so they need to be manually
|
||||
// checked for and added
|
||||
|
||||
// detect all plugged in aura devices (eventually)
|
||||
// only USB devices are detected for here
|
||||
std::thread::spawn(move || {
|
||||
let mut monitor = MonitorBuilder::new()?.listen()?;
|
||||
let mut poll = Poll::new()?;
|
||||
@@ -420,7 +426,10 @@ impl DeviceManager {
|
||||
{
|
||||
index
|
||||
} else {
|
||||
warn!("No device for dbus path: {path:?}");
|
||||
if dev_prop_matches(&event.device(), "ID_VENDOR_ID", "0b05")
|
||||
{
|
||||
warn!("No device for dbus path: {path:?}");
|
||||
}
|
||||
return Ok(());
|
||||
};
|
||||
info!("removing: {path:?}");
|
||||
|
||||
@@ -100,6 +100,7 @@ async fn start_daemon() -> Result<(), Box<dyn Error>> {
|
||||
// Request dbus name after finishing initalizing all functions
|
||||
server.request_name(DBUS_NAME).await?;
|
||||
|
||||
info!("Startup success, begining dbus server loop");
|
||||
loop {
|
||||
// This is just a blocker to idle and ensure the reator reacts
|
||||
server.executor().tick().await;
|
||||
|
||||
Reference in New Issue
Block a user