MTK平台disable 5g band

项目需求

该项目不需要支持5g wifi,所以需要disable 5g band,并且在softap模式中,5g的热点也要关闭。

sta关闭5g band

1. 修改wifi配置文件

Wi-Fi NVRAM 內的下列兩個欄位皆設置為 0x0 即可disable.
文件路径:AOSP/vendor/mediatek/proprietary/custom/dandelion/cgen/cfgdefault/CFG_WIFI_Default.h

WIFI_CUSTOM_PARAM_STRUCT stWifiCustomDefault = {
    // ...
    0x00, /* Support5GBand | offset: 0x00C5 */
    // ...
    0x00, /* Enable5GBand | offset: 0x00F0 */
}

NVRAM里将这两位配置为0,即可关闭5gband,但是在此项目中不知为何,上层依然会扫描到5g 的wifi.
所以在上层load nvram时,将这两项从nvram中获取改为强制设置为0,改动如下:

Subject: disable 5g band in wifi search list 
Change-Id: Id6d4875cd5ab3d8324785399c770677367572f50
---

diff --git a/os/linux/gl_cfg80211.c b/os/linux/gl_cfg80211.c
index 7e10365..819dfed 100644
--- a/os/linux/gl_cfg80211.c
+++ b/os/linux/gl_cfg80211.c
@@ -1062,6 +1062,14 @@
                       i, request->channels[i]->center_freq);
                continue;
            }
+           // add begin
+           if(u4channel >14)
+           {
+               DBGLOG(REQ, WARN, "disable 5G channel [%d] freq=%un",
+               i, request->channels[i]->center_freq);
+               continue;
+           }
+           // add end
            prScanRequest->arChannel[j].ucChannelNum = u4channel;
            switch ((request->channels[i])->band) {
            case KAL_BAND_2GHZ:
diff --git a/os/linux/gl_init.c b/os/linux/gl_init.c
index 7d824a2..6c796f4 100644
--- a/os/linux/gl_init.c
+++ b/os/linux/gl_init.c
@@ -929,10 +929,9 @@
    prRegInfo->au2CountryCode[1] =
            (uint16_t) prNvramSettings->aucCountryCode[1];

-   prRegInfo->ucSupport5GBand =
-           prNvramSettings->ucSupport5GBand;
+   prRegInfo->ucSupport5GBand = 0;

-   prRegInfo->ucEnable5GBand = prNvramSettings->ucEnable5GBand;
+   prRegInfo->ucEnable5GBand = 0;

    /* load regulation subbands */
    prRegInfo->eRegChannelListMap = 0;

关闭softap模式中的5g band

上层Settings是自适应的,判断条件为wifi 底层是否有可扫描的5G 频段

涉及的文件
frameworks/opt/net/wifi/service/java/com/android/server/wifi/WificondControl.java#828
system/connectivity/wificond/server.cpp#261

MTK平台还需要设置一下config文件,config_wifi_dual_band_support 如下:

    public boolean isDualBandSupported() {
        //TODO (b/123227116): pull it from the HAL
        if (mVerboseLoggingEnabled) {
            mLog.info("isDualBandSupported uid=%").c(Binder.getCallingUid()).flush();
        }

        return mContext.getResources().getBoolean(
                com.android.internal.R.bool.config_wifi_dual_band_support);
    }

所以要在对应项目中的config.xml中将此项config_wifi_dual_band_support改为false关闭

剑气纵横三万里

“为什么要努力?” “想去的地方很远,想要的东西很贵,喜欢的人很优秀,父母的白发,朋友的约定,周围人的嘲笑,以及,天生傲骨。”

留下你的评论

*评论支持代码高亮<pre class="prettyprint linenums">代码</pre>

相关推荐

暂无内容!