From 6ecfc32dfe905c35a59e2e0dc79538dfd67bfae2 Mon Sep 17 00:00:00 2001
From: Stefan Schmidt <stefan.schmidt@huawei.com>
Date: Wed, 22 Mar 2023 21:43:41 +0100
Subject: [PATCH] openharmony-standard: enable peripherals wlan

The HDF peripherals drivers for wlan had been patched out
before. Enable them again in the build and package the
needed files.

They do not end up being installed in the normal libdir so
we pick them from the build dir instead.

Signed-off-by: Stefan Schmidt <stefan.schmidt@huawei.com>
---
 ...ers-list-to-supported-by-the-qemuarm.patch | 10 +++++++++-
 .../openharmony/openharmony-standard_3.0.bb   | 19 +++++++++++++++++++
 2 files changed, 28 insertions(+), 1 deletion(-)

diff --git a/recipes-openharmony/openharmony/openharmony-standard-3.0/peripherals-Limit-drivers-list-to-supported-by-the-qemuarm.patch b/recipes-openharmony/openharmony/openharmony-standard-3.0/peripherals-Limit-drivers-list-to-supported-by-the-qemuarm.patch
index 056b3530..29a9f3ca 100644
--- a/recipes-openharmony/openharmony/openharmony-standard-3.0/peripherals-Limit-drivers-list-to-supported-by-the-qemuarm.patch
+++ b/recipes-openharmony/openharmony/openharmony-standard-3.0/peripherals-Limit-drivers-list-to-supported-by-the-qemuarm.patch
@@ -11,7 +11,7 @@ diff --git a/uhdf2/ohos.build b/uhdf2/ohos.build
 index f56e333..38db541 100644
 --- a/uhdf2/ohos.build
 +++ b/uhdf2/ohos.build
-@@ -6,43 +6,17 @@
+@@ -6,43 +6,25 @@
          "//drivers/adapter/uhdf2/osal:libhdf_utils",
          "//drivers/adapter/uhdf2/ipc:libhdf_ipc_adapter",
          "//drivers/adapter/uhdf2/hdi:libhdi",
@@ -61,6 +61,14 @@ index f56e333..38db541 100644
 +      "module_list": [
 +        "//drivers/peripheral/display/hal:hdi_display",
 +        "//device/hihope/hardware/display:display_gralloc"
++      ]
++    },
++    "wlan_device_driver": {
++      "module_list": [
++        "//drivers/peripheral/wlan/client:wifi_driver_client",
++        "//drivers/peripheral/wlan/hal:wifi_hal",
++        "//drivers/peripheral/wlan/hdi_service:wifi_hdi_device",
++        "//drivers/peripheral/wlan/hdi_service:wifi_hdi_c_device"
        ]
      }
    }
diff --git a/recipes-openharmony/openharmony/openharmony-standard_3.0.bb b/recipes-openharmony/openharmony/openharmony-standard_3.0.bb
index 129d7711..3f086fd3 100644
--- a/recipes-openharmony/openharmony/openharmony-standard_3.0.bb
+++ b/recipes-openharmony/openharmony/openharmony-standard_3.0.bb
@@ -376,6 +376,7 @@ OPENHARMONY_PARTS += "global:resmgr_standard"
 OPENHARMONY_PARTS += "graphic:graphic_standard"
 OPENHARMONY_PARTS += "hdf:hdf"
 OPENHARMONY_PARTS += "hdf:display_device_driver"
+OPENHARMONY_PARTS += "hdf:wlan_device_driver"
 OPENHARMONY_PARTS += "hiviewdfx:faultloggerd"
 OPENHARMONY_PARTS += "hiviewdfx:hilog"
 OPENHARMONY_PARTS += "hiviewdfx:hilog_native"
@@ -1187,6 +1188,24 @@ RDEPENDS:${PN}-peripheral-input += "musl libcxx"
 RDEPENDS:${PN}-peripheral-input += "${PN}-hilog ${PN}-libutils ${PN}-uhdf2"
 RDEPENDS:${PN} += "${PN}-peripheral-input"
 
+# //drivers/peripheral/wlan
+PACKAGES =+ "${PN}-peripheral-wlan"
+do_install:append() {
+    install -m 644 ${B}/hdf/hdf/libwifi_driver_client.z.so ${D}${libdir}/
+    install -m 644 ${B}/hdf/hdf/libwifi_hal.z.so ${D}${libdir}/
+    install -m 644 ${B}/hdf/hdf/libwifi_hdi_c_device.z.so ${D}${libdir}/
+    install -m 644 ${B}/hdf/hdf/libwifi_hdi_device.z.so ${D}${libdir}/
+}
+FILES:${PN}-peripheral-wlan = " \
+    ${libdir}/libwifi_driver_client*${SOLIBS} \
+    ${libdir}/libwifi_hal*${SOLIBS} \
+    ${libdir}/libwifi_hdi_c_device*${SOLIBS} \
+    ${libdir}/libwifi_hdi_device*${SOLIBS} \
+"
+RDEPENDS:${PN}-peripheral-wlan += "musl libcxx"
+RDEPENDS:${PN}-peripheral-wlan += "${PN}-hilog ${PN}-libutils ${PN}-uhdf2 ${PN}-ipc"
+RDEPENDS:${PN} += "${PN}-peripheral-wlan"
+
 # //base/miscservices/time
 PACKAGES =+ "${PN}-timeservice"
 SYSTEMD_PACKAGES += "${PN}-timeservice"
-- 
GitLab