synescu, on 26 May 2012 - 08:02 AM, said:
/mlog +insmod -f /modules/libertasspi.ko
It seems to me your hardware and modules files are okay. These are the lines that I am looking for which is a good sign:
<6>[ 474.266237]( insmod) libertas_spi: Libertas SPI driver
<4>[ 475.760329]( insmod) Sanya: Power On wlan
<6>[ 475.761038]( insmod) libertas_spi spi1.0: firmware: requesting libertas/gspi8686_hlp.bin
<6>[ 476.158740]( insmod) libertas_spi spi1.0: firmware: requesting libertas/gspi8686.bin
<6>[ 476.455511]( insmod) libertas: 00:21:19:ba:90:ac, fw 9.70.10p0, cap 0x00000303
<4>[ 476.463046]( insmod) txpower:18 min:4 max:20
<6>[ 476.473278]( insmod) libertas: wlan0: Marvell WLAN 802.11 adapter
I think we need a few more rounds of these - so instead I will outline the troubleshooting procedures here so that you can try it all yourselves and others might find it useful. It will be a bit lengthy though, mind you. First we need to understand how the wifi stuff are put together in Android.
1. Kernel has a compiled in wifi driver call Libertas, which loads at boot (normally it won't spit any message in kernel log)
2. When you press the wifi on in the android interface, the android framework will load a second piece of driver named "libertasspi" spi is the SPI bus interface where the hardware card is connected. This is equivilent to you running "insmod /modules/libertasspi.ko" in a terminal. When you do a dmesg you'll see the above quoted message if the module is successfully loaded, together with the wlan firmware. Any error will show up in the kernel log (using the command "dmesg" or my mlog script.)
3. Note that there are kind of modules versioning problem - i.e. you use a different set of module files than that is required by that particular kernel zImage. That won't work - though sometimes, you might get it working by doing a "insmod -f /modules/libertasspi.ko" - the "f" parameter tells the kernel to load the module by force. Not a good thing in general - but it might provide you will more useful error messages nevertheless. It is noteworthy that android won't do a -f, so if the module is for a different zImage, it won't even attempt to forcefully load it, and report a "Wifi error" right away.
Then a couple of things will happen fast here. See init.rc:
service wpa_supplicant /system/bin/wpa_supplicant -Dwext -iwlan0 -c/data/misc/wifi/bcm_supp.conf
service dhcpcd /system/bin/dhcpcd -BKL wlan0
4. Android will then try to start the wpa_supplicant which was originally used for connecting WPA protected networks - but Google hacked it and turn it into a android<->hardware communication software and to issue wifi hardware commands via this piece of software. When it runs you'll see something like this in kernel log:
[ 1028.016935]( init) init: starting 'wpa_supplicant'
[ 1033.297673]( wpa_supplicant) libertas: Unknown PRIVATE command RXFILTER-ADD 0, ignored
[ 1033.298463]( wpa_supplicant) libertas: Unknown PRIVATE command RXFILTER-ADD 1, ignored
[ 1033.299200]( wpa_supplicant) libertas: Unknown PRIVATE command RXFILTER-ADD 3, ignored
[ 1033.299933]( wpa_supplicant) libertas: Unknown PRIVATE command RXFILTER-START, ignored
[ 1033.301539]( wpa_supplicant) libertas: Unknown PRIVATE command BTCOEXSCAN-STOP, ignored
They are harmless and is an evidence that wpa_supplicant is running. As you can see from the command line parameter you'll see it expects a config file /data/misc/wifi/bcm_supp.conf This file could be troublesome. I usually delete it (after backup of course) and let it generate a fresh copy. You can use the following commands in a terminal and reboot afterwards:
mv /data/misc/wifi/bcm_supp.conf /data/misc/wifi/bcm_supp.conf.bak
chmod g+w /data/misc/wifi/
5. The next one in init.rc is a dhcp client to obtain IP address when being connected to a wifi SSID. Nothing special here - it's just will run and directly exits when you have no network joined, and thus you'll see those lines "untracked pid XXXX exited" all the time. Normal kernel message would look like:
[ 2392.631228]( init) init: processing action 0x2f658 (property:init.svc.wpa_supplicant=running)
[ 2392.631806]( init) init: starting 'dhcpcd'
6. Back to android - normally, you'll need to configure some settings in Wi-Fi settings->Menu->Advanced->Regulatory domain. Also, make sure you don't use static IP in the same page.
7. Android should now be scanning for available APs. Trouble is sometimes it won't scan due to some weired reasons. Do the following in a terminal:
ifconfig wlan0 up
and you will get the scan results in the terminal, and soon appear in the android UI. It should be almost everything.
If you turn on wifi in android and receive the "wifi error" in the user interface, it's probably related to the driver/firmware loading. It could be anything like missing file, corrupted file, mismatched file, kernel bugs, file and directory permissions, etc. It should be quick to get into that error state and is usally within seconds. But if you are not receiving "wifi error", it might be one or more steps outlined above has problems. Try to make sure the config files (including init.rc) has the relavant sections, and the files it requests are in place and are accessible.
Lastly, a quick way is to reload the original cm beta2 kernel and modules and see if it works well or not. Hope this piece is useful for you all.