summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMatthew Barth <msbarth@us.ibm.com>2017-11-20 10:36:41 -0600
committerMatthew Barth <msbarth@linux.vnet.ibm.com>2017-12-05 16:14:56 +0000
commitd199dcdfd50debb67645a320fe04ad35c9b0c999 (patch)
treea82714fdb725928afc3358045eb0cfde5c4167c1
parent4d982856b445a7e1ba0ba2a349a7dbb3ed19e9aa (diff)
downloadphosphor-fan-presence-d199dcdfd50debb67645a320fe04ad35c9b0c999.tar.gz
phosphor-fan-presence-d199dcdfd50debb67645a320fe04ad35c9b0c999.zip
Set tach sensor inventory functional state
At startup, initialize the functional state of each tach sensor to true and then update the inventory's functional state to match the tach sensor's functional state. Resolves openbmc/openbmc#2629 Change-Id: If608e4c044d9eeaa3dbdafa22bc89327e323c9a8 Signed-off-by: Matthew Barth <msbarth@us.ibm.com>
-rw-r--r--monitor/tach_sensor.cpp10
-rw-r--r--monitor/tach_sensor.hpp9
2 files changed, 12 insertions, 7 deletions
diff --git a/monitor/tach_sensor.cpp b/monitor/tach_sensor.cpp
index a272681..8ae8583 100644
--- a/monitor/tach_sensor.cpp
+++ b/monitor/tach_sensor.cpp
@@ -78,8 +78,11 @@ TachSensor::TachSensor(sdbusplus::bus::bus& bus,
_timeout(timeout),
_timer(events, [this, &fan](){ fan.timerExpired(*this); })
{
- //Load in starting Target and Input values
+ // Start from a known state of functional
+ _functional = true;
+ updateInventory(_functional);
+ // Load in starting Target and Input values
try
{
// Use getProperty directly to allow a missing sensor object
@@ -130,6 +133,11 @@ std::string TachSensor::getMatchString(const std::string& interface)
_name, interface);
}
+void TachSensor::setFunctional(bool functional)
+{
+ _functional = functional;
+ updateInventory(_functional);
+}
/**
* @brief Reads a property from the input message and stores it in value.
diff --git a/monitor/tach_sensor.hpp b/monitor/tach_sensor.hpp
index 59b99d2..ba3465a 100644
--- a/monitor/tach_sensor.hpp
+++ b/monitor/tach_sensor.hpp
@@ -94,12 +94,9 @@ class TachSensor
}
/**
- * Sets functional status
+ * Set the functional status and update inventory to match
*/
- inline void setFunctional(bool functional)
- {
- _functional = functional;
- }
+ void setFunctional(bool functional);
/**
* @brief Says if the timer is running or not
@@ -202,7 +199,7 @@ class TachSensor
* @brief If functional (not too slow). The parent
* fan object sets this.
*/
- bool _functional = true;
+ bool _functional;
/**
* @brief If the sensor has a Target property (can set speed)
OpenPOWER on IntegriCloud