From 2bd3c22a7d8b4110c2ab85b6f8041e01b25d37a1 Mon Sep 17 00:00:00 2001 From: likuanxin Date: Sat, 23 Dec 2023 17:45:19 +0800 Subject: [PATCH] =?UTF-8?q?=E9=80=82=E9=85=8Dwpa=E5=AD=97=E7=AC=A6?= =?UTF-8?q?=E4=B8=B2=E4=BF=AE=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: likuanxin --- .../hdi_interface/wifi_hdi_wpa_proxy.c | 4 +++- .../hdi_client/wifi_hdi_wpa_callback.cpp | 22 ++++++++++++++----- .../wifi_hal/etc/init/wifi_hal_service.cfg | 6 ++--- 3 files changed, 22 insertions(+), 10 deletions(-) diff --git a/wifi/services/wifi_standard/wifi_framework/wifi_manage/wifi_native/client/hdi_client/hdi_interface/wifi_hdi_wpa_proxy.c b/wifi/services/wifi_standard/wifi_framework/wifi_manage/wifi_native/client/hdi_client/hdi_interface/wifi_hdi_wpa_proxy.c index 5d82c2e1b..a442f4895 100644 --- a/wifi/services/wifi_standard/wifi_framework/wifi_manage/wifi_native/client/hdi_client/hdi_interface/wifi_hdi_wpa_proxy.c +++ b/wifi/services/wifi_standard/wifi_framework/wifi_manage/wifi_native/client/hdi_client/hdi_interface/wifi_hdi_wpa_proxy.c @@ -218,7 +218,9 @@ WifiErrorNo CopyUserFile(const char *srcFilePath, const char* destFilePath) LOGE("CopyUserFile() failed, read srcFilePath:%{public}s error!", srcFilePath); break; } - write(destFd, buf, bytes); + if (write(destFd, buf, bytes) < 0) { + LOGE("CopyUserFile() failed, write destFilePath:%{public}s error!", destFilePath); + } } } while (0); if (srcFd>=0) { diff --git a/wifi/services/wifi_standard/wifi_framework/wifi_manage/wifi_native/client/hdi_client/wifi_hdi_wpa_callback.cpp b/wifi/services/wifi_standard/wifi_framework/wifi_manage/wifi_native/client/hdi_client/wifi_hdi_wpa_callback.cpp index 58fb14443..c3b29b4a0 100644 --- a/wifi/services/wifi_standard/wifi_framework/wifi_manage/wifi_native/client/hdi_client/wifi_hdi_wpa_callback.cpp +++ b/wifi/services/wifi_standard/wifi_framework/wifi_manage/wifi_native/client/hdi_client/wifi_hdi_wpa_callback.cpp @@ -26,13 +26,13 @@ constexpr int WIFI_HDI_STR_MAC_LENGTH = 17; int32_t OnEventDisconnected(struct IWpaCallback *self, const struct HdiWpaDisconnectParam *disconectParam, const char* ifName) { + LOGI("OnEventDisconnected: callback enter!"); if (disconectParam == NULL) { LOGE("OnEventDisconnected: invalid parameter!"); return 1; } uint32_t bssidLen = disconectParam->bssidLen; - std::string strBssid = OHOS::Wifi::ConvertArrayToHex(disconectParam->bssidLen, - disconectParam->bssidLen); + std::string strBssid = OHOS::Wifi::ConvertArrayToHex(disconectParam->bssid, bssidLen); char szBssid[WIFI_HDI_STR_MAC_LENGTH +1] = {0}; ConvertMacToStr(disconectParam->bssid, bssidLen, szBssid, sizeof(szBssid)); const OHOS::Wifi::WifiEventCallback &cbk = OHOS::Wifi::WifiStaHalInterface::GetInstance().GetCallbackInst(); @@ -45,13 +45,13 @@ int32_t OnEventDisconnected(struct IWpaCallback *self, int32_t OnEventConnected(struct IWpaCallback *self, const struct HdiWpaConnectParam *connectParam, const char* ifName) { + LOGI("OnEventConnected: callback enter!"); if (connectParam == NULL) { LOGE("OnEventConnected: invalid parameter!"); return 1; } uint32_t bssidLen = connectParam->bssidLen; - std::string strBssid = OHOS::Wifi::ConvertArrayToHex(connectParam->bssidLen, - connectParam->bssidLen); + std::string strBssid = OHOS::Wifi::ConvertArrayToHex(connectParam->bssid, bssidLen); char szBssid[WIFI_HDI_STR_MAC_LENGTH +1] = {0}; ConvertMacToStr(connectParam->bssid, bssidLen, szBssid, sizeof(szBssid)); const OHOS::Wifi::WifiEventCallback &cbk = OHOS::Wifi::WifiStaHalInterface::GetInstance().GetCallbackInst(); @@ -64,14 +64,18 @@ int32_t OnEventConnected(struct IWpaCallback *self, int32_t OnEventBssidChanged(struct IWpaCallback *self, const struct HdiWpaBssidChangedParam *bssidChangedParam, const char* ifName) { + LOGI("OnEventBssidChanged: callback enter!"); if (bssidChangedParam == NULL) { LOGE("OnEventBssidChanged: invalid parameter!"); return 1; } - + uint32_t bssidLen = bssidChangedParam->bssidLen; + std::string strBssid = OHOS::Wifi::ConvertArrayToHex(bssidChangedParam->bssid, bssidLen); + char szBssid[WIFI_HDI_STR_MAC_LENGTH +1] = {0}; + ConvertMacToStr(disconectParam->bssid, bssidLen, szBssid, sizeof(szBssid)); const OHOS::Wifi::WifiEventCallback &cbk = OHOS::Wifi::WifiStaHalInterface::GetInstance().GetCallbackInst(); if (cbk.onBssidChanged) { - cbk.onBssidChanged((const char *)bssidChangedParam->reason, (const char *)bssidChangedParam->bssid); + cbk.onBssidChanged((const char *)bssidChangedParam->reason, szBssid); } return 0; } @@ -79,6 +83,7 @@ int32_t OnEventBssidChanged(struct IWpaCallback *self, int32_t OnEventStateChanged(struct IWpaCallback *self, const struct HdiWpaStateChangedParam *statechangedParam, const char* ifName) { + LOGI("OnEventStateChanged: callback enter!"); if (statechangedParam == NULL) { LOGE("OnEventStateChanged: invalid parameter!"); return 1; @@ -94,6 +99,7 @@ int32_t OnEventStateChanged(struct IWpaCallback *self, int32_t OnEventTempDisabled(struct IWpaCallback *self, const struct HdiWpaTempDisabledParam *tempDisabledParam, const char *ifName) { + LOGI("OnEventTempDisabled: callback enter!"); const OHOS::Wifi::WifiEventCallback &cbk = OHOS::Wifi::WifiStaHalInterface::GetInstance().GetCallbackInst(); if (cbk.onWpaSsidWrongKey) { cbk.onWpaSsidWrongKey(1); @@ -104,6 +110,7 @@ int32_t OnEventTempDisabled(struct IWpaCallback *self, int32_t OnEventAssociateReject(struct IWpaCallback *self, const struct HdiWpaAssociateRejectParam *associateRejectParam, const char *ifName) { + LOGI("OnEventAssociateReject: callback enter!"); if (associateRejectParam == NULL) { LOGE("OnEventAssociateReject: invalid parameter!"); return 1; @@ -118,6 +125,7 @@ int32_t OnEventAssociateReject(struct IWpaCallback *self, int32_t OnEventWpsOverlap(struct IWpaCallback *self, const char *ifName) { + LOGI("OnEventWpsOverlap: callback enter!"); const OHOS::Wifi::WifiEventCallback &cbk = OHOS::Wifi::WifiStaHalInterface::GetInstance().GetCallbackInst(); if (cbk.onWpsOverlap) { cbk.onWpsOverlap(1); @@ -127,6 +135,7 @@ int32_t OnEventWpsOverlap(struct IWpaCallback *self, const char *ifName) int32_t OnEventWpsTimeout(struct IWpaCallback *self, const char *ifName) { + LOGI("OnEventWpsTimeout: callback enter!"); const OHOS::Wifi::WifiEventCallback &cbk = OHOS::Wifi::WifiStaHalInterface::GetInstance().GetCallbackInst(); if (cbk.onWpsTimeOut) { cbk.onWpsTimeOut(1); @@ -137,6 +146,7 @@ int32_t OnEventWpsTimeout(struct IWpaCallback *self, const char *ifName) int32_t OnEventScanResult(struct IWpaCallback *self, const struct HdiWpaRecvScanResultParam *recvScanResultParam, const char* ifName) { + LOGI("OnEventScanResult: callback enter!"); if (recvScanResultParam == NULL) { LOGE("OnEventScanResult: invalid parameter!"); return 1; diff --git a/wifi/services/wifi_standard/wifi_hal/etc/init/wifi_hal_service.cfg b/wifi/services/wifi_standard/wifi_hal/etc/init/wifi_hal_service.cfg index 7a1466b36..f82b7dad9 100644 --- a/wifi/services/wifi_standard/wifi_hal/etc/init/wifi_hal_service.cfg +++ b/wifi/services/wifi_standard/wifi_hal/etc/init/wifi_hal_service.cfg @@ -2,9 +2,9 @@ "jobs" : [{ "name" : "early-boot", "cmds" : [ - "mkdir /data/service/el1/public/wifi 0770 wifi wifi", - "mkdir /data/service/el1/public/wifi/wpa_supplicant 0770 wifi wifi", - "mkdir /data/service/el1/public/wifi/sockets 0770 wifi wifi", + "mkdir /data/service/el1/public/wifi 0770 wifi wifi_group", + "mkdir /data/service/el1/public/wifi/wpa_supplicant 0770 wifi wifi_group", + "mkdir /data/service/el1/public/wifi/sockets 0770 wifi wifi_group", "mkdir /data/service/el1/public/dhcp 0770 dhcp dhcp" ] }, {