Add debug mode
Description:
1. Could enable debug mode by adding file: /etc/thermal.d/debugging.
$ mkdir /etc/thermal.d
$ touch /etc/thermal.d/debugging
$ systemctl restart phosphor-pid-control
2. Could record fans output PWM, chosen temperature, PID/stepwise output PWM in debug mode.
Design:
1. Create debugging file and restart service to enable debug mode.
2. Check if debug mode is enabled to output fans output PWM, chosen temperature,
PID/stepwise output PWM, and so on.
Test Case:
1. Enable debug mode and check logs: pass
Change-Id: I8527ebcb81e723298ba7e786b4501f986ebd439e
Signed-off-by: Bonnie Lo <Bonnie_Lo@wiwynn.com>
diff --git a/pid/fancontroller.cpp b/pid/fancontroller.cpp
index 57902ab..7d4a92d 100644
--- a/pid/fancontroller.cpp
+++ b/pid/fancontroller.cpp
@@ -145,8 +145,24 @@
{
percent = failsafePercent;
}
+
+ if (failsafePrint || debugEnabled)
+ {
+ std::cerr << "Zone " << _owner->getZoneID()
+ << " fans output failsafe pwm: " << percent << "\n";
+ failsafePrint = false;
+ }
#endif
}
+ else
+ {
+ failsafePrint = true;
+ if (debugEnabled)
+ {
+ std::cerr << "Zone " << _owner->getZoneID()
+ << " fans output pwm: " << percent << "\n";
+ }
+ }
}
// value and kFanFailSafeDutyCycle are 10 for 10% so let's fix that.