A3x android4.4.2平台; rtl8188eu是一款USB接口的wifi模组,支持802.11b/g/n协议,具有station、softAP和wifi direct功能。
2. 内核配置rtl8188eu模组所使用的驱动为8188eu,代码位于lichee/linux-3.3/drivers/net/wireless/rtl8188eu目录,配置内核将该驱动编译为模块,在linux-3.3目录下执行make ARCh=arm menuconfig命令,做以下选择:
Device Drivers —> Network device support—> Wireless LAN—> <M> Realtek 8188E USB WiFi配置完后编译内核。
3. 引脚配置rtl8188eu的引脚配置在lichee/tools/pack_brandy/chips/sun6i/configs/android/fiber-evb/sys_config.fex中定义,需要修改的地方有两个,首先是wifi配置:
;wifi configuration ;wifi_sdc_id — 0- SDC0, 1- SDC1, 2- SDC2, 3- SDC3 ;wifi_usbc_id — 0- USB0, 1- USB1, 2- USB2 ;wifi_usbc_type — 1- EHCI(speed 2.0), 2- OHCI(speed 1.0) ;wifi_mod_sel — 0- none, 1- ap6181, 2- ap6210(wifi+bt), ; 3 – rtl8723as(wifi+bt), 4- rtl8189es(SM89E00), ; 5 – rtl8192cu, 6 – rtl8188eu, 7 – mt6620, ; 8 – rtl8723au, 9 – ap6330(wifi+bt+fm) ; 10 – ap6476, 11 – rtl8723bs ;——————————————————————————– [wifi_para] wifi_used = 1 wifi_sdc_id = 1 wifi_usbc_id = 1 wifi_usbc_type = 1 wifi_mod_sel = 6 wifi_power = port:PH27<1><0><default><0>需要注意的是wifi_power这个参数,从原理图上可以知道,wifi电源开关通过一个三极管控制,原来的wifi电源由axp控制,但是调试中发现axp控制wifi电源的aldo1这一路一直输出低电平,不能输出高电平,因此这里使用了一个IO管脚进行控制。 然后,8188eu模组是接在USB1接口上的,因此需要对USB1进行配置:
;usb_used:USB使能标志。置1,表示系统中USB模块可用,置0,则表示系统USB禁用。 ;usb_port_type:USB端口的使用情况。 0:device only;1:host only;2:OTG ;usb_detect_type:USB端口的检查方式。0:不做检测;1:vbus/id检查;2:id/dpdm检查 ;usb_id_gpio:USB ID pin脚配置。具体请参考gpio配置说明。 ;usb_det_vbus_gpio:USB DET_VBUS pin脚配置。具体请参考gpio配置说明。 ;usb_drv_vbus_gpio:USB DRY_VBUS pin脚配置。具体请参考gpio配置说明。 ;usb_det_vbus_gpio: “axp_ctrl”,表示axp 提供 ;usb_restrict_gpio usb限流控制pin ;usb_restric_flag: usb限流标置 ;usb_not_suspend: usb远程唤醒标置,0:不支持,1:支持 ;——————————– ;— USB1控制标志 ;——————————– [usbc1] usb_used = 1 usb_port_type = 1 usb_detect_type = 0 usb_id_gpio = usb_det_vbus_gpio = usb_drv_vbus_gpio = usb_restrict_gpio = usb_host_init_state = 0 usb_restric_flag = 0 usb_not_suspend = 0由于使用了IO管脚代替axp控制wifi的电源开关,因此需要对电源管理部分的代码进行修改。rtl8188eu模组的电源管理部分代码位于lichee/linux-3.3/arch/arm/mach-sun6i/rf目录下,只需要修改wifi_pm_rtl8188eu.c文件,首先是rtl8188eu_gpio_init()函数的修改:
void rtl8188eu_gpio_init(void) { script_item_u val; script_item_value_type_e type; struct wifi_pm_ops *ops = &wifi_select_pm_ops; int ret = 1; rtl8188eu_msg(“exec rtl8188eu_wifi_gpio_init\n”); /* get drv_vbus gpio */ type = script_get_item(wifi_para, “wifi_power”, &drv_vbus_gpio_set); if(type == SCIRPT_ITEM_VALUE_TYPE_PIO){ }else{ rtl8188eu_msg(“ERR: %s(drv vbus) is invalid\n”, “rtl8188eu”); return; } ret = gpio_request(drv_vbus_gpio_set.gpio.gpio, NULL); if(ret != 0){ rtl8188eu_msg(“ERR: gpio_request failed\n”); return; } else { /* set config, ouput */ gpio_direction_output(drv_vbus_gpio_set.gpio.gpio, 0); } rtl8188eu_powerup = 0; rtk8188eu_suspend = 0; ops->power = rtl8188eu_power; ops->standby = rtl8188eu_standby; // force to disable wifi power in system booting, // make sure wifi power is down when system start up rtl8188eu_module_power(0); }接着是rtl8188eu_module_power()函数的修改:
static int rtl8188eu_module_power(int onoff) { int ret = 0; rtl8188eu_msg(“function: rtl8188eu_module_power\n”); if (onoff) { __gpio_set_value(drv_vbus_gpio_set.gpio.gpio, 1); } else { __gpio_set_value(drv_vbus_gpio_set.gpio.gpio, 0); } return ret; } 5. Android平台配置在Android源码下device/softwinner/fiber-evb/BoardConfig.mk文件中指定加载那一款wifi模组,修改如下:
# 1.1 realtek wifi configuration BOARD_WIFI_VENDOR := realtek ifeq ($(BOARD_WIFI_VENDOR), realtek) WPA_SUPPLICANT_VERSION := VER_0_8_X BOARD_WPA_SUPPLICANT_DRIVER := NL80211 BOARD_WPA_SUPPLICANT_PRIVATE_LIB := lib_driver_cmd_rtl BOARD_HOSTAPD_DRIVER := NL80211 BOARD_HOSTAPD_PRIVATE_LIB := lib_driver_cmd_rtl SW_BOARD_USR_WIFI := rtl8188eu BOARD_WLAN_DEVICE := rtl8188eu endif说明: BOARD_WIFI_VENDOR:指定使用realtek厂商的wifi模组; SW_BOARD_USR_WIFI和BOARD_WLAN_DEVICE指定使用rtl8188eu模组。 在device/softwinner/fiber-evb/init.sun6i.rc文件中指定需要开启的wifi相关的服务,添加如下代码:
# 1. realtek wifi service # 1.1 realtek wifi sta service service wpa_supplicant /system/bin/wpa_supplicant \ -iwlan0 -Dnl80211 -c/data/misc/wifi/wpa_supplicant.conf \ -O/data/misc/wifi/sockets \ -e/data/misc/wifi/entropy.bin -g@android:wpa_wlan0 # 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 # 1.2 realtek wifi sta p2p concurrent service service p2p_supplicant /system/bin/wpa_supplicant \ -ip2p0 -Dnl80211 -c/data/misc/wifi/p2p_supplicant.conf \ -e/data/misc/wifi/entropy.bin -N \ -iwlan0 -Dnl80211 -c/data/misc/wifi/wpa_supplicant.conf \ -O/data/misc/wifi/sockets \ -g@android:wpa_wlan0 class main socket wpa_wlan0 dgram 660 wifi wifi disabled oneshot指定开启wpa_supplicant和p2p_supplicant这两个服务,并设置它们的启动参数。 为了使Settings界面显示wifi和wifi direct界面,需要在device/softwinner/fiber-evb/fiber_evb.mk文件中添加如下代码:
# wifi & bt config file PRODUCT_COPY_FILES += \ frameworks/native/data/etc/android.hardware.wifi.xml:system/etc/permissions/android.hardware.wifi.xml \ frameworks/native/data/etc/android.hardware.wifi.direct.xml:system/etc/permissions/android.hardware.wifi.direct.xmlrtl8188eu模组支持aoftAP功能,为了在Settings界面显示便携式wifi热点功能,需要在device/softwinner/fiber-evb/overlay/frameworks/base/core/res/res/values/config.xml文件中作如下配置:
<!– List of regexpressions describing the interface (if any) that represent tetherable Wifi interfaces. If the device doesnt want to support tethering over Wifi this should be empty. An example would be “softap.*” –> <string-array translatable=”false” name=”config_tether_wifi_regexs”> <item>”wlan0″</item> </string-array>rtl8188eu模组支持miracast功能,为了Settings界面显示miracast功能,需要在device/softwinner/fiber-evb/overlay/frameworks/base/core/res/res/values/config.xml文件中作如下配置:
<!– Whether WiFi display is supported by this device. There are many prerequisites for this feature to work correctly. Here are a few of them: * The WiFi radio must support WiFi P2P. * The WiFi radio must support concurrent connections to the WiFi display and to an access point. * The Audio Flinger audio_policy.conf file must specify a rule for the “r_submix” remote submix module. This module is used to record and stream system audio output to the WiFi display encoder in the media server. * The remote submix module “audio.r_submix.default” must be installed on the device. * The device must be provisioned with HDCP keys (for protected content). –> <bool name=”config_enableWifiDisplay”>true</bool>免责声明:文章内容来自互联网,本站不对其真实性负责,也不承担任何法律责任,如有侵权等情况,请与本站联系删除。
转载请注明出处:Android平台wifi模组rtl8188eu移植 https://www.yhzz.com.cn/a/12658.html