From c39e859b44c7d9152c76462ab4848060c840ab29 Mon Sep 17 00:00:00 2001 From: Matt Spinler Date: Thu, 28 Sep 2017 13:13:08 -0500 Subject: monitor: Start checking tach trust The Fan class now uses the trust::Manager class to ask if a sensor value is trusted before analyzing its value against the upper and lower limits. Change-Id: I81dd468877873ba84753d76395b4a59129824c0b Signed-off-by: Matt Spinler --- monitor/fan.cpp | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) (limited to 'monitor/fan.cpp') diff --git a/monitor/fan.cpp b/monitor/fan.cpp index a2e0386..ba0744a 100644 --- a/monitor/fan.cpp +++ b/monitor/fan.cpp @@ -39,11 +39,13 @@ constexpr auto OPERATIONAL_STATUS_INTF = Fan::Fan(Mode mode, sdbusplus::bus::bus& bus, phosphor::fan::event::EventPtr& events, + std::unique_ptr& trust, const FanDefinition& def) : _bus(bus), _name(std::get(def)), _deviation(std::get(def)), - _numSensorFailsForNonFunc(std::get(def)) + _numSensorFailsForNonFunc(std::get(def)), + _trustManager(trust) { //Start from a known state of functional updateInventory(true); @@ -64,6 +66,8 @@ Fan::Fan(Mode mode, std::get(s), std::get(def), events)); + + _trustManager->registerSensor(_sensors.back()); } catch (InvalidSensorError& e) { @@ -89,6 +93,14 @@ void Fan::tachChanged() void Fan::tachChanged(TachSensor& sensor) { + if (_trustManager->active()) + { + if (!_trustManager->checkTrust(sensor)) + { + return; + } + } + auto running = sensor.timerRunning(); //If this sensor is out of range at this moment, start -- cgit v1.2.1