[X Play Q&A, Help & Troubleshooting] RoDeltaLambda:
Edit: Considering all the complex processes that I've done, I'm willing to do some series of steps again with the gathered knowledge, but I still need some guidance.

Actual status: Losing my mind (not fixed)

Here's the info of my current problem:

I have a XT1563, cid12 (cl)

Working perfectly until android 6.0 OTA. After restart, in the wifi screen loading bar is constantly present and switches itself off after a couple of seconds of activated. Network list is empty, mac address appears as 02:00:00:00:00:00 in wifi details and status of the phone.

Sent it to support and they 'updated the software', when I got it back wifi was working, but when I installed sd and sim cards back it stopped working.

The most relevant logcat message that appears to be the main one is from WifiStateMachine:

WifiStateMachine: Fail to set up pno, want false now false
WifiStateMachine: Failed to load driver

Things I've done

Most of this steps have been tried with clean installs and removing sd/sim cards

Network Reset

Factory Reset

Flash different stock roms (currently on 6.0.1 MPD24.107-52)

Flashed ultra kernel R2, R3 and squid kernels 14, 15, 15 oc, 15b

Used twrp 2.8.7 and 3.0.0-r2

Used rsd to flash official firmware for my carrier (RETLA-ENTEL_6.0_MPD24.65-25.1)

Flashed CM 12 and CM 13 unofficial

Installed SuperSU and Busybox

Changed owners and permits in persist/

Copied new persist from different sources

Hex edited .bin file in persist/

downloaded WCNSS_wlan_dictionary.dat and put it in persist to comply with symlink in prima/

fastboot oem install [2 of my carriers; entel, claro]

Replaced WCNSS files in persist with the ones available the motorola repo

Copied WCNSS factory file to prima/ folder

Copied WCNSS_qcom_cfg.ini to /data/misc/wifi

went crazy with 776 permissions

Even after flashing stock with RSDLite, bootloader show the modified status as 3 when I think it should be 2. This has led me to think that something is in the file system that android does not like but is not being fixed by RSD nor clean wipes.

From what I understand, the only thing that could be surviving full flashes and wipes are contents in persist/ and modifications to the root of the system, like busybox and superSU. I've not been able to find any way of cleaning the root of the phone and I imagine that's really dangerous.

TL;DR Wifi driver is not loading, persist folder is ok and clean flash does not fix it.

Possibly relevant logcat entries:

E WifiService: Invoking mWifiStateMachine.setWifiEnable

D WifiStateMachine: setting operational mode to 1

E WifiHW : User build,dont Start logging service.

E WifiService: Invoking mWifiStateMachine.setWifiEnabled

E WifiStateMachine: Failed to load driver

D WifiStateMachine: setWifiState: unknown state

Info for nerds:

Source code of WifiStateMachine.java containing the error message:

public boolean processMessage(Message message) {
switch (message.what) {
case CMD_START_SUPPLICANT:
[B]if (mWifiNative.loadDriver())[/B] {
// Code for loading supplicant
} else {
loge("Failed to load driver");
}
break;
# More code
}
}

WifiNative.java cointains the class being instantiated where the evaluation calls a empty abstract method:

public native static boolean loadDriver();

I'm having problems for identifying where this class is being extended for this method to actually do something. If anyone knows please leave a comment.