callback-manager: match thersholdAsserted signal for updateLedStatus
Issue: For ADC sensors, LED state did not change after de-assert.
Fix: Added a match for thresholdAsserted signal to capture the de-assert
event for powerDelayed threshold sensors and update the LED state
accordingly.
Tested:
ipmitool sdr elist | grep P3VBAT
P3VBAT | 47h | ok | 0.1 | 3.14 Volts
Initial state:
ipmitool raw 0x4 0x27 0x47
1b 7b 6b 00 a4 a6 00
Initial LED state:
ipmitool raw 0x30 0xb0
20 --> Solid Green
Assert events:
1. Change the Lower Non-Critical threshold
ipmitool raw 0x04 0x26 0x47 0x1b 0xa1 0x6b 0x00 0xa4 0xa6 0x00
ipmitool raw 0x4 0x27 0x47
1b a1 6b 00 a4 a6 00
ipmitool raw 0x30 0xb0
10 --> Blinking Green.
2. Change the Lower critical threshold
ipmitool raw 0x04 0x26 0x47 0x1b 0xa1 0xa1 0x00 0xa4 0xa6 0x00
ipmitool raw 0x4 0x27 0x47
1b a1 a1 00 a4 a6 00
ipmitool raw 0x30 0xb0
04 --> Blinking Amber
De-assert events:
1. Restore Lower critical threshold.
ipmitool raw 0x04 0x26 0x47 0x1b 0xa1 0x6b 0x00 0xa4 0xa6 0x00
ipmitool raw 0x4 0x27 0x47
1b a1 6b 00 a4 a6 00
ipmitool raw 0x30 0xb0
10 --> Blinking Green
2. Restore Lower Non-Critical Threshold.
ipmitool raw 0x04 0x26 0x47 0x1b 0x7b 0x6b 0x00 0xa4 0xa6 0x00
ipmitool raw 0x4 0x27 0x47
1b 7b 6b 00 a4 a6 00
ipmitool raw 0x30 0xb0
20 --> Solid Green
ipmitool sel list
1 | Pre-Init |0000006680| Voltage #0x47 | Lower Non-critical going
low | Asserted
2 | Pre-Init |0000006944| Voltage #0x47 | Lower Critical going low
| Asserted
3 | Pre-Init |0000007218| Voltage #0x47 | Lower Critical going low
| Deasserted
4 | Pre-Init |0000007345| Voltage #0x47 | Lower Non-critical going
low | Deasserted
Signed-off-by: Chalapathi Venkataramashetty <chalapathix.venkataramashetty@intel.com>
Change-Id: I505871913bbbcfc7ba174d9243c736561818ee0f
diff --git a/callback-manager/src/callback_manager.cpp b/callback-manager/src/callback_manager.cpp
index fbac190..aff8996 100644
--- a/callback-manager/src/callback_manager.cpp
+++ b/callback-manager/src/callback_manager.cpp
@@ -211,17 +211,18 @@
static sdbusplus::bus::match::match match(
static_cast<sdbusplus::bus::bus&>(*conn),
- "type='signal',interface='org.freedesktop.DBus.Properties',"
- "path_"
- "namespace='/xyz/openbmc_project/"
- "sensors',arg0namespace='xyz.openbmc_project.Sensor.Threshold'",
+ "type='signal',member='ThresholdAsserted'",
[&conn](sdbusplus::message::message& message) {
- std::string objectName;
- boost::container::flat_map<std::string, std::variant<bool>> values;
+ std::string sensorName;
+ std::string thresholdInterface;
+ std::string event;
+ bool assert;
+ double assertValue;
try
{
- message.read(objectName, values);
+ message.read(sensorName, thresholdInterface, event, assert,
+ assertValue);
}
catch (sdbusplus::exception_t&)
{
@@ -229,35 +230,26 @@
}
if constexpr (debug)
{
- std::cerr << "Threshold callback " << message.get_path()
+ std::cerr << "Threshold callback: SensorName = " << sensorName
+ << ", Event = " << event << ", Asserted = " << assert
<< "\n";
}
- auto findCriticalLow = values.find("CriticalAlarmLow");
- auto findCriticalHigh = values.find("CriticalAlarmHigh");
-
- auto findWarnLow = values.find("WarningAlarmLow");
- auto findWarnHigh = values.find("WarningAlarmHigh");
-
- if (findCriticalLow != values.end())
+ if (event == "CriticalAlarmLow")
{
- criticalAssertMap[message.get_path()]["Low"] =
- std::get<bool>(findCriticalLow->second);
+ criticalAssertMap[message.get_path()]["low"] = assert;
}
- if (findCriticalHigh != values.end())
+ else if (event == "CriticAlalarmHigh")
{
- criticalAssertMap[message.get_path()]["High"] =
- std::get<bool>(findCriticalHigh->second);
+ criticalAssertMap[message.get_path()]["high"] = assert;
}
- if (findWarnLow != values.end())
+ else if (event == "WarningAlarmLow")
{
- warningAssertMap[message.get_path()]["Low"] =
- std::get<bool>(findWarnLow->second);
+ warningAssertMap[message.get_path()]["low"] = assert;
}
- if (findWarnHigh != values.end())
+ else if (event == "WarningAlarmHigh")
{
- warningAssertMap[message.get_path()]["High"] =
- std::get<bool>(findWarnHigh->second);
+ warningAssertMap[message.get_path()]["high"] = assert;
}
associationManager->setSensorAssociations(