From c3f4b7c08e49c89d1d7ef04a3dda2434bfa7a626 Mon Sep 17 00:00:00 2001 From: Daniel Schaefer Date: Tue, 6 Aug 2024 19:09:33 +0800 Subject: [PATCH] framework_lib: Prettier test Signed-off-by: Daniel Schaefer --- framework_lib/src/ccgx/mod.rs | 1 + framework_lib/src/commandline/mod.rs | 23 ++++++++++++++++------- 2 files changed, 17 insertions(+), 7 deletions(-) diff --git a/framework_lib/src/ccgx/mod.rs b/framework_lib/src/ccgx/mod.rs index 46cc515..185d103 100644 --- a/framework_lib/src/ccgx/mod.rs +++ b/framework_lib/src/ccgx/mod.rs @@ -230,6 +230,7 @@ pub struct PdVersions { } /// Same as PdVersions but only the main FW +#[derive(Debug)] pub struct MainPdVersions { pub controller01: ControllerVersion, pub controller23: ControllerVersion, diff --git a/framework_lib/src/commandline/mod.rs b/framework_lib/src/commandline/mod.rs index b36c7ea..d5c415a 100644 --- a/framework_lib/src/commandline/mod.rs +++ b/framework_lib/src/commandline/mod.rs @@ -35,6 +35,7 @@ use crate::chromium_ec; use crate::chromium_ec::commands::DeckStateMode; use crate::chromium_ec::commands::FpLedBrightnessLevel; use crate::chromium_ec::commands::RebootEcCmd; +use crate::chromium_ec::EcResponseStatus; use crate::chromium_ec::{print_err, EcFlashType}; use crate::chromium_ec::{EcError, EcResult}; #[cfg(feature = "linux")] @@ -1049,14 +1050,16 @@ fn selftest(ec: &CrosEc) -> Option<()> { println!(" Reading EC Build Version"); print_err(ec.version_info())?; - println!(" Reading EC Flash by EC"); + print!(" Reading EC Flash by EC"); ec.flash_version()?; + println!(" - OK"); - println!(" Reading EC Flash directly"); + println!(" Reading EC Flash directly - See below"); ec.test_ec_flash_read().ok()?; - println!(" Getting power info from EC"); + print!(" Getting power info from EC"); power::power_info(ec)?; + println!(" - OK"); println!(" Getting AC info from EC"); // All our laptops have at least 4 PD ports so far @@ -1065,25 +1068,31 @@ fn selftest(ec: &CrosEc) -> Option<()> { return None; } - println!("Reading PD Version from EC"); + print!("Reading PD Version from EC"); if let Err(err) = power::read_pd_version(ec) { // TGL does not have this command, so we have to ignore it if err != EcError::Response(EcResponseStatus::InvalidCommand) { + println!(); println!("Err: {:?}", err); - return None; + } else { + println!(" - Skipped"); } + } else { + println!(" - OK"); } let pd_01 = PdController::new(PdPort::Left01, ec.clone()); let pd_23 = PdController::new(PdPort::Right23, ec.clone()); - println!(" Getting PD01 info"); + print!(" Getting PD01 info through I2C tunnel"); print_err(pd_01.get_silicon_id())?; print_err(pd_01.get_device_info())?; print_err(pd_01.get_fw_versions())?; - println!(" Getting PD23 info"); + println!(" - OK"); + print!(" Getting PD23 info through I2C tunnel"); print_err(pd_23.get_silicon_id())?; print_err(pd_23.get_device_info())?; print_err(pd_23.get_fw_versions())?; + println!(" - OK"); Some(()) }