Add extra debug logging to anime path

This commit is contained in:
Luke D. Jones
2025-01-20 13:43:38 +13:00
parent fb98827a1a
commit cba8e1a473
9 changed files with 58 additions and 20 deletions

View File

@@ -74,7 +74,15 @@ fn main() {
println!("\nError: {e}\n"); println!("\nError: {e}\n");
print_info(); print_info();
}) { }) {
let asusd_version = platform_proxy.version().unwrap(); let asusd_version = platform_proxy
.version()
.map_err(|e| {
error!(
"Could not get asusd version: {e:?}\nIs asusd.service running? {}",
check_service("asusd")
);
})
.unwrap();
if asusd_version != self_version { if asusd_version != self_version {
println!("Version mismatch: asusctl = {self_version}, asusd = {asusd_version}"); println!("Version mismatch: asusctl = {self_version}, asusd = {asusd_version}");
return; return;

View File

@@ -8,7 +8,7 @@ use std::sync::Arc;
use std::thread::sleep; use std::thread::sleep;
use config_traits::StdConfig; use config_traits::StdConfig;
use log::{error, info, warn}; use log::{debug, error, info, warn};
use rog_anime::usb::{ use rog_anime::usb::{
pkt_flush, pkt_set_brightness, pkt_set_enable_display, pkt_set_enable_powersave_anim, pkt_flush, pkt_set_brightness, pkt_set_enable_display, pkt_set_enable_powersave_anim,
pkts_for_init, Brightness pkts_for_init, Brightness
@@ -59,6 +59,8 @@ impl AniMe {
config.rename_file_old(); config.rename_file_old();
*config = AniMeConfig::new(); *config = AniMeConfig::new();
config.write(); config.write();
} else {
debug!("Initialised AniMe cache");
} }
} else { } else {
error!("AniMe Matrix could not init cache") error!("AniMe Matrix could not init cache")
@@ -70,7 +72,9 @@ impl AniMe {
self.do_init_cache().await; self.do_init_cache().await;
let pkts = pkts_for_init(); let pkts = pkts_for_init();
self.write_bytes(&pkts[0]).await?; 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> { pub async fn lock_config(&self) -> MutexGuard<AniMeConfig> {

View File

@@ -1,7 +1,7 @@
use std::sync::atomic::Ordering; use std::sync::atomic::Ordering;
use config_traits::StdConfig; use config_traits::StdConfig;
use log::{error, warn}; use log::{debug, error, warn};
use logind_zbus::manager::ManagerProxy; use logind_zbus::manager::ManagerProxy;
use rog_anime::usb::{ use rog_anime::usb::{
pkt_set_brightness, pkt_set_builtin_animations, pkt_set_enable_display, pkt_set_brightness, pkt_set_builtin_animations, pkt_set_enable_display,
@@ -51,8 +51,11 @@ impl AniMeZbus {
.object_server() .object_server()
.at(path.clone(), self) .at(path.clone(), self)
.await .await
.map_err(|e| error!("Couldn't add server at path: {path}, {e:?}")) .map_err(|e| {
.ok(); error!("Couldn't add server at path: {path}, {e:?}");
e
})?;
debug!("start_tasks was successful");
Ok(()) Ok(())
} }
} }

View File

@@ -319,11 +319,17 @@ impl DeviceManager {
if let DeviceHandle::AniMe(anime) = dev_type.clone() { if let DeviceHandle::AniMe(anime) = dev_type.clone() {
let path = dbus_path_for_anime(); let path = dbus_path_for_anime();
let ctrl = AniMeZbus::new(anime); let ctrl = AniMeZbus::new(anime);
ctrl.start_tasks(connection, path.clone()).await.unwrap(); if ctrl
devices.push(AsusDevice { .start_tasks(connection, path.clone())
device: dev_type, .await
dbus_path: path .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 { } else {
info!("Tested device was not AniMe Matrix"); info!("Tested device was not AniMe Matrix");
@@ -364,7 +370,9 @@ impl DeviceManager {
pub async fn new(connection: Connection) -> Result<Self, RogError> { pub async fn new(connection: Connection) -> Result<Self, RogError> {
let conn_copy = connection.clone(); 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 { let manager = Self {
_dbus_connection: connection _dbus_connection: connection
}; };
@@ -372,8 +380,6 @@ impl DeviceManager {
// TODO: The /sysfs/ LEDs don't cause events, so they need to be manually // TODO: The /sysfs/ LEDs don't cause events, so they need to be manually
// checked for and added // checked for and added
// detect all plugged in aura devices (eventually)
// only USB devices are detected for here
std::thread::spawn(move || { std::thread::spawn(move || {
let mut monitor = MonitorBuilder::new()?.listen()?; let mut monitor = MonitorBuilder::new()?.listen()?;
let mut poll = Poll::new()?; let mut poll = Poll::new()?;
@@ -420,7 +426,10 @@ impl DeviceManager {
{ {
index index
} else { } 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(()); return Ok(());
}; };
info!("removing: {path:?}"); info!("removing: {path:?}");

View File

@@ -100,6 +100,7 @@ async fn start_daemon() -> Result<(), Box<dyn Error>> {
// Request dbus name after finishing initalizing all functions // Request dbus name after finishing initalizing all functions
server.request_name(DBUS_NAME).await?; server.request_name(DBUS_NAME).await?;
info!("Startup success, begining dbus server loop");
loop { loop {
// This is just a blocker to idle and ensure the reator reacts // This is just a blocker to idle and ensure the reator reacts
server.executor().tick().await; server.executor().tick().await;

View File

@@ -49,7 +49,12 @@ async fn main() -> Result<()> {
let self_version = env!("CARGO_PKG_VERSION"); let self_version = env!("CARGO_PKG_VERSION");
let zbus_con = zbus::blocking::Connection::system()?; let zbus_con = zbus::blocking::Connection::system()?;
let platform_proxy = rog_dbus::zbus_platform::PlatformProxyBlocking::new(&zbus_con)?; let platform_proxy = rog_dbus::zbus_platform::PlatformProxyBlocking::new(&zbus_con)?;
let asusd_version = platform_proxy.version().unwrap(); let asusd_version = platform_proxy
.version()
.map_err(|e| {
println!("Could not get asusd version: {e:?}\nIs asusd.service running?");
})
.unwrap();
if asusd_version != self_version { if asusd_version != self_version {
println!("Version mismatch: asusctl = {self_version}, asusd = {asusd_version}"); println!("Version mismatch: asusctl = {self_version}, asusd = {asusd_version}");
return Ok(()); return Ok(());

View File

@@ -208,7 +208,15 @@ pub fn init_tray(_supported_properties: Vec<Properties>, config: Arc<Mutex<Confi
} }
} }
} }
Err(e) => warn!("Couldn't get mode form supergfxd: {e:?}") Err(e) => match e {
zbus::Error::MethodError(_, _, message) => {
warn!(
"Couldn't get mode from supergfxd: {message:?}, the supergfxd service \
may not be running or installed"
)
}
_ => warn!("Couldn't get mode from supergfxd: {e:?}")
}
} }
info!("Started ROGTray"); info!("Started ROGTray");

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: 2025-01-19 10:35+0000\n" "POT-Creation-Date: 2025-01-20 00:43+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"
@@ -88,7 +88,7 @@ msgid "POST boot sound"
msgstr "" msgstr ""
#: rog-control-center/ui/pages/system.slint:224 #: rog-control-center/ui/pages/system.slint:224
msgctxt "no_asus_armoury_driver_2" msgctxt "no_asus_armoury_driver_1"
msgid "The asus-armoury driver is not loaded" msgid "The asus-armoury driver is not loaded"
msgstr "" msgstr ""

View File

@@ -221,7 +221,7 @@ export component PageSystem inherits Rectangle {
max-height: 30px; max-height: 30px;
VerticalBox { VerticalBox {
Text { Text {
text: @tr("no_asus_armoury_driver_2" => "The asus-armoury driver is not loaded"); text: @tr("no_asus_armoury_driver_1" => "The asus-armoury driver is not loaded");
font-size: 16px; font-size: 16px;
horizontal-alignment: TextHorizontalAlignment.center; horizontal-alignment: TextHorizontalAlignment.center;
} }