Skip to content

Commit

Permalink
framework_lib: Prettier test
Browse files Browse the repository at this point in the history
Signed-off-by: Daniel Schaefer <dhs@frame.work>
  • Loading branch information
JohnAZoidberg committed Oct 21, 2024
1 parent bc44172 commit c3f4b7c
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 7 deletions.
1 change: 1 addition & 0 deletions framework_lib/src/ccgx/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
23 changes: 16 additions & 7 deletions framework_lib/src/commandline/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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")]
Expand Down Expand Up @@ -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
Expand All @@ -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(())
}
Expand Down

0 comments on commit c3f4b7c

Please sign in to comment.