Debug the RT3070 WiFi module on Android 4.2

Source: Internet
Author: User

Android4.2 debug the RT3070 WiFi Module


After four days, I finally learned something. Let's summarize it today.

Monday 1. Test the WiFi module on PC ubuntu
Two results are obtained. ubuntu12.10 is the driver that supports this WiFi module, such as rt2x00usb and rt2x00lib. The product id is 148f: 3070. It also brings some confusion. How can there be so many modules? Rtl8192cu is a module. What should I do on Android? I learned that the drivers of standard linux are not synchronized with those of various manufacturers. The former requires the latter, so I continue to do the following.
  
Remove the Wi-Fi module to learn the specific model
The model is a bit fuzzy. The best way to understand the specific model is to split the machine and directly look at the model on the chip. This will not be blurred at all, so I split the WiFi module, the chip model is as follows:
RalinkRT3070LTPKY371F91234PT: make sure its real model is RT3070!
2. Find the latest official driver
Find it here! No.: This model is now incorporated into MTK ).
RT3070 DRIVER: http://www.mediatek.com/_en/07_downloads/01_windows.php? Sn = 501
3. Compile the driver module
The compilation process is twists and turns, but the process is retained (here), recorded with GIT, and recorded every change. Here, let's take a look at git log:
Commit 2f3f683eec43ce123017b5302002e14e01367a2bAuthor: ybk Date: Thu Dec 26 10:59:28 2013 + 0800 Change fw path
Commit 742c1b56450de3f1ea79b59aae688c5d8cf30561author: kangear Date: Wed Dec 25 16:29:52 2013 + 0800 Location and name of the updated ifname and if2name
Commit 1334bbcffc59321fee262d5ca1_a5208a85da6author: ybk Date: Wed Dec 25 13:08:03 2013 + 0800 Add module_param ifname if2name
Commit 35bed3ef00ed8ff38238d18a3895f05fc490d7beAuthor: ybk Date: Tue Dec 24 14:39:11 2013 + 0800 Fix: Supplicant not running, cannot connect
Commit ed54e07e671c903e0cf74171d185ad43240c0a33author: ybk Date: Tue Dec 24 14:23:55 2013 + 0800 V1.0 succeed cmd
Commit 7c0d98a75ab0df239c0defc4f09a27b13d9fd801Author: ybk Date: Tue Dec 24 14:18:49 2013 + 0800 0.0 version
Today's main reference documents:
1. Transplantation of arm + linux for wifi module rt3070
2. android wifi ralink rt3070 development record
The situation on Tuesday is not optimistic. I almost want to give up because I have not compiled the WiFi driver module for Android. I subconsciously think that the driver module I compiled must be missing something. At least the driver module can be compiled now, and the kernel module can be inserted normally. However, I did not see the wlan or other modules through busybox ifconfig.
1. Find the network interface
The most important thing to debug the Android driver is to determine which layer of the problem is to be solved by one layer. Layers are loose coupling, so you can debug a layer separately. The network interface is not visible now. Where is the problem? Read this article "portable arm + linux for the wifi module rt3070" and see ifconfig and the parameter-a. So check out what this means and show all network interfaces, if yes, ra0 appears. I was so excited that I changed the interface name to wlan0, which is determined by the driver compilation.
2. manually start and scan the AP.
(1). # busybox ifocnfig-a # view all network interfaces
(2). # busybox ifconfig wlan0 up # use this Nic
(3). # iwlist wlan0 scan # search for the AP and write down the ESSID. Here we use ChinaNet as an example.
(4). # iwconfig wlan0 essid ChinaNet # connect to an ESSID without a password. In order to test the function, set a password-less essid.
(5). # dhcp wlan0 # obtain the IP address
(6). # busybox ifconfig # Check the NIC status. You can see that the IP address has been obtained successfully.
(7). # ping 115.29.210.26 # ping Baidu ip first. (It is best to ping Baidu, which is not recommended by Google)
(8). # ping www.baidu.com # successfully ping the Baidu domain name.


On Wednesday, I did a lot of chores. I planned the firmware path, which is still related to driver compilation. I just needed to re-compile the driver. The focus is to manually start wpa_supplicant. Wpa_supplicant:
Supplicant not running, cannot connect.
1. manually start wpa_supplicant
When there is no problem with the driver module, I will force it on the road, but when it is opened from Settings, the module is thrown into success-"wpa_supplicant startup failed, so you need to find the reason why it cannot be started.
I encountered two questions. We can see that the wext protocol was used to start the program. Currently, several Android BSP instances are started with nl80211. The wext Protocol is applicable to the RT3070 protocol. After wpa_supplicant is started normally, the startup end will have a response, which can be seen from/proc/kmsg. The final startup parameters are as follows:
service rt_supplicant /system/bin/wpa_supplicant \    -Dwext -iwlan0 -c/data/misc/wifi/wpa_supplicant.conf    #-Dnl80211 -iwlan0 -puse_p2p_group_interface=1 -e/data/misc/wifi/entropy.bin    #   we will start as root and wpa_supplicant will switch to user wifi    #   after setting up the capabilities required for WEXT    #   user wifi    #   group wifi inet keystore    class main    socket wpa_wlan0 dgram 660 wifi wifi    disabled  Oneshot


Add it to init. rk30board. rc and start rt_supplicant in hardware/libhardware_legacy/wifi. c. To distinguish wpa_supplicant started with other protocols.
Road Accident
This time, the Wi-Fi module was taken on the road again, and the process was opened directly from Settings. unexpectedly, the Wi-Fi module went on normally and found the AP smoothly. Test network connection. Everything is OK.


On Thursday, we have to sort out the code and documents. These two items are not trivial. Organize the Code, including the standard code and remove the added debugging information. The document is recorded because the memory disappears, but the recorded text does not. Therefore, keep a good record of the document.
Type: RT3070
Module: rt3070sta. ko
Parameter: ifname = wlan0 if2name = p2p0
Protocol: wext
Firmware:/etc/firmware/RT2870STA. dat

In the final optimization, there is still a problem with the AP mode. You can solve it in the next time. The specific error is: Unable to open connection to supplicant on "/data/misc/wifi/sockets/p2p0": No such file or directory


Related Article

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.