USB_WIFI移植(realtek_8192cu)

   对于移植USB的WIFI模块来讲,相对于要简单很多。特别是我们现在要移植的这款realtek_8192已将做好了傻瓜式的步骤文档,只需要你懂一点点wifi的流程或他的工作调用。

作为没有接触过android的新人,当初也是折腾了好几天。

      sdk已经非常完美,所以我们只需要按照文档进行就OK了


首先我们得把驱动编译成.KO文件,因为支持很多种的平台所以我们还是把添加到Makefile的贴出来:

支持android:

ifeq ($(CONFIG_PLATFORM_ANDROID), y)
EXTRA_CFLAGS += -DCONFIG_LITTLE_ENDIAN
ARCH := arm
CROSS_COMPILE := /usr/local/arm/arm-none-eabi-2010-09-51/bin/arm-none-eabi-
KVER  := 2.6.35.7
KSRC ?= /home/ly/s5pv210/android_gingerbread_m12/android/kernel
MODULE_NAME := wlan                      \\定义模块名字为 wlan
endif


编译完成后你可以动态加载到kernel下用iwlist.iwconfig等命令进行简单的调试,如果正常就可以进行下面的步骤了。


接下来按照文档移植:

realtek_wifi_SDK_for_android_20110623.txt

==========================================================
Realtek Wifi SDK for Android
==========================================================
To port Realtek Wi-Fi driver onto Android platform, you
can go through the following guide with reference codes 
within our driver package's realtek_wifi_SDK_for_android_20110623.tar.gz.


Because Android's SDK may differ from platform to
platform, our reference codes may not be applied on every
platform without modifications. You should check if our
reference code is suitable for you to use.


==========================================================
1. Modifications for platform related files
==========================================================
a. BOARD_USES_REALTEK_WIFI
Ensure "BOARD_USES_REALTEK_WIFI = true" is defined
in BoardConfig.mk or Android.mk. This is for some
compile-time choices to be applied for our wifi.

b. Service definitions
Make sure the service definition of wpa_supplicant,
dhcpd, hostapd is defined in init.rc or init.xxx.rc
for your platform. As following:


service wpa_supplicant /system/bin/wpa_supplicant -Dwext -iwlan0 -c/data/misc/wifi/wpa_supplicant.conf
disabled
oneshot


service hostapd /system/bin/hostapd_wps /data/misc/wifi/hostapd.conf
disabled
oneshot


service dhcpcd /system/bin/dhcpcd -ABKL
disabled
oneshot

==========================================================
2. Modifications for dhcpcd
==========================================================
external/dhcpcd/Android.mk
external/dhcpcd/client_realtek.c
external/dhcpcd/logger_realtek.c

==========================================================
3. Modifications for wpa_supplicant
==========================================================
external/wpa_supplicant/Android.mk
external/wpa_supplicant/driver_wext.c
external/wpa_supplicant/vendor.h

Following is the reference content of wpa_supplicant.conf:

update_config=1
ctrl_interface=DIR=/data/misc/wifi/wpa_supplicant GROUP=wifi


==========================================================
4. Modifications for libhardware_legacy - wifi
==========================================================
hardware/libhardware_legacy/wifi/Android.mk
hardware/libhardware_legacy/wifi/wifi_realtek.c

==========================================================
5. Modifications for netd - hostapd
==========================================================
external/hostapd-0.6.9_rtl/*
system/netd/Android.mk
system/netd/SoftapController_realtek.cpp


==========================================================
6. Modification for opening portable hotspot UI
==========================================================
Add interface items for "config_tether_wifi_regexs" and
"config_tether_upstream_regexs"

frameworks/base/core/res/res/values/config.xml


==========================================================
7. Driver compilation 
==========================================================
a. For compilation, see document/HowTo support new platform(including Android).doc or
document/HowTo build driver under kernel tree.doc for reference.

b. MODULE_NAME defined in Makefile
For android to rmmod the wifi kernel module, the
driver module name, which is decided in compilation
time as MODULE_NAME defined in Makefile, should be
the same as WIFI_DRIVER_MODULE_NAME defined in
wifi_realtek.c:

#define WIFI_DRIVER_MODULE_NAME "wlan"

c. If you compile wifi driver to .ko file, place driver module to specific path.
The default path is defined in wifi_realtek.c:

#define WIFI_DRIVER_MODULE_PATH "/system/wifi/wlan.ko"


d. Other useful driver options defined in include/autoconf.h

#define CONFIG_IPS_LEVEL_2
The default IPS mode, IPS_NORMAL, needs a lot of IO to
wake up, it will spend much time espeically with low
speed IO interface, ex: USB1.1. With this Macro defined,
driver will set the default IPS mode to IPS_LEVEL_2.
IPS_LEVEL_2 spends more power than IPS_NORMAL but it is
speedy while waken up.

讽筿家Αゴ秨driver个砞IPS(硈絬玡筿家Α)家Α
酬眶惠璶耕IOIO硉耕篊ざ穦耕诀
穦盢IPS家Α个砞IPS_LEVEL_2IPS_LEVEL_2耕IPS_NORMAL
筿祘ゴчΙ才翴琌酬眶硉е


#define CONFIG_ADAPTOR_INFO_CACHING_FILE
When the driver recognizes the wifi HW, it will read HW
configuration from it. This will spend much time espeically
with low speed IO interface. With this Macro defined, the
HW configuration will be cached in file (default path is
/data/misc/wifi/rtw_cache) to save the time of reading HW
configuration through IO. This machanism is suitable for
situations placing wifi module inside platform case. If wifi
module/dongle is replacable, due to the configuration
difference of each Wifi HW, using wrong HW configuration
will cause wifi to work unnormally.

wifi driver粄呼穦眖呼弄祑砰砞𥩟戈瘪˙艼
IO硉耕篊ざ穦耕诀盢呼祑砰砞𥩟戈瘪
郎い(个砞隔畖/data/misc/wifi/rtw_cache)窃丁
惠猔种诀続ず𥩟wifiㄏノ薄挂キ𪻺蹦ノ𥩟┾传
wifi dongleパ–呼祑砰砞𥩟戈瘪ぃㄏノ岿祑砰砞
𥩟穦硑Θwifiぃタ盽


#define CONFIG_RESUME_IN_WORKQUEUE
The Android system will resume normal peripherals(ex: Wifi)
first and then peripherals registerd under early suspend
(ex: screen). The Wif resume process will spend much time
espeically with low speed IO interface. This will cause the
user experience a period of "black screen time" after
pushing down the resume button. With this Macro defined,
the wifi resume process will be done in workqueue to avoid
delaying of screen light-up.

╰参resume穦resume㏄娩杆𥩟礛resume爹early
suspend杆𥩟wifiresume惠璶禣ㄇ丁τandroid
獹场琌爹early suspend┮穦Τresume龄ぃ
穦皑獹薄猵诀盢wifi resumeworkqueue磷wifi
resume┑筐獹丁


#define CONFIG_SET_SCAN_DENY_TIMER
With this Macro defined, driver will bypass the scan command
from upper layer for a short period of time (3 sec by default)
when the connection to AP is done and DHCP process. This will
reduce the disturbance caused by scan command from upper layer
while WPA/WPA2 authentication and DHCP are in progress.

诀ゴ秨䉤AP硈絬┪DHCP穦既盢糷scan㏑
钡scanЧΘτぃ籼︽痷タscan搭ぶ糷scan癸硈絬の
DHCP耑


==============================================================================================================================

在修改了nit.rc or init.xxx.rc之后需要从android/out/release更新android.img.cpio到kernel目录下替换android.img.cpio



如果是在你曾经编译过的环境下进行移植,那就非常有必要注意下面这3个服务有没有及时的更新链接的.SO文件,如果是干净的环境那将不需要考虑:
dhcpcd

wpa_supplicant

netd - hostapd

==============================================================================================================================


一个萝卜一个坑的完成了上面的工作,基本上你就已经成功了....




   


發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章