Porting the WiFi module

Source: Internet
Author: User

This article takes the Realtek 8192CU WiFi module as an example to introduce the USB WiFi in Jelly Bean 4.1 debug notes.

1, WiFi does not open the phenomenon overview

WiFi does not open refers to you in the UI settings under the WiFi option, set it to ON (open), but the end result is automatically turned off (off), the Wi-Fi is turned on, scanning, and so on a series of not normally open WiFi prompt.

2, the problem analysis process

WiFi does not open from the hardware and software are two aspects of positioning, usually the first hardware, and then software. Overall analysis Process

3, confirm that the hardware can be identified

8192CU WiFi module is based on USB interface, in the UI set WiFi to on state, through the serial port input LSUSB confirm the device can be recognized.

Red Flag Bus 002 Device 003:id 0bda:8176 is the platform on the 8192CU USB WiFi vid and PID, can display this description system can normally identify 8192CU USB WiFi device, hardware is OK.

4. Verify that the driver is loaded

After verifying that the hardware is fine, then check to see if the driver is loaded, lsmod.

When you put WiFi on the UI in the settings, if it can open normally, then in the serial port input lsmod, there will be the following results

Red Flag 8192cu Ko, indicating that the 8192CU WiFi driver has been successfully loaded, if you do not see this KO file, please switch to the Platform/system/lib/directory, see if there is 8192CU ko in this directory.

You can see the 8192cu.ko under the platform. If you have this file under the platform, please go to 5 for further analysis, if your platform does not have this file, please go to 6 for further analysis.

5, the Platform/system/lib drive KO file

First make sure that its permissions are at least-rw-r--r--(that is, 644), and if the permissions are not correct, modify the permissions as follows:

chmod644 8192cu.ko

If these are normal, please manually load them first.

Manual load Operation instructions: first switch to the platform/system/lib/directory, and then do the following:

Insmod8192cu.ko

If the manual loading succeeds, go to a for the next analysis, if the manual loading is unsuccessful, go to B for the next analysis

A. Manual loading can be successful, stating that the UI loading is not successful and that the system configuration file is incorrect and there is no driver loaded into the specified path.

If you are Android 4.1 please follow the configuration below:

Make sure that the following configuration is in the device\xxx boardconfig.mk file:

Wifi_driver: = RTL8192CU

Wifi_driver_module_path: =/system/lib/8192cu.ko

Wifi_driver_module_name: = 8192CU

Where wifi_driver specifies what driver you want to load from the UI to open the WIFI, Wifi_driver_module_path explains where you want to load the driver's Ko file, and Wifi_driver_module_name indicates the name of the driver module.

B. Manually loaded drivers are also unsuccessful, typically for two reasons:

(1) Compile the kernel without the CFG80211 protocol, for the G18 board this is the default configuration, if not configured, before you compile the kernel, you first enter the common directory, input make menuconfig, with networkingsupport content

(2) Compile-driven kernel and your current platform running kernel is not the same code, this from the manual loading of the unsuccessful log can be clearly seen, so be sure to make the compiler-driven kernel and your current platform running the kernel is the same code. The safest approach is to repackage the upgrade

For both of these reasons, it is easy to see that the magic number does not match when the log from the load driver is unsuccessful.

6. No drive KO file under platform/system/lib

You need to compile 8192CU ko file, drive in Common/drivers/net/wireless/rtl8xxx_cu. Copy it to the/system/lib/directory and modify its permissions, and modify the permissions command as follows:

chmod644 8192cu.ko

Note: When compiling the 8192CU driver, the kernel code that is guaranteed to compile the driver and the kernel code that the system is running is the same code, otherwise the KO file is not loaded, it will prompt the compilation of the driver and the current system kernel version does not match the error message.

If this is still not loading, follow the steps below to package the upgrade.

(1) First configure the corresponding file according to a 6

(2) Compile the 8192CU driver 8192cu.ko and copy it to the DEVICE\XXX

(3) Package upgrade.

After these positioning and resolution, from the UI of the settings load WiFi driver should be no problem, normal to this step when the UI can display the WiFi scan to the different APS, but also do not exclude WiFi or open, this time can not open the main phenomenon, will WiFi as on, found a flash, and turned off, there is the interface "is open Wi-Fi ...", there is a display is scanning, this time the problem may be in wpa_supplicant

This piece, please go to 8 for further analysis.

8. Wpa_supplicant Analysis

Confirmation of 8.1 wpa_supplicant related documents and services

(1) Confirm the existence of wpa_supplicant under platform/system/bin/:

The operation steps are described below:

130| [Email protected]:/system/bin# ls-l wpa_supplicant

-rwxr-xr-x root Shell 686672 2008-08-01 12:00

Also ensure that the file operation attribute is at least-rwxr-xr-x (755)

(2) for Android 4.1 confirm device\xxx The following service is present in init.rc

Service p2p_supplicant/system/bin/wpa_supplicant \

-ip2p0-dnl80211-c/data/misc/wifi/p2p_supplicant.conf\

-e/data/misc/wifi/entropy.bin-puse_p2p_group_interface=1\

-n-iwlan0-dnl80211-c/data/misc/wifi/wpa_supplicant.conf

Class Main

Socket wpa_wlan0 Dgram 0660 WiFi wifi

Disabled

OneShot

Service wpa_supplicant/system/bin/wpa_supplicant \

-iwlan0-dnl80211-c/data/misc/wifi/wpa_supplicant.conf\

-e/data/misc/wifi/entropy.bin

Class Main

Socket wpa_wlan0 Dgram 0660 WiFi wifi

Disabled

One of the p2p_supplicant is when WiFi is started as a peer to function, Wpa_supplicant is wifi as station function to start the service.

8.2 Turn WiFi on, find a flash and turn off

There are two main cases for this phenomenon:

(1) Wpa_supplicant and p2p_supplicant configuration files are missing from the platform

Confirm that there are wpa_supplicant.conf and p2p_supplicant.conf files in the platform/data/misc/wifi/directory, and confirm these file operation permissions, the operation instructions are as follows:

130| [Email protected]:/data/misc/wifi# ls-l *supplicant.conf

-RW-RW----System WiFi 219 2013-07-03 03:28p2p_supplicant.conf

-RW-RW----System WiFi 374 1970-01-02 00:35wpa_supplicant.conf

(2) Confirm the interface provided by WiFi:

This part is mainly you want to clear what WiFi as function, that is, WiFi is only as station function, or to turn on peer-to function, when the WiFi as station function when the opening is Wpa_supplicant service, when WiFi as peer-to open is peer _SUPPLICANTF Services.

When the WiFi as station function is turned on is wpa_supplicant, this time generally do not appear interface error, because this time wpa_supplicant service only use Wlan0 interface, The Wlan0 interface is generated by default even if the upper layer does not define the wlan0 underlying driver

When Wi-Fi is turned on as a peer, the interface error may occur because the P2p_supplicant service uses the P2p0 interface, so you need to define the p2p0 in advance p2p_supplicant.

If you do not define the P2p0 interface, but sometimes the P2p_supplicant service is started at the time of loading, because the P2p_supplicant service will use the P2p0 interface, the load failure occurs. So how can you make the system not start the P2p_supplicant service first, but start the Wpa_supplicant service first? This is because your platform/etc/permisssions/directory has android.hardware.wifi.direct.xml this file, as long as the file is deleted or renamed, after the change, remember to reboot to take effect, the operating instructions are as follows:

130| [Email protected]:/etc/permissions# ls-l

-rw-r--r--root root 158 2008-08-01 Amlogic.libplayer.xml

-rw-r--r--root Root 2008-08-01 12:00amlogic.pppoe.xml

-rw-r--r--root Root 168 2008-08-01 12:00amlogic.subtitle.xml

-rw-r--r--root root 975 2008-08-01 Android.hardware.usb.accessory.xml

-rw-r--r--root root 868 2008-08-01 android.hardware.usb.host.xml

-rw-r--r--root root 843 2008-08-01 android.hardware.wifi.direct.xml

-rw-r--r--root Root 829 2008-08-01 android.hardware.wifi.xml

-rw-r--r--root Root 1050 2008-08-01 android.software.live_wallpAPer.xml

-rw-r--r--root Root 880 2008-08-01 12:00android.software.sip.voip.xml

-rw-r--r--root Root 828 2008-08-01 12:00com.android.location.provider.xml

-rw-r--r--root root 828 2008-08-01 12:00com.google.widevine.software.drm.xml

-rw-r--r--root Root 10536 2008-08-01 platform.xml

-rw-r--r--root Root 2614 2008-08-01 12:00tablet_core_hardware.xml

How do you tell if it's p2p_supplicant or wpa_supplicant? Since you started the P2p_supplicant service without defining p2p0, it is clear that the following log is visible from log:

Wpa_supplicant (4316):p 2p0:failed to initialize driver interface

Tip: To avoid this type of error when the interface fails to load, follow these settings:

For Android 4.1, make sure that the boarconfig.mk in the Device\xxx directory is as follows:

Wifi_driver_module_arg: = "Ifname=wlan0 if2name=p2p0"

9. "Opening Wi-Fi ..." is on the UI.

This phenomenon generally has the following situations:

(1) Missing configuration file: Follow 8 steps to confirm

(2) The driver fails to load, so that the underlying network interface is not generated, so that supplicant to the underlying network interface initialization failed, but supplicant will try to repeat the initialization several times, if the constant initialization after a period of time will still fail, eventually supplicant exit, the UI WiFi turned off.

How to view the interface of the WiFi module under the platform has not been generated, directly in the serial input NETCFG command, operation as follows:

130| [Email protected]:/# netcfg

Lo up 127.0.0.1/8 0x00000049 00:00:00:00:00:00

Eth0 down 0.0.0.0/0 0x00001002 00:56:0b:d9:59:65

Sit0 down 0.0.0.0/0 0x00000080 00:00:00:00:00:00

Ip6tnl0 down 0.0.0.0/0 0x0000008000:00:00:00:00:00

Wlan0 up 192.168.0.138/24 0x00001043 34:08:04:df:9a:63

P2p0 up 0.0.0.0/0 0x00001003 36:08:04:df:9a:63

This is the result of my operation on my own machine, the red labeled Wlan0 and P2P0 interfaces are the two interfaces that the WiFi module generates to communicate with supplicant.

(3) The underlying WiFi module does already have the corresponding interface in the system, but supplicant the initialization of these interfaces failed, mainly because the underlying driver provides supplicant interface function has problems, this is generally the underlying driver problem, please feedback to the author further analysis.

10. "Scanning ap ..." is on the UI.

Generally this phenomenon should be supplicant and the underlying WiFi driver communication problems, please feedback to the author analysis.

Porting the WiFi module

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.