Adding support for power sensor and average values in CPU domain.
Current implementation of CPUSensor exposes on dbus only temperature sensors.
This change allows it to expose also power values under a new object
path: /xyz/openbmc_project/sensors/power/
It also introduce support for the average values and their thresholds.
Tested:
After applying this change the same CPU sensors and their thresholds
values are visible on dbus.
Plus additional power sensor appears when available in system.
Signed-off-by: Zbigniew Kurzynski <zbigniew.kurzynski@intel.com>
Change-Id: I0eeadca841ccb279bbd26d16b0b41f66a44f22cd
diff --git a/include/Thresholds.hpp b/include/Thresholds.hpp
index 20ce69e..2205c5e 100644
--- a/include/Thresholds.hpp
+++ b/include/Thresholds.hpp
@@ -100,6 +100,11 @@
Sensor* sensor;
};
+// The common scheme for sysfs files naming is: <type><number>_<item>.
+// This function returns optionally these 3 elements as a tuple.
+std::optional<std::tuple<std::string, std::string, std::string>>
+ splitFileName(const std::filesystem::path& filePath);
+
bool parseThresholdsFromConfig(
const SensorData& sensorData,
std::vector<thresholds::Threshold>& thresholdVector,