diff options
author | Matthew Barth <msbarth@us.ibm.com> | 2018-04-26 09:46:49 -0500 |
---|---|---|
committer | Matthew Barth <msbarth@us.ibm.com> | 2018-04-27 15:09:34 -0500 |
commit | 0b3050582046e509d517360c413a6f90ca7d9b3a (patch) | |
tree | ffe6c911f697a9a34500ec227c2937da0eb30635 | |
parent | bfcaf3d8c9de49453d85a2cbaf65e4fe276512d8 (diff) | |
download | phosphor-hwmon-0b3050582046e509d517360c413a6f90ca7d9b3a.tar.gz phosphor-hwmon-0b3050582046e509d517360c413a6f90ca7d9b3a.zip |
Remove OCC EREMOTEIO return code hack
With openbmc/openbmc#2329, an OCC sensor value will not be read when the
associated fault file is set to true. This will set the value to 0 when
a sensor is faulted at startup or not update the previous value during
the monitoring loop if the OCC sensor becomes faulted.
Applications(i.e. fan control) needing to react to a faulted OCC sensor
can subscribe to property changed signals on the OperationalStatus
Functional property for the sensor's dbus object.
Tested:
A faulted OCC sensor has a non-functional status on dbus
Change-Id: Ia43ebb1e0fe0227797bc4034e617ac357edd348d
Signed-off-by: Matthew Barth <msbarth@us.ibm.com>
-rw-r--r-- | hwmonio.cpp | 15 | ||||
-rw-r--r-- | hwmonio.hpp | 3 | ||||
-rw-r--r-- | mainloop.cpp | 17 | ||||
-rw-r--r-- | mainloop.hpp | 2 |
4 files changed, 6 insertions, 31 deletions
diff --git a/hwmonio.cpp b/hwmonio.cpp index fe167f5..18ceff9 100644 --- a/hwmonio.cpp +++ b/hwmonio.cpp @@ -68,8 +68,7 @@ int64_t HwmonIO::read( const std::string& id, const std::string& sensor, size_t retries, - std::chrono::milliseconds delay, - bool isOCC) const + std::chrono::milliseconds delay) const { int64_t val; std::ifstream ifs; @@ -114,18 +113,6 @@ int64_t HwmonIO::read( exit(0); } - if (isOCC) - { - 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(), diff --git a/hwmonio.hpp b/hwmonio.hpp index b254b0f..619d6ad 100644 --- a/hwmonio.hpp +++ b/hwmonio.hpp @@ -57,8 +57,7 @@ class HwmonIO const std::string& id, const std::string& sensor, size_t retries, - std::chrono::milliseconds delay, - bool isOCC = false) const; + std::chrono::milliseconds delay) const; /** @brief Perform formatted hwmon sysfs write. * diff --git a/mainloop.cpp b/mainloop.cpp index 11b182e..bfc010e 100644 --- a/mainloop.cpp +++ b/mainloop.cpp @@ -135,8 +135,7 @@ int64_t adjustValue(const SensorSet::key_type& sensor, int64_t value) auto addValue(const SensorSet::key_type& sensor, const RetryIO& retryIO, hwmonio::HwmonIO& ioAccess, - ObjectInfo& info, - bool isOCC = false) + ObjectInfo& info) { static constexpr bool deferSignals = true; @@ -181,8 +180,7 @@ auto addValue(const SensorSet::key_type& sensor, sensor.second, hwmon::entry::cinput, std::get<size_t>(retryIO), - std::get<std::chrono::milliseconds>(retryIO), - isOCC); + std::get<std::chrono::milliseconds>(retryIO)); val = adjustValue(sensor, val); } @@ -307,8 +305,7 @@ optional_ns::optional<ObjectStateData> MainLoop::getObject( { // Add status interface based on _fault file being present sensor::addStatus(sensor.first, ioAccess, _devPath, info); - valueInterface = addValue(sensor.first, retryIO, ioAccess, info, - _isOCC); + valueInterface = addValue(sensor.first, retryIO, ioAccess, info); } catch (const std::system_error& e) { @@ -397,11 +394,6 @@ MainLoop::MainLoop( state(), ioAccess(path) { - if (path.find("occ") != std::string::npos) - { - _isOCC = true; - } - // Strip off any trailing slashes. std::string p = path; while (!p.empty() && p.back() == '/') @@ -554,8 +546,7 @@ void MainLoop::read() i.first.second, input, hwmonio::retries, - hwmonio::delay, - _isOCC); + hwmonio::delay); value = adjustValue(i.first, value); diff --git a/mainloop.hpp b/mainloop.hpp index 3fbc059..fec576d 100644 --- a/mainloop.hpp +++ b/mainloop.hpp @@ -94,8 +94,6 @@ class MainLoop const char* _prefix; /** @brief DBus sensors namespace root. */ const char* _root; - /** @brief hwmon instance is for an OCC. */ - bool _isOCC = false; /** @brief DBus object state. */ SensorState state; /** @brief Sleep interval in microseconds. */ |