sensors: ignore min/max in json for D-Bus passive sensor read
min/max values were meant to scale write to be PWM, but were
overloaded in commit 75eb769d351434547899186f73ff70ae00d7934a
to scale sensor read to percent as well. However currently the D-Bus sensors
built from JSON can only specify one pair of min/max values,so they
cannot be used for both read/write interfaces.
Fix the behavior by ignoring min/max in settings when building D-Bus passive
read interface and only read them from D-Bus.
Tested:
D-Bus passive sensor value is no longer scaled if there is no
MinValue/MaxValue specified.
Resolves: openbmc/phosphor-pid-control#14
Signed-off-by: Kun Yi <kunyi731@gmail.com>
Change-Id: I206bbe75c77e79f765eca76cfa015321dcba4aa7
diff --git a/conf.hpp b/conf.hpp
index 9d65154..35c2da5 100644
--- a/conf.hpp
+++ b/conf.hpp
@@ -10,8 +10,6 @@
namespace conf
{
-constexpr int64_t inheritValueFromDbus = std::numeric_limits<int64_t>::lowest();
-
/*
* General sensor structure used for configuration.
*/
diff --git a/dbus/dbusconfiguration.cpp b/dbus/dbusconfiguration.cpp
index c33264c..7641eaf 100644
--- a/dbus/dbusconfiguration.cpp
+++ b/dbus/dbusconfiguration.cpp
@@ -527,11 +527,6 @@
{
config.timeout = 0;
}
- else if (config.type == "fan")
- {
- config.max = conf::inheritValueFromDbus;
- config.min = conf::inheritValueFromDbus;
- }
}
else if (sensorPathIfacePair.second == pwmInterface)
{
diff --git a/dbus/dbuspassive.cpp b/dbus/dbuspassive.cpp
index 5614335..c199563 100644
--- a/dbus/dbuspassive.cpp
+++ b/dbus/dbuspassive.cpp
@@ -60,15 +60,6 @@
{
return nullptr;
}
- if (info->max != conf::inheritValueFromDbus)
- {
- settings.max = info->max;
- }
-
- if (info->min != conf::inheritValueFromDbus)
- {
- settings.min = info->min;
- }
return std::make_unique<DbusPassive>(bus, type, id, helper, settings,
failed, path, redundancy);