sensordatahandler: Throw on sensor's OperationalStatus

Add UPDATE_FUNCTIONAL_ON_FAIL and only when defined, read sensor's
OperationalStatus interface for the functional property and throw if the
sensor is not funcitonal.

Bug: openbmc/phosphor-hwmon#10
Signed-off-by: Brandon Kim <brandonkim@google.com>
Change-Id: I1144a6d3f8145bda73f3363664ca48b848a295db
diff --git a/configure.ac b/configure.ac
index 869c53d..5ed0506 100644
--- a/configure.ac
+++ b/configure.ac
@@ -192,6 +192,26 @@
 AS_IF([test "x$HOST_IPMI_LIB_PATH" == "x"], [HOST_IPMI_LIB_PATH="/usr/lib/ipmid-providers/"])
 AC_DEFINE_UNQUOTED([HOST_IPMI_LIB_PATH], ["$HOST_IPMI_LIB_PATH"], [The file path to search for libraries.])
 
+# When a sensor read fails, hwmon will update the OperationalState interface's Functional property.
+# This will mark the sensor as not functional and we will skip reading from that sensor.
+AC_ARG_ENABLE([update-functional-on-fail],
+    AS_HELP_STRING(
+        [--enable-update-functional-on-fail],
+        [Check functional property to skip reading from faulty sensors.]
+    )
+)
+
+AC_ARG_VAR(UPDATE_FUNCTIONAL_ON_FAIL, [Check functional property to skip reading from faulty sensors.])
+AS_IF(
+    [test "x$enable_update_functional_on_fail" == "xyes"],
+    [UPDATE_FUNCTIONAL_ON_FAIL="yes"]
+    AC_DEFINE_UNQUOTED(
+        [UPDATE_FUNCTIONAL_ON_FAIL],
+        ["$UPDATE_FUNCTIONAL_ON_FAIL"],
+        [Check functional property to skip reading from faulty sensors.]
+    )
+)
+
 # When disable-libuserlayer flag is set, libuserlayer won't be included in the build.
 AC_ARG_ENABLE([libuserlayer],
     AS_HELP_STRING([--disable-libuserlayer], [Set a flag to exclude libuserlayer])