Get PSU version from vendor specific tool
The code was getting the version from PSU inventory object.
This commit changes the behavior to use a vendor-specific tool to get
the version directly, where the tool is expected to be configured during
build time.
Add an example get_version app that shows the expected behavior of the
tool:
* It accepts an argument of PSU inventory object;
* It outputs the version to stdout.
Tested: 1. Put and configure to use the example get_version on witherspoon,
verify that PSU software objects are created with the version
returned by the exmaple tool.
2. With the Witherspoon specific tool in
https://gerrit.openbmc-project.xyz/c/openbmc/witherspoon-pfault-analysis/+/24811,
verify the version is correctly got from the PSU inventory path
and the software objects are created.
Signed-off-by: Lei YU <mine260309@gmail.com>
Change-Id: I5195cb6fc8998a76b09abcfe0b107364cb180c01
diff --git a/src/item_updater.cpp b/src/item_updater.cpp
index 89bd388..cf691d7 100644
--- a/src/item_updater.cpp
+++ b/src/item_updater.cpp
@@ -356,12 +356,10 @@
auto paths = utils::getPSUInventoryPath(bus);
for (const auto& p : paths)
{
- // Assume the same service implement both Version and Item interface
- auto service = utils::getService(bus, p.c_str(), VERSION_IFACE);
- auto version = utils::getProperty<std::string>(
- bus, service.c_str(), p.c_str(), VERSION_IFACE, VERSION);
+ auto service = utils::getService(bus, p.c_str(), ITEM_IFACE);
auto present = utils::getProperty<bool>(bus, service.c_str(), p.c_str(),
ITEM_IFACE, PRESENT);
+ auto version = utils::getVersion(p);
if (present && !version.empty())
{
createPsuObject(p, version);