log debug information for sensor threshold assert events
There are sightings that TCPUx_P12_PVCCIO_VS_Temp Sensor
reports reading of zero and trips the low critical threshold.
Add debug prints to gather data.
Also add logs for raw value in sensor base class to help
debug threshold assert events for other sensori type.
Tested:
Verified that log messages show up as expected for threshold
assert events. There is no unwanted log messages on systems that
do not have bad sensor readings.
Signed-off-by: Zhikui Ren <zhikui.ren@intel.com>
Change-Id: Ib0557e804d275fbb3dce3347b4abec696925cc67
diff --git a/src/HwmonTempSensor.cpp b/src/HwmonTempSensor.cpp
index 649ca68..35dc5f3 100644
--- a/src/HwmonTempSensor.cpp
+++ b/src/HwmonTempSensor.cpp
@@ -106,6 +106,8 @@
if ((err == boost::system::errc::bad_file_descriptor) ||
(err == boost::asio::error::misc_errors::not_found))
{
+ std::cerr << "Hwmon temp sensor " << name << " removed " << path
+ << "\n";
return; // we're being destroyed
}
std::istream responseStream(&readBuf);
@@ -115,8 +117,8 @@
std::getline(responseStream, response);
try
{
- double nvalue = std::stod(response);
- nvalue /= sensorScaleFactor;
+ rawValue = std::stod(response);
+ double nvalue = rawValue / sensorScaleFactor;
updateValue(nvalue);
}
catch (const std::invalid_argument&)
@@ -134,6 +136,8 @@
int fd = open(path.c_str(), O_RDONLY);
if (fd < 0)
{
+ std::cerr << "Hwmon temp sensor " << name << " not valid " << path
+ << "\n";
return; // we're no longer valid
}
inputDev.assign(fd);
@@ -143,6 +147,15 @@
std::shared_ptr<HwmonTempSensor> self = weakRef.lock();
if (ec == boost::asio::error::operation_aborted)
{
+ if (self)
+ {
+ std::cerr << "Hwmon temp sensor " << self->name
+ << " read cancelled " << self->path << "\n";
+ }
+ else
+ {
+ std::cerr << "Hwmon sensor read cancelled, no self\n";
+ }
return; // we're being canceled
}
if (self)