regs: Use new compatible interface
Enhance the phosphor-regulators application to use the new D-Bus
interface xyz.openbmc_project.Inventory.Decorator.Compatible.
The list of compatible system type names from this interface is used to
find the configuration file for the current system.
Rename the configuration files to match the system type names in the new
D-Bus interface.
Tested:
* Verified phosphor-regulators loaded correct config file
* When interface was available before app started
* When interface was available after app started
* When interface was available after configure action started
* When interface was never available but default config file exists
* On Rainier, Everest, and Fuji systems
* Verified system could be powered on and off without error
* Verified app waited up to 5 minutes during configure action for
interface to become available. Verified critical error logged and
power on failed if interface not found within 5 minutes.
Change-Id: Icee0c59566c68730ca318fc4521f05af2546eed1
Signed-off-by: Shawn McCarney <shawnmm@us.ibm.com>
diff --git a/phosphor-regulators/src/manager.hpp b/phosphor-regulators/src/manager.hpp
index fdb8461..ad51d98 100644
--- a/phosphor-regulators/src/manager.hpp
+++ b/phosphor-regulators/src/manager.hpp
@@ -15,12 +15,12 @@
*/
#pragma once
+#include "compatible_system_types_finder.hpp"
#include "services.hpp"
#include "system.hpp"
#include <interfaces/manager_interface.hpp>
#include <sdbusplus/bus.hpp>
-#include <sdbusplus/bus/match.hpp>
#include <sdbusplus/server/object.hpp>
#include <sdeventplus/event.hpp>
#include <sdeventplus/source/signal.hpp>
@@ -69,13 +69,6 @@
void configure() override;
/**
- * Callback function to handle interfacesAdded D-Bus signals
- *
- * @param msg Expanded sdbusplus message data
- */
- void interfacesAddedHandler(sdbusplus::message_t& msg);
-
- /**
* Implements the D-Bus "monitor" method.
*
* Sets whether regulator monitoring is enabled.
@@ -104,6 +97,14 @@
void monitor(bool enable) override;
/**
+ * Callback that is called when a list of compatible system types is found.
+ *
+ * @param types Compatible system types for the current system ordered from
+ * most to least specific
+ */
+ void compatibleSystemTypesFound(const std::vector<std::string>& types);
+
+ /**
* Phase fault detection timer expired callback function.
*/
void phaseFaultTimerExpired();
@@ -134,19 +135,6 @@
void clearHardwareData();
/**
- * Finds the list of compatible system types using D-Bus methods.
- *
- * This list is used to find the correct JSON configuration file for the
- * current system.
- *
- * Note that some systems do not support the D-Bus compatible interface.
- *
- * If a list of compatible system types is found, it is stored in the
- * compatibleSystemTypes data member.
- */
- void findCompatibleSystemTypes();
-
- /**
* Finds the JSON configuration file.
*
* Looks for a configuration file based on the list of compatible system
@@ -216,6 +204,11 @@
BMCServices services;
/**
+ * Object that finds the compatible system types for the current system.
+ */
+ std::unique_ptr<util::CompatibleSystemTypesFinder> compatSysTypesFinder;
+
+ /**
* Event timer used to initiate phase fault detection.
*/
Timer phaseFaultTimer;
@@ -226,11 +219,6 @@
Timer sensorTimer;
/**
- * List of D-Bus signal matches
- */
- std::vector<std::unique_ptr<sdbusplus::bus::match_t>> signals{};
-
- /**
* Indicates whether regulator monitoring is enabled.
*/
bool isMonitoringEnabled{false};