Update hwmon fan target sysfs entries
Override the default FanSpeed.Target set implementation so when a target
value is written to the FanSpeed interface it is also updated in the
related fan target sysfs file. This sets a particular fan to the given
target speed.
Resolves openbmc/openbmc#962
Resolves openbmc/phosphor-hwmon#1
Change-Id: I867811737269b3f42d2a0dc15b37782a74f147b8
Signed-off-by: Matthew Barth <msbarth@us.ibm.com>
diff --git a/mainloop.cpp b/mainloop.cpp
index 7af3096..34970b1 100644
--- a/mainloop.cpp
+++ b/mainloop.cpp
@@ -25,6 +25,7 @@
#include "env.hpp"
#include "thresholds.hpp"
#include "targets.hpp"
+#include "fan_speed.hpp"
// Initialization for Warning Objects
decltype(Thresholds<WarningObject>::setLo) Thresholds<WarningObject>::setLo =
@@ -54,12 +55,6 @@
decltype(Thresholds<CriticalObject>::alarmHi) Thresholds<CriticalObject>::alarmHi =
&CriticalObject::criticalAlarmHigh;
-// Initialization for Target objects
-decltype(Targets<FanSpeedObject>::setTarget)
- Targets<FanSpeedObject>::setTarget = &FanSpeedObject::target;
-decltype(Targets<FanSpeedObject>::getTarget)
- Targets<FanSpeedObject>::getTarget = &FanSpeedObject::target;
-
using namespace std::literals::chrono_literals;
@@ -247,7 +242,7 @@
addThreshold<CriticalObject>(i.first, sensorValue, info);
//TODO openbmc/openbmc#1347
// Handle application restarts to set/refresh fan speed values
- addTarget<FanSpeedObject>(i.first, _hwmonRoot, _instance, info);
+ addTarget<hwmon::FanSpeed>(i.first, _hwmonRoot, _instance, info);
// All the interfaces have been created. Go ahead
// and emit InterfacesAdded.