diff options
author | James Feist <james.feist@linux.intel.com> | 2018-01-22 16:14:28 -0800 |
---|---|---|
committer | Patrick Venture <venture@google.com> | 2018-02-22 15:33:12 +0000 |
commit | 7bd5fcf356d7ba99a3648ad4b905078806fe27ec (patch) | |
tree | 2024f730e19a1e0d51430b6e2164d24e0b2cad51 | |
parent | a4bba96ed8e6a706928bd2c4de5f113df9304047 (diff) | |
download | phosphor-hwmon-7bd5fcf356d7ba99a3648ad4b905078806fe27ec.tar.gz phosphor-hwmon-7bd5fcf356d7ba99a3648ad4b905078806fe27ec.zip |
Read MaxValue and MinValue from configuration
Read MaxValue and MinValue from enviroment variables file.
With this change MAXVALUE_temp1 and MINVALUE_temp1 for example
can be read from the configuration and added to dbus.
Change-Id: Ic7c2ba57ae65415bb154c617b13866d661969e5a
Signed-off-by: James Feist <james.feist@linux.intel.com>
-rw-r--r-- | mainloop.cpp | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/mainloop.cpp b/mainloop.cpp index 419bfc7..1cd5db6 100644 --- a/mainloop.cpp +++ b/mainloop.cpp @@ -237,6 +237,17 @@ auto addValue(const SensorSet::key_type& sensor, iface->scale(getScale(attrs)); } + auto maxValue = getEnv("MAXVALUE", sensor); + if(!maxValue.empty()) + { + iface->maxValue(std::stoll(maxValue)); + } + auto minValue = getEnv("MINVALUE", sensor); + if(!minValue.empty()) + { + iface->minValue(std::stoll(minValue)); + } + obj[InterfaceType::VALUE] = iface; return iface; } |