Fix for CpuSensor warning observed after bmc reset
In case of peci cdev open failed we are now exiting CpuSensor service
with error code. Since this is unexpected behaviour we will now retry
the detectCpu function.
Tested: No warning observed on platform.
Change-Id: Icdf71b674cbdfcc70ca3bfae6d7863a04783d4ca
Signed-off-by: Jakub Nowacki <jakubx.nowacki@intel.com>
diff --git a/src/IntelCPUSensorMain.cpp b/src/IntelCPUSensorMain.cpp
index d1c5a0e..665daa8 100644
--- a/src/IntelCPUSensorMain.cpp
+++ b/src/IntelCPUSensorMain.cpp
@@ -28,6 +28,7 @@
#include <sdbusplus/bus/match.hpp>
#include <array>
+#include <cerrno>
#include <filesystem>
#include <fstream>
#include <functional>
@@ -464,8 +465,11 @@
auto file = open(peciDevPath.c_str(), O_RDWR | O_CLOEXEC);
if (file < 0)
{
- std::cerr << "unable to open " << peciDevPath << "\n";
- std::exit(EXIT_FAILURE);
+ std::cerr << "unable to open " << peciDevPath << " "
+ << std::strerror(errno) << "\n";
+ detectCpuAsync(pingTimer, creationTimer, io, objectServer,
+ dbusConnection, cpuConfigs, sensorConfigs);
+ return;
}
State newState = State::OFF;