diff --git a/Cargo.lock b/Cargo.lock index 25e0ca18..f2cb24fc 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -379,7 +379,7 @@ dependencies = [ [[package]] name = "framework_lib" -version = "0.2.0" +version = "0.2.1" dependencies = [ "built", "clap", @@ -410,7 +410,7 @@ dependencies = [ [[package]] name = "framework_tool" -version = "0.2.0" +version = "0.2.1" dependencies = [ "framework_lib", "static_vcruntime", @@ -418,7 +418,7 @@ dependencies = [ [[package]] name = "framework_uefi" -version = "0.2.0" +version = "0.2.1" dependencies = [ "framework_lib", "log", diff --git a/framework_lib/Cargo.toml b/framework_lib/Cargo.toml index 884aab04..3dadedf9 100644 --- a/framework_lib/Cargo.toml +++ b/framework_lib/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "framework_lib" -version = "0.2.0" +version = "0.2.1" edition = "2021" # Minimum Supported Rust Version # Ubuntu 24.04 LTS ships 1.75 diff --git a/framework_lib/src/ccgx/mod.rs b/framework_lib/src/ccgx/mod.rs index 71f187b1..8c8f89d2 100644 --- a/framework_lib/src/ccgx/mod.rs +++ b/framework_lib/src/ccgx/mod.rs @@ -1,5 +1,6 @@ //! Interact with Infineon (formerly Cypress) PD controllers (their firmware binaries) in the CCGx series +use alloc::format; use alloc::string::String; use alloc::string::ToString; #[cfg(feature = "uefi")] @@ -117,6 +118,14 @@ pub struct BaseVersion { /// Build Number part of the version. PP of X.Y.Z.BB pub build_number: u16, } +impl BaseVersion { + pub fn to_dec_string(&self) -> String { + format!( + "{}.{}.{}.{:0>3}", + self.major, self.minor, self.patch, self.build_number + ) + } +} impl fmt::Display for BaseVersion { fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { write!( @@ -215,8 +224,9 @@ impl ControllerFirmwares { pub fn active_fw_ver(&self) -> String { let active = self.active_fw(); // On 11th Gen we modified base version instead of app version + // And it's formatted as decimal instead of hex if let Some(Platform::IntelGen11) = smbios::get_platform() { - active.base.to_string() + active.base.to_dec_string() } else { active.app.to_string() } diff --git a/framework_tool/Cargo.toml b/framework_tool/Cargo.toml index 06defaae..f4d3bfa9 100644 --- a/framework_tool/Cargo.toml +++ b/framework_tool/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "framework_tool" -version = "0.2.0" +version = "0.2.1" edition = "2021" [features] diff --git a/framework_uefi/Cargo.toml b/framework_uefi/Cargo.toml index 8323fc84..a8e579b0 100644 --- a/framework_uefi/Cargo.toml +++ b/framework_uefi/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "framework_uefi" -version = "0.2.0" +version = "0.2.1" edition = "2021" # Minimum Supported Rust Version rust-version = "1.74"