fans: Use attribute() instead of attributes()
It is needed to read only those fanX_input files, that are enabled via
fanX_enable. Reading from fanX_input while it's fanX_enable is disabled
returns an error.
Change-Id: Iaf8d43d11e01fc24a19791bdf86d427ec714e064
diff --git a/src/ietf-hardware/IETFHardware.cpp b/src/ietf-hardware/IETFHardware.cpp
index e138e51..b18a071 100644
--- a/src/ietf-hardware/IETFHardware.cpp
+++ b/src/ietf-hardware/IETFHardware.cpp
@@ -133,13 +133,11 @@
{
DataTree res(m_staticData);
- auto attrs = m_hwmon->attributes();
-
for (unsigned i = 1; i <= m_fanChannelsCount; i++) {
const auto sensorComponentName = m_componentName + ":fan" + std::to_string(i) + ":rpm";
const auto attribute = "fan"s + std::to_string(i) + "_input";
- addSensorValue(res, sensorComponentName, std::to_string(attrs.at(attribute)));
+ addSensorValue(res, sensorComponentName, std::to_string(m_hwmon->attribute(attribute)));
}
return res;