summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMatthew Barth <msbarth@us.ibm.com>2018-04-25 14:38:51 -0500
committerMatthew Barth <msbarth@us.ibm.com>2018-04-27 15:09:34 -0500
commit27c4a3943f05d762202432ac064f392253681265 (patch)
tree2c550413577d705c481c8dcc30ee8084db19bf82
parentca44c2e11fd6ee4849790c9d1bae930315039413 (diff)
downloadphosphor-hwmon-27c4a3943f05d762202432ac064f392253681265.tar.gz
phosphor-hwmon-27c4a3943f05d762202432ac064f392253681265.zip
Skip updating value for faulted sensors
When a sensor is marked as faulted, the input value is skipped from being read and updated in the sensor's dbus object during the monitoring loop. This keeps the sensor's value set to its previously known state. The hwmon documentation states that when a sensor input channel presents an associated fault file, the measurement value provided for that channel should not be trusted when the fault boolean has a value of 1. Not updating the sensor value follows this specification. Tested: A non-functional sensor's input value is not read A non-functional sensor's value state in dbus object is not updated Any functional sensor's input value is read during monitoring Any functional sensor's value state is updated during monitoring All sensors without a fault sysfs file are read/updated normally Change-Id: Iccf3e4e44125d6e481ce91c8f63e8f0e4ee3df4b Signed-off-by: Matthew Barth <msbarth@us.ibm.com>
-rw-r--r--mainloop.cpp17
1 files changed, 14 insertions, 3 deletions
diff --git a/mainloop.cpp b/mainloop.cpp
index ad73df7..9944e09 100644
--- a/mainloop.cpp
+++ b/mainloop.cpp
@@ -526,6 +526,20 @@ void MainLoop::read()
try
{
+ auto& objInfo = std::get<ObjectInfo>(i.second);
+ auto& obj = std::get<Object>(objInfo);
+
+ auto it = obj.find(InterfaceType::STATUS);
+ if (it != obj.end())
+ {
+ auto statusIface = std::experimental::any_cast<
+ std::shared_ptr<StatusObject>>(it->second);
+ if (!statusIface->functional())
+ {
+ continue;
+ }
+ }
+
// Retry for up to a second if device is busy
// or has a transient error.
@@ -539,9 +553,6 @@ void MainLoop::read()
value = adjustValue(i.first, value);
- auto& objInfo = std::get<ObjectInfo>(i.second);
- auto& obj = std::get<Object>(objInfo);
-
for (auto& iface : obj)
{
auto valueIface = std::shared_ptr<ValueObject>();
OpenPOWER on IntegriCloud