From 9b3aeeecc22a295d9bdae84b70bd6771aa2baa84 Mon Sep 17 00:00:00 2001 From: bunnie Date: Mon, 27 Feb 2023 01:25:29 +0800 Subject: [PATCH] improve debug telemetry on llio --- services/llio/src/i2c/hardware.rs | 2 +- services/llio/src/main.rs | 14 ++++++++------ 2 files changed, 9 insertions(+), 7 deletions(-) diff --git a/services/llio/src/i2c/hardware.rs b/services/llio/src/i2c/hardware.rs index e39db6f67..2b1c9693d 100644 --- a/services/llio/src/i2c/hardware.rs +++ b/services/llio/src/i2c/hardware.rs @@ -183,7 +183,7 @@ impl I2cStateMachine { /// Assumes we are initiating on a "clean" I2C machine (idle, no errors, no callbacks or state mapped) fn checked_initiate(&mut self, transaction: I2cTransaction, msg: xous::MessageEnvelope) { - log::debug!("I2C initated with {:x?}", transaction); + log::debug!("I2C initiated with {:x?}", transaction); // sanity-check the bounds limits if transaction.txlen > 258 || transaction.rxlen > 258 { self.report_response(I2cStatus::ResponseFormatError, None); diff --git a/services/llio/src/main.rs b/services/llio/src/main.rs index 3a540649e..fd6b934a7 100644 --- a/services/llio/src/main.rs +++ b/services/llio/src/main.rs @@ -37,8 +37,9 @@ fn i2c_thread(i2c_sid: xous::SID) { log::trace!("starting i2c main loop"); loop { let msg = xous::receive_message(i2c_sid).unwrap(); - log::trace!("i2c message: {:?}", msg); - match FromPrimitive::from_usize(msg.body.id()) { + let opcode: Option:: = FromPrimitive::from_usize(msg.body.id()); + log::debug!("{:?}", opcode); + match opcode { Some(I2cOpcode::SuspendResume) => xous::msg_scalar_unpack!(msg, token, _, _, _, { if !i2c_mutex_acquired && !i2c.is_busy() { i2c.suspend(); @@ -172,7 +173,7 @@ fn main() -> ! { let i2c_sid = xns.register_name(api::SERVER_NAME_I2C, Some(2)).expect("can't register I2C thread"); #[cfg(not(target_os = "xous"))] let i2c_sid = xns.register_name(api::SERVER_NAME_I2C, Some(1)).expect("can't register I2C thread"); - log::trace!("registered I2C thread with NS -- {:?}", i2c_sid); + log::debug!("registered I2C thread with NS -- {:?}", i2c_sid); let _ = thread::spawn({ let i2c_sid = i2c_sid.clone(); move || { @@ -203,11 +204,12 @@ fn main() -> ! { let mut i2c = llio::I2c::new(&xns); let tt = ticktimer_server::Ticktimer::new().unwrap(); - log::trace!("starting main loop"); + log::debug!("starting main loop"); loop { let msg = xous::receive_message(llio_sid).unwrap(); - log::trace!("Message: {:?}", msg); - match FromPrimitive::from_usize(msg.body.id()) { + let opcode: Option:: = FromPrimitive::from_usize(msg.body.id()); + log::debug!("{:?}", opcode); + match opcode { Some(Opcode::SuspendResume) => xous::msg_scalar_unpack!(msg, token, _, _, _, { llio.suspend(); #[cfg(feature="tts")]