psu-ng: Move entity-manager interaces added
Move the code for handling interfacesAdded from entity-manager to the
PSUManager constructor. Plans on using this for both the system
properties from SupportedConfiguration and the IBMCFFPSConnector
properties.
Signed-off-by: Brandon Wyman <bjwyman@gmail.com>
Change-Id: I440ffdf5a3ad77f58dc521ba743e5c984659cc69
diff --git a/phosphor-power-supply/psu_manager.cpp b/phosphor-power-supply/psu_manager.cpp
index 3117e2c..b5e07c3 100644
--- a/phosphor-power-supply/psu_manager.cpp
+++ b/phosphor-power-supply/psu_manager.cpp
@@ -22,6 +22,16 @@
// Parse out the JSON properties
sysProperties = {0};
getJSONProperties(configfile);
+ // Subscribe to InterfacesAdded before doing a property read, otherwise
+ // the interface could be created after the read attempt but before the
+ // match is created.
+ entityManagerIfacesAddedMatch = std::make_unique<sdbusplus::bus::match_t>(
+ bus,
+ sdbusplus::bus::match::rules::interfacesAdded() +
+ sdbusplus::bus::match::rules::sender(
+ "xyz.openbmc_project.EntityManager"),
+ std::bind(&PSUManager::supportedConfIfaceAdded, this,
+ std::placeholders::_1));
getSystemProperties();
using namespace sdeventplus;
@@ -80,16 +90,6 @@
void PSUManager::getSystemProperties()
{
- // Subscribe to InterfacesAdded before doing a property read, otherwise
- // the interface could be created after the read attempt but before the
- // match is created.
- entityManagerIfacesAddedMatch = std::make_unique<sdbusplus::bus::match_t>(
- bus,
- sdbusplus::bus::match::rules::interfacesAdded() +
- sdbusplus::bus::match::rules::sender(
- "xyz.openbmc_project.EntityManager"),
- std::bind(&PSUManager::supportedConfIfaceAdded, this,
- std::placeholders::_1));
uint64_t maxCount;
try