Expand and update location code property on BUS
This commit expands and updates the required location code
poperty on BUS in case following condition holds true.
a) if FC or SE or both keyword
under VCEN record has been modified by VPD write
application for Motherboard FRU.
OR
b) if TM or SE or both keyword
under VSYS record has been modified by VPD write
application for Motherboard FRU.
Tested on simics.
-make bus call or use VPD tool application to update
keywords as mentioned above in (a) and (b).
-Introspect that motherboard object on bus.
-Check the value of interface "com.ibm.ipzvpd.Location",
property - "LocationCode"
To build the application
meson -Dibm-parser=enabled -Dvpd-manager=Enabled build
ninja -C build
Signed-off-by: Sunny Srivastava <sunnsr25@in.ibm.com>
Change-Id: Ic964da0f058153bdd43b94679bdfc5596d7f3861
diff --git a/utils.cpp b/utils.cpp
index 6f2bfe4..558e728 100644
--- a/utils.cpp
+++ b/utils.cpp
@@ -1,3 +1,5 @@
+#include "config.h"
+
#include "utils.hpp"
#include "defines.hpp"
@@ -116,5 +118,30 @@
return string(kw.begin(), kw.end());
}
}
+
+string readBusProperty(const string& obj, const string& inf, const string& prop)
+{
+ std::string propVal{};
+ std::string object = INVENTORY_PATH + obj;
+ auto bus = sdbusplus::bus::new_default();
+ auto properties = bus.new_method_call(
+ "xyz.openbmc_project.Inventory.Manager", object.c_str(),
+ "org.freedesktop.DBus.Properties", "Get");
+ properties.append(inf);
+ properties.append(prop);
+ auto result = bus.call(properties);
+ if (!result.is_method_error())
+ {
+ variant<Binary> val;
+ result.read(val);
+
+ if (auto pVal = get_if<Binary>(&val))
+ {
+ propVal.assign(reinterpret_cast<const char*>(pVal->data()),
+ pVal->size());
+ }
+ }
+ return propVal;
+}
} // namespace vpd
} // namespace openpower