summaryrefslogtreecommitdiffstats
path: root/sysfs.cpp
diff options
context:
space:
mode:
authorMatthew Barth <msbarth@us.ibm.com>2018-03-16 10:03:27 -0500
committerMatthew Barth <msbarth@us.ibm.com>2018-03-22 16:31:36 -0500
commita23babd6952cb21397d6aa408a827047d1de81de (patch)
tree064e56bbbb558e75e0eae150be57d7c1d6dbc794 /sysfs.cpp
parent147b0337b36e58604fbdd517f71f97a4dae725c1 (diff)
downloadphosphor-hwmon-a23babd6952cb21397d6aa408a827047d1de81de.tar.gz
phosphor-hwmon-a23babd6952cb21397d6aa408a827047d1de81de.zip
Handle OCC EAGAIN & EREMOTEIO in 4.13
This is a temporary fix until the following issues are completed: openbmc/openbmc#2327 openbmc/openbmc#2329 When an EAGAIN or an EREMOTEIO return code is received by hwmon from the OCC driver in the 4.13 kernel, they should be translated to an unavailable sensor(0x00) and failed sensor(0xFF) scaled values respectively. This will keep the OCC hwmon instance running and allow applications to continue using these sensors as they were reported under the mainline openbmc/linux 4.10 kernel. Tested: Verified return codes are caught and sensor value modified Change-Id: Ie61859863e7d88878caa942e5f5b062acabe67aa Signed-off-by: Matthew Barth <msbarth@us.ibm.com>
Diffstat (limited to 'sysfs.cpp')
-rw-r--r--sysfs.cpp22
1 files changed, 21 insertions, 1 deletions
diff --git a/sysfs.cpp b/sysfs.cpp
index 0eb7863..f348be4 100644
--- a/sysfs.cpp
+++ b/sysfs.cpp
@@ -289,7 +289,8 @@ int64_t HwmonIO::read(
const std::string& id,
const std::string& sensor,
size_t retries,
- std::chrono::milliseconds delay) const
+ std::chrono::milliseconds delay,
+ bool isOCC) const
{
int64_t val;
std::ifstream ifs;
@@ -334,6 +335,25 @@ int64_t HwmonIO::read(
exit(0);
}
+ if (isOCC)
+ {
+ if (rc == EAGAIN)
+ {
+ // For the OCCs, when an EAGAIN is return, just set the
+ // value to 0 (0x00 = sensor is unavailable)
+ val = 0;
+ break;
+ }
+ else if (rc == EREMOTEIO)
+ {
+ // For the OCCs, when an EREMOTEIO is return, set the
+ // value to 255*1000
+ // (0xFF = sensor is failed, 1000 = sensor factor)
+ val = 255000;
+ break;
+ }
+ }
+
if (0 == std::count(
retryableErrors.begin(),
retryableErrors.end(),
OpenPOWER on IntegriCloud