Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 11 additions & 1 deletion framework_lib/src/ccgx/mod.rs
Original file line number Diff line number Diff line change
@@ -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")]
Expand Down Expand Up @@ -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!(
Expand Down Expand Up @@ -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()
}
Expand Down