Skipping over Association Definitions messages
See upstream for commentary. This is a local patch which should
disappear when the corresponding upstream patch is merged.
Patch Tracking Bug: b/267556082
Upstream info / review: https://gerrit.openbmc.org/c/openbmc/phosphor-pid-control/+/60580
Upstream-Status: Submitted
Justification: Awaiting upstream review and merging
Change-Id: Ia31c420c8679b9f178b83033dce8008a974a2d8e
Signed-off-by: Josh Lehan <krellan@google.com>
diff --git a/recipes-phosphor/fans/phosphor-pid-control/0001-Skipping-over-Association-Definitions-messages.patch b/recipes-phosphor/fans/phosphor-pid-control/0001-Skipping-over-Association-Definitions-messages.patch
new file mode 100644
index 0000000..d62f7a8
--- /dev/null
+++ b/recipes-phosphor/fans/phosphor-pid-control/0001-Skipping-over-Association-Definitions-messages.patch
@@ -0,0 +1,69 @@
+From 10e46efabf262d99cd457e97bd8c9ad6f90f834a Mon Sep 17 00:00:00 2001
+From: Josh Lehan <krellan@google.com>
+Date: Wed, 1 Feb 2023 18:25:58 -0800
+Subject: [PATCH] Skipping over Association Definitions messages
+
+Patch Tracking Bug: b/267556082
+Upstream info / review: https://gerrit.openbmc.org/c/openbmc/phosphor-pid-control/+/60580
+Upstream-Status: Submitted
+Justification: Awaiting upstream review and merging
+
+These incoming messages cause problems, for the same reason Assocation
+is skipped over. They are not relevant to PID control, because they
+are maintained by Object Mapper for another purpose. Treating
+Association Definitions similarly to Associations, namely, skipping
+them over. It looks like this was simply omitted in the past, perhaps
+Definitions did not exist then, only Associations.
+Also adding some optional logging.
+
+Thanks to Chu Lin for originally discovering this bug and creating
+this fix.
+
+Tested: It works, and avoids the problem of unwanted messages causing
+swampd to needlessly restart itself internally.
+
+Change-Id: I2f9cb123990d240b515d08138dd919312aac5a30
+Signed-off-by: Josh Lehan <krellan@google.com>
+---
+ dbus/dbusconfiguration.cpp | 18 ++++++++++++++++--
+ 1 file changed, 16 insertions(+), 2 deletions(-)
+
+diff --git a/dbus/dbusconfiguration.cpp b/dbus/dbusconfiguration.cpp
+index 66ef7f8..96d2b4b 100644
+--- a/dbus/dbusconfiguration.cpp
++++ b/dbus/dbusconfiguration.cpp
+@@ -158,8 +158,9 @@ int eventHandler(sd_bus_message* m, void* context, sd_bus_error*)
+ }
+
+ // we skip associations because the mapper populates these, not the sensors
+- const std::array<const char*, 1> skipList = {
+- "xyz.openbmc_project.Association"};
++ const std::array<const char*, 2> skipList = {
++ "xyz.openbmc_project.Association",
++ "xyz.openbmc_project.Association.Definitions"};
+
+ sdbusplus::message_t message(m);
+ if (std::string(message.get_member()) == "InterfacesAdded")
+@@ -184,6 +185,19 @@ int eventHandler(sd_bus_message* m, void* context, sd_bus_error*)
+ }
+ }
+ }
++
++ if constexpr (pid_control::conf::DEBUG)
++ {
++ std::cout << "New config detected: " << path.str << std::endl;
++ for (auto& d : data)
++ {
++ std::cout << "\tdata is " << d.first << std::endl;
++ for (auto& second : d.second)
++ {
++ std::cout << "\t\tdata is " << second.first << std::endl;
++ }
++ }
++ }
+ }
+
+ boost::asio::steady_timer* timer =
+--
+2.39.1.519.gcb327c4b5f-goog
+
diff --git a/recipes-phosphor/fans/phosphor-pid-control_%.bbappend b/recipes-phosphor/fans/phosphor-pid-control_%.bbappend
index f97dfa9..9cc66e5 100644
--- a/recipes-phosphor/fans/phosphor-pid-control_%.bbappend
+++ b/recipes-phosphor/fans/phosphor-pid-control_%.bbappend
@@ -2,4 +2,5 @@
SRC_URI:append:gbmc = " \
file://0001-Implementing-the-TempToMargin-feature.patch \
+ file://0001-Skipping-over-Association-Definitions-messages.patch \
"