leds:Make use of Decorator.Compatible interface

Switching led-manager to use xyz.openbmc_project.Inventory.Decorator.
Compatible interface from using xyz.openbmc_project.Configuration.
IBMCompatibleSystem interface.

Test:
Tested that the right config json is picked based on the Names property
from xyz.openbmc_project.Inventory.Decorator.Compatible interface.

Change-Id: I48ee37cb3f11fd6cd99e913caee4ebeb2e1004c3
Signed-off-by: Priyanga Ramasamy <priyanga24@in.ibm.com>
diff --git a/manager/json-config.hpp b/manager/json-config.hpp
index 4eb77db..eadf4b4 100644
--- a/manager/json-config.hpp
+++ b/manager/json-config.hpp
@@ -18,7 +18,7 @@
 static constexpr auto confOverridePath = "/etc/phosphor-led-manager";
 static constexpr auto confBasePath = "/usr/share/phosphor-led-manager";
 static constexpr auto confCompatibleInterface =
-    "xyz.openbmc_project.Configuration.IBMCompatibleSystem";
+    "xyz.openbmc_project.Inventory.Decorator.Compatible";
 static constexpr auto confCompatibleProperty = "Names";
 
 class JsonConfig
@@ -28,8 +28,8 @@
      * @brief Constructor
      *
      * Looks for the JSON config file.  If it can't find one, then it
-     * will watch entity-manager for the IBMCompatibleSystem interface
-     * to show up.
+     * will watch entity-manager for the
+     * xyz.openbmc_project.Inventory.Decorator.Compatible interface to show up.
      *
      * @param[in] bus       - The D-Bus object
      * @param[in] event     - sd event handler
@@ -72,10 +72,11 @@
     {
         auto it = std::find_if(names.begin(), names.end(),
                                [this](const auto& name) {
-            auto tempConfFile = fs::path{confBasePath} / name / confFileName;
-            if (fs::exists(tempConfFile))
+            auto configFileName = name + ".json";
+            auto configFilePath = fs::path{confBasePath} / configFileName;
+            if (fs::exists(configFilePath))
             {
-                confFile = tempConfFile;
+                confFile = configFilePath;
                 return true;
             }
             return false;
@@ -85,9 +86,9 @@
 
     /**
      * @brief The interfacesAdded callback function that looks for
-     *        the IBMCompatibleSystem interface.  If it finds it,
-     *        it uses the Names property in the interface to find
-     *        the JSON config file to use.
+     *        the xyz.openbmc_project.Inventory.Decorator.Compatible interface.
+     * If it finds it, it uses the Names property in the interface to find the
+     * JSON config file to use.
      *
      * @param[in] msg - The D-Bus message contents
      */
@@ -108,7 +109,7 @@
         }
 
         // Get the "Name" property value of the
-        // "xyz.openbmc_project.Configuration.IBMCompatibleSystem" interface
+        // "xyz.openbmc_project.Inventory.Decorator.Compatible" interface
         const auto& properties = interfaces.at(confCompatibleInterface);
 
         if (!properties.contains(confCompatibleProperty))
@@ -215,7 +216,8 @@
 
     /**
      * @brief The interfacesAdded match that is used to wait
-     *        for the IBMCompatibleSystem interface to show up.
+     *        for the xyz.openbmc_project.Inventory.Decorator.Compatible
+     * interface to show up.
      */
     std::unique_ptr<sdbusplus::bus::match_t> match;