summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--occ_device.hpp14
-rw-r--r--occ_manager.cpp9
-rw-r--r--occ_status.hpp6
3 files changed, 24 insertions, 5 deletions
diff --git a/occ_device.hpp b/occ_device.hpp
index fd30641..2ca94f5 100644
--- a/occ_device.hpp
+++ b/occ_device.hpp
@@ -105,11 +105,6 @@ class Device
/** @brief Starts to monitor for errors */
inline void addErrorWatch()
{
- if (master())
- {
- presence.addWatch();
- }
-
throttleProcTemp.addWatch();
throttleProcPower.addWatch();
throttleMemTemp.addWatch();
@@ -128,6 +123,15 @@ class Device
throttleProcTemp.removeWatch();
}
+ /** @brief Starts to watch how many OCCs are present on the master */
+ inline void addPresenceWatchMaster()
+ {
+ if (master())
+ {
+ presence.addWatch();
+ }
+ }
+
private:
/** @brief Config value to be used to do bind and unbind */
const std::string config;
diff --git a/occ_manager.cpp b/occ_manager.cpp
index 040676b..6fd0652 100644
--- a/occ_manager.cpp
+++ b/occ_manager.cpp
@@ -82,6 +82,15 @@ void Manager::statusCallBack(bool status)
}
activeCount += status ? 1 : -1;
+
+ // Only start presence detection if all the OCCs are bound
+ if (activeCount == statusObjects.size())
+ {
+ for (auto &obj : statusObjects)
+ {
+ obj->addPresenceWatchMaster();
+ }
+ }
}
#ifdef I2C_OCC
diff --git a/occ_status.hpp b/occ_status.hpp
index 60134fb..d88ef6b 100644
--- a/occ_status.hpp
+++ b/occ_status.hpp
@@ -120,6 +120,12 @@ class Status : public Interface
return device.removeErrorWatch();
}
+ /** @brief Starts to watch how many OCCs are present on the master */
+ inline void addPresenceWatchMaster()
+ {
+ return device.addPresenceWatchMaster();
+ }
+
private:
/** @brief sdbus handle */
OpenPOWER on IntegriCloud