PSUSensor: improve error logging
PSU sub-events might be asserted by to different alarm flags as returned
by the kernel so when debugging a hardware or driver issue it's
important to know what condition exactly triggered.
Same about errors reading data from PMBUS sensors, for debugging it's
essential to learn precisely what happened.
Example output:
System error 11 (Resource temporarily unavailable) reading from /sys/class/hwmon/hwmon12/temp1_input, line: 199
PSUSubEvent asserted by /sys/class/hwmon/hwmon10/curr3_crit_alarm
PSUSubEvent asserted by /sys/class/hwmon/hwmon12/curr3_crit_alarm
System error 6 (No such device or address) reading from /sys/class/hwmon/hwmon8/curr3_input, line: 199
PSUSubEvent asserted by /sys/class/hwmon/hwmon15/curr3_crit_alarm
Monitoring with strace confirms psusensor happily continues to read from
the file descriptors in question after the glitches.
Signed-off-by: Paul Fertser <fercerpav@gmail.com>
Change-Id: I2f1adac52ad8393d455c3c1a04e7f9bac479f68f
diff --git a/src/PSUEvent.cpp b/src/PSUEvent.cpp
index 3e8c589..8c12c5b 100644
--- a/src/PSUEvent.cpp
+++ b/src/PSUEvent.cpp
@@ -333,6 +333,8 @@
}
else
{
+ std::cerr << "PSUSubEvent asserted by " << path << "\n";
+
if ((*assertState == false) && ((*asserts).empty()))
{
*assertState = true;