summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAdriana Kobylak <anoo@us.ibm.com>2017-12-07 12:24:56 -0600
committerAdriana Kobylak <anoo@linux.vnet.ibm.com>2018-01-16 20:29:31 +0000
commit1254c628c5fcf59e111799a839ab7c132fac7330 (patch)
treeb8b0064d6acd886d7fe220f855ef7da358383b98
parent6273efd7b45453d7c268049812646afdb6ae630d (diff)
downloadphosphor-bmc-code-mgmt-1254c628c5fcf59e111799a839ab7c132fac7330.tar.gz
phosphor-bmc-code-mgmt-1254c628c5fcf59e111799a839ab7c132fac7330.zip
item_updater: Look for BMC inventory interface
There were some TODOs to more efficiently find the BMC inventory object. The pending issues have been resolved so update the code to search for the BMC inventory interface from the whole inventory root path. Change-Id: I4331814bb6b9cc8e8b0bba7b85c8d75b8c1bacf6 Signed-off-by: Adriana Kobylak <anoo@us.ibm.com>
-rwxr-xr-xconfigure.ac5
-rw-r--r--item_updater.cpp24
2 files changed, 9 insertions, 20 deletions
diff --git a/configure.ac b/configure.ac
index 548b361..749f537 100755
--- a/configure.ac
+++ b/configure.ac
@@ -53,7 +53,10 @@ AX_APPEND_COMPILE_FLAGS([-Wall -Werror], [CXXFLAGS])
AC_DEFINE(ACTIVATION_FWD_ASSOCIATION, "inventory", [The name of the activation's forward association.])
AC_DEFINE(ACTIVATION_REV_ASSOCIATION, "activation", [The name of the activation's reverse association.])
-AC_DEFINE(CHASSIS_INVENTORY_PATH, "/xyz/openbmc_project/inventory/system/chassis/", [The chassis inventory path root.])
+AC_DEFINE(INVENTORY_PATH, "/xyz/openbmc_project/inventory/",
+ [The inventory path root.])
+AC_DEFINE(BMC_INVENTORY_INTERFACE, "xyz.openbmc_project.Inventory.Item.Bmc",
+ [The BMC inventory interface])
AC_DEFINE(ACTIVE_FWD_ASSOCIATION, "active", [The name of the active's forward association.])
AC_DEFINE(ACTIVE_REV_ASSOCIATION, "software_version", [The name of the active's reverse association.])
diff --git a/item_updater.cpp b/item_updater.cpp
index bbfdef4..df53747 100644
--- a/item_updater.cpp
+++ b/item_updater.cpp
@@ -533,20 +533,15 @@ void ItemUpdater::restoreFieldModeStatus()
void ItemUpdater::setBMCInventoryPath()
{
- //TODO: openbmc/openbmc#1786 - Get the BMC path by looking for objects
- // that implement the BMC inventory interface
auto depth = 0;
auto mapperCall = bus.new_method_call(MAPPER_BUSNAME,
MAPPER_PATH,
MAPPER_INTERFACE,
"GetSubTreePaths");
- mapperCall.append(CHASSIS_INVENTORY_PATH);
+ mapperCall.append(INVENTORY_PATH);
mapperCall.append(depth);
-
- // TODO: openbmc/openbmc#2226 - Add Inventory Item filter when
- // mapper is fixed.
- std::vector<std::string> filter = {};
+ std::vector<std::string> filter = {BMC_INVENTORY_INTERFACE};
mapperCall.append(filter);
auto response = bus.call(mapperCall);
@@ -560,21 +555,12 @@ void ItemUpdater::setBMCInventoryPath()
ObjectPaths result;
response.read(result);
- if (result.empty())
+ if (!result.empty())
{
- log<level::ERR>("Invalid response from mapper");
- return;
+ bmcInventoryPath = result.front();
}
- for (auto& iter : result)
- {
- const auto& path = iter;
- if (path.substr(path.find_last_of('/') + 1).compare("bmc") == 0)
- {
- bmcInventoryPath = path;
- return;
- }
- }
+ return;
}
void ItemUpdater::createActiveAssociation(const std::string& path)
OpenPOWER on IntegriCloud