usb-dbg: Support sensor out of threshold message present
Description:
- Modified sensors config for greatlakes platform those currently supported.
- Support OCP debug card sensor frame threshold message shown when sensor value is out of threshold.
e.g “P0_temp XXC/UCR”
- Support OCP debug card screen blink and invert the color if the sensor out of threshold.
Test Case:
Sensor threshold message should be shown on debug card when the sensor value is out of threshold.
Signed-off-by: Delphine CC Chiu <Delphine_CC_Chiu@wiwynn.com>
Change-Id: I894b50bee33ad84abc07c5aa086fe1b798b7079b
diff --git a/src/usb-dbg.cpp b/src/usb-dbg.cpp
index a97a998..751d78d 100644
--- a/src/usb-dbg.cpp
+++ b/src/usb-dbg.cpp
@@ -40,6 +40,7 @@
{
int getSensorValue(std::string&, double&);
int getSensorUnit(std::string&, std::string&);
+int getSensorThreshold(std::string&, std::string&);
} // namespace storage
void getMaxHostPosition(size_t& maxPosition)
@@ -756,7 +757,28 @@
if (ipmi::storage::getSensorUnit(senName, unitStr) == 0)
senStr += unitStr;
- frame_snr.append(senStr.c_str(), 0);
+ std::string thresholdStr;
+ int ret =
+ ipmi::storage::getSensorThreshold(senName, thresholdStr);
+ if (ret < 0)
+ {
+ phosphor::logging::log<phosphor::logging::level::ERR>(
+ "Error getting critical sensor threshold status",
+ phosphor::logging::entry("CRI_SENSOR_NAME=%s",
+ senName.c_str()));
+ return -1;
+ }
+ if (thresholdStr.size() != 0)
+ {
+ senStr += ("/" + thresholdStr);
+ std::string senStrWithBlinkAndInvertColor =
+ ESC_ALT + senStr + ESC_RST;
+ frame_snr.append(senStrWithBlinkAndInvertColor.c_str(), 0);
+ }
+ else
+ {
+ frame_snr.append(senStr.c_str(), 0);
+ }
}
else
{