Exclude non-sensor properties from CPU sensor creation
This commit makes CPU sensor service excludes non-sensor properties
while creating dbus sensors. Tcontrol, Tthrottle and Tjmax will be
filtered out.
Change-Id: I57a551bf576d74164a6f7ea4873ac8340c0696c3
Signed-off-by: Jae Hyun Yoo <jae.hyun.yoo@linux.intel.com>
diff --git a/src/CPUSensorMain.cpp b/src/CPUSensorMain.cpp
index 3af20a0..7f437ce 100644
--- a/src/CPUSensorMain.cpp
+++ b/src/CPUSensorMain.cpp
@@ -73,6 +73,8 @@
"xyz.openbmc_project.Configuration.";
static constexpr std::array<const char*, 3> sensorTypes = {
"SkylakeCPU", "BroadwellCPU", "HaswellCPU"};
+static constexpr std::array<const char*, 3> skipProps = {"Tcontrol",
+ "Tthrottle", "Tjmax"};
void detectCpuAsync(
boost::asio::deadline_timer& pingTimer,
@@ -263,6 +265,22 @@
std::string label;
std::getline(labelFile, label);
labelFile.close();
+
+ // skip non-sensor properties
+ bool skipIt = false;
+ for (const char* prop : skipProps)
+ {
+ if (label == prop)
+ {
+ skipIt = true;
+ break;
+ }
+ }
+ if (skipIt)
+ {
+ continue;
+ }
+
std::string sensorName = label + " CPU" + std::to_string(cpuId);
auto findSensor = cpuSensors.find(sensorName);