Skip to content

Commit fb8f885

Browse files
Merge pull request #75 from FrameworkComputer/tgl-dec-pd-ver
ccgx: Format PD version as decimal on 11th Gen
2 parents 96a7ed9 + 3e6f386 commit fb8f885

File tree

1 file changed

+11
-1
lines changed

1 file changed

+11
-1
lines changed

framework_lib/src/ccgx/mod.rs

+11-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
//! Interact with Infineon (formerly Cypress) PD controllers (their firmware binaries) in the CCGx series
22
3+
use alloc::format;
34
use alloc::string::String;
45
use alloc::string::ToString;
56
#[cfg(feature = "uefi")]
@@ -117,6 +118,14 @@ pub struct BaseVersion {
117118
/// Build Number part of the version. PP of X.Y.Z.BB
118119
pub build_number: u16,
119120
}
121+
impl BaseVersion {
122+
pub fn to_dec_string(&self) -> String {
123+
format!(
124+
"{}.{}.{}.{:0>3}",
125+
self.major, self.minor, self.patch, self.build_number
126+
)
127+
}
128+
}
120129
impl fmt::Display for BaseVersion {
121130
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
122131
write!(
@@ -215,8 +224,9 @@ impl ControllerFirmwares {
215224
pub fn active_fw_ver(&self) -> String {
216225
let active = self.active_fw();
217226
// On 11th Gen we modified base version instead of app version
227+
// And it's formatted as decimal instead of hex
218228
if let Some(Platform::IntelGen11) = smbios::get_platform() {
219-
active.base.to_string()
229+
active.base.to_dec_string()
220230
} else {
221231
active.app.to_string()
222232
}

0 commit comments

Comments
 (0)