Create functional association on startup
Look at /var/lib/phosphor-software-manager/pnor/ro
to determine if there is a funcitonal image, if so
create a functional association.
Resolves openbmc/openbmc#2279
Change-Id: I6e576e2e21a592a98d843eb45cdab8bba8f55192
Signed-off-by: Gunnar Mills <gmills@us.ibm.com>
diff --git a/watch.cpp b/watch.cpp
index da06bbc..2212e01 100644
--- a/watch.cpp
+++ b/watch.cpp
@@ -8,6 +8,7 @@
#include <phosphor-logging/log.hpp>
#include "config.h"
#include "watch.hpp"
+#include "item_updater.hpp"
namespace openpower
{
@@ -97,12 +98,7 @@
path /= event->name;
if (fs::equivalent(path, PNOR_RO_ACTIVE_PATH))
{
- auto target = fs::canonical(path).string();
-
- // Get the image <id> from the symlink target
- // for example /media/ro-2a1022fe
- static const auto PNOR_RO_PREFIX_LEN = strlen(PNOR_RO_PREFIX);
- auto id = target.substr(PNOR_RO_PREFIX_LEN);
+ auto id = ItemUpdater::determineId(path);
auto objPath = std::string{SOFTWARE_OBJPATH} + '/' + id;
static_cast<Watch*>(userdata)->functionalCallback(objPath);