diff options
| author | Matthew Barth <msbarth@us.ibm.com> | 2018-03-16 10:03:27 -0500 |
|---|---|---|
| committer | Matthew Barth <msbarth@us.ibm.com> | 2018-03-22 16:31:36 -0500 |
| commit | a23babd6952cb21397d6aa408a827047d1de81de (patch) | |
| tree | 064e56bbbb558e75e0eae150be57d7c1d6dbc794 /mainloop.cpp | |
| parent | 147b0337b36e58604fbdd517f71f97a4dae725c1 (diff) | |
| download | phosphor-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 'mainloop.cpp')
| -rw-r--r-- | mainloop.cpp | 17 |
1 files changed, 13 insertions, 4 deletions
diff --git a/mainloop.cpp b/mainloop.cpp index 9af3053..cfa5483 100644 --- a/mainloop.cpp +++ b/mainloop.cpp @@ -171,7 +171,8 @@ int64_t adjustValue(const SensorSet::key_type& sensor, int64_t value) auto addValue(const SensorSet::key_type& sensor, const std::string& devPath, sysfs::hwmonio::HwmonIO& ioAccess, - ObjectInfo& info) + ObjectInfo& info, + bool isOCC = false) { static constexpr bool deferSignals = true; @@ -190,7 +191,8 @@ auto addValue(const SensorSet::key_type& sensor, sensor.second, hwmon::entry::cinput, sysfs::hwmonio::retries, - sysfs::hwmonio::delay); + sysfs::hwmonio::delay, + isOCC); } catch (const std::system_error& e) { @@ -269,6 +271,11 @@ MainLoop::MainLoop( state(), ioAccess(path) { + if (path.find("occ") != std::string::npos) + { + _isOCC = true; + } + std::string p = path; while (!p.empty() && p.back() == '/') { @@ -371,7 +378,8 @@ void MainLoop::run() objectPath.append(label); ObjectInfo info(&_bus, std::move(objectPath), Object()); - auto valueInterface = addValue(i.first, _devPath, ioAccess, info); + auto valueInterface = addValue(i.first, _devPath, ioAccess, info, + _isOCC); if (!valueInterface) { #ifdef REMOVE_ON_FAIL @@ -469,7 +477,8 @@ void MainLoop::run() i.first.second, input, sysfs::hwmonio::retries, - sysfs::hwmonio::delay); + sysfs::hwmonio::delay, + _isOCC); value = adjustValue(i.first, value); |

