Android Wireless wl12xx driver

This post is notes gathered from adding support for a tiwi-2 chipset on a custom board running Android.

  •  Add wifi xml permission file:

PRODUCT_COPY_FILES += \ frameworks/native/data/etc/android.hardware.wifi.xml:system/etc/permissions/android.hardware.wifi.xml

  • Add BoardConfig.mk stuff

BOARD_WPA_SUPPLICANT_DRIVER := NL80211 WPASUPPLICANTVERSION := VER08X BOARDWLANDEVICE := wl12xxmac80211 BOARDSOFTAPDEVICE := wl12xxmac80211 BOARDWPASUPPLICANTPRIVATELIB := libdrivercmdwl12xx WIFIDRIVERMODULEPATH := "/system/lib/modules/wl12xxsdio.ko" WIFIDRIVERMODULENAME := "wl12xxsdio"

init.rc

on post-fs # give system access to wpasupplicant.conf for backup and restore mkdir /system/etc/wifi 0770 wifi wifi chmod 0770 /system/etc/wifi chmod 0660 /system/etc/wifi/wpasupplicant.conf chown wifi wifi /system/etc/wifi/wpasupplicant.conf mkdir /data/misc/wifi 0770 wifi wifi mkdir /data/misc/wifi/sockets 0770 wifi wifi chmod 0770 /data/misc/wifi chmod 0660 /data/misc/wifi/wpasupplicant.conf chown wifi wifi /data/misc/wifi chown wifi wifi /data/misc/wifi/wpasupplicant.conf insmod /system/lib/modules/cfg80211.ko insmod /system/lib/modules/mac80211.ko insmod /system/lib/modules/wl12xx.ko service p2psupplicant /system/bin/wpasupplicant \ -iwlan0 -Dnl80211 -c/data/misc/wifi/wpasupplicant.conf -N \ -ip2p0 -Dnl80211 -c/data/misc/wifi/p2psupplicant.conf -e/data/misc/wifi/entropy.bin -pusep2pgroupinterface=1 # we will start as root and wpasupplicant will switch to user wifi # after setting up the capabilities required for WEXT # user wifi # group wifi inet keystore class main socket wpawlan0 dgram 660 wifi wifi disabled oneshot service wpasupplicant /system/bin/wpasupplicant \ -iwlan0 -Dnl80211 -c/data/misc/wifi/wpasupplicant.conf -e/data/misc/wifi/entropy.bin # we will start as root and wpasupplicant will switch to user wifi # after setting up the capabilities required for WEXT # user wifi # group wifi inet keystore class main socket wpawlan0 dgram 660 wifi wifi disabled oneshot service dhcpcdwlan0 /system/bin/dhcpcd -aABKL class main disabled oneshot service dhcpcdp2p /system/bin/dhcpcd -aABKL class main disabled oneshot service iprenewwlan0 /system/bin/dhcpcd -n class main disabled oneshot service iprenew_p2p /system/bin/dhcpcd -n class main disabled oneshot

  •  device.mk

PRODUCT_PROPERTY_OVERRIDES += \ wifi.interface=wlan0

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

... "wifi,1,1,1,-1,true" "wifi_p2p,13,1,0,-1,true" ... "1,1" ...

The kernel driver (wl12xx_sdio.ko) is part of the linux kernel. Enable it to be build as a module and compile it with make modules. Put them in /system/lib/modules

Firmware can be downloaded from:

git clone git://git.kernel.org/pub/scm/linux/kernel/git/firmware/linux-firmware.git

put the firmware files:
<br></br>
wl1271-fw-2.bin<br></br>
wl1271-fw-ap.bin<br></br>
wl1271-fw.bin<br></br>
wl1271-fw-3.bin<br></br>
wl1271-fw-4-mr.bin<br></br>
wl1271-fw-4-plt.bin<br></br>
wl1271-fw-4-sr.bin<br></br>

in /etc/firmware/ti-connectivity/

Take a look at how the wireless hardware is started by the android system:

http://androidxref.com/4.2.2r1/xref/hardware/libhardwarelegacy/wifi/wifi.c

http://androidxref.com/4.2.2_r1/xref/frameworks/base/wifi/java/android/net/wifi/WifiStateMachine.java

http://wireless.kernel.org/en/users/Drivers/wl12xx

http://processors.wiki.ti.com/index.php/TI-Android-ICS-PortingGuide#WLAN

http://blog.linuxconsulting.ro/2010/04/porting-wifi-drivers-to-android.html

Make sure the permissions on /etc/dhcpcd/dhcpcd-run-hooks and friends are set so that they are executable by the dhcp service

Paul Soucy

Read more posts by this author.