Revert "Reading min and max values from the rated files exposed by hwmon"
This reverts commit 484b9b37530a52f10a606abff23b345a4ec6ab2a.
Reason for revert: <Rated values exposed by hwmon can be inadequate
for MinValue/MaxValue sensor properties. Values read
from power_rated_max hwmon file can be lower than maximal possible
power peak for PSU.>
Change-Id: I7e7537f9a309e8256cabc31f1b9115affb357d9d
Signed-off-by: Agata Wiatrowska <agata.wiatrowska@intel.com>
diff --git a/src/PSUSensor.cpp b/src/PSUSensor.cpp
index dec02ab..d221ecb 100644
--- a/src/PSUSensor.cpp
+++ b/src/PSUSensor.cpp
@@ -50,9 +50,8 @@
std::move(thresholdsIn), sensorConfiguration, objectType, false, max,
min, conn, powerState),
std::enable_shared_from_this<PSUSensor>(), objServer(objectServer),
- inputDev(io), waitTimer(io), path(path), pathRatedMax(""), pathRatedMin(""),
- sensorFactor(factor), minMaxReadCounter(0), sensorOffset(offset),
- thresholdTimer(io)
+ inputDev(io), waitTimer(io), path(path), sensorFactor(factor),
+ sensorOffset(offset), thresholdTimer(io)
{
std::string unitPath = sensor_paths::getPathForUnits(sensorUnits);
if constexpr (debug)
@@ -107,23 +106,6 @@
association = objectServer.add_interface(dbusPath, association::interface);
createInventoryAssoc(conn, association, configurationPath);
-
- if (auto fileParts = splitFileName(path))
- {
- auto& [type, nr, item] = *fileParts;
- if (item.compare("input") == 0)
- {
- pathRatedMax = boost::replace_all_copy(path, item, "rated_max");
- pathRatedMin = boost::replace_all_copy(path, item, "rated_min");
- }
- }
- if constexpr (debug)
- {
- std::cerr << "File: " << pathRatedMax
- << " will be used to update MaxValue\n";
- std::cerr << "File: " << pathRatedMin
- << " will be used to update MinValue\n";
- }
}
PSUSensor::~PSUSensor()
@@ -175,19 +157,6 @@
});
}
-void PSUSensor::updateMinMaxValues(void)
-{
- if (auto newVal = readFile(pathRatedMin, sensorFactor))
- {
- updateProperty(sensorInterface, minValue, *newVal, "MinValue");
- }
-
- if (auto newVal = readFile(pathRatedMax, sensorFactor))
- {
- updateProperty(sensorInterface, maxValue, *newVal, "MaxValue");
- }
-}
-
// Create a buffer expected to be able to hold more characters than will be
// present in the input file.
static constexpr uint32_t psuBufLen = 128;
@@ -211,10 +180,6 @@
{
rawValue = std::stod(buffer);
updateValue((rawValue / sensorFactor) + sensorOffset);
- if (minMaxReadCounter++ % 8 == 0)
- {
- updateMinMaxValues();
- }
}
catch (const std::invalid_argument&)
{