第一掌:编译KO文件,生成rt3070sta.ko
编译时提示如下错误:
错误:
./include/generated/autoconf.h:708: fatal error: /home/lqm/share/V210/samsung/kernel/include/config/modversions.h: No such file or directory
这是因为内核中没有开启模块版本管理选项,在内核的menuconfig中做如下配置:
make menuconfig
[*] Enable loadable module support --->
[*] Module versioning support
重新编译内核后,再编译RT3070源码,该问题解决。
另外提示找不到private等变量的问题,是因为内核中CONFIG_EXT_PRIV没有置高造成的,三星默认BSP包并没有置高该变量,这个配置很繁琐,配了
整整一个下午也没有配出来,换用自己的BSP包,问题解决。
为支持android系统,需修改源码:
由于在linux的根文件系统下存在/etc目录,而android的根目录下,/etc是从/system/etc下链接过来的,因此
需要修改wifi源码,让驱动从/system/etc下寻找配置文件。
寻找/etc/Wireless文件,找到如下文件存在,全修改为/system/etc/Wireless:
root@lqm:/opt/program/tools/RT3070_Linux_STA# grep -r '/etc/Wireless' ./
./include/os/rt_drv.h:#define STA_PROFILE_PATH
"/etc/Wireless/RT2870STA/RT2870STA.dat"
./include/os/rt_drv.h:#define CARD_INFO_PATH
"/etc/Wireless/RT2870STA/RT2870STACard.dat"
./include/os/rt_drv.h:#define EEPROM_BIN_FILE_NAME "/etc/Wireless/RT2870STA/e2p.bin"
./include/os/rt_linux.h:#define STA_PROFILE_PATH
"/etc/Wireless/RT2870STA/RT2870STA.dat"
./include/os/rt_linux.h:#define CARD_INFO_PATH
"/etc/Wireless/RT2870STA/RT2870STACard.dat"
./include/os/rt_linux.h:#define EEPROM_BIN_FILE_NAME "/etc/Wireless/RT2870STA/e2p.bin"
./os/linux/Makefile.6:DAT_PATH = /etc/Wireless/RT$(CHIPSET_DAT)STA
./os/linux/Makefile.6:
$(shell [ ! -f /etc/Wireless ] && mkdir /etc/Wireless)
二进制文件 ./os/linux/rt_profile.o 匹配
./os/linux/Makefile:DAT_PATH = /mnt/etc/Wireless/RT$(CHIPSET_DAT)STA
./os/linux/Makefile:
$(shell [ ! -f /etc/Wireless ] && mkdir /etc/Wireless)
二进制文件 ./os/linux/rt3070sta.o 匹配
二进制文件 ./os/linux/rt3070sta.ko 匹配
./os/linux/Makefile.4:DAT_PATH = /etc/Wireless/RT$(CHIPSET_DAT)STA
./os/linux/Makefile.4:
$(shell [ ! -f /etc/Wireless ] && mkdir /etc/Wireless)
二进制文件 ./common/rtmp_init_inf.o 匹配
./RT2870STACard.dat:00CARDID=/etc/Wireless/RT2870STA/RT2870STA1.dat
./RT2870STACard.dat:01CARDID=/etc/Wireless/RT2870STA/RT2870STA2.dat
./RT2870STACard.dat:02CARDID=/etc/Wireless/RT2870STA/RT2870STA3.dat
./RT2870STACard.dat:00MAC00:0E:2E:C3:D0:48=/etc/Wireless/RT2870STA/RT2870STA1.dat
./RT2870STACard.dat:01MAC00:40:F4:FF:AA:40=/etc/Wireless/RT2870STA/RT2870STA2.dat
./RT2870STACard.dat:02MAC00:0C:43:10:11:5C=/etc/Wireless/RT2870STA/RT2870STA3.dat
./RT2870STACard.dat:00CARDTYPEbgn=/etc/Wireless/RT2870STA/RT2870STA1.dat
./RT2870STACard.dat:01CARDTYPEbgn=/etc/Wireless/RT2870STA/RT2870STA2.dat
./RT2870STACard.dat:02CARDTYPEabgn=/etc/Wireless/RT2870STA/RT2870STA3.dat
root@lqm:/opt/program/tools/RT3070_Linux_STA#
再次编译,最终得到我们需要的ko文件。
第二掌:修改init.rc文件
on init
# give system access to wpa_supplicant.conf for backup and restore
mkdir /data/misc/wifi 0777 wifi system
chmod 0771 /data/misc/wifi
chmod 0660 /data/misc/wifi/wpa_supplicant.conf
mkdir /system/etc/wifi 0771 wifi wifi
chmod 0771 /system/etc/wifi
chmod 0660 /system/etc/wifi/wpa_supplicant.conf
chown wifi wifi /system/etc/wifi/wpa_supplicant.conf
mkdir /data/misc/dhcp 0777 wifi system
mkdir /data/misc/wifi/sockets 0777 wifi wifi
mkdir /data/misc/wifi/wpa_supplicant 0777 wifi system
mkdir /data/misc/wifi/hostapd 0777 wifi system
mkdir /system/etc/Wireless 0777 wifi wifi
mkdir /system/etc/Wireless/RT2870STA 0777 wifi wifi
on boot
# basic network init
ifup lo
hostname localhost
domainname localdomain
mkdir /data/system 0775 system system
mkdir /data/system/wpa_supplicant 0771 wifi wifi # lqm added.
# Set DNS. lqm added.
setprop net.dns1 192.168.1.1
# Prepare for wifi. lqm added.
setprop wifi.interface ra0
mkdir /data/misc/wifi/sockets 0777 wifi wifi #lqm changed property
mkdir /data/misc/dhcp 0771 system system #lqm changed.
service wpa_supplicant /system/bin/wpa_supplicant -Dwext -ira0 -c /system/etc/wifi/wpa_supplicant.conf
group system wifi inet
disabled
oneshot
service dhcpcd /system/bin/dhcpcd ra0
group system dhcp wifi
disabled
oneshot
默认init.rc中全使用的wlan0,而rt2860的网络名称为ra0,因此需全替换为ra0。
第三掌:修改hardware/libhardware_legacy/wifi/wifi_rt3070.c文件,内容详见源码,注意,
默认该目录下有一个wifi.c文件,它已经针对AR6102调试成功,为保持兼容性,特别再建一个wifi_rt3070.c
文件,通过Android.mk脚本选择。
在Android.mk脚本中做如下判断:
ifeq ($(BOARD_HAVE_WIFI_AR6102), true)
LOCAL_SRC_FILES += wifi/wifi.c
else
LOCAL_SRC_FILES += wifi/wifi_rt3070.c
endif
这里就需要定义变量BOARD_HAVE_WIFI_AR6102了,通常我们在device/samsung/smdkv210/BoardConfig.mk中定义,
示例如下:
BOARD_HAVE_WIFI_AR6102 := false
BOARD_WPA_SUPPLICANT_DRIVER := WEXT
在wifi_rt3070.c中,主要是修改了模块的名称等,重要修改部分如下:
#ifndef WIFI_DRIVER_MODULE_PATH
#define WIFI_DRIVER_MODULE_PATH "/system/lib/modules/rt3070sta.ko"
#endif
#ifndef WIFI_DRIVER_MODULE_NAME
#define WIFI_DRIVER_MODULE_NAME "rt3070sta"
#endif
#ifndef WIFI_DRIVER_MODULE_ARG
#define WIFI_DRIVER_MODULE_ARG ""
#endif
#ifndef WIFI_FIRMWARE_LOADER
#define WIFI_FIRMWARE_LOADER
""
#endif
#define WIFI_TEST_INTERFACE
"sta"
#define WIFI_DRIVER_LOADER_DELAY
5000000
static const char IFACE_DIR[] = "/data/system/wpa_supplicant";
static const char DRIVER_MODULE_NAME[] = WIFI_DRIVER_MODULE_NAME;
static const char DRIVER_MODULE_TAG[] = WIFI_DRIVER_MODULE_NAME " ";
static const char DRIVER_MODULE_PATH[] = WIFI_DRIVER_MODULE_PATH;
static const char DRIVER_MODULE_ARG[] = WIFI_DRIVER_MODULE_ARG;
static const char FIRMWARE_LOADER[] = WIFI_FIRMWARE_LOADER;
static const char DRIVER_PROP_NAME[] = "wlan.driver.status";
static const char SUPPLICANT_NAME[] = "wpa_supplicant";
static const char SUPP_PROP_NAME[] = "init.svc.wpa_supplicant";
static const char SUPP_CONFIG_TEMPLATE[]= "/system/etc/wifi/wpa_supplicant.conf";
static const char SUPP_CONFIG_FILE[] = "/data/misc/wifi/wpa_supplicant.conf";
static const char MODULE_FILE[] = "/proc/modules";
wifi.c用于启动时自动加载ko模块,因触摸屏效果不理想,这里暂时使用手动加载的方法,后续更新自动加载功能。
第四掌:BoardConfig.mk配置
device/samsung/smdkv210/BoardConfig.mk中,屏掉如下语句:
WPA_SUPPLICANT_VERSION := VER_0_6_X
在external目录,可以看到有wpa_supplicant和wpa_supplicant_6两个目录,他们分别对应0.5和0.6两个版本。
打开前面目录的Android.mk文件,可以看到有如下定义:
ifndef WPA_SUPPLICANT_VERSION
WPA_SUPPLICANT_VERSION := VER_0_5_X
endif
打开后面目录的Android.mk文件,可以看到有如下定义:
ifeq ($(WPA_SUPPLICANT_VERSION),VER_0_6_X)
include $(call all-subdir-makefiles)
endif
可见,这两个目录都是根据变量WPA_SUPPLICANT_VERSION的值来决定是否编译,最终都是生成WPA_SUPPLICANT可
执行文件。这里测试0.5版本的WPA_SUPPLICANT,可以成功上网,0.6版本的有兴趣的可以测试一下,之前在MX53平台
上使用0.6的版本无法正常上网,一直报错。
第五掌:device.mk配置
由于AR6102和RT3070的init.rc文件不同,至少目前没有使用自动联网方式下是有很大差异的,为了保证二者兼容性,
另做一个init.rc文件,命名为init_sdmmc_RT3070.rc,这时,init_sdmmc.rc就是针对AR6102的,
init_sdmmc_RT3070.rc就是针对RT3070的,具体通过device.mk来选择,示例脚本如下:
ifeq ($(BOARD_SDMMC_BSP),true)
ifeq ($(BOARD_HAVE_WIFI_AR6102),true)
source_init_rc_file := $(LOCAL_PATH)/init_sdmmc_RT3070.rc
else
source_init_rc_file := $(LOCAL_PATH)/init_sdmmc.rc
endif
else
source_init_rc_file := $(LOCAL_PATH)/init.rc
endif
可以看到,这里通过两个变量判断,如果没有定义BOARD_SDMMC_BSP,则使用init.rc,即如果映像文件全烧在nand中,
则使用init.rc,目前我们暂时将映像文件全放在SD卡上,先不考虑init.rc文件。
第六掌:device-vendor.mk文件配置
在vendor/samsung/smdkv210目录下,打开device-vendor.mk文件,可以发现很多关于WIFI的文件都是在这里指定
并拷备的,由于之前拷备的全是AR6102的文件,这里需添加RT3070文件,同样我们可以使用变量BOARD_HAVE_WIFI_AR6102
来判断。示例如下:
ifeq ($(BOARD_HAVE_WIFI_AR6102), true)
PRODUCT_COPY_FILES += \
vendor/samsung/smdkv210/wifi/bin/busybox:system/busybox/busybox \
vendor/samsung/smdkv210/wifi/bin/ls:system/busybox/ls \
vendor/samsung/smdkv210/wifi/bin/cp:system/busybox/cp \
vendor/samsung/smdkv210/wifi/bin/sh:system/busybox/sh \
vendor/samsung/smdkv210/wifi/bin/wmiconfig:system/bin/wmiconfig \
vendor/samsung/smdkv210/wifi/bin/wlan_tool:system/bin/wlan_tool \
vendor/samsung/smdkv210/wifi/bin/deviceid:system/bin/deviceid \
vendor/samsung/smdkv210/wifi/etc/udhcpd.conf:system/etc/udhcpd.conf \
vendor/samsung/smdkv210/wifi/etc/dhcpcd.conf:system/etc/dhcpcd.conf \
vendor/samsung/smdkv210/wifi/etc/wifi/wpa_supplicant.conf:system/etc/wifi/wpa_supplicant.conf \
vendor/samsung/smdkv210/wifi/etc/wifi/hostapd.conf:system/etc/wifi/hostapd.conf \
vendor/samsung/smdkv210/wifi/fw/softmac:system/wifi/softmac \
vendor/samsung/smdkv210/wifi/fw/data.patch.hw2_0.bin:system/wifi/data.patch.hw2_0.bin \
vendor/samsung/smdkv210/wifi/fw/calData_ar6102_15dBm.bin:system/wifi/calData_ar6102_15dBm.bin \
vendor/samsung/smdkv210/wifi/fw/athwlan.bin.z77:system/wifi/athwlan.bin.z77 \
vendor/samsung/smdkv210/wifi/fw/ar6000.ko:system/wifi/ar6000.ko
else
PRODUCT_COPY_FILES += \
vendor/samsung/smdkv210/wifi/bin/busybox:system/busybox/busybox \
vendor/samsung/smdkv210/wifi/bin/ls:system/busybox/ls \
vendor/samsung/smdkv210/wifi/bin/cp:system/busybox/cp \
vendor/samsung/smdkv210/wifi/bin/sh:system/busybox/sh \
vendor/samsung/smdkv210/wifi/bin/wmiconfig:system/bin/wmiconfig \
vendor/samsung/smdkv210/wifi/bin/deviceid:system/bin/deviceid \
vendor/samsung/smdkv210/wifi/etc/udhcpd.conf:system/etc/udhcpd.conf \
vendor/samsung/smdkv210/wifi/etc/dhcpcd.conf:system/etc/dhcpcd_rt3070.conf \
vendor/samsung/smdkv210/wifi/etc/wifi/wpa_supplicant_RT3070.conf:system/etc/wifi/wpa_supplicant.conf \
vendor/samsung/smdkv210/wifi/etc/wifi/RT2870STA.dat:system/etc/Wireless/RT2870STA/RT2870STA.dat \
vendor/samsung/smdkv210/wifi/etc/wifi/hostapd.conf:system/etc/wifi/hostapd_rt3070.conf \
vendor/samsung/smdkv210/wifi/fw/softmac:system/wifi/softmac \
vendor/samsung/smdkv210/wifi/fw/rt3070sta.ko:system/wifi/rt3070sta.ko
endif
第七掌:由于前面屏掉了WPA_SUPPLICANT_VERSION,需要单独编译wpa_supplicant。注意,编译之前先要删掉
wpa_supplicant生成的一些文件,否则会提示出错,路径如下:
out/target/product/smdkv210/obj/EXECUTABLES/wpa_cli_intermediates以及
out/target/product/smdkv210/obj/EXECUTABLES/wpa_supplicant_intermediates
将这两个目录删掉,再编译:
source build/envsetup.sh
mm external/wpa_supplicant/ PRODUCT-full_smdkv210-eng
这时将会在out/..../system/bin下生成新的wpa_supplicant文件。
第八掌:新建wpa_supplicant配置文件
默认在vendor/samsung/smdkv210/wifi/etc/wifi目录下,存在wpa_supplicant.conf文件,保留用于AR6102,新
建wpa_supplicant_RT3070.conf文件,内容如下:
# WPA-PSK/TKIP
ctrl_interface=/data/system/wpa_supplicant
network={
ssid="yyb"
scan_ssid=1
key_mgmt=WPA-EAP WPA-PSK IEEE8021X NONE
pairwise=TKIP CCMP
group=CCMP TKIP WEP104 WEP40
psk="androidok"
}
注意,ctrl_interface的路径不要放在/system目录下,否则会提示unlink[ctrl_iface]: Not a directory的错误。
ssid为路由的名称,androidok为路由的密码,用户请根据自己的路由密码设置。
将wpa_supplicant_RT3070.conf文件拷贝到/ventor/samsung/smdkv210/wifi/etc/wifi目录;
第九掌:新建hostapd配置文件
在vendor/samsung/smdkv210/wifi/etc/wifi目录下,存在hostapd.conf文件,保留用于AR6102,新建hostapd_rt3070.conf
文件,内容如下:
interface=ra0
ctrl_interface=ra0
ssid=test
channel=1
max_num_sta=8
beacon_int=100
dtim_period=1
二者区别在于接口名称,rt3070名称为ra0。
第十掌:将第一步生成的RT2870STA.dat文件拷贝到vendor/samsung/smdkv210/wifi目录;
第十一掌:新建dhcpcd配置文件
在vendor/samsung/smdkv210/wifi/etc目录下,存在dhcpcd.conf文件,保留用于AR6102,新建dhcpcd_rt3070.conf文件,
内容如下:
# dhcpcd configuration for Android Wi-Fi interface
# See dhcpcd.conf(5) for details.
interface ra0
# dhcpcd-run-hooks uses these options.
option subnet_mask, routers, domain_name_servers, domain_search, host_name, domain_name
第十二掌:将第一步生成的rt3070sta.ko文件拷贝到vendor/samsung/smdkv210/wifi/fw目录;
第十三掌:重新编译android源码,注意由于更新了init.rc,必须更新xboot;
第十四掌:更新内核,xboot,android系统映像,重启开发板,进入文件系统后,将USB WIFI模块插到USB HOST端口,加载驱动
手动加载驱动如下:
/mnt/sdcard # insmod rt3070sta.ko
[ 428.933862] rtusb init rt2870 --->
[ 428.935247]
[ 428.935251]
[ 428.935254] === pAd = e117d000, size = 514896 ===
[ 428.935260]
[ 428.938024] <-- RTMPAllocTxRxRingMemory, Status=0
[ 428.938394] <-- RTMPAllocAdapterBlock, Status=0
[ 428.951083] usbcore: registered new interface driver rt2870
/mnt/sdcard #
注意,如果开发板没有检测到USB WIFI模块,则加载驱动时打印如下信息:
/mnt/sdcard # insmod rt3070sta.ko
[ 304.232305] rtusb init rt2870 --->
[ 304.235108] usbcore: registered new interface driver rt2870
这时仅仅加载了驱动,没未探测到WIFI模块。
正常加载后,可以通过下面的命令查询驱动是否正常加载:
cat /proc/net/dev
正常打印如下:
/mnt/sdcard # cat /proc/net/dev
Inter-| Receive | Transmit
face |bytes packets errs drop fifo frame compressed multicast|bytes pacd
lo: 0 0 0 0 0 0 0 0 0 0
ifb0: 0 0 0 0 0 0 0 0 0 0
ifb1: 0 0 0 0 0 0 0 0 0 0
usb0: 0 0 0 0 0 0 0 0 0 0
sit0: 0 0 0 0 0 0 0 0 0 0
ip6tnl0: 0 0 0 0 0 0 0 0 0 0
ra0: 0 0 0 0 0 0 0 0 0 0
/mnt/sdcard #
可以看到多了一路ra0了,它就是我们需要的rt2860驱动。
第十五掌:配置IP地址,并使能网口
/mnt/sdcard # ifconfig ra0 192.168.1.5 up
[ 668.686681] (Efuse for 3062/3562/3572) Size=0x2d [2d0-2fc]
[ 669.006160] -->RTUSBVenderReset
[ 669.006280] <--RTUSBVenderReset
[ 669.319229] RtmpOSFileOpen(): Error 2 opening /system/etc/Wireless/RT2870STA/RT2870STA.dat
[ 669.319339] Open file "/system/etc/Wireless/RT2870STA/RT2870STA.dat" failed!
[ 669.319430] 1. Phy Mode = 0
[ 669.319466] ERROR!!! RTMPReadParametersHook failed, Status[=0x00000001]
[ 669.383946] !!! rt28xx Initialized fail !!!
error: SIOCSIFFLAGS (Operation not permitted)
/mnt/sdcard #
这是/system/etc下没有找到相关文件造成的,先手动创建,再配置IP地址,注意,手动创建时,会提示只读,需手动mount:
mount -o remount,rw -t ext4 /dev/block/mmcblk0p2 /system
再配置IP地址,正确打印如下:
/system/etc # ifconfig ra0 192.168.1.5 up
[ 256.708808] (Efuse for 3062/3562/3572) Size=0x2d [2d0-2fc]
[ 257.018670] -->RTUSBVenderReset
[ 257.018914] <--RTUSBVenderReset
[ 257.339967] Key1Str is Invalid key length(0) or Type(0)
[ 257.340119] Key2Str is Invalid key length(0) or Type(0)
[ 257.340255] Key3Str is Invalid key length(0) or Type(0)
[ 257.340393] Key4Str is Invalid key length(0) or Type(0)
[ 257.342169] 1. Phy Mode = 5
[ 257.342211] 2. Phy Mode = 5
[ 257.344107] NVM is Efuse and its size =2d[2d0-2fc]
[ 257.411799] phy mode> Error! The chip does not support 5G band 5!
[ 257.412329] RTMPSetPhyMode: channel is out of range, use first channel=1
[ 257.416162] (Efuse for 3062/3562/3572) Size=0x2d [2d0-2fc]
[ 257.435416] 3. Phy Mode = 9
[ 257.516803] MCS Set = ff 00 00 00 01
[ 257.528524] <==== rt28xx_init, Status=0
[ 257.530162] 0x1300 = 00064300
/system/etc # ifconfig
使用如下指令查询是否配置成功:
/system/etc # ifconfig ra0
ra0: ip 192.168.1.5 mask 255.255.255.0 flags [up broadcast running multicast]
注意,不能使用ifconfig指令查询,仅使用ifconfig将找不到任何的网络名称。
第十六掌:使用wireless_tools寻找WIFI信号
注意,由于之前AR6102已经调试成功,因此这里没有必要再移植wireless_tools了,用现成的即可。
使用下面的指令寻找附近的AP:
iwlist ra0 scan
打印如下信息:
/ # iwlist ra0 scan
[ 104.990667] ===>rt_ioctl_giwscan. 4(4) BSS returned, data->length = 642
ra0 Scan completed :
Cell 01 - Address: F4:EC:38:5A:C5:1C
Protocol:802.11b/g/n
ESSID:"Lolaage"
Mode:Managed
Frequency:2.412 GHz (Channel 1)
Quality=31/100 Signal level=-77 dBm Noise level=-85 dBm
Encryption key:on
Bit Rates:54 Mb/s
(Unknown Wireless Token 0x8C05)
(Unknown Wireless Token 0x8C05)
(Unknown Wireless Token 0x8C05)
Cell 02 - Address: B0:48:7A:51:BA:72
Protocol:802.11b/g/n
ESSID:"yyb"
Mode:Managed
Frequency:2.437 GHz (Channel 6)
Quality=100/100 Signal level=-19 dBm Noise level=-92 dBm
Encryption key:on
Bit Rates:22.5 Mb/s
(Unknown Wireless Token 0x8C05)
(Unknown Wireless Token 0x8C05)
(Unknown Wireless Token 0x8C05)
Cell 03 - Address: 22:0F:C6:69:22:6A
Protocol:802.11b/g
ESSID:"888"
Mode:Managed
Frequency:2.437 GHz (Channel 6)
Quality=100/100 Signal level=-47 dBm Noise level=-92 dBm
Encryption key:on
Bit Rates:54 Mb/s
(Unknown Wireless Token 0x8C05)
Cell 04 - Address: 94:8F:C2:69:22:69
Protocol:802.11b/g
ESSID:"XGD-A"
Mode:Managed
Frequency:2.437 GHz (Channel 6)
Quality=31/100 Signal level=-77 dBm Noise level=-81 dBm
Encryption key:on
Bit Rates:54 Mb/s
(Unknown Wireless Token 0x8C05)
/ #
可见,第二个就是我们需要找的AP。
第十七掌:使用强大的wpa_supplicant连接网络:
/ # wpa_supplicant -Dwext -ira0 -c /system/etc/wifi/wpa_supplicant.conf &
/ # ===>rt_ioctl_giwscan. 4(4) BSS returned, data->length = 635
ioctl[SIOCSIWGENIE]==>rt_ioctl_siwfreq::SIOCSIWFREQ(Channel=1)
: Operation not supported on transport endpoint
/ #
我们可以通过PING路由来测试是否工作正常:
/ # ping 192.168.1.1
PING 192.168.1.1 (192.168.1.1): 56 data bytes
RTMP_TimerListAdd: add timer obj d4ad873c!
Rcv Wcid(1) AddBAReq
Start Seq = 00000000
RTMP_TimerListAdd: add timer obj d4ada74c!
64 bytes from 192.168.1.1: seq=0 ttl=64 time=89.936 ms
64 bytes from 192.168.1.1: seq=1 ttl=64 time=2.154 ms
64 bytes from 192.168.1.1: seq=2 ttl=64 time=6.433 ms
64 bytes from 192.168.1.1: seq=3 ttl=64 time=0.899 ms
^C
--- 192.168.1.1 ping statistics ---
4 packets transmitted, 4 packets received, 0% packet loss
round-trip min/avg/max = 0.899/24.855/89.936 ms
/ #
曾经遇到过如下错误信息:
/system/etc/wifi # wpa_supplicant -Dwext -ira0 -c /system/etc/wifi/wpa_supplican
t.conf &
/system/etc/wifi # [ 327.506005] (Efuse for 3062/3562/3572) Size=0x2d [2d0-2fc]
[ 327.803791] RTMP_TimerListAdd: add timer obj e11c3280!
[ 327.803867] RTMP_TimerListAdd: add timer obj e11c32b0!
[ 327.803932] RTMP_TimerListAdd: add timer obj e11c32e0!
[ 327.803999] RTMP_TimerListAdd: add timer obj e11c3250!
[ 327.804068] RTMP_TimerListAdd: add timer obj e11c31c0!
[ 327.807221] RTMP_TimerListAdd: add timer obj e11c31f0!
[ 327.812275] RTMP_TimerListAdd: add timer obj e118ddf4!
[ 327.817403] RTMP_TimerListAdd: add timer obj e117d0cc!
[ 327.823662] RTMP_TimerListAdd: add timer obj e117d104!
[ 327.827673] RTMP_TimerListAdd: add timer obj e118de98!
[ 327.832743] RTMP_TimerListAdd: add timer obj e118dd94!
[ 327.839855] RTMP_TimerListAdd: add timer obj e118de64!
[ 327.846376] -->RTUSBVenderReset
[ 327.846637] <--RTUSBVenderReset
[ 328.190142] Key1Str is Invalid key length(0) or Type(0)
[ 328.190288] Key2Str is Invalid key length(0) or Type(0)
[ 328.190419] Key3Str is Invalid key length(0) or Type(0)
[ 328.190555] Key4Str is Invalid key length(0) or Type(0)
[ 328.192035] 1. Phy Mode = 5
[ 328.192076] 2. Phy Mode = 5
[ 328.194241] NVM is Efuse and its size =2d[2d0-2fc]
[ 328.251497] phy mode> Error! The chip does not support 5G band 5!
[ 328.252119] RTMPSetPhyMode: channel is out of range, use first channel=1
[ 328.260874] (Efuse for 3062/3562/3572) Size=0x2d [2d0-2fc]
[ 328.280741] 3. Phy Mode = 9
[ 328.351997] MCS Set = ff 00 00 00 01
[ 328.367418] <==== rt28xx_init, Status=0
[ 328.370119] 0x1300 = 00064300
unlink[ctrl_iface]: Not a directory
找了很久原因没有找到,后来修改wpa_supplicant.conf文件中wpa_supplicant的工作路径为/data/misc/wpa_supplicant即可。
有可能是权限问题,手动将以前的只读路径重新remount也不能解决问题,不知是何原因。
如果遇到如下问题:
[ 329.394596] RtmpOSFileOpen(): Error 30 opening /system/etc/Wireless/RT2870STA/RT2870STA.dat
修改RT2870STA.dat权限为777即可。
第十八掌:进入android系统后,手动添加网关:
busybox ip route add default via 192.168.1.1
设置完后我们PING一下新浪主页,测试是否能正常上网了:
/ # ping 58.63.236.42
PING 58.63.236.42 (58.63.236.42): 56 data bytes
64 bytes from 58.63.236.42: seq=0 ttl=51 time=122.108 ms
64 bytes from 58.63.236.42: seq=1 ttl=51 time=15.205 ms
64 bytes from 58.63.236.42: seq=2 ttl=51 time=7.797 ms
64 bytes from 58.63.236.42: seq=3 ttl=51 time=11.878 ms
^C
--- 58.63.236.42 ping statistics ---
4 packets transmitted, 4 packets received, 0% packet loss
round-trip min/avg/max = 7.797/39.247/122.108 ms
/ #
到此,整个USB WIFI的流程已经走通。在android图形界面下打开浏览器,会提示网络没连接的错误,这是因为我们全部使用手动方式上网,
暂先不理会它,随便输入网址,发现已经能够正常上网了。
如果您自己移植没有成功,仔细研究看看哪一掌没有练熟^_^
如果在ping时发现无法使用ctrl+c中止程序的问题,请参考如下文章:
<<解决busybox ctrl+c不能中止程序的问题>>
附:由于这里无法上传附件,相关代码及ko文件进如下链接下载:
http://xboot.org/forum.php?mod=viewthread&tid=370&page=1&extra=#pid411