diff --git a/framework_lib/src/commandline/mod.rs b/framework_lib/src/commandline/mod.rs index 8f90d525..118296e0 100644 --- a/framework_lib/src/commandline/mod.rs +++ b/framework_lib/src/commandline/mod.rs @@ -47,7 +47,7 @@ use crate::chromium_ec::{EcError, EcResult}; #[cfg(target_os = "linux")] use crate::csme; use crate::ec_binary; -use crate::esrt; +use crate::esrt::{self, ResourceType}; #[cfg(feature = "rusb")] use crate::inputmodule::check_inputmodule_version; #[cfg(target_os = "linux")] @@ -708,6 +708,23 @@ fn print_versions(ec: &CrosEc) { // This means there's a bug, we should've found one but didn't println!(" Unknown"); } + } else { + // If we don't know the GUID, print all the device firmwares in ESRT + println!("Intel Retimers (Potential)"); + if let Some(esrt) = esrt::get_esrt() { + for entry in esrt.entries.iter() { + if ResourceType::from_int(entry.fw_type) != ResourceType::DeviceFirmware { + continue; + } + println!(" GUID: {}", entry.fw_class); + println!( + " Version: 0x{:X} ({})", + entry.fw_version, entry.fw_version + ); + } + } else { + println!("Could not find and parse ESRT table."); + } } match parade_retimer::get_version(ec) { // Does not exist diff --git a/framework_lib/src/esrt/mod.rs b/framework_lib/src/esrt/mod.rs index 0ccc8a39..7283d580 100644 --- a/framework_lib/src/esrt/mod.rs +++ b/framework_lib/src/esrt/mod.rs @@ -251,7 +251,7 @@ pub struct Esrt { // Current Entry Version pub const ESRT_FIRMWARE_RESOURCE_VERSION: u64 = 1; -#[derive(Debug)] +#[derive(Debug, PartialEq)] pub enum ResourceType { Unknown = 0, SystemFirmware = 1, @@ -262,7 +262,7 @@ pub enum ResourceType { } impl ResourceType { - fn from_int(i: u32) -> Self { + pub fn from_int(i: u32) -> Self { match i { 1 => Self::SystemFirmware, 2 => Self::DeviceFirmware,