[Fire TV General] xenyz:
This is a bit of a back story for those interested, or for those who this will happen to, to help people find this thread by including a bunch of possible symptoms, skip to the end for the tl;dr heads-up.

So over the past two days I've been struggling to figure out why a heavily customized Fire Stick I use all of a sudden stopped connecting to the network.

On Tuesday I just happened to upgrade my wireless router's firmware (asuswrt merlin fork for the R7000 called XWRT, but irrelevant to the problem) and was very happy with the new release. All my other devices on the network were working well, and I decided to go downstairs and watch something on the Fire TV Stick.

The first indication that something was wrong was in SPMC (Kodi), not being able to apply any add-on updates, and not being able to connect to a local FTP server with media. I first thought that the wireless network has to be 'forgotten' and signed onto again to fix some low level change in the router's wireless driver conflicting with the Fire stick's wireless driver.

Before I planned on doing this, I first connected to the stick via wireless ADB and hit 'su' at the prompt, getting ready to poke around in dmesg/logcat. I then did one troubleshooting step, try another app to see if it just was Kodi that was having trouble. I loaded up Youtube and it played a video just fine.

I went back to the computer to use the adb shell, when it all of a sudden disconnected. I couldn't reconnect, so I decided to restart the Fire Stick to get everything sorted out.

When the Fire Stick restarted, it wasn't connected to wireless any longer. When I went into Fire TV network settings, not only did I not see my wireless networks, but there were zero other options - no 'Join', 'WPS entry', no options whatsoever. This was the beginning of the two day hassle.

My Fire stick is on firmware 5.2.10 rooted with Kingo root exploit, and loaded up with Xposed from tips on the guide by sconnyuk. Two xposed modules were installed, Youtube ad-away and rbox mods (to enable the use of Firestopper home screen). Other root-related apps installed included AdAway, Busybox, Kernel adiutor, etc.

I also had a bunch of Amazon packages disabled to 'de-bloat' the limited memory:

# pm list packages -d
package:com.amazon.precog
package:com.amazon.recess
package:com.amazon.whisperplay.contracts
package:com.amazon.bueller.photos
package:com.amazon.kindle.cms
package:com.amazon.client.metrics
package:com.amazon.device.software.ota
package:com.kingouser.com
package:com.amazon.whisperlink.core.android
package:com.amazon.application.compatibility.enforcer
package:com.amazon.whisperplay.service.install
package:com.amazon.device.software.ota.override
package:com.amazon.bueller.music

Originally I thought it was something I did to the stick, with these heavy customizations. I brought the laptop down and plugged it in to do some USB ADB debugging.

The first thing I noticed was in the kernel log,

# dmesg
[...]
<6>[ 42.472473] CFG80211-ERROR) wl_event_handler : was terminated
<4>[ 42.472717] wl_destroy_event_handler(): thread:wl_event_handler:4d0 terminated OK
<6>[ 42.685516] usb 1-1: new high speed USB device number 3 using bcm-ehci
<6>[ 42.852508] usb 1-1: New USB device found, idVendor=0a5c, idProduct=bd1f
<6>[ 42.852569] usb 1-1: New USB device strings: Mfr=1, Product=2, SerialNumber=3
<6>[ 42.852722] usb 1-1: Product: Remote Download Wireless Adapter
<6>[ 42.852783] usb 1-1: Manufacturer: Broadcom
<6>[ 42.852905] usb 1-1: SerialNumber: 000000000001
[b]<4>[ 43.262603] wifi_platform_prealloc: failed to alloc static mem section 7[/b]
<6>[ 43.262725] usbcore: deregistering interface driver dbus_usbdev
<4>[ 43.262939] found wifi platform device bcmdhd_wlan
<4>[ 43.263092] unregister wifi platform drivers
<4>[ 43.263153] CSP bus_remove_driver bcmdhd_wlan node address is c300709c
<4>[ 43.263305] CSP klist_remove node is c300709c
<4>[ 43.263366] CSP klist_del
<4>[ 43.263427] CSP klist_put
<4>[ 43.263549] CSP klist_release setting woken == 1 waiter node c300709c waiter process c90a52c0 node c300709c
<4>[ 43.263610] CSP klist_remove waiting waiter node c300709c waiter process c90a52c0
<4>[ 43.263732] CSP bus: 'platform': remove driver bcmdhd_wlan

When I first saw the 'wifi_platform_prealloc: failed to alloc static mem section 7' line I went 'uh-oh' thinking it was some sort of hardware failure, maybe the stick was running 100% CPU and cooked something, etc. I didn't really understand what this really meant and tried a bunch of hardware solutions: hard power cycle the stick, try a different power supply, leave it unplugged for 5 minutes, leave unplugged for 5 hours, etc. I couldn't sort out why it was unloading the wifi driver...

Then I tried some software fixes, re-enabling all packages, reverting /etc/hosts, deleting the saved network from /data/misc/wifi/wpa_supplicant.conf, svc wifi disable / enable, even so far as to go poking into /data/data/com.android.providers.settings/databases/settings.db with sqlite3 turning airplane mode on/off, wifi_on off/on, etc. Just anything I could think of to trigger something.

I finally gave up the first night and left it unplugged just to be safe, and thought about my options. Since I've so heavily modified the stick, I wasn't 100% certain that a Factory Reset would work, with the obvious issue of bringing up the wireless hardware properly in order to get past the Amazon sign-in to re-enable ADB debugging. If something was really wrong, this would end up as a brick with no network and no ADB access.

I'm still not sure about that part, but I'm sure glad I waited and thought about things a bit more, as you'll see. :)