From 28f8e66dd50d5c855ddf0ea02f2eef56ec0274fc Mon Sep 17 00:00:00 2001 From: Matthew Barth Date: Mon, 26 Mar 2018 16:57:36 -0500 Subject: Check TARGET_MODE on target sensors Move the TARGET_MODE config entry to be done on target specific sensors. Tested: Target sensors are still created for the mode given in TARGET_MODE Change-Id: I7731b73e14495360ccb5b8fb8ada59176e9125d3 Signed-off-by: Matthew Barth --- mainloop.cpp | 46 +++++----------------------------------------- 1 file changed, 5 insertions(+), 41 deletions(-) (limited to 'mainloop.cpp') diff --git a/mainloop.cpp b/mainloop.cpp index d3987cc..29ce2b3 100644 --- a/mainloop.cpp +++ b/mainloop.cpp @@ -285,32 +285,6 @@ auto addValue(const SensorSet::key_type& sensor, */ void MainLoop::getObject(SensorSet::container_t::const_reference sensor) { - //If this device supports target speeds, - //check which type to use. - targetType fanTargetType = targetType::DEFAULT; - auto targetMode = getenv("TARGET_MODE"); - if (targetMode) - { - std::string type{targetMode}; - std::transform(type.begin(), type.end(), type.begin(), toupper); - - if (type == RPM_TARGET) - { - fanTargetType = targetType::RPM; - } - else if (type == PWM_TARGET) - { - fanTargetType = targetType::PWM; - } - else - { - log( - "Invalid TARGET_MODE env var found", - entry("TARGET_MODE=%s", targetMode), - entry("DEVPATH=%s", _devPath.c_str())); - } - } - // Get list of return codes for removing sensors on device std::string deviceRmRCs; auto devRmRCs = getenv("REMOVERCS"); @@ -422,23 +396,13 @@ void MainLoop::getObject(SensorSet::container_t::const_reference sensor) addThreshold(sensor.first.first, id, sensorValue, info); addThreshold(sensor.first.first, id, sensorValue, info); - if ((fanTargetType == targetType::RPM) || - (fanTargetType == targetType::DEFAULT)) - { - auto target = addTarget( - sensor.first, ioAccess, _devPath, info); - - if (target) - { - target->enable(); - } - } - - if ((fanTargetType == targetType::PWM) || - (fanTargetType == targetType::DEFAULT)) + auto target = addTarget( + sensor.first, ioAccess, _devPath, info); + if (target) { - addTarget(sensor.first, ioAccess, _devPath, info); + target->enable(); } + addTarget(sensor.first, ioAccess, _devPath, info); // All the interfaces have been created. Go ahead // and emit InterfacesAdded. -- cgit v1.2.3