From f552ea5ce23889905ce15c0ffcfc73fa1245a423 Mon Sep 17 00:00:00 2001 From: Matthew Barth Date: Mon, 15 Jan 2018 16:22:04 -0600 Subject: All sensors should return a target speed value All tach sensors associated with a fan should return a target speed sensor from its getTarget function. In the case where a target speed sensor does not exist for the tach sensor, it retrieves and returns the target speed value from the fan where the fan finds the target speed value from a tach sensor the fan contains that provides it. Resolves openbmc/openbmc#2784 Change-Id: Iea5561b0aad6942be52af262c7255c60e5e75c7a Signed-off-by: Matthew Barth --- monitor/tach_sensor.cpp | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) (limited to 'monitor/tach_sensor.cpp') diff --git a/monitor/tach_sensor.cpp b/monitor/tach_sensor.cpp index 8ae8583..1069313 100644 --- a/monitor/tach_sensor.cpp +++ b/monitor/tach_sensor.cpp @@ -126,13 +126,21 @@ TachSensor::TachSensor(sdbusplus::bus::bus& bus, } - std::string TachSensor::getMatchString(const std::string& interface) { return sdbusplus::bus::match::rules::propertiesChanged( _name, interface); } +uint64_t TachSensor::getTarget() const +{ + if (!_hasTarget) + { + return _fan.findTargetSpeed(); + } + return _tachTarget; +} + void TachSensor::setFunctional(bool functional) { _functional = functional; -- cgit v1.2.1