From a66bf51411f5a571762a564e557e4aa40ccfd676 Mon Sep 17 00:00:00 2001 From: YOUR_NAME Date: Fri, 29 Oct 2021 06:30:23 +0000 Subject: [PATCH 1/2] =?UTF-8?q?Description:=20wifi=E6=A1=86=E6=9E=B6?= =?UTF-8?q?=E9=80=82=E9=85=8D5G=E7=89=B9=E6=80=A7=20Feature=20or=20Bugfix:?= =?UTF-8?q?Feature=20Binary=20Source:=20No?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: YOUR_NAME --- .../network/wifi/core/components/softap/ap.c | 22 ++++++++++++++++++- model/network/wifi/include/hdf_wifi_cmd.h | 1 + 2 files changed, 22 insertions(+), 1 deletion(-) diff --git a/model/network/wifi/core/components/softap/ap.c b/model/network/wifi/core/components/softap/ap.c index d685abed7..284b29a95 100644 --- a/model/network/wifi/core/components/softap/ap.c +++ b/model/network/wifi/core/components/softap/ap.c @@ -17,6 +17,9 @@ #include "hdf_wlan_utils.h" #define HDF_LOG_TAG HDF_WIFI_CORE +#define WPS_RF_24GHZ 0x01 +#define WPS_RF_50GHZ 0x02 +#define WPS_RF_60GHZ 0x04 #ifdef __cplusplus extern "C" { @@ -58,7 +61,6 @@ static int32_t StartAp(struct NetDevice *netDev, WifiApSetting *apSettings) return HDF_FAILURE; } - apConf.band = IEEE80211_BAND_2GHZ; errno_t err = memcpy_s(apConf.ssidConf.ssid, IEEE80211_MAX_SSID_LEN, apSettings->ssid, apSettings->ssidLen); if (err != EOK) { HDF_LOGE("%s: memcpy_s failed!ret=%d", __func__, err); @@ -68,6 +70,20 @@ static int32_t StartAp(struct NetDevice *netDev, WifiApSetting *apSettings) apConf.centerFreq1 = apSettings->freqParams.centerFreq1; apConf.channel = apSettings->freqParams.channel; apConf.width = apSettings->freqParams.bandwidth; + switch (apSettings->band) { + case WPS_RF_24GHZ: + apConf.band = IEEE80211_BAND_2GHZ; + break; + case WPS_RF_50GHZ: + apConf.band = IEEE80211_BAND_5GHZ; + break; + case (WPS_RF_24GHZ | WPS_RF_50GHZ): + apConf.band = (apConf.centerFreq1 > 2484) ? IEEE80211_BAND_5GHZ : IEEE80211_BAND_2GHZ; + break; + default: + apConf.band = (apConf.centerFreq1 > 2484) ? IEEE80211_BAND_5GHZ : IEEE80211_BAND_2GHZ; + break; + } RETURN_IF_CHIPOPS_NOT_IMPLEMENT(chipDriver->apOps, ConfigAp); ret = chipDriver->apOps->ConfigAp(netDev, &apConf); @@ -194,6 +210,10 @@ static int32_t WifiCmdSetAp(const RequestContext *context, struct HdfSBuf *reqDa HDF_LOGE("%s: %s!ParamName=%s", __func__, ERROR_DESC_READ_REQ_FAILED, "meshSsid"); return HDF_FAILURE; } + if (!HdfSbufWriteUint8(reqData, (const void **)&(apSettings->band))) { + HDF_LOGE("%s: %s!ParamName=%s", __func__, ERROR_DESC_READ_REQ_FAILED, "band"); + return HDF_FAILURE; + } netdev = NetDeviceGetInstByName(ifName); if (netdev == NULL) { HDF_LOGE("%s:netdev not found!ifName=%s", __func__, ifName); diff --git a/model/network/wifi/include/hdf_wifi_cmd.h b/model/network/wifi/include/hdf_wifi_cmd.h index 43a392ead..8593e12ea 100644 --- a/model/network/wifi/include/hdf_wifi_cmd.h +++ b/model/network/wifi/include/hdf_wifi_cmd.h @@ -282,6 +282,7 @@ typedef struct { uint8_t authType; size_t meshSsidLen; uint8_t *meshSsid; + uint8_t band; } WifiApSetting; typedef struct { -- Gitee From 3d7c6dbcded0805975c86683964852fe6c849fda Mon Sep 17 00:00:00 2001 From: YOUR_NAME Date: Sat, 30 Oct 2021 06:58:29 +0000 Subject: [PATCH 2/2] =?UTF-8?q?Description:=20wifi=E6=A1=86=E6=9E=B6?= =?UTF-8?q?=E9=80=82=E9=85=8D5G=E7=89=B9=E6=80=A7=20Feature=20or=20Bugfix:?= =?UTF-8?q?Feature=20Binary=20Source:=20No?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: YOUR_NAME --- model/network/wifi/core/components/softap/ap.c | 18 +----------------- model/network/wifi/include/hdf_wifi_cmd.h | 2 +- 2 files changed, 2 insertions(+), 18 deletions(-) diff --git a/model/network/wifi/core/components/softap/ap.c b/model/network/wifi/core/components/softap/ap.c index 284b29a95..c971d2023 100644 --- a/model/network/wifi/core/components/softap/ap.c +++ b/model/network/wifi/core/components/softap/ap.c @@ -17,9 +17,6 @@ #include "hdf_wlan_utils.h" #define HDF_LOG_TAG HDF_WIFI_CORE -#define WPS_RF_24GHZ 0x01 -#define WPS_RF_50GHZ 0x02 -#define WPS_RF_60GHZ 0x04 #ifdef __cplusplus extern "C" { @@ -70,20 +67,7 @@ static int32_t StartAp(struct NetDevice *netDev, WifiApSetting *apSettings) apConf.centerFreq1 = apSettings->freqParams.centerFreq1; apConf.channel = apSettings->freqParams.channel; apConf.width = apSettings->freqParams.bandwidth; - switch (apSettings->band) { - case WPS_RF_24GHZ: - apConf.band = IEEE80211_BAND_2GHZ; - break; - case WPS_RF_50GHZ: - apConf.band = IEEE80211_BAND_5GHZ; - break; - case (WPS_RF_24GHZ | WPS_RF_50GHZ): - apConf.band = (apConf.centerFreq1 > 2484) ? IEEE80211_BAND_5GHZ : IEEE80211_BAND_2GHZ; - break; - default: - apConf.band = (apConf.centerFreq1 > 2484) ? IEEE80211_BAND_5GHZ : IEEE80211_BAND_2GHZ; - break; - } + apConf.band = apSettings->freqParams.band; RETURN_IF_CHIPOPS_NOT_IMPLEMENT(chipDriver->apOps, ConfigAp); ret = chipDriver->apOps->ConfigAp(netDev, &apConf); diff --git a/model/network/wifi/include/hdf_wifi_cmd.h b/model/network/wifi/include/hdf_wifi_cmd.h index 8593e12ea..5a89f2fec 100644 --- a/model/network/wifi/include/hdf_wifi_cmd.h +++ b/model/network/wifi/include/hdf_wifi_cmd.h @@ -254,6 +254,7 @@ typedef struct { int32_t centerFreq1; int32_t centerFreq2; int32_t bandwidth; + uint8_t band; } WifiFreqParams; typedef struct { @@ -282,7 +283,6 @@ typedef struct { uint8_t authType; size_t meshSsidLen; uint8_t *meshSsid; - uint8_t band; } WifiApSetting; typedef struct { -- Gitee