Retry on ENODATA errors
A particular device in a particular system is known to fail
with an ENODATA errno when another entity is using the same
path to access it. Add it to the retry list so that
phosphor-hwmon will retry and hopefully be able to get a
clean read. Even for devices where this contention isn't
the case, the code may as well retry as opposed to trying
once and giving up.
Resolves openbmc/openbmc#2645
Change-Id: Ib7aaaa14be33a33794a8c62d6991f77ab65a2ffa
Signed-off-by: Matt Spinler <spinler@us.ibm.com>
diff --git a/sysfs.cpp b/sysfs.cpp
index 369d2e7..8b7ee48 100644
--- a/sysfs.cpp
+++ b/sysfs.cpp
@@ -62,6 +62,14 @@
* and kill this process.
*/
ENODEV,
+
+ /*
+ * Some devices return this when they are busy doing
+ * something else. Even if being busy isn't the cause,
+ * a retry still gives this app a shot at getting data
+ * as opposed to failing out on the first try.
+ */
+ ENODATA,
};
static const auto emptyString = ""s;