diff options
-rw-r--r-- | Redfish.md | 1 | ||||
-rw-r--r-- | redfish-core/lib/power_supply.hpp | 25 |
2 files changed, 26 insertions, 0 deletions
diff --git a/Redfish.md b/Redfish.md index d74d3e961c..dbbbfd1097 100644 --- a/Redfish.md +++ b/Redfish.md @@ -379,6 +379,7 @@ Fields common to all schemas ##### PowerSupply +- FirmwareVersion - Manufacturer - Model - PartNumber diff --git a/redfish-core/lib/power_supply.hpp b/redfish-core/lib/power_supply.hpp index aa88e09988..4fc0ce9e48 100644 --- a/redfish-core/lib/power_supply.hpp +++ b/redfish-core/lib/power_supply.hpp @@ -310,6 +310,29 @@ inline void }); } +inline void getPowerSupplyFirmwareVersion( + const std::shared_ptr<bmcweb::AsyncResp>& asyncResp, + const std::string& service, const std::string& path) +{ + sdbusplus::asio::getProperty<std::string>( + *crow::connections::systemBus, service, path, + "xyz.openbmc_project.Software.Version", "Version", + [asyncResp](const boost::system::error_code& ec, + const std::string& value) { + if (ec) + { + if (ec.value() != EBADR) + { + BMCWEB_LOG_ERROR << "DBUS response error for FirmwareVersion " + << ec.value(); + messages::internalError(asyncResp->res); + } + return; + } + asyncResp->res.jsonValue["FirmwareVersion"] = value; + }); +} + inline void doPowerSupplyGet(const std::shared_ptr<bmcweb::AsyncResp>& asyncResp, const std::string& chassisId, @@ -359,6 +382,8 @@ inline void powerSupplyPath); getPowerSupplyAsset(asyncResp, object.begin()->first, powerSupplyPath); + getPowerSupplyFirmwareVersion(asyncResp, object.begin()->first, + powerSupplyPath); }); }); } |