Android5.0系统wifi一直在向wps发送scan问题

logcat -s WifiEnabler Wifimultisupport WifiPowerSetting WifiStateMachine wpa_supplicant ConnectivityService NetworkSettingsActivity WifiController WifiHW CommandListener WifiMonitor WifiSettings WifiConfigStore addOrUpdateNetworkNative dhcpcd WifiManager

一、问题描述

由于网卡本身性能就不好;加之开启p2p功能以后、又是Android框架部分发送scan命令给wps再到驱动,导致网络更加不稳定。

二、问题原因

1.扫描

E/WifiStateMachine( 2023): WifiStateMachine CMD_START_SCAN source -2 txSuccessRate=7.24 rxSuccessRate=50.68 targetRoamBSSID=f4:ec:38:73:02:8e
 RSSI=-45
E/WifiStateMachine( 2023): TK-------->>>>WifiStateMachine.java>>>>111111111
E/WifiStateMachine( 2023): WifiStateMachine starting scan for "CTS_TEST_FIVE"WPA_PSK with 2412
D/WifiHW  ( 2023): TK--------->>>>command is IFNAME=wlan0 SCAN TYPE=ONLY freq=2412,reply is ,reply_len is 4095
D/WifiHW  ( 2023): TK-------->>>wifi_send_command,ctrl_conn is �
I/wpa_supplicant( 4800): [CTRL_IFACE]wlan0: SCAN TYPE=ONLY freq=2412
I/wpa_supplicant( 4800): wpa_bss_update_scan_res: SSID:X-link No RNS IE !!! 
I/wpa_supplicant( 4800): 
D/WifiHW  ( 2023): TK--------->>>>command is IFNAME=wlan0 BSS RANGE=0- MASK=0x21987,reply is 6R�,reply_len is 4095
D/WifiHW  ( 2023): TK-------->>>wifi_send_command,ctrl_conn is �
I/wpa_supplicant( 4800): [CTRL_IFACE]wlan0: BSS RANGE=0- MASK=0x21987
D/WifiHW  ( 2023): TK--------->>>>command is IFNAME=wlan0 STATUS-NO_EVENTS,reply is ���,reply_len is 4095
D/WifiHW  ( 2023): TK-------->>>wifi_send_command,ctrl_conn is �
I/wpa_supplicant( 4800): [CTRL_IFACE]wlan0: STATUS-NO_EVENTS
D/WifiHW  ( 2023): TK--------->>>>command is IFNAME=wlan0 SIGNAL_POLL,reply is 04031
D/WifiHW  ( 2023): flags=[WPA-PSK-CCMP+TKIP][WPA2-PSK-CCMP+TKIP][WPS][ESS]
D/WifiHW  ( 2023): ssid=CTS_TEST_FIVE
D/WifiHW  ( 2023): ====
D/WifiHW  ( 2023): id=37
D/WifiHW  ( 2023): bssid=6c:b0:ce:17:63:6a
2.不扫描
E/WifiStateMachine( 2023): WifiStateMachine CMD_START_SCAN source -2 txSuccessRate=59.00 rxSuccessRate=34.75 targetRoamBSSID=f4:ec:38:73:02:8
e RSSI=-45
E/WifiStateMachine( 2023): TK-------->>>>WifiStateMachine.java>>>>111111111
E/WifiStateMachine( 2023): TK-------->>>>WifiStateMachine.java>>>>22222222222222
E/WifiStateMachine( 2023): TK-------->>>>WifiStateMachine.java>>>>mWifiConfigStore.alwaysEnableScansWhileAssociated is 0
D/WifiHW  ( 2023): TK--------->>>>command is IFNAME=p2p0 P2P_LISTEN 5,reply is OK,reply_len is 4095
D/WifiHW  ( 2023): TK-------->>>wifi_send_command,ctrl_conn is �
I/wpa_supplicant( 4800): [CTRL_IFACE]p2p0: P2P_LISTEN 5
D/WifiHW  ( 2023): TK--------->>>>command is IFNAME=wlan0 SIGNAL_POLL,reply is @��,reply_len is 4095
D/WifiHW  ( 2023): TK-------->>>wifi_send_command,ctrl_conn is �
I/wpa_supplicant( 4800): [CTRL_IFACE]wlan0: SIGNAL_POLL
D/WifiHW  ( 2023): TK--------->>>>command is IFNAME=wlan0 SIGNAL_POLL,reply is @��,reply_len is 4095
D/WifiHW  ( 2023): TK-------->>>wifi_send_command,ctrl_conn is �
I/wpa_supplicant( 4800): [CTRL_IFACE]wlan0: SIGNAL_POLL
E/WifiStat

eMachine( 2023): WifiStateMachine CMD_START_SCAN source -2 txSuccessRate=121.00 rxSuccessRate=119.19 targetRoamBSSID=f4:ec:38:73:02:8e RSSI=-
45
E/WifiStateMachine( 2023): TK-------->>>>WifiStateMachine.java>>>>111111111
E/WifiStateMachine( 2023): TK-------->>>>WifiStateMachine.java>>>>22222222222222
E/WifiStateMachine( 2023): TK-------->>>>WifiStateMachine.java>>>>mWifiConfigStore.alwaysEnableScansWhileAssociated is 0
问题就出在如下:

frameworks/opt/net/wifi/service/java/com/android/server/wifi/WifiStateMachine.java

if (message.arg1 == SCAN_ALARM_SOURCE || message.arg1 == 1000) {  //modify by tank
                          if (mWifiInfo.txSuccessRate >
                                    mWifiConfigStore.maxTxPacketForPartialScans
                                    || mWifiInfo.rxSuccessRate >
                                    mWifiConfigStore.maxRxPacketForPartialScans) {
                                loge("TK-------->>>>WifiStateMachine.java>>>>22222222222222");//add by [email protected]
                                // Don't scan if lots of packets are being sent
                                restrictChannelList = true;
                                loge("TK-------->>>>WifiStateMachine.java>>>>mWifiConfigStore.alwaysEnableScansWhileAssociated is " + mWifiConfigStore.alwaysEnableScansWhileAssociated);//add by [email protected]
                                if (mWifiConfigStore.alwaysEnableScansWhileAssociated == 0) {
                                    if (DBG) {
                                     loge("WifiStateMachine CMD_START_SCAN source " + message.arg1
                                        + " ...and ignore scans"
                                        + " tx=" + String.format("%.2f", mWifiInfo.txSuccessRate)
                                        + " rx=" + String.format("%.2f", mWifiInfo.rxSuccessRate));
                                    }
                                    messageHandlingStatus = MESSAGE_HANDLING_STATUS_REFUSED;
                                    return HANDLED;
                                }
                            }
}

看如上maxTxPacketForPartialScans和maxRxPacketForPartialScans的定义:

frameworks/opt/net/wifi/service/java/com/android/server/wifi/WifiConfigStore.java

public int maxTxPacketForPartialScans = 0;//40; //modify by tank
public int maxRxPacketForPartialScans = 0;//80; //modify by tank

三、问题解决

修改如上后问题解决;原因为Android5.0本身就有这个自动scan的机制。


你可能感兴趣的:(移动操作系统之Android)