Welcome to XDA

Search to go directly to your device's forum

Register an account

Unlock full posting privileges

Ask a question

No registration required
Post Reply

why wifi not working? here there is the answer...

OP Vicolodo

20th March 2014, 08:56 PM   |  #1  
OP Senior Member
Thanks Meter: 1
 
106 posts
Join Date:Joined: Oct 2011
hello,
i open this thread to collect informations about a common problem that happens after flashing new roms
this thread has generic purpose, and is not intended for a specific board...
- suggestions on how to discover the cause of the problem
- suggestions on how to fix the problem
anyone that think to have some useful informations on this issue can insert his post

i am not an expert ( and still my wifi is not working )
but i collected some informations, and i would like to share them
20th March 2014, 08:57 PM   |  #2  
OP Senior Member
Thanks Meter: 1
 
106 posts
Join Date:Joined: Oct 2011
The first thing is:
what happens when from the settings i click on wifi to turn it on
to see this, i opened a terminal emulator session
and i have written this:
adb logcat > 'some file name on a writable directory' (for example , i redirected the output to the external sd card)
here is what was written on the file (extracting from the file only the last part, that is the output related to my action of wifi activation):

D/WifiHW ( 368): Read wifi chip type OK ! wifi_chip_type = RK901
D/WifiHW ( 368): wifi_load_driver: DRIVER_MODULE_PATH = /system/lib/modules/rkwifi.ko, DRIVER_MODULE_ARG =
D/BluetoothAdapterService(1097373104)( 811): getState(): mAdapterProperties: com.android.bluetooth.btservice.AdapterProperties@ 4168aef0
D/BluetoothAdapterService(1097373104)( 811): getState(): mAdapterProperties: com.android.bluetooth.btservice.AdapterProperties@ 4168aef0
D/WifiService( 368): setWifiEnabled: true pid=870, uid=1000
D/AudioHardwareALSA( 109): Audio exiting sandby will open audio device
D/AudioHardwareALSA( 109): AudioStreamOutALSA::standby().....
D/WifiHW ( 368): wifi_load_driver: driver load failed
D/WifiHW ( 368): Unable to unload driver module "wlan": No such file or directory
E/WifiStateMachine( 368): Failed to load driver!
E/WifiStateMachine( 368): DriverFailedState

Searching on the web this string: "Read wifi chip type OK ! wifi_chip_type"
i found this:

https://github.com/aloksinha2001/pi*...22/wifi/wifi.c

into procedure check_wifi_chip_type() i saw exactly this part:

else if (0 == strncmp(buf, "RK901", strlen("RK901")) )
{
wifi_chip_type = RK901;
ALOGD("Read wifi chip type OK ! wifi_chip_type = RK901");
}


here is compared the value of string buf with "RK901"
the string buf is read from this file: "/sys/class/rkwifi/chip"

(so i suppose that this file has been written before by some other procedure)

so, i searched the caller procedure of check_wifi_chip_type():
in the same source i find this caller:

int wifi_load_driver()
{
#ifdef WIFI_DRIVER_MODULE_PATH
char driver_status[PROPERTY_VALUE_MAX];
int count = 100; /* wait at most 20 seconds for completion */
int type;
char path[64];

if (is_wifi_driver_loaded()) {
return 0;
}

strcpy(path, DRIVER_MODULE_PATH);
type = check_wifi_chip_type();
if((type == RK901) || (type == RK903) || (type == BCM4330)) {
strcpy(path, "/system/lib/modules/rkwifi.ko");
} else if (type == RTL8188CU) {
....

this procedure as first step checks if the driver is already loaded,
if not:
the driver module path is set by default to "/system/lib/modules/wlan.ko"

Then basing on the chip type is got a more specific path:
for example, for RK901/RK903/BCM4330 the path is set to : "/system/lib/modules/rkwifi.ko"

Then, is checked if the file does exist, and if not the path is seth to the default DRIVER_MODULE_PATH,
that is "/system/lib/modules/wlan.ko"


// judge if the KO file exist, if not, insmod wlan.ko
if (access(path, F_OK) < 0) {
ALOGD("DRIVER_MODULE_PATH = %s (Not such file)...", path);
strcpy(path, DRIVER_MODULE_PATH);
}


Then,
is called insmod (insert module),
to load the driver file in 'memory' (a new module into the kernel, i suppose):

if (insmod(path, DRIVER_MODULE_ARG) < 0) {
ALOGD("%s: driver load failed", __FUNCTION__);
wifi_unload_driver();
if(retry_count-- > 0) goto retry_load_driver;
return -1;
}

Looking the logcat above,
the flow in my case stops here, with : wifi_load_driver: driver load failed

so something happened in insmod:it is not able to load the file /system/lib/modules/rkwifi.ko in memory or initialize it
(the file is found, else the process should stop before, when checking access to the file)

The insmod function does this:
allocates memory for the structure name (type utsname) :
memset(&name, 0, sizeof(name));
and load the file on this area:
module = load_file(filename_release, &size);
Then is checked if the file has been loaded

if (!module)
return -1;

and finally

the module is 'initialized':

ret = init_module(module, size, args);

One of this two events went wrong, because insmod returned -1

My investigation stops here... i am not able to proceed more...
but i am open to all suggestions and hints

Thank you!!
6th April 2014, 05:51 AM   |  #3  
Senior Member
Thanks Meter: 99
 
615 posts
Join Date:Joined: Jun 2009
More
Quote:
Originally Posted by Vicolodo

The first thing is:
what happens when from the settings i click on wifi to turn it on
to see this, i opened a terminal emulator session
and i have written this:
adb logcat > 'some file name on a writable directory' (for example , i redirected the output to the external sd card)
here is what was written on the file (extracting from the file only the last part, that is the output related to my action of wifi activation):

D/WifiHW ( 368): Read wifi chip type OK ! wifi_chip_type = RK901
D/WifiHW ( 368): wifi_load_driver: DRIVER_MODULE_PATH = /system/lib/modules/rkwifi.ko, DRIVER_MODULE_ARG =
D/BluetoothAdapterService(1097373104)( 811): getState(): mAdapterProperties: com.android.bluetooth.btservice.AdapterProperties@ 4168aef0
D/BluetoothAdapterService(1097373104)( 811): getState(): mAdapterProperties: com.android.bluetooth.btservice.AdapterProperties@ 4168aef0
D/WifiService( 368): setWifiEnabled: true pid=870, uid=1000
D/AudioHardwareALSA( 109): Audio exiting sandby will open audio device
D/AudioHardwareALSA( 109): AudioStreamOutALSA::standby().....
D/WifiHW ( 368): wifi_load_driver: driver load failed
D/WifiHW ( 368): Unable to unload driver module "wlan": No such file or directory
E/WifiStateMachine( 368): Failed to load driver!
E/WifiStateMachine( 368): DriverFailedState

Searching on the web this string: "Read wifi chip type OK ! wifi_chip_type"
i found this:

https://github.com/aloksinha2001/pi*...22/wifi/wifi.c

into procedure check_wifi_chip_type() i saw exactly this part:

else if (0 == strncmp(buf, "RK901", strlen("RK901")) )
{
wifi_chip_type = RK901;
ALOGD("Read wifi chip type OK ! wifi_chip_type = RK901");
}


here is compared the value of string buf with "RK901"
the string buf is read from this file: "/sys/class/rkwifi/chip"

(so i suppose that this file has been written before by some other procedure)

so, i searched the caller procedure of check_wifi_chip_type():
in the same source i find this caller:

int wifi_load_driver()
{
#ifdef WIFI_DRIVER_MODULE_PATH
char driver_status[PROPERTY_VALUE_MAX];
int count = 100; /* wait at most 20 seconds for completion */
int type;
char path[64];

if (is_wifi_driver_loaded()) {
return 0;
}

strcpy(path, DRIVER_MODULE_PATH);
type = check_wifi_chip_type();
if((type == RK901) || (type == RK903) || (type == BCM4330)) {
strcpy(path, "/system/lib/modules/rkwifi.ko");
} else if (type == RTL8188CU) {
....

this procedure as first step checks if the driver is already loaded,
if not:
the driver module path is set by default to "/system/lib/modules/wlan.ko"

Then basing on the chip type is got a more specific path:
for example, for RK901/RK903/BCM4330 the path is set to : "/system/lib/modules/rkwifi.ko"

Then, is checked if the file does exist, and if not the path is seth to the default DRIVER_MODULE_PATH,
that is "/system/lib/modules/wlan.ko"


// judge if the KO file exist, if not, insmod wlan.ko
if (access(path, F_OK) < 0) {
ALOGD("DRIVER_MODULE_PATH = %s (Not such file)...", path);
strcpy(path, DRIVER_MODULE_PATH);
}


Then,
is called insmod (insert module),
to load the driver file in 'memory' (a new module into the kernel, i suppose):

if (insmod(path, DRIVER_MODULE_ARG) < 0) {
ALOGD("%s: driver load failed", __FUNCTION__);
wifi_unload_driver();
if(retry_count-- > 0) goto retry_load_driver;
return -1;
}

Looking the logcat above,
the flow in my case stops here, with : wifi_load_driver: driver load failed

so something happened in insmod:it is not able to load the file /system/lib/modules/rkwifi.ko in memory or initialize it
(the file is found, else the process should stop before, when checking access to the file)

The insmod function does this:
allocates memory for the structure name (type utsname) :
memset(&name, 0, sizeof(name));
and load the file on this area:
module = load_file(filename_release, &size);
Then is checked if the file has been loaded

if (!module)
return -1;

and finally

the module is 'initialized':

ret = init_module(module, size, args);

One of this two events went wrong, because insmod returned -1

My investigation stops here... i am not able to proceed more...
but i am open to all suggestions and hints

Thank you!!

Interesting... Yesterday i was trying to solve this problem caused by a cwm recovery flashing during about 8 hours with my mk809ii. I let my pc downloading about 10 different roms from other similar devices, and this morning i stay to try one by one. Finally i found "mk808B bob finless 2.1 room (jb4.2.2) with wifi APxxxx" (APxxxx is my wifi chip, i can't remember the xxxx just now) fix both wifi and bluetooth.

You did a good research, i will save your post on case i get the error again, but i think the best thing to do is to search for a compatible rom and try, with same both cpu and wifi chipset. Also now after read your post i am going to save a backup of system /lib and system /etc directories, maybe changing the wifi library files fix the error without needing of flash and reflash...

Thanks, i liked your post!

Enviado desde mi GT-P7510 usando Tapatalk 2
Post Reply Subscribe to Thread
Previous Thread Next Thread
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes