[[rdkb]ccsp-cm-agent build error]

[Description]
Fix ccsp-cm-agent build error.

[Release-log]

Change-Id: I145e16d102e94702959a56ded5e2ab2b548c93e0
diff --git a/recipes-ccsp/ccsp/ccsp-cm-agent.bbappend b/recipes-ccsp/ccsp/ccsp-cm-agent.bbappend
index 251f867..8fdaa64 100644
--- a/recipes-ccsp/ccsp/ccsp-cm-agent.bbappend
+++ b/recipes-ccsp/ccsp/ccsp-cm-agent.bbappend
@@ -1,10 +1,25 @@
 require ccsp_common_filogic.inc
+FILESEXTRAPATHS_append := "${THISDIR}/files:"
 
 DEPENDS_append_dunfell = " safec"
 LDFLAGS_append_dunfell = " -lsafec-3.5.1"
 
 EXTRA_OECONF_remove = " ${@bb.utils.contains('DISTRO_FEATURES', 'rdkb_wan_manager', '--enable-wanmgr', '', d)}"
 
+SRC_URI_append += " \
+    file://Fix-ccsp-cm-agent-build-error.patch;apply=no \
+"
+
+do_filogic_patches() {
+    cd ${S}
+
+    if ${@bb.utils.contains( 'DISTRO_FEATURES', '2022q3_support', 'true', 'false', d)}; then
+        patch -p1 < ${WORKDIR}/Fix-ccsp-cm-agent-build-error.patch
+        touch filogic_patch_applied
+    fi
+}
+addtask filogic_patches after do_unpack before do_configure
+
 do_install_append() {
     # Config files and scripts
     install -m 644 ${S}/config-arm/CcspCMDM.cfg ${D}${prefix}/ccsp/cm/CcspCMDM.cfg
diff --git a/recipes-ccsp/ccsp/files/Fix-ccsp-cm-agent-build-error.patch b/recipes-ccsp/ccsp/files/Fix-ccsp-cm-agent-build-error.patch
new file mode 100644
index 0000000..b512a78
--- /dev/null
+++ b/recipes-ccsp/ccsp/files/Fix-ccsp-cm-agent-build-error.patch
@@ -0,0 +1,37 @@
+From 691fcd84fb980f918eaf012fef83022f1c4a4fbc Mon Sep 17 00:00:00 2001
+From: Fang Zhao <fang.zhao@mediatek.com>
+Date: Fri, 23 Feb 2024 11:50:39 +0800
+Subject: [PATCH] fix ccsp cm agent build fail issue.
+
+Signed-off-by: Fang Zhao <fang.zhao@mediatek.com>
+---
+ source/TR-181/middle_layer_src/cosa_rbus_handler_apis.c | 6 ++++--
+ 1 file changed, 4 insertions(+), 2 deletions(-)
+
+diff --git a/source/TR-181/middle_layer_src/cosa_rbus_handler_apis.c b/source/TR-181/middle_layer_src/cosa_rbus_handler_apis.c
+index 208bc7d..1b4f43c 100644
+--- a/source/TR-181/middle_layer_src/cosa_rbus_handler_apis.c
++++ b/source/TR-181/middle_layer_src/cosa_rbus_handler_apis.c
+@@ -62,7 +62,7 @@ rbusDataElement_t cmAgentRbusDataElements[] = {
+ 
+ 	{DOCSIS_LINK_STATUS_TR181, RBUS_ELEMENT_TYPE_EVENT, {getBoolHandler, NULL, NULL, NULL, eventSubHandler, NULL}},
+ 	{DOCSIS_LINKDOWN_TR181, RBUS_ELEMENT_TYPE_EVENT, {getBoolHandler, SetBoolHandler, NULL, NULL, NULL, NULL}},
+-	{DOCSIS_LINKDOWNTIMEOUT_TR181, RBUS_ELEMENT_TYPE_EVENT, {getuintHandler, SetUintHandler, NULL, NULL, NULL, NULL}}
++	{DOCSIS_LINKDOWNTIMEOUT_TR181, RBUS_ELEMENT_TYPE_EVENT, {getuintHandler, SetUintHandler, NULL, NULL, NULL, NULL}},
+ 	{CABLE_MODEM_RF_SIGNAL_STATUS, RBUS_ELEMENT_TYPE_EVENT, {getBoolHandler, NULL, NULL, NULL, eventSubHandler, NULL}},
+ 
+ 
+@@ -506,7 +506,9 @@ BOOL SetDocsisLinkdowSignalfunc(fpDocsisLinkdownSignal CreateThreadandSendCondSi
+ 	cmAgent_Link_Status.pDocsisLinkdowSignal=CreateThreadandSendCondSignalToPthreadfunc;
+ 	return TRUE;
+ }
+-  publishCableModemRfSignalStatus(): publish CableModemRfSignalStatus event after event value gets updated
++/*******************************************************************************
++
++publishCableModemRfSignalStatus(): publish CableModemRfSignalStatus event after event value gets updated
+ 
+  ********************************************************************************/
+ void publishCableModemRfSignalStatus() {
+-- 
+2.18.0
+