93 lines
3.0 KiB
Diff
93 lines
3.0 KiB
Diff
|
|
From 5efe2a34889b828a19c84818be3a551516513907 Mon Sep 17 00:00:00 2001
|
||
|
|
From: wangjue <jue.wang2@luxshare-ict.com>
|
||
|
|
Date: Fri, 24 Jan 2025 17:27:19 +0800
|
||
|
|
Subject: [PATCH] Set DIMM LED to NA when dc on and OFF when dc off
|
||
|
|
|
||
|
|
Signed-off-by: wangjue <jue.wang2@luxshare-ict.com>
|
||
|
|
---
|
||
|
|
src/DIMMTempSensor.cpp | 26 ++++++++++++++------------
|
||
|
|
1 file changed, 14 insertions(+), 12 deletions(-)
|
||
|
|
|
||
|
|
diff --git a/src/DIMMTempSensor.cpp b/src/DIMMTempSensor.cpp
|
||
|
|
index d2c2f65..dca398e 100644
|
||
|
|
--- a/src/DIMMTempSensor.cpp
|
||
|
|
+++ b/src/DIMMTempSensor.cpp
|
||
|
|
@@ -84,7 +84,7 @@ static void setupDimmLEDMatch(
|
||
|
|
std::move(eventHandler));
|
||
|
|
}
|
||
|
|
|
||
|
|
-static bool getDbusMsgState(sdbusplus::message_t& msg, bool& value)
|
||
|
|
+static bool getDbusMsgState(sdbusplus::message_t& msg, bool& value, std::string& propertyName)
|
||
|
|
{
|
||
|
|
std::string pltStateInterface;
|
||
|
|
std::string event;
|
||
|
|
@@ -99,13 +99,13 @@ static bool getDbusMsgState(sdbusplus::message_t& msg, bool& value)
|
||
|
|
}
|
||
|
|
|
||
|
|
std::string property = propertiesChanged.begin()->first;
|
||
|
|
-
|
||
|
|
- if (property.empty() || property != "dimmI3cSwitch")
|
||
|
|
+ if (property.empty() || (property != "dimmI3cSwitch" && property != "ESpiPlatformReset"))
|
||
|
|
{
|
||
|
|
return false;
|
||
|
|
}
|
||
|
|
|
||
|
|
value = std::get<bool>(propertiesChanged.begin()->second);
|
||
|
|
+ propertyName = property;
|
||
|
|
return true;
|
||
|
|
}
|
||
|
|
catch (const std::exception& e)
|
||
|
|
@@ -117,16 +117,17 @@ static bool getDbusMsgState(sdbusplus::message_t& msg, bool& value)
|
||
|
|
|
||
|
|
static void dimmI3cSwitchMatcher(
|
||
|
|
std::vector<sdbusplus::bus::match_t>& matches, sdbusplus::bus_t& connection,
|
||
|
|
- std::function<void(bool)>&& onMatch)
|
||
|
|
+ std::function<void(std::string, bool)>&& onMatch)
|
||
|
|
{
|
||
|
|
auto pulseEventMatcherCallback =
|
||
|
|
[onMatch{std::move(onMatch)}](sdbusplus::message_t& msg) {
|
||
|
|
bool value = false;
|
||
|
|
- if (!getDbusMsgState(msg, value))
|
||
|
|
+ std::string propertyName = "";
|
||
|
|
+ if (!getDbusMsgState(msg, value, propertyName))
|
||
|
|
{
|
||
|
|
return;
|
||
|
|
}
|
||
|
|
- onMatch(value);
|
||
|
|
+ onMatch(propertyName, value);
|
||
|
|
};
|
||
|
|
|
||
|
|
matches.emplace_back(
|
||
|
|
@@ -343,21 +344,22 @@ void DIMMTempSensor::setupMatches(const std::string& sensorName)
|
||
|
|
}
|
||
|
|
);
|
||
|
|
|
||
|
|
- dimmI3cSwitchMatcher(matches, *dbusConnection, [sharedRef](bool state)
|
||
|
|
+ dimmI3cSwitchMatcher(matches, *dbusConnection, [sharedRef](std::string propertyName, bool state)
|
||
|
|
{
|
||
|
|
if (!sharedRef)
|
||
|
|
{
|
||
|
|
return;
|
||
|
|
}
|
||
|
|
- if (!state)
|
||
|
|
+
|
||
|
|
+ if (propertyName == "dimmI3cSwitch")
|
||
|
|
{
|
||
|
|
- sharedRef->dimmI3cSwitchState = false;
|
||
|
|
+ sharedRef->dimmI3cSwitchState = state;
|
||
|
|
}
|
||
|
|
- else
|
||
|
|
+ else if (propertyName == "ESpiPlatformReset")
|
||
|
|
{
|
||
|
|
- sharedRef->dimmI3cSwitchState = true;
|
||
|
|
+ std::string dimmLEDState = state ? "NA" : "OFF";
|
||
|
|
+ sharedRef->dimmLEDInterface->set_property("LEDState", dimmLEDState);
|
||
|
|
}
|
||
|
|
- std::cout << "dimmI3cSwitchState: " << (int)sharedRef->dimmI3cSwitchState << std::endl;
|
||
|
|
});
|
||
|
|
}
|
||
|
|
|
||
|
|
--
|
||
|
|
2.34.1
|
||
|
|
|