Add location interface
Tested:
$busctl introspect xyz.openbmc_project.eStoraged \
/xyz/openbmc_project/inventory/storage/mmcblk0
...
xyz.openbmc_project.Inventory.Decorator.LocationCode interface
.LocationCode property s "Embedded" emits-change
...
Signed-off-by: John Edward Broadbent <jebr@google.com>
Change-Id: Ib1c2177541de193c5930238958201ad26b38e7d2
diff --git a/include/estoraged.hpp b/include/estoraged.hpp
index 2db260f..bf5e6c8 100644
--- a/include/estoraged.hpp
+++ b/include/estoraged.hpp
@@ -132,6 +132,9 @@
/** @brief D-Bus interface for the physical drive. */
std::shared_ptr<sdbusplus::asio::dbus_interface> driveInterface;
+ /** @brief D-Bus interface for the location of the drive. */
+ std::shared_ptr<sdbusplus::asio::dbus_interface> locationInterface;
+
/** @brief Association between chassis and drive. */
std::shared_ptr<sdbusplus::asio::dbus_interface> association;
diff --git a/src/estoraged.cpp b/src/estoraged.cpp
index 93efaae..83c96c2 100644
--- a/src/estoraged.cpp
+++ b/src/estoraged.cpp
@@ -100,8 +100,14 @@
return value;
});
+ locationInterface = objectServer.add_interface(
+ objectPath, "xyz.openbmc_project.Inventory.Decorator.LocationCode");
+ locationInterface->register_property("LocationCode",
+ std::string("Embedded"));
+
volumeInterface->initialize();
driveInterface->initialize();
+ locationInterface->initialize();
/* Set up the association between chassis and drive. */
association = objectServer.add_interface(
@@ -118,6 +124,7 @@
{
objectServer.remove_interface(volumeInterface);
objectServer.remove_interface(driveInterface);
+ objectServer.remove_interface(locationInterface);
objectServer.remove_interface(association);
}