Skip to content

Commit 218d77b

Browse files
committed
--versions: Print version of potential retimers
If the ESRT reports not what is expected, print it anyways. Signed-off-by: Daniel Schaefer <dhs@frame.work>
1 parent b5273be commit 218d77b

File tree

2 files changed

+20
-3
lines changed

2 files changed

+20
-3
lines changed

framework_lib/src/commandline/mod.rs

Lines changed: 18 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ use crate::chromium_ec::{EcError, EcResult};
4747
#[cfg(target_os = "linux")]
4848
use crate::csme;
4949
use crate::ec_binary;
50-
use crate::esrt;
50+
use crate::esrt::{self, ResourceType};
5151
#[cfg(feature = "rusb")]
5252
use crate::inputmodule::check_inputmodule_version;
5353
#[cfg(target_os = "linux")]
@@ -708,6 +708,23 @@ fn print_versions(ec: &CrosEc) {
708708
// This means there's a bug, we should've found one but didn't
709709
println!(" Unknown");
710710
}
711+
} else {
712+
// If we don't know the GUID, print all the device firmwares in ESRT
713+
println!("Intel Retimers (Potential)");
714+
if let Some(esrt) = esrt::get_esrt() {
715+
for entry in esrt.entries.iter() {
716+
if ResourceType::from_int(entry.fw_type) != ResourceType::DeviceFirmware {
717+
continue;
718+
}
719+
println!(" GUID: {}", entry.fw_class);
720+
println!(
721+
" Version: 0x{:X} ({})",
722+
entry.fw_version, entry.fw_version
723+
);
724+
}
725+
} else {
726+
println!("Could not find and parse ESRT table.");
727+
}
711728
}
712729
match parade_retimer::get_version(ec) {
713730
// Does not exist

framework_lib/src/esrt/mod.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -251,7 +251,7 @@ pub struct Esrt {
251251
// Current Entry Version
252252
pub const ESRT_FIRMWARE_RESOURCE_VERSION: u64 = 1;
253253

254-
#[derive(Debug)]
254+
#[derive(Debug, PartialEq)]
255255
pub enum ResourceType {
256256
Unknown = 0,
257257
SystemFirmware = 1,
@@ -262,7 +262,7 @@ pub enum ResourceType {
262262
}
263263

264264
impl ResourceType {
265-
fn from_int(i: u32) -> Self {
265+
pub fn from_int(i: u32) -> Self {
266266
match i {
267267
1 => Self::SystemFirmware,
268268
2 => Self::DeviceFirmware,

0 commit comments

Comments
 (0)