[Android Apps and Games] f3tus:
I have a problem with WiFi not coming back on Android 4.3. The "User Present" option does not help. This is what happens when phone goes to deep sleep and WiFi gets disabled, and then I have to turn airplane mode on/off to get WiFi working again (kmsg in green):

(1) DSBS puts phone to deep sleep and turns WiFi off by unloading the wlan driver completely (logcat 1.txt):

10-10 13:15:12.200 Deep Sleep On (DeepSleepOn,(Now) status network wifi WIFI_STATE_ENABLED, data false)

10-10 13:16:22.294 Wifi Off (Control wifi)

10-10 13:16:22.381 D/WifiService( 667): setWifiEnabled: false pid=25204, uid=10056
[COLOR="SeaGreen"]<6>[ 3498.432392] wlan: disconnected
<6>[ 3498.433291] ADDRCONF(NETDEV_CHANGE): wlan0: link becomes ready
<6>[ 3498.436864] cfg80211: Calling CRDA to update world regulatory domain[/COLOR]
10-12 17:05:00.381 I/wpa_supplicant(31104): wlan0: CTRL-EVENT-DISCONNECTED bssid=00:1e:e5:43:b2:eb reason=3 locally_generated=1
10-12 17:05:00.391 I/wpa_supplicant(31104): wlan0: CTRL-EVENT-TERMINATING
[COLOR="SeaGreen"]<3>[ 3498.496251] init: untracked pid 31104 exited
<6>[ 3498.737844] wlan: unloading driver v0.2.2.643
<4>[ 3498.738117] After the while loop to block rmmod
<4>[ 3498.738251] QCOM Enter edd_wlan_exit
<4>[ 3498.738384] QCOM After wlan_hdd_restart_deinit
<4>[ 3498.738776] QCOM After hdd_UnregisterWext
<4>[ 3498.738924] QCOM After sme_DisablePowerSave
<4>[ 3498.739377] QCOM After sme_RequestFullPower
<4>[ 3498.798851] QCOM After wait_for_completion (sme_RequestFullPower)
<4>[ 3498.799189] QCOM After After msleep (sme_RequestFullPower)
<4>[ 3498.799441] QCOM After unregister_netdevice_notifier
<4>[ 3498.804846] QCOM After libra_getsdio_funcdev
<4>[ 3498.805082] QCOM Claiming sd_claim_host
<3>[ 3498.806142] [31043:F :VOS] VosMCThread: MC thread signaled to shutdown
<3>[ 3498.806516] [31044:F :VOS] VosTXThread: TX thread signaled to shutdown
<3>[ 3498.919022] [760:F :SAL] WLANSAL_allow_card_removal: Done with cleanup, notifying SDCC
<3>[ 3498.919302] [760:F :SAL] WLANSAL_allow_shutdown: Done with cleanup, notifying SDCC
<6>[ 3498.919547] wlan: driver unloaded
<6>[ 3499.443194] libra_sdio_remove : Module removed.
<6>[ 3499.443521] mmc2: card 0002 removed
<6>[ 3499.927759] libra_sdioif_exit: Unloaded Successfully
[/COLOR]

(2) DSBS wakes up phone and tries to turn WiFi on, but fails (logcat 2.txt)

10-10 13:18:14.258 Deep Sleep Off

10-10 13:18:14.442 Wifi On (Control wifi)

[COLOR="SeaGreen"]<4>[ 3558.647469] Freezing remaining freezable tasks ... (elapsed 0.02 seconds) done.
<4>[ 3558.671152] Suspending console(s) (use no_console_suspend to debug)
<6>[ 3558.686139] radio-tavaruatavarua_suspend: radio suspend
<6>[ 3558.686199]
<6>[ 3558.694869] LED DEBUG: Value is 0
<7>[ 3558.701871] msm_batt_suspend: enter
<7>[ 3558.703702] msm_batt_suspend: exit
<6>[ 3558.705239] PM: suspend of devices complete after 30.658 msecs
<6>[ 3558.706849] PM: late suspend of devices complete after 1.505 msecs
<6>[ 3558.709592] PM: noirq suspend of devices complete after 2.626 msecs
<6>[ 3558.713069] PM: noirq resume of devices complete after 1.993 msecs
<6>[ 3558.715462] PM: early resume of devices complete after 1.241 msecs
<7>[ 3558.716336] msm_batt_resume: enter
<6>[ 3558.717942] wakeup wake lock: rpcrotuer_smd_xprt
<7>[ 3558.718606] msm_batt_resume: exit
<6>[ 3558.719292] LED DEBUG: Value is 0
<6>[ 3558.727026] radio-tavaruatavarua_resume: radio resume
<6>[ 3558.727084]
<6>[ 3558.732351] PM: resume of devices complete after 16.761 msecs
<4>[ 3558.746479] Restarting tasks ...
<6>[ 3558.752777] rmt_storage_ioctl Entered
<4>[ 3558.769486] done.
<6>[ 3558.771417] PM: suspend exit 2013-10-12 15:06:12.043058334 UTC
<6>[ 3558.771679] suspend: exit suspend, ret = 0 (2013-10-12 15:06:12.043338334 UTC)
<6>[ 3558.772084] active wake lock mmc2_detect
<6>[ 3558.772301] active wake lock mmc1_detect
<6>[ 3558.772669] active wake lock alarm_rtc, time left 95[/COLOR]
[...]
10-10 13:18:14.481 D/WifiService( 667): setWifiEnabled: true pid=25204, uid=10056
[COLOR="SeaGreen"]<6>[ 6404.011350] libra_sdioif_init: Loaded Successfully
<6>[ 6404.328050] wlan: loading driver v0.2.2.643_20130130
<4>[ 6404.328360] ldo17: Failed to create debugfs directory
<4>[ 6404.328519] smps3: Failed to create debugfs directory
<4>[ 6404.328757] ldo11: Failed to create debugfs directory
<4>[ 6404.328899] ldo19: Failed to create debugfs directory
<4>[ 6404.329132] ldo05: Failed to create debugfs directory
<4>[ 6404.329274] ldo06: Failed to create debugfs directory
<3>[ 6404.333050] [746:F :HDD] hdd_module_init: Libra WLAN not detected yet.
<3>[ 6404.587980] [746:F :HDD] hdd_module_init: Libra WLAN not detected yet.
<3>[ 6404.846982] [746:F :HDD] hdd_module_init: Libra WLAN not detected yet.
<3>[ 6405.106969] [746:F :HDD] hdd_module_init: Libra WLAN not detected yet.
<6>[ 6405.170040] mmc2: new high speed SDIO card at address 0002
<6>[ 6405.173055] libra_sdio_probe: success with block size of 256 device_id=0x2881
<3>[ 6405.366994] [746:F :HDD] hdd_module_init: Libra WLAN detecton succeeded
<4>[ 6405.367517] WLANSAL_Open Address=bf0121fc[/COLOR]
10-10 13:20:14.592 E/WifiStateMachine( 667): Failed to load driver

kmsg shouldn't say "<6>[ 3498.919547] wlan: driver unloaded" in log 1 if WiFi was turned off normally.

Also, this is how log 2 should look like if WiFi was turned back on successfully:

10-12 16:54:49.179 D/WifiService( 680): setWifiEnabled: true pid=25719, uid=10056
10-12 16:54:51.949 I/wpa_supplicant(29111): Successfully initialized wpa_supplicant
10-12 16:54:53.519 I/wpa_supplicant(29111): rfkill: Cannot open RFKILL control device
10-12 16:54:53.989 I/wpa_supplicant(29111): wlan0: Trying to associate with 00:1e:e5:43:b2:eb (SSID='xxxxxx' freq=2437 MHz)
10-12 16:54:54.039 E/WifiConfigStore( 680): Error parsing configurationjava.io.FileNotFoundException: /data/misc/wifi/ipconfig.txt: open failed: ENOENT (No such file or directory)
10-12 16:54:54.179 I/wpa_supplicant(29111): wlan0: Associated with 00:1e:e5:43:b2:eb
10-12 16:54:54.179 I/wpa_supplicant(29111): wlan0: CTRL-EVENT-CONNECTED - Connection to 00:1e:e5:43:b2:eb completed (auth) [id=1 id_str=]
10-12 16:54:54.229 E/WifiHW ( 680): Unable to open connection to supplicant on "/data/misc/wifi/sockets/p2p0": No such file or directory
10-12 16:54:55.099 D/WifiStateMachine( 680): VerifyingLinkState enter
10-12 16:54:55.119 D/WifiStateMachine( 680): VerifyingLinkState GOOD_LINK_DETECTED: transition to captive portal check
10-12 16:54:55.119 D/WifiStateMachine( 680): CaptivePortalCheckState enter
10-12 16:54:55.129 D/ConnectivityService( 680): Captive portal check NetworkInfo: type: WIFI[], state: CONNECTING/CAPTIVE_PORTAL_CHECK, reason: (unspecified), extra: "xxxxxx", roaming: false, failover: false, isAvailable: true, isConnectedToProvisioningNetwork: false
10-12 16:54:55.129 D/ConnectivityService( 680): handleCaptivePortalTrackerCheck: call captivePortalCheckComplete ni=NetworkInfo: type: WIFI[], state: CONNECTING/CAPTIVE_PORTAL_CHECK, reason: (unspecified), extra: "xxxxxx", roaming: false, failover: false, isAvailable: true, isConnectedToProvisioningNetwork: false
10-12 16:54:55.139 D/WifiStateMachine( 680): CaptivePortalCheckState CMD_CAPTIVE_CHECK_COMPLETE
10-12 16:54:55.159 D/ConnectivityService( 680): ConnectivityChange for WIFI: CONNECTED/CONNECTED
10-12 16:54:55.189 D/Nat464Xlat( 680): requiresClat: netType=1, hasIPv4Address=true