Merge "[Fix and force linux-libc-headers to v5.4]"
diff --git a/recipes-ccsp/hal/hal-wifi-patches/0022-HAL-add-wifi_getApAssociatedDevice.patch b/recipes-ccsp/hal/hal-wifi-patches/0022-HAL-add-wifi_getApAssociatedDevice.patch
new file mode 100644
index 0000000..cc307c4
--- /dev/null
+++ b/recipes-ccsp/hal/hal-wifi-patches/0022-HAL-add-wifi_getApAssociatedDevice.patch
@@ -0,0 +1,29 @@
+From db41fa4fb08c4d6e7f7d89f3283b875a89408763 Mon Sep 17 00:00:00 2001
+From: Allen Ye <allen.ye@mediatek.com>
+Date: Tue, 12 Apr 2022 10:36:58 +0800
+Subject: [PATCH] HAL: add wifi_getApAssociatedDevice()
+
+---
+ source/wifi/wifi_hal.c | 6 +++++-
+ 1 file changed, 5 insertions(+), 1 deletion(-)
+
+diff --git a/source/wifi/wifi_hal.c b/source/wifi/wifi_hal.c
+index f6c2aa2..19a6281 100644
+--- a/source/wifi/wifi_hal.c
++++ b/source/wifi/wifi_hal.c
+@@ -9607,7 +9607,11 @@ INT wifi_getApAssociatedDevice(INT ap_index, mac_address_t *output_deviceMacAddr
+ #else
+ INT wifi_getApAssociatedDevice(INT ap_index, CHAR *output_buf, INT output_buf_size)
+ {
+- return RETURN_OK;
++ char cmd[128];
++
++ sprintf(cmd, "hostapd_cli -i %s%d list_sta | tr -d \"\\n\"", AP_PREFIX, ap_index);
++ _syscmd(cmd, output_buf, output_buf_size);
++ return RETURN_OK;
+ }
+ #endif
+
+--
+2.18.0
+
diff --git a/recipes-ccsp/hal/hal-wifi-patches/0023-HAL-refactor-wifi_setRadioGuardInterval-and-wifi_get.patch b/recipes-ccsp/hal/hal-wifi-patches/0023-HAL-refactor-wifi_setRadioGuardInterval-and-wifi_get.patch
new file mode 100644
index 0000000..c772b95
--- /dev/null
+++ b/recipes-ccsp/hal/hal-wifi-patches/0023-HAL-refactor-wifi_setRadioGuardInterval-and-wifi_get.patch
@@ -0,0 +1,35 @@
+From f0445f4769576791d5085f3db54411afacd5f755 Mon Sep 17 00:00:00 2001
+From: "howard.hsu" <howard-yh.hsu@mediatek.com>
+Date: Wed, 13 Apr 2022 19:43:53 +0800
+Subject: [PATCH] HAL: refactor wifi_setRadioGuardInterval() and
+ wifi_getRadioGuardInterval()
+
+---
+ source/wifi/wifi_hal.c | 4 ++--
+ 1 file changed, 2 insertions(+), 2 deletions(-)
+
+diff --git a/source/wifi/wifi_hal.c b/source/wifi/wifi_hal.c
+index f4ee248..e5b551f 100644
+--- a/source/wifi/wifi_hal.c
++++ b/source/wifi/wifi_hal.c
+@@ -2169,7 +2169,7 @@ INT wifi_getRadioGuardInterval(INT radioIndex, CHAR *output_string) //Tr181
+ //save config and apply instantly
+ if (NULL == output_string)
+ return RETURN_ERR;
+- snprintf(output_string, 64, (radioIndex == 0) ? "400nsec" : "400nsec");
++ snprintf(output_string, 64, "Auto");
+
+ return RETURN_OK;
+ }
+@@ -2178,7 +2178,7 @@ INT wifi_getRadioGuardInterval(INT radioIndex, CHAR *output_string) //Tr181
+ INT wifi_setRadioGuardInterval(INT radioIndex, CHAR *string) //Tr181
+ {
+ //Apply setting instantly
+- return RETURN_ERR;
++ return RETURN_OK;
+ }
+
+ //Get the Modulation Coding Scheme index, eg: "-1", "1", "15"
+--
+2.18.0
+
diff --git a/recipes-ccsp/hal/hal-wifi-patches/0024-HAL-refactor-wifi_factoryResetRadio.patch b/recipes-ccsp/hal/hal-wifi-patches/0024-HAL-refactor-wifi_factoryResetRadio.patch
new file mode 100644
index 0000000..953123b
--- /dev/null
+++ b/recipes-ccsp/hal/hal-wifi-patches/0024-HAL-refactor-wifi_factoryResetRadio.patch
@@ -0,0 +1,37 @@
+From fe9452e2d7c27c7ae680b32a4db9f92f90d4ca4b Mon Sep 17 00:00:00 2001
+From: Allen Ye <allen.ye@mediatek.com>
+Date: Thu, 14 Apr 2022 19:10:15 +0800
+Subject: [PATCH] HAL: refactor wifi_factoryResetRadio()
+
+---
+ source/wifi/wifi_hal.c | 8 +++++---
+ 1 file changed, 5 insertions(+), 3 deletions(-)
+
+diff --git a/source/wifi/wifi_hal.c b/source/wifi/wifi_hal.c
+index bfa7b01..8b302d5 100644
+--- a/source/wifi/wifi_hal.c
++++ b/source/wifi/wifi_hal.c
+@@ -726,15 +726,17 @@ INT wifi_factoryResetRadios()
+ */
+ INT wifi_factoryResetRadio(int radioIndex) //RDKB
+ {
++ system("systemctl stop hostapd.service");
++
+ WIFI_ENTRY_EXIT_DEBUG("Inside %s:%d\n",__func__, __LINE__);
+ if(radioIndex == 0)
+- system("cp /etc/hostapd-2G.conf /nvram/hostapd0.conf");
++ system("rm /nvram/hostapd0.conf");
+ else if(radioIndex == 1)
+- system("cp /etc/hostapd-5G.conf /nvram/hostapd1.conf");
++ system("rm /nvram/hostapd1.conf");
+ else
+ return RETURN_ERR;
+
+- system("systemctl restart hostapd.service");
++ system("systemctl start hostapd.service");
+ WIFI_ENTRY_EXIT_DEBUG("Exiting %s:%d\n",__func__, __LINE__);
+ return RETURN_OK;
+ }
+--
+2.18.0
+