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>
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 @@
_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 @@
_name, interface);
}
+void TachSensor::setFunctional(bool functional)
+{
+ _functional = functional;
+ updateInventory(_functional);
+}
/**
* @brief Reads a property from the input message and stores it in value.