Skip to content

Commit 1250929

Browse files
committed
chromium_ec: Implement Display for EcResponseGetHwDiag
Debug for raw values, Display for human readable. Signed-off-by: Daniel Schaefer <[email protected]>
1 parent d55d3c5 commit 1250929

File tree

1 file changed

+14
-0
lines changed

1 file changed

+14
-0
lines changed

framework_lib/src/chromium_ec/commands.rs

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
use core::fmt;
2+
13
use num_derive::FromPrimitive;
24

35
use super::{command::*, input_deck::INPUT_DECK_SLOTS};
@@ -366,6 +368,18 @@ impl EcResponseGetHwDiag {
366368
)
367369
}
368370
}
371+
impl fmt::Display for EcResponseGetHwDiag {
372+
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
373+
let (left_fan, right_fan) = self.fan_fault();
374+
write!(
375+
f,
376+
"BIOS Done: {}, Fan Fault Left: {}, Right: {}",
377+
self.bios_complete != 0,
378+
left_fan,
379+
right_fan
380+
)
381+
}
382+
}
369383

370384
impl EcRequest<EcResponseGetHwDiag> for EcRequestGetHwDiag {
371385
fn command_id() -> EcCommands {

0 commit comments

Comments
 (0)