nxp的wifi热点不能够打开和关闭的bug


基于上次写了笔记过后的wifi调试 https://editor.csdn.net/md/?articleId=122733587 wifi可以使用,但是存在的bug在于wifi的热点无法打开。

一、log提示

通过adb logcat -b all | grep -E -i "wifi|wlan" 命令抓取点击热点开关的log

02-12 08:34:53.955   879   879 I sysui_multi_action: [757,853,758,4,854,wifi.tether.WifiTetherSettings/switch_bar,1089,1]
02-12 08:34:53.960   525   580 I WifiService: startTetheredHotspot uid=1073
02-12 08:34:53.962   525   607 D WifiActiveModeWarden: Starting SoftApModeManager config = null
02-12 08:34:53.962   525   607 D WifiCountryCode: Reading country code from telephony
02-12 08:34:53.964   525   607 D WifiCountryCode: Set telephony country code to: 
02-12 08:34:53.976   219   219 I hwservicemanager: Since android.hardware.wifi.hostapd@1.0::IHostapd/default is not registered, trying to start it as a lazy HAL.
02-12 08:34:54.000     0     0 I init    : Control message: Processed ctl.interface_start for 'android.hardware.wifi.hostapd@1.0::IHostapd/default' from pid: 219 (/system/bin/hwservicemanager)
02-12 08:34:54.040  2243  2243 I HidlServiceManagement: Registered android.hardware.wifi.hostapd@1.2::IHostapd/default
02-12 08:34:54.041   525   912 I android_os_HwBinder: HwBinder: Starting thread pool for getting: android.hardware.wifi.hostapd@1.0::IHostapd/default
02-12 08:34:54.092   339   339 I android.hardware.wifi@1.0-service: Adding interface handle for wlan0
02-12 08:34:54.092   339   339 W android.hardware.wifi@1.0-service: No active wlan interfaces in use! Using default
02-12 08:34:54.097   525   607 I android_os_HwBinder: HwBinder: Starting thread pool for getting: android.hardware.wifi.supplicant@1.0::ISupplicant/default
02-12 08:34:54.160  2236  2236 I wpa_supplicant: nl80211: deinit ifname=wlan0 disabled_11b_rates=0
02-12 08:34:54.186   525   544 I EthernetTracker: interfaceLinkStateChanged, iface: wlan0, up: true
02-12 08:34:54.193   425   425 I wificond: Unsubscribe scan result for interface with index: 7
02-12 08:34:54.195     0     0 E [dhd][wlan0] dhd_pri_stop: tx queue stopped
02-12 08:34:54.202     0     0 E [dhd][wlan0] dhd_stop: Enter
02-12 08:34:54.240     0     0 E [dhd][wlan0] dhd_stop: Exit
02-12 08:34:54.189   525   544 I EthernetTracker: interfaceLinkStateChanged, iface: wlan0, up: true
02-12 08:34:54.244   525   544 I EthernetTracker: interfaceLinkStateChanged, iface: wlan0, up: false
02-12 08:34:54.247   525   607 I android_os_HwBinder: HwBinder: Starting thread pool for getting: android.hardware.wifi.supplicant@1.0::ISupplicant/default
02-12 08:34:54.282   525   607 D WifiClientModeManager: STA iface wlan0 was destroyed, stopping client mode
02-12 08:34:54.283   525   607 V WifiClientModeImpl: stopIpClient IpClientWithPreConnection: false
02-12 08:34:54.283   525   607 V WifiClientModeImpl: java.lang.Throwable
02-12 08:34:54.283   525   607 V WifiClientModeImpl: 	at com.android.server.wifi.ClientModeImpl.stopIpClient(ClientModeImpl.java:1068)
02-12 08:34:54.283   525   607 V WifiClientModeImpl: 	at com.android.server.wifi.ClientModeImpl.stopDhcpSetup(ClientModeImpl.java:1083)
02-12 08:34:54.283   525   607 V WifiClientModeImpl: 	at com.android.server.wifi.ClientModeImpl.handleNetworkDisconnect(ClientModeImpl.java:2760)
02-12 08:34:54.283   525   607 V WifiClientModeImpl: 	at com.android.server.wifi.ClientModeImpl.handleIfaceDestroyed(ClientModeImpl.java:1568)
02-12 08:34:54.283   525   607 V WifiClientModeImpl: 	at com.android.server.wifi.ClientModeManager$ClientModeStateMachine$1.onDestroyed(ClientModeManager.java:423)
02-12 08:34:54.283   525   607 V WifiClientModeImpl: 	at com.android.server.wifi.WifiNative.onInterfaceDestroyed(WifiNative.java:578)
02-12 08:34:54.283   525   607 V WifiClientModeImpl: 	at com.android.server.wifi.WifiNative.access$1200(WifiNative.java:77)
02-12 08:34:54.283   525   607 V WifiClientModeImpl: 	at com.android.server.wifi.WifiNative$InterfaceDestoyedListenerInternal.onDestroyed(WifiNative.java:605)
02-12 08:34:54.283   525   607 V WifiClientModeImpl: 	at com.android.server.wifi.WifiVendorHal$StaInterfaceDestroyedListenerInternal.onDestroyed(WifiVendorHal.java:429)
02-12 08:34:54.283   525   607 V WifiClientModeImpl: 	at com.android.server.wifi.HalDeviceManager$InterfaceDestroyedListenerProxy.action(HalDeviceManager.java:2165)
02-12 08:34:54.283   525   607 V WifiClientModeImpl: 	at com.android.server.wifi.HalDeviceManager$ListenerProxy.trigger(HalDeviceManager.java:2130)
02-12 08:34:54.283   525   607 V WifiClientModeImpl: 	at com.android.server.wifi.HalDeviceManager.dispatchDestroyedListeners(HalDeviceManager.java:2081)
02-12 08:34:54.283   525   607 V WifiClientModeImpl: 	at com.android.server.wifi.HalDeviceManager.removeIfaceInternal(HalDeviceManager.java:2000)
02-12 08:34:54.283   525   607 V WifiClientModeImpl: 	at com.android.server.wifi.HalDeviceManager.executeChipReconfiguration(HalDeviceManager.java:1882)
02-12 08:34:54.283   525   607 V WifiClientModeImpl: 	at com.android.server.wifi.HalDeviceManager.createIfaceIfPossible(HalDeviceManager.java:1469)
02-12 08:34:54.283   525   607 V WifiClientModeImpl: 	at com.android.server.wifi.HalDeviceManager.createIface(HalDeviceManager.java:1425)
02-12 08:34:54.283   525   607 V WifiClientModeImpl: 	at com.android.server.wifi.HalDeviceManager.createApIface(HalDeviceManager.java:240)
02-12 08:34:54.283   525   607 V WifiClientModeImpl: 	at com.android.server.wifi.WifiVendorHal.createApIface(WifiVendorHal.java:520)
02-12 08:34:54.283   525   607 V WifiClientModeImpl: 	at com.android.server.wifi.WifiNative.createApIface(WifiNative.java:836)
02-12 08:34:54.283   525   607 V WifiClientModeImpl: 	at com.android.server.wifi.WifiNative.setupInterfaceForSoftApMode(WifiNative.java:1163)
02-12 08:34:54.283   525   607 V WifiClientModeImpl: 	at com.android.server.wifi.SoftApManager$SoftApStateMachine$IdleState.processMessage(SoftApManager.java:573)
02-12 08:34:54.283   525   607 V WifiClientModeImpl: 	at com.android.wifi.x.com.android.internal.util.StateMachine$SmHandler.processMsg(StateMachine.java:992)
02-12 08:34:54.283   525   607 V WifiClientModeImpl: 	at com.android.wifi.x.com.android.internal.util.StateMachine$SmHandler.handleMessage(StateMachine.java:809)
02-12 08:34:54.283   525   607 V WifiClientModeImpl: 	at android.os.Handler.dispatchMessage(Handler.java:106)
02-12 08:34:54.283   525   607 V WifiClientModeImpl: 	at android.os.Looper.loop(Looper.java:223)
02-12 08:34:54.283   525   607 V WifiClientModeImpl: 	at android.os.HandlerThread.run(HandlerThread.java:67)
02-12 08:34:54.284   525   607 I WifiNative: Successfully torn down Iface:{Name=wlan0,Id=10,Type=STA_CONNECTIVITY}
02-12 08:34:54.284   339   339 I android.hardware.wifi@1.0-service: Reconfiguring chip from mode 0 to mode 1
02-12 08:34:54.285   339   339 I WifiHAL : found interface wlan0
02-12 08:34:54.285   339   339 E WifiHAL : Calling hal cleanup
02-12 08:34:54.285   339   339 E WifiHAL : Cancel: Stop Hal
02-12 08:34:54.285   339  2234 E WifiHAL : wifi_event_loop: Read after POLL returned 4, error no = 0 (Success)
02-12 08:34:54.285   339  2234 D WifiHAL : Got a signal to exit!!!
02-12 08:34:54.285   339  2234 I WifiHAL : Exit wifi_event_loop
02-12 08:34:54.285   339   339 E WifiHAL : wifi_cleanup: Read after POLL returned 4, error no = 0 (Success)
02-12 08:34:54.285   339   339 E WifiHAL : Event processing terminated
02-12 08:34:54.285   339   339 I WifiHAL : wifi nan internal clean up done
02-12 08:34:54.285   339   339 I WifiHAL : event_cb callbacks left: 1 
02-12 08:34:54.285   339   339 I WifiHAL : event_cb cleanup. index:0
02-12 08:34:54.285   339   339 I WifiHAL : event_cb cleanup. vendor cmd:6673 sub_cmd:11
02-12 08:34:54.285   339   339 I WifiHAL : Command left in event_cb 0xb400e59349fb1430
02-12 08:34:54.285   339   339 I WifiHAL : Check bad commands: num_cmd:1 bad_commands:0
02-12 08:34:54.285   339   339 I WifiHAL : Cancelling command 0xb400e59349fb1430:SetAlertHandler
02-12 08:34:54.285   339   339 D WifiHAL : Success to clear alerthandler
02-12 08:34:54.285   339   339 I WifiHAL : internal clean up
02-12 08:34:54.285   339   339 I WifiHAL : cmd_sock non null. clean up
02-12 08:34:54.286   339   339 I WifiHAL : cleanup_handler cb
02-12 08:34:54.286   339   339 I android.hardware.wifi@1.0-service: Legacy HAL stop complete callback received
02-12 08:34:54.286   339   339 I WifiHAL : Internal cleanup completed
02-12 08:34:54.286   339   339 E WifiHAL : wifi_clean_up done
02-12 08:34:54.286   339   339 E WifiHAL : wifi_pre_initialize
02-12 08:34:54.286   339   339 E WifiHAL : --- HAL version: Android-10-FRC2-SDK_29 59.0 (r854927) 2019-12-06 23:33:52 +0530 (Fri, 06 Dec 2019) ---
02-12 08:34:54.286   339   339 I WifiHAL : Creating socket
02-12 08:34:54.287   339   339 I WifiHAL : Initialized Wifi HAL Successfully; vendor cmd = 103
02-12 08:34:54.287   339   339 I WifiHAL : found interface wlan0
02-12 08:34:54.287   339   339 E WifiHAL : Calling preInit
02-12 08:34:54.287   339   339 E WifiHAL : Hal preInit
02-12 08:34:54.288   339   339 E WifiHAL : Failed to register set Hal preInit; result = -22
02-12 08:34:54.288   339   339 E WifiHAL : wifi_hal_preInit failed
02-12 08:34:54.289     0     0 E [dhd][wlan0] dhd_open: Enter
02-12 08:34:54.289     0     0 I init    : processing action (wlan.driver.status=ok) from (/vendor/etc/init/hw/init.nxp.rc:375)
02-12 08:34:54.349     0     0 E [dhd][wlan0] dhd_open: Exit ret=0
02-12 08:34:54.354     0     0 E [dhd][wlan0] dhd_pri_open: tx queue started
02-12 08:34:54.359   339   339 E WifiHAL : wifi_initialize
02-12 08:34:54.359   339   339 I WifiHAL : found interface wlan0
02-12 08:34:54.359   339   339 E WifiHAL : Calling Hal_init
02-12 08:34:54.359   339   339 E WifiHAL : Start Set Hal
02-12 08:34:54.359   339   339 I android.hardware.wifi@1.0-service: Adding interface handle for wlan0
02-12 08:34:54.359   339   339 W android.hardware.wifi@1.0-service: No active wlan interfaces in use! Using default
02-12 08:34:54.359   339   339 E android.hardware.wifi@1.0-service: Failed to register radio mode change callback
02-12 08:34:54.359   339   339 W android.hardware.wifi@1.0-service: No active wlan interfaces in use! Using default
02-12 08:34:54.359   339   339 E WifiHAL : Failed to register debug response; result = -22
02-12 08:34:54.360   339   339 E android.hardware.wifi@1.0-service: Failed to get driver version: UNKNOWN ERROR
02-12 08:34:54.360   525   544 I EthernetTracker: interfaceLinkStateChanged, iface: wlan0, up: true
02-12 08:34:54.360   339   339 I android.hardware.wifi@1.0-service: Configured chip in mode 1
02-12 08:34:54.360   339   339 W android.hardware.wifi@1.0-service: No active wlan interfaces in use! Using default
02-12 08:34:54.361   339   339 I android.hardware.wifi@1.0-service: Adding interface handle for wlan0
02-12 08:34:54.366   525   608 D WifiP2pNative: P2P InterfaceAvailableListener false
02-12 08:34:54.366   525   608 D WifiP2pService: Wifi enabled=true, P2P Interface availability=false
02-12 08:34:54.367   525   607 D WifiNl80211Manager: Setting up interface for soft ap mode
02-12 08:34:54.369   525   607 I WifiNative: Interface state changed on Iface:{Name=wlan0,Id=11,Type=AP}, isUp=true
02-12 08:34:54.369   525   607 I WifiNative: Successfully setup Iface:{Name=wlan0,Id=11,Type=AP}
02-12 08:34:54.371   339   339 D WifiHAL : In DebugCommand::handleResponse
02-12 08:34:54.371   339   339 D WifiHAL : len = 4, expected len = 4
02-12 08:34:54.376   525   607 D SoftApManager: band 1 iface wlan0 country CN
02-12 08:34:54.378   879   879 D WifiTetherSettings: updating display config due to receiving broadcast action android.net.wifi.WIFI_AP_STATE_CHANGED
02-12 08:34:54.379     0     0 E [dhd][wlan0] dhd_pri_stop: tx queue stopped
02-12 08:34:54.384     0     0 E [dhd][wlan0] dhd_stop: Enter
02-12 08:34:54.415     0     0 E [dhd][wlan0] dhd_stop: Exit
02-12 08:34:54.420   525   544 I EthernetTracker: interfaceLinkStateChanged, iface: wlan0, up: false
02-12 08:34:54.420     0     0 E [dhd][wlan0] dhd_set_mac_address: iftype = 2 macaddr = 7e:65:4e:9d:b5:da
02-12 08:34:54.429     0     0 E [dhd][wlan0] dhd_open: Enter
02-12 08:34:54.486     0     0 E [dhd][wlan0] dhd_open: Exit ret=0
02-12 08:34:54.490     0     0 E [dhd][wlan0] dhd_pri_open: tx queue started
02-12 08:34:54.429   525   544 I EthernetTracker: interfaceLinkStateChanged, iface: wlan0, up: false
02-12 08:34:54.496   525   544 I EthernetTracker: interfaceLinkStateChanged, iface: wlan0, up: true
02-12 08:34:54.497   525   607 E WifiVendorHal: setCountryCodeHal(l.1507) failed {.code = ERROR_UNKNOWN, .description = unknown error}
02-12 08:34:54.500  2243  2243 I hostapd : Add interface 'wlan0'
02-12 08:34:54.497     0     0 E [dhd][wlan0] _dhd_set_mac_address: MACID 7e:65:4e:9d:b5:da is overwritten
02-12 08:34:54.512     0     0 E [dhd][wlan0] wl_run_escan: LEGACY_SCAN sync ID: 24, bssidx: 0
02-12 08:34:54.539     0     0 E [dhd][wlan0] wl_cfg80211_add_del_bss: wl bss 2 bssidx:0
02-12 08:34:54.548     0     0 E [dhd][wlan0] wl_run_escan: LEGACY_SCAN sync ID: 25, bssidx: 0
02-12 08:34:54.577  2243  2243 I hostapd : wlan0: IEEE 802.11 Configured channel (0) or frequency (0) not found from the channel list of the current mode (1) IEEE 802.11g
02-12 08:34:54.577  2243  2243 W hostapd : wlan0: IEEE 802.11 Configured channel (0) or frequency (0) not found from the channel list of the current mode (1) IEEE 802.11g
02-12 08:34:54.577  2243  2243 I hostapd : wlan0: IEEE 802.11 Hardware does not support configured channel
02-12 08:34:54.577  2243  2243 W hostapd : wlan0: IEEE 802.11 Hardware does not support configured channel
02-12 08:34:54.577  2243  2243 I hostapd : wlan0: interface state UNINITIALIZED->DISABLED
02-12 08:34:54.577  2243  2243 I hostapd : wlan0: AP-DISABLED 
02-12 08:34:54.577  2243  2243 E hostapd : wlan0: Unable to setup interface.
02-12 08:34:54.577  2243  2243 I hostapd : nl80211: deinit ifname=wlan0 disabled_11b_rates=0
02-12 08:34:54.625  2243  2243 E hostapd : Enabling interface wlan0 failed
02-12 08:34:54.618     0     0 E [dhd][wlan0] wl_cfg80211_add_del_bss: wl bss 2 bssidx:0
02-12 08:34:54.625   525   607 E WifiNative: Failed to add acccess point
02-12 08:34:54.626   525   607 D WifiDiags: stopLogging() iface list is {} after removing wlan0
02-12 08:34:54.627   525   607 E WifiVendorHal: resetLogHandler(l.1550) failed {.code = ERROR_NOT_AVAILABLE, .description = }
02-12 08:34:54.627   525   607 W WifiDiags: Fail to reset log handler
02-12 08:34:54.629   339   339 I android.hardware.wifi@1.0-service: Adding interface handle for wlan0
02-12 08:34:54.629   339   339 W android.hardware.wifi@1.0-service: No active wlan interfaces in use! Using default
02-12 08:34:54.630  2243  2243 I hostapd : Remove interface 'wlan0'
02-12 08:34:54.630  2243  2243 I hostapd : wlan0: interface state DISABLED->DISABLED
02-12 08:34:54.630  2243  2243 I hostapd : wlan0: AP-DISABLED 
02-12 08:34:54.630  2243  2243 I hostapd : wlan0: CTRL-EVENT-TERMINATING 
02-12 08:34:54.631  2243  2243 E hostapd : hostapd_free_hapd_data: Interface wlan0 wasn't started
02-12 08:34:54.632     0     0 E [dhd][wlan0] dhd_pri_stop: tx queue stopped
02-12 08:34:54.638     0     0 E [dhd][wlan0] dhd_stop: Enter
02-12 08:34:54.669     0     0 E [dhd][wlan0] dhd_stop: Exit
02-12 08:34:54.673   525   544 I EthernetTracker: interfaceLinkStateChanged, iface: wlan0, up: false
02-12 08:34:54.713   525   607 D WifiNl80211Manager: tearing down interfaces in wificond
02-12 08:34:54.715   339   339 I WifiHAL : found interface wlan0
02-12 08:34:54.715   339   339 E WifiHAL : Calling hal cleanup
02-12 08:34:54.715   339   339 E WifiHAL : Cancel: Stop Hal
02-12 08:34:54.715   339  2244 E WifiHAL : wifi_event_loop: Read after POLL returned 4, error no = 0 (Success)
02-12 08:34:54.715   339  2244 D WifiHAL : Got a signal to exit!!!
02-12 08:34:54.715   339  2244 I WifiHAL : Exit wifi_event_loop
02-12 08:34:54.715   339   339 E WifiHAL : wifi_cleanup: Read after POLL returned 4, error no = 0 (Success)
02-12 08:34:54.715   339   339 E WifiHAL : Event processing terminated
02-12 08:34:54.715   339   339 I WifiHAL : wifi nan internal clean up done
02-12 08:34:54.715   339   339 I WifiHAL : event_cb callbacks left: 0 
02-12 08:34:54.715   339   339 I WifiHAL : Check bad commands: num_cmd:0 bad_commands:0
02-12 08:34:54.715   339   339 I WifiHAL : internal clean up
02-12 08:34:54.715   339   339 I WifiHAL : cmd_sock non null. clean up
02-12 08:34:54.715   339   339 I WifiHAL : cleanup_handler cb
02-12 08:34:54.715   339   339 I android.hardware.wifi@1.0-service: Legacy HAL stop complete callback received
02-12 08:34:54.716   339   339 I WifiHAL : Internal cleanup completed
02-12 08:34:54.716   339   339 E WifiHAL : wifi_clean_up done
02-12 08:34:54.716   339   339 I android.hardware.wifi@1.0-service: Wifi HAL stopped
02-12 08:34:54.717   525   607 I WifiVendorHal: Vendor Hal stopped
02-12 08:34:54.717   525   607 I WifiNative: Successfully torn down Iface:{Name=wlan0,Id=11,Type=AP}
02-12 08:34:54.717   525   607 E HalDevMgr: getAllChipInfo: called but mWifi is null!?
02-12 08:34:54.717   525   607 W HalDevMgr: stopWifi called but mWifi is null!?
02-12 08:34:54.717   525   608 W HalDevMgr: isWifiStarted called but mWifi is null!?
02-12 08:34:54.717   525   607 I WifiNative: Successfully initiated teardown for iface=wlan0
02-12 08:34:54.719   525   607 D WifiClientModeManager: interface destroyed - client mode stopping
02-12 08:34:54.719   525   525 D WifiP2pService: Wifi enabled=false, P2P Interface availability=false
02-12 08:34:54.720   525   525 D WifiP2pService: Wifi enabled=false, P2P Interface availability=false
02-12 08:34:54.720   525   607 D WifiScanRequestProxy: Sending scan available broadcast: false
02-12 08:34:54.720   525   610 I WifiScanningService: Received a request to disable scanning, UID = 1000
02-12 08:34:54.720   525   610 E WifiNl80211Manager: No valid wificond scanner interface handler
02-12 08:34:54.720   525   610 I WifiScanningService: Removed an impl for wlan0
02-12 08:34:54.721   525   610 I WifiScanningService: wifi driver unloaded
02-12 08:34:54.723   525   607 I WifiScanRequestProxy: Scanning is disabled
02-12 08:34:54.725   525   607 D WifiClientModeManager: entering IdleState
02-12 08:34:54.727   525   607 D WifiOpenNetworkNotifier: Notification with state=1 was cleared for recommended network: "Vantron-90086C"
02-12 08:34:54.731   525   607 E WifiClientModeImpl: Failed to remove networks on exiting connect mode
02-12 08:34:54.733   525   607 V WifiClientModeImpl: stopIpClient IpClientWithPreConnection: false
02-12 08:34:54.733   525   607 V WifiClientModeImpl: java.lang.Throwable
02-12 08:34:54.733   525   607 V WifiClientModeImpl: 	at com.android.server.wifi.ClientModeImpl.stopIpClient(ClientModeImpl.java:1068)
02-12 08:34:54.733   525   607 V WifiClientModeImpl: 	at com.android.server.wifi.ClientModeImpl.stopDhcpSetup(ClientModeImpl.java:1083)
02-12 08:34:54.733   525   607 V WifiClientModeImpl: 	at com.android.server.wifi.ClientModeImpl.handleNetworkDisconnect(ClientModeImpl.java:2760)
02-12 08:34:54.733   525   607 V WifiClientModeImpl: 	at com.android.server.wifi.ClientModeImpl.stopClientMode(ClientModeImpl.java:3665)
02-12 08:34:54.733   525   607 V WifiClientModeImpl: 	at com.android.server.wifi.ClientModeImpl.access$4300(ClientModeImpl.java:163)
02-12 08:34:54.733   525   607 V WifiClientModeImpl: 	at com.android.server.wifi.ClientModeImpl$ConnectModeState.exit(ClientModeImpl.java:3824)
02-12 08:34:54.733   525   607 V WifiClientModeImpl: 	at com.android.wifi.x.com.android.internal.util.StateMachine$SmHandler.invokeExitMethods(StateMachine.java:1021)
02-12 08:34:54.733   525   607 V WifiClientModeImpl: 	at com.android.wifi.x.com.android.internal.util.StateMachine$SmHandler.performTransitions(StateMachine.java:877)
02-12 08:34:54.733   525   607 V WifiClientModeImpl: 	at com.android.wifi.x.com.android.internal.util.StateMachine$SmHandler.handleMessage(StateMachine.java:819)
02-12 08:34:54.733   525   607 V WifiClientModeImpl: 	at android.os.Handler.dispatchMessage(Handler.java:106)
02-12 08:34:54.733   525   607 V WifiClientModeImpl: 	at android.os.Looper.loop(Looper.java:223)
02-12 08:34:54.733   525   607 V WifiClientModeImpl: 	at android.os.HandlerThread.run(HandlerThread.java:67)
02-12 08:34:54.734   525   607 W WifiDiags: ifaceName: wlan0 is not in the start log user list
02-12 08:34:54.748   525   607 W HalDevMgr: isWifiStarted called but mWifi is null!?
02-12 08:34:54.749   525   607 D WifiController: SoftAp disabled, start client mode
02-12 08:34:54.749   525   607 D WifiActiveModeWarden: Starting ClientModeManager
02-12 08:34:54.750   525   607 D WifiClientModeManager: entering IdleState
02-12 08:34:54.750   525   607 E WifiNative: Could not get Iface object for interface null
02-12 08:34:54.752   525   607 D WifiController: STA disabled, remain in EnabledState.
02-12 08:34:54.754   525   607 I android_os_HwBinder: HwBinder: Starting thread pool for getting: android.hardware.wifi@1.0::IWifi/default
02-12 08:34:54.757   339   339 I android.hardware.wifi@1.0-service: Wifi HAL started
02-12 08:34:54.759   525   607 I WifiVendorHal: Vendor Hal started successfully
02-12 08:34:54.760   525   608 I WifiP2pNative: Registering for interface available listener
02-12 08:34:54.763   525  2205 D WifiMemoryStoreImpl: Set cluster Ge9309ea299f67b2a for We9309ea299f67b2a: SUCCESS
02-12 08:34:54.766   339   339 E WifiHAL : wifi_pre_initialize
02-12 08:34:54.766   339   339 E WifiHAL : --- HAL version: Android-10-FRC2-SDK_29 59.0 (r854927) 2019-12-06 23:33:52 +0530 (Fri, 06 Dec 2019) ---
02-12 08:34:54.766   339   339 I WifiHAL : Creating socket
02-12 08:34:54.767   339   339 I WifiHAL : Initialized Wifi HAL Successfully; vendor cmd = 103
02-12 08:34:54.767   339   339 I WifiHAL : found interface wlan0
02-12 08:34:54.767   339   339 E WifiHAL : Calling preInit
02-12 08:34:54.767   339   339 E WifiHAL : Hal preInit
02-12 08:34:54.767   339   339 E WifiHAL : Failed to register set Hal preInit; result = -22
02-12 08:34:54.767   339   339 E WifiHAL : wifi_hal_preInit failed
02-12 08:34:54.769     0     0 I init    : processing action (wlan.driver.status=ok) from (/vendor/etc/init/hw/init.nxp.rc:375)
02-12 08:34:54.770     0     0 E [dhd][wlan0] dhd_open: Enter
02-12 08:34:54.858     0     0 E [dhd][wlan0] dhd_open: Exit ret=0
02-12 08:34:54.863     0     0 E [dhd][wlan0] dhd_pri_open: tx queue started
02-12 08:34:54.870   339   339 E WifiHAL : wifi_initialize
02-12 08:34:54.870   339   339 I WifiHAL : found interface wlan0
02-12 08:34:54.870   339   339 E WifiHAL : Calling Hal_init
02-12 08:34:54.870   339   339 E WifiHAL : Start Set Hal
02-12 08:34:54.871   525   544 I EthernetTracker: interfaceLinkStateChanged, iface: wlan0, up: true
02-12 08:34:54.872   339   339 I android.hardware.wifi@1.0-service: Adding interface handle for wlan0
02-12 08:34:54.881   339   339 W android.hardware.wifi@1.0-service: No active wlan interfaces in use! Using default
02-12 08:34:54.882   339   339 E android.hardware.wifi@1.0-service: Failed to register radio mode change callback
02-12 08:34:54.882   339   339 W android.hardware.wifi@1.0-service: No active wlan interfaces in use! Using default
02-12 08:34:54.882   339   339 E WifiHAL : Failed to register debug response; result = -22
02-12 08:34:54.882   339   339 E android.hardware.wifi@1.0-service: Failed to get driver version: UNKNOWN ERROR
02-12 08:34:54.882   339   339 I android.hardware.wifi@1.0-service: Configured chip in mode 0
02-12 08:34:54.882   339   339 W android.hardware.wifi@1.0-service: No active wlan interfaces in use! Using default
02-12 08:34:54.885   339   339 I android.hardware.wifi@1.0-service: Adding interface handle for wlan0
02-12 08:34:54.885   339   339 E android.hardware.wifi@1.0-service: Failed to set DFS flag; DFS channels may be unavailable.
02-12 08:34:54.899   525   608 I WifiP2pNative: Registering for interface available listener
02-12 08:34:54.900   525   608 D WifiP2pNative: P2P InterfaceAvailableListener true
02-12 08:34:54.900   525   608 D WifiP2pService: Wifi enabled=false, P2P Interface availability=true
02-12 08:34:54.901   525   607 D WifiNl80211Manager: Setting up interface for client mode
02-12 08:34:54.903   425   425 I wificond: create scanner for interface with index: 7
02-12 08:34:54.903   425   425 I wificond: subscribe scan result for interface with index: 7
02-12 08:34:54.906   525   607 I WifiNative: Interface state changed on Iface:{Name=wlan0,Id=12,Type=STA_SCAN}, isUp=true
02-12 08:34:54.906   525   607 I WifiNative: Successfully setup Iface:{Name=wlan0,Id=12,Type=STA_SCAN}
02-12 08:34:54.910   339   339 D WifiHAL : In DebugCommand::handleResponse
02-12 08:34:54.910   339   339 D WifiHAL : len = 4, expected len = 4
02-12 08:34:54.911   339   339 D WifiHAL : In DebugCommand::handleResponse
02-12 08:34:54.911   339   339 D WifiHAL : len = 4, expected len = 4
02-12 08:34:54.918   525   607 D WifiClientModeManager: entering StartedState
02-12 08:34:54.919   525   607 D WifiClientModeManager: entering ScanOnlyModeState
02-12 08:34:54.919   525   607 D WifiScanRequestProxy: Sending scan available broadcast: true
02-12 08:34:54.920   525   610 I WifiScanningService: Received a request to enable scanning, UID = 1000
02-12 08:34:54.920   525   607 I WifiScanRequestProxy: Scanning is enabled
02-12 08:34:54.920   525   607 I WifiScanRequestProxy: Scanning for hidden networks is disabled
02-12 08:34:54.922   525   610 E WifiVendorHal: getBgScanCapabilities(l.674) failed {.code = ERROR_UNKNOWN, .description = unknown error}
02-12 08:34:54.922   525   525 D WifiP2pService: Wifi enabled=false, P2P Interface availability=true
02-12 08:34:54.924   219   219 I hwservicemanager: Since android.hardware.wifi.supplicant@1.0::ISupplicant/default is not registered, trying to start it as a lazy HAL.
02-12 08:34:54.928   525   610 I WifiScanningService: Created a new impl for wlan0
02-12 08:34:54.929   525   610 I WifiScanningService: wifi driver loaded with scan capabilities: max buckets=16
02-12 08:34:54.965  2247  2247 I HidlServiceManagement: Registered android.hardware.wifi.supplicant@1.3::ISupplicant/default
02-12 08:34:54.967   525   630 I android_os_HwBinder: HwBinder: Starting thread pool for getting: android.hardware.wifi.supplicant@1.0::ISupplicant/default
02-12 08:34:55.027   525   607 I android_os_HwBinder: HwBinder: Starting thread pool for getting: android.hardware.wifi.supplicant@1.0::ISupplicant/default
02-12 08:34:55.040   525   544 I EthernetTracker: interfaceLinkStateChanged, iface: wlan0, up: true
02-12 08:34:55.041   525   544 I EthernetTracker: interfaceLinkStateChanged, iface: wlan0, up: true
02-12 08:34:55.080   339   339 D WifiHAL : In DebugCommand::handleResponse
02-12 08:34:55.081   339   339 D WifiHAL : len = 4, expected len = 4
02-12 08:34:55.081   339   339 D WifiHAL : In DebugCommand::handleResponse
02-12 08:34:55.081   339   339 D WifiHAL : len = 4, expected len = 4
02-12 08:34:55.087   525   607 I WifiNative: Successfully switched to connectivity mode on iface=Iface:{Name=wlan0,Id=12,Type=STA_CONNECTIVITY}
02-12 08:34:55.087   525   607 E WifiScanner: listener cannot be found
02-12 08:34:55.087   525   607 D WifiClientModeManager: entering ConnectModeState
02-12 08:34:55.089   525   607 D WifiScanRequestProxy: Sending scan available broadcast: true
02-12 08:34:55.090   525   610 I WifiScanningService: Received a request to enable scanning, UID = 1000
02-12 08:34:55.090   525   610 I WifiScanningService: scanner impls already exists
02-12 08:34:55.090   525   607 I WifiScanRequestProxy: Scanning is enabled
02-12 08:34:55.090   525   607 I WifiScanRequestProxy: Scanning for hidden networks is enabled
02-12 08:34:55.090   525   610 E WifiScanningService: wifi driver loaded received while already loaded
02-12 08:34:55.091   525   607 D WifiClientModeImpl: entering ConnectModeState: ifaceName = wlan0
02-12 08:34:55.091   525   607 D WifiClientModeImpl: setupClientMode() ifacename = wlan0
02-12 08:34:55.092   525   525 D WifiP2pService: Wifi enabled=true, P2P Interface availability=true, Number of clients=0
02-12 08:34:55.092   525   525 D WifiP2pService: Wifi enabled=true, P2P Interface availability=true
02-12 08:34:55.098   677   677 W View    : requestLayout() improperly called by com.android.keyguard.AlphaOptimizedLinearLayout{f72dd29 V.E...... ......ID 3,0-23,29 #7f0a04f2 app:id/wifi_group} during layout: running second layout pass
02-12 08:34:55.099   677   677 W View    : requestLayout() improperly called by com.android.keyguard.AlphaOptimizedLinearLayout{639729c V.E...... ......ID 3,0-23,29 #7f0a04f2 app:id/wifi_group} during layout: running second layout pass
02-12 08:34:55.103   677   677 W View    : requestLayout() improperly called by com.android.keyguard.AlphaOptimizedLinearLayout{e5c6cc6 V.E...... ......ID 3,0-23,29 #7f0a04f2 app:id/wifi_group} during layout: running second layout pass
02-12 08:34:55.102     0     0 E [dhd][wlan0] dhd_pri_stop: tx queue stopped
02-12 08:34:55.109     0     0 E [dhd][wlan0] dhd_stop: Enter
02-12 08:34:55.142     0     0 E [dhd][wlan0] dhd_stop: Exit
02-12 08:34:55.149     0     0 E [dhd][wlan0] dhd_set_mac_address: iftype = 2 macaddr = 62:34:f6:8e:7e:d2
02-12 08:34:55.150   525   544 I EthernetTracker: interfaceLinkStateChanged, iface: wlan0, up: false
02-12 08:34:55.158     0     0 E [dhd][wlan0] dhd_open: Enter
02-12 08:34:55.244     0     0 E [dhd][wlan0] dhd_open: Exit ret=0
02-12 08:34:55.249     0     0 E [dhd][wlan0] dhd_pri_open: tx queue started
02-12 08:34:55.158   525   544 I EthernetTracker: interfaceLinkStateChanged, iface: wlan0, up: false
02-12 08:34:55.257   525   544 I EthernetTracker: interfaceLinkStateChanged, iface: wlan0, up: true
02-12 08:34:55.259     0     0 E [dhd][wlan0] _dhd_set_mac_address: MACID 62:34:f6:8e:7e:d2 is overwritten
02-12 08:34:55.304   525   607 D WifiCountryCode: Reading country code from telephony
02-12 08:34:55.305   525   607 D WifiCountryCode: Set telephony country code to: 
02-12 08:34:55.306   525   607 D WifiCountryCode: updateCountryCode to CN
02-12 08:34:55.307  2247  2247 I wpa_supplicant: wlan0: CTRL-EVENT-REGDOM-CHANGE init=USER type=COUNTRY alpha2=CN
02-12 08:34:55.310   525   607 D WifiCountryCode: Succeeded to set country code to: CN
02-12 08:34:55.311   339   339 D WifiHAL : Start get packet fate command
02-12 08:34:55.311   339   339 D WifiHAL : createRequest Monitor packet fate request
02-12 08:34:55.311   339   339 E WifiHAL : Failed to register get pkt fate response; result = -95
02-12 08:34:55.312   525   607 E WifiVendorHal: startPktFateMonitoring(l.1821) failed {.code = ERROR_UNKNOWN, .description = unknown error}
02-12 08:34:55.312   525   607 W WifiDiags: Failed to start packet fate monitoring
02-12 08:34:55.312   339   339 E WifiHAL : Failed to register debug response; result = -22
02-12 08:34:55.312   339   339 E android.hardware.wifi@1.0-service: Failed to get driver version: UNKNOWN ERROR
02-12 08:34:55.313   525   607 E WifiVendorHal: requestChipDebugInfo(l.1636) failed {.code = ERROR_UNKNOWN, .description = unknown error}
02-12 08:34:55.313   525   607 I WifiVendorHal: Driver: null Firmware: null
02-12 08:34:55.314   339   339 E WifiHAL : Failed to register debug response; result = -22
02-12 08:34:55.319   525   607 E WifiVendorHal: requestChipDebugInfo(l.1636) failed {.code = ERROR_UNKNOWN, .description = unknown error}
02-12 08:34:55.319   525   607 I WifiVendorHal: Driver: null Firmware: null
02-12 08:34:55.320   339   339 E WifiHAL : Failed to register debug response; result = -95
02-12 08:34:55.321   525   607 E WifiVendorHal: getRingBufferStatus(l.1713) failed {.code = ERROR_UNKNOWN, .description = unknown error}
02-12 08:34:55.321   525   607 W WifiDiags: no ring buffers found
02-12 08:34:55.321   525   607 D WifiDiags: startLogging() iface list is {wlan0} after adding wlan0
02-12 08:34:55.398   525   607 D WifiConnectivityHelper: Firmware supported feature set: 8b8101419
02-12 08:34:55.399   525   607 D WifiConnectivityHelper: Firmware roaming is not supported
02-12 08:34:55.401   525   607 E WifiVendorHal: getWifiLinkLayerStats_1_3_Internal(l.973) failed {.code = ERROR_UNKNOWN, .description = unknown error}
02-12 08:34:55.404   525   607 I WifiClientModeImpl: disconnectedstate enter
02-12 08:34:55.407   525   607 E WifiScoringParams: Invalid frequency(-1), using 5G as default rssi array
02-12 08:34:55.418     0     0 E [dhd][wlan0] wl_run_escan: LEGACY_SCAN sync ID: 26, bssidx: 0
02-12 08:34:55.450   525   724 D WifiCountryCode: Reading country code from telephony
02-12 08:34:55.452   525   724 D WifiCountryCode: Set telephony country code to: 
02-12 08:34:55.455   879   879 D WifiTetherApBandPref: Updating band index to 1
02-12 08:34:55.461   525   580 D WifiCountryCode: Reading country code from telephony
02-12 08:34:55.464   525   580 D WifiCountryCode: Set telephony country code to: 
02-12 08:34:55.466   879   879 I sysui_multi_action: [757,853,758,4,854,wifi.tether.WifiTetherSettings/switch_bar,1089,0]
02-12 08:34:55.468   879   879 D WifiTetherSettings: updating display config due to receiving broadcast action android.net.wifi.WIFI_AP_STATE_CHANGED
02-12 08:34:55.473   525   724 D WifiCountryCode: Reading country code from telephony
02-12 08:34:55.475   525   724 D WifiCountryCode: Set telephony country code to: 
02-12 08:34:55.476   879   879 D WifiTetherApBandPref: Updating band index to 1
02-12 08:34:55.477   525   724 D WifiCountryCode: Reading country code from telephony
02-12 08:34:55.479   525   724 D WifiCountryCode: Set telephony country code to: 

二、问题分析

首先找到的异常log在这里。

02-12 08:34:54.577  2243  2243 I hostapd : wlan0: IEEE 802.11 Configured channel (0) or frequency (0) not found from the channel list of the current mode (1) IEEE 802.11g
02-12 08:34:54.577  2243  2243 W hostapd : wlan0: IEEE 802.11 Configured channel (0) or frequency (0) not found from the channel list of the current mode (1) IEEE 802.11g
02-12 08:34:54.577  2243  2243 I hostapd : wlan0: IEEE 802.11 Hardware does not support configured channel
02-12 08:34:54.577  2243  2243 W hostapd : wlan0: IEEE 802.11 Hardware does not support configured channel
02-12 08:34:54.577  2243  2243 I hostapd : wlan0: interface state UNINITIALIZED->DISABLED
02-12 08:34:54.577  2243  2243 I hostapd : wlan0: AP-DISABLED 

直接去搜索对应的错误log,在网上找到类似的bug。

https://bbs.csdn.net/topics/392434240

这里的回答是:
这个主要是没关闭wlan0 ,要先关闭,设置一下和udhcpd.conf一样 的IP ,就不会出现这个错误了。
然后我就去找对应的udhcpd.conf文件,最后在开发板的目录下找到了对应的文件
需要在wifi界面打开一次热点才会出现对应的conf文件

evk_8mp:/data/vendor/wifi/hostapd # ls
hostapd_wlan0.conf  sockets

我cat了一下conf文件里面的内容


interface=wlan0
driver=nl80211
ctrl_interface=/data/vendor/wifi/hostapd/ctrl
ssid2=416e64726f696441505f35393939
channel=0
acs_exclude_dfs=1
freqlist=2412-2462,5170-5865
ieee80211n=1
ieee80211ac=1
hw_mode=any
ht_capab=[HT40+]
vht_oper_chwidth=1
ignore_broadcast_ssid=0
wowlan_triggers=any
wpa=2
rsn_pairwise=CCMP
wpa_passphrase=70b15cf9be8d

这里ctrl_interface=/data/vendor/wifi/hostapd/ctrl
但是我在我的目录下没看到对应的ctrl文件,因为这个ctrl时打开wifi热点的控制,当wifi热点打开的时候才会有对应的ctrl。我在rk的开发板上验证后,发现会生成对应的ctrl文件,里面放的是对应的wlan0这个节点。我理解为这个节点就是用于控制热点模式和普通模式的开关控制(不知道对不对)。
…(过了两天)
后面经过验证,这个ctrl只是上层开关的一个显示,如果热点开关打开,就会有对应的ctrl文件生成,如果没有就证明打开按钮是失败的。
我试过强行把开关打开,对应的热点没有生成,这个ctrl节点也会出现。所以这个只是一个开关的显示,与真正的热点无关。

三、问题解决

询问有经验的同事,一起探讨了过后,他觉得是wifi热点选择频率出现了问题,修改了几个地方。

  1. 关闭wifi的ACS模式,
  2. 将wifi的频率设为定值2.4G
external/wpa_supplicant_8/hostapd/android.config

# Enable support of Automatic Channel Selection
-CONFIG_ACS=y
+#CONFIG_ACS=y
diff --git a/hostapd/config_file.c b/hostapd/config_file.c
index cc1855dc..825acc63 100644
--- a/hostapd/config_file.c
+++ b/hostapd/config_file.c
@@ -3170,6 +3170,7 @@ static int hostapd_config_fill(struct hostapd_config *conf,
 #endif /* CONFIG_ACS */
                } else {
                        conf->channel = atoi(pos);
+            		    conf->channel = 1;
                        conf->acs = conf->channel == 0;
                }
        } else if (os_strcmp(buf, "edmg_channel") == 0) {

经过验证,确实可以打开一次wifi热点,后面也可以连上,但是只能打开一次,算是有点小进步。

后续增加log发现:

android.hardware.wifi@1.0-service: Failed to open wlan fw path param: Permission denied
每次打不开都有这句话。
比较后发现最先出现的不正常的log也是这句话

添加log定位到对应的代码位置,发现时wifi读取路径的时候没有对应的权限。
通过adb进入开发板,

evk_8mp:/sys/module/bcmdhd/parameters # ls -l
total 0
-rw-rw---- 1 root root 4096 2022-02-21 06:23 clm_path
-rw-r--r-- 1 root root 4096 2022-02-21 06:23 clockoverride
-rw-r--r-- 1 root root 4096 2022-02-21 06:23 dhd_console_ms
-rw-r--r-- 1 root root 4096 2022-02-21 06:23 dhd_doflow
-rw-r--r-- 1 root root 4096 2022-02-21 06:23 dhd_dpcpoll
-rw-r--r-- 1 root root 4096 2022-02-21 06:23 dhd_tcm_test_enable
-rw-r--r-- 1 root root 4096 2022-02-21 06:23 disable_proptx
-rw-rw---- 1 root root 4096 2022-02-21 06:23 firmware_path
-rw-rw---- 1 root root 4096 2022-02-21 06:23 fw_ap_select
-r--r--r-- 1 root root 4096 2022-02-21 06:23 info_string
-rw-r--r-- 1 root root 4096 2022-02-21 06:23 instance_base
-rw-rw---- 1 root root 4096 2022-02-21 06:23 logtrace_pkt_sendup
-rw-rw---- 1 root root 4096 2022-02-21 06:23 nvram_path
-rw-r--r-- 1 root root 4096 2022-02-21 06:23 op_mode
-rw------- 1 root root 4096 2022-02-21 06:23 passive_channel_skip
-rw-rw---- 1 root root 4096 2022-02-21 06:23 wl_event_enable

发现权限不对,确实root权限,然而再init.rc文件里面我确实也修改了文件的所属权限:

on property:sys.boot_completed=1
    chown wifi wifi /sys/module/bcmdhd/parameters/firmware_path
    chown wifi wifi /sys/module/bcmdhd/parameters/nvram_path

但是没有任何作用。。

frameworks/opt/net/wifi/libwifi_hal/wifi_hal_common.cpp

int wifi_change_fw_path(const char *fwpath) {
  int len;
  int fd;
  int ret = 0;
  if (!fwpath) return ret;
  fd = TEMP_FAILURE_RETRY(open(WIFI_DRIVER_FW_PATH_PARAM, O_WRONLY));
  if (fd < 0) {
    PLOG(ERROR) << "Failed to open wlan fw path param";
    return -1;
  }
  len = strlen(fwpath) + 1;
  if (TEMP_FAILURE_RETRY(write(fd, fwpath, len)) != len) {
    PLOG(ERROR) << "Failed to write wlan fw path param";
    ret = -1;
  }
  close(fd);
  return ret;
}

于是我想直接再函数开始之前返回,不让他去操作文件,因为我已经把对应的固件考到了对应的目录,这里不需要再次去加载,这样应该行,

int wifi_change_fw_path(const char *fwpath) {
  int len;
  int fd;
  int ret = 0;
  
	return 0;
  if (!fwpath) return ret;
  fd = TEMP_FAILURE_RETRY(open(WIFI_DRIVER_FW_PATH_PARAM, O_WRONLY));

果然,改了就可以了。但是当我切换为2.4G和5G频段自动切换的时候(打开ACS),他还是会提示我最开始的报错,他无法自动去选择一个频段。但是没有提示权限问题,主要是扫描后无法确定通道。后面继续修改。后面就需要去追代码看错误是从那里返回的了。

评论 2
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

永不秃头的程序员

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值