Skip to content

Commit c3f4b7c

Browse files
committed
framework_lib: Prettier test
Signed-off-by: Daniel Schaefer <[email protected]>
1 parent bc44172 commit c3f4b7c

File tree

2 files changed

+17
-7
lines changed

2 files changed

+17
-7
lines changed

framework_lib/src/ccgx/mod.rs

+1
Original file line numberDiff line numberDiff line change
@@ -230,6 +230,7 @@ pub struct PdVersions {
230230
}
231231

232232
/// Same as PdVersions but only the main FW
233+
#[derive(Debug)]
233234
pub struct MainPdVersions {
234235
pub controller01: ControllerVersion,
235236
pub controller23: ControllerVersion,

framework_lib/src/commandline/mod.rs

+16-7
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,7 @@ use crate::chromium_ec;
3535
use crate::chromium_ec::commands::DeckStateMode;
3636
use crate::chromium_ec::commands::FpLedBrightnessLevel;
3737
use crate::chromium_ec::commands::RebootEcCmd;
38+
use crate::chromium_ec::EcResponseStatus;
3839
use crate::chromium_ec::{print_err, EcFlashType};
3940
use crate::chromium_ec::{EcError, EcResult};
4041
#[cfg(feature = "linux")]
@@ -1049,14 +1050,16 @@ fn selftest(ec: &CrosEc) -> Option<()> {
10491050
println!(" Reading EC Build Version");
10501051
print_err(ec.version_info())?;
10511052

1052-
println!(" Reading EC Flash by EC");
1053+
print!(" Reading EC Flash by EC");
10531054
ec.flash_version()?;
1055+
println!(" - OK");
10541056

1055-
println!(" Reading EC Flash directly");
1057+
println!(" Reading EC Flash directly - See below");
10561058
ec.test_ec_flash_read().ok()?;
10571059

1058-
println!(" Getting power info from EC");
1060+
print!(" Getting power info from EC");
10591061
power::power_info(ec)?;
1062+
println!(" - OK");
10601063

10611064
println!(" Getting AC info from EC");
10621065
// All our laptops have at least 4 PD ports so far
@@ -1065,25 +1068,31 @@ fn selftest(ec: &CrosEc) -> Option<()> {
10651068
return None;
10661069
}
10671070

1068-
println!("Reading PD Version from EC");
1071+
print!("Reading PD Version from EC");
10691072
if let Err(err) = power::read_pd_version(ec) {
10701073
// TGL does not have this command, so we have to ignore it
10711074
if err != EcError::Response(EcResponseStatus::InvalidCommand) {
1075+
println!();
10721076
println!("Err: {:?}", err);
1073-
return None;
1077+
} else {
1078+
println!(" - Skipped");
10741079
}
1080+
} else {
1081+
println!(" - OK");
10751082
}
10761083

10771084
let pd_01 = PdController::new(PdPort::Left01, ec.clone());
10781085
let pd_23 = PdController::new(PdPort::Right23, ec.clone());
1079-
println!(" Getting PD01 info");
1086+
print!(" Getting PD01 info through I2C tunnel");
10801087
print_err(pd_01.get_silicon_id())?;
10811088
print_err(pd_01.get_device_info())?;
10821089
print_err(pd_01.get_fw_versions())?;
1083-
println!(" Getting PD23 info");
1090+
println!(" - OK");
1091+
print!(" Getting PD23 info through I2C tunnel");
10841092
print_err(pd_23.get_silicon_id())?;
10851093
print_err(pd_23.get_device_info())?;
10861094
print_err(pd_23.get_fw_versions())?;
1095+
println!(" - OK");
10871096

10881097
Some(())
10891098
}

0 commit comments

Comments
 (0)