Skip to content

Commit 2e73c9b

Browse files
committed
framework_lib: Prettier test
Signed-off-by: Daniel Schaefer <[email protected]>
1 parent 8dbc455 commit 2e73c9b

File tree

2 files changed

+17
-7
lines changed

2 files changed

+17
-7
lines changed

framework_lib/src/ccgx/mod.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -209,6 +209,7 @@ pub struct PdVersions {
209209
}
210210

211211
/// Same as PdVersions but only the main FW
212+
#[derive(Debug)]
212213
pub struct MainPdVersions {
213214
pub controller01: ControllerVersion,
214215
pub controller23: ControllerVersion,

framework_lib/src/commandline/mod.rs

Lines changed: 16 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,7 @@ use crate::chromium_ec;
3434
use crate::chromium_ec::commands::DeckStateMode;
3535
use crate::chromium_ec::commands::FpLedBrightnessLevel;
3636
use crate::chromium_ec::commands::RebootEcCmd;
37+
use crate::chromium_ec::EcResponseStatus;
3738
use crate::chromium_ec::{print_err, EcFlashType};
3839
use crate::chromium_ec::{EcError, EcResult};
3940
#[cfg(feature = "linux")]
@@ -886,40 +887,48 @@ fn selftest(ec: &CrosEc) -> Option<()> {
886887
println!(" Reading EC Build Version");
887888
print_err(ec.version_info())?;
888889

889-
println!(" Reading EC Flash by EC");
890+
print!(" Reading EC Flash by EC");
890891
ec.flash_version()?;
892+
println!(" - OK");
891893

892-
println!(" Reading EC Flash directly");
894+
println!(" Reading EC Flash directly - See below");
893895
ec.test_ec_flash_read().ok()?;
894896

895-
println!(" Getting power info from EC");
897+
print!(" Getting power info from EC");
896898
power::power_info(ec)?;
899+
println!(" - OK");
897900

898901
println!(" Getting AC info from EC");
899902
// All our laptops have at least 4 PD ports so far
900903
if power::get_pd_info(ec, 4).iter().any(|x| x.is_err()) {
901904
return None;
902905
}
903906

904-
println!("Reading PD Version from EC");
907+
print!("Reading PD Version from EC");
905908
if let Err(err) = power::read_pd_version(ec) {
906909
// TGL does not have this command, so we have to ignore it
907910
if err != EcError::Response(EcResponseStatus::InvalidCommand) {
911+
println!("");
908912
println!("Err: {:?}", err);
909-
return None;
913+
} else {
914+
println!(" - Skipped");
910915
}
916+
} else {
917+
println!(" - OK");
911918
}
912919

913920
let pd_01 = PdController::new(PdPort::Left01, ec.clone());
914921
let pd_23 = PdController::new(PdPort::Right23, ec.clone());
915-
println!(" Getting PD01 info");
922+
print!(" Getting PD01 info through I2C tunnel");
916923
print_err(pd_01.get_silicon_id())?;
917924
print_err(pd_01.get_device_info())?;
918925
print_err(pd_01.get_fw_versions())?;
919-
println!(" Getting PD23 info");
926+
println!(" - OK");
927+
print!(" Getting PD23 info through I2C tunnel");
920928
print_err(pd_23.get_silicon_id())?;
921929
print_err(pd_23.get_device_info())?;
922930
print_err(pd_23.get_fw_versions())?;
931+
println!(" - OK");
923932

924933
Some(())
925934
}

0 commit comments

Comments
 (0)