psu-ng: PMBus STATUS_* command error data as hex
The various STATUS_* command response data added to the error logs are
in a decimal format added as a string. Convert those to hexadecimal
format.
Tested:
Simulated input/UV fault, verified PEL details in hex.
Remove AC from real power supplies in real Rainier, verified PEL
for Input/UV fault had details in hex.
Change-Id: I3a86742d68aa5595526dc98b81794d984b7cb5bc
Signed-off-by: Brandon Wyman <bjwyman@gmail.com>
diff --git a/phosphor-power-supply/psu_manager.cpp b/phosphor-power-supply/psu_manager.cpp
index 76838dc..8e1be6a 100644
--- a/phosphor-power-supply/psu_manager.cpp
+++ b/phosphor-power-supply/psu_manager.cpp
@@ -395,10 +395,12 @@
}
else if (!psu->isFaultLogged() && psu->isFaulted())
{
+ // Add STATUS_WORD and STATUS_MFR last response, in padded
+ // hexadecimal format.
additionalData["STATUS_WORD"] =
- std::to_string(psu->getStatusWord());
+ fmt::format("{:#04x}", psu->getStatusWord());
additionalData["STATUS_MFR"] =
- std::to_string(psu->getMFRFault());
+ fmt::format("{:#02x}", psu->getMFRFault());
// If there are faults being reported, they possibly could be
// related to a bug in the firmware version running on the power
// supply. Capture that data into the error as well.