Wi-Fi User Guide for
Android 4.0
i
Revision History
Date Version Description Author
2010/07/09 0.2
Initial revision of WLAN function
1. Driver version: 4.218.195.0
Terence Hsieh
2010/07/25 0.3
1. Refine the user guide
2. Add WLAN power saving mode
Fred Chen
2010/08/18 0.6 Add SoftAP guide Terence Hsieh
2010/11/16 0.9 Add WLAN deepsleep mode Terence Hsieh
2011/01/07 1.0
1. Add auto channel selection of SoftAP
2. Add OOB (Out-Of-Band) mode
Terence Hsieh
2011/01/08 1.2 Correct typo in OOB mode Fred Chen
2011/06/02 2.0
1. Add Wi-Fi Direct guide
2. Add 802.11 B/G/N configuration of SoftAP
3. Enable frameburst for SoftAP
4. Set dtim to 1 for SoftAP
Terence Hsieh
2011/12/20 2.2
1. Driver version: 4.218.248.18
2. Update WLAN Operation
Terence Hsieh
2012/02/10 3.0 Upgrade driver version: 5.90.125.120 Terence Hsieh
2012/08/20 3.1
1. Upgrade Wi-Fi driver version: 5.90.195.26.1
2. Modify WLAN OOB mode
3. Modify SoftAP function
4. Modify Wi-Fi Direct function
5. Remove WLAN deepsleep mode
Terence Hsieh
2012/12/10 4.2 1. Remove WEXT from WLAN Terence Hsieh
ii
TABLE OF CONTENTS
IINNTTRROODDUUCCTTIIOONN ............................................................................................................... 1
WWLLAANN SSOOFFTTWWAARREE AARRCCHHIITTEECCTTUURREE OOVVEERRVVIIEEWW ............................................................ 2
BROADCOM WLAN DONGLE BASIC CONCEPT ..................................................... 2
WLAN DONGLE OVERVIEW .................................................................................. 2
WWLLAANN SSOOFFTTWWAARREE PPAACCKKAAGGEE ........................................................................................ 3
AANNDDRROOIIDD CCOONNFFIIGGUURRAATTIIOONN FFOORR WWLLAANN FFUUNNCCTTIIOONN ....................................................... 4
ENABLE CFG80211 IN LINUX KERNEL ................................................................. 4
ENABLE WI-FI STATION FUNCTION IN ANDROID SOURCE ..................................... 4
WWLLAANN OOPPEERRAATTIIOONN ........................................................................................................ 6
INSTALL DONGLE HOST DRIVER ............................................................................ 6
ADD WPA SUPPLICANT CONFIGURATION FILE ...................................................... 6
INITIAL WPA SUPPLICATION ................................................................................... 7
SCAN NETWORK .................................................................................................... 8
WWLLAANN PPOOWWEERR SSAAVVIINNGG MMOODDEE ...................................................................................... 9
WWLLAANN OOOOBB ((OOUUTT--OOFF--BBAANNDD)) IINNTTEERRRRUU
ppt
关于艾滋病ppt课件精益管理ppt下载地图下载ppt可编辑假如ppt教学课件下载triz基础知识ppt
T MMOODDEE ...................................................... 10
MAKEFILE ............................................................................................................. 10
GPIO PIN DEFINE ............................................................................................... 10
SSOOFFTTAAPP FFUUNNCCTTIIOONNAALLIITTYY OOVVEERRVVIIEEWW .......................................................................... 11
SOFTAP FIRMWARE ............................................................................................. 12
ENABLE SOFTAP FUNCTION IN ANDROID SOURCE ............................................. 12
WWII--FFII DDIIRREECCTT FFUUNNCCTTIIOONNAALLIITTYY OOVVEERRVVIIEEWW .................................................................. 13
KERNEL CONFIGURATION ..................................................................................... 13
WI-FI DIRECT FIRMWARE .................................................................................... 13
ENABLE WI-FI DIRECT FUNCTION IN ANDROID SOURCE .................................... 13
WI-FI DIRECT OPERATION STEPS ....................................................................... 15
iii
LIST OF FIGURES
Figure 1: Broadcom SDIO WLAN Dongle Concept ............................................... 3
Figure 2: Connect to WLAM AP ................................................................................ 7
Figure 3: Scan WLAN network .................................................................................. 8
Figure 4: Enable Wi-Fi direct ................................................................................... 15
Figure 5: Scan p2p devices ..................................................................................... 15
Figure 6: Connect to p2p device ............................................................................. 16
Figure 7: Connected with p2p device ..................................................................... 16
iv
LIST OF TABLE
Table 1: SoftAP Features ......................................................................................... 11
1
IINNTTRROODDUUCCTTIIOONN
This user guide is intended to give Ampak Wi-Fi module users a general guide of how to enable
the WLAN in Android operating system.
2
WWLLAANN SSOOFFTTWWAARREE AARRCCHHIITTEECCTTUURREE OOVVEERRVVIIEEWW
BROADCOM WLAN DONGLE BASIC CONCEPT
The WLAN software package contains the dongle host driver for the host, a downloadable
binary image for WLAN dongle, and management utilities.
The wireless driver runs on the WLAN dongle. The SDIO host controller passes IEEE 802.3
packets, and the necessary control packets, back and forth over the SDIO bus. A special
Broadcom Device Class protocol is used to encapsulate control packets on a separate logical
control channel and to add packet information to the data channel.
The advantage of using the dongle concept is that the wireless driver is executed externally
from a host device, which means the host device does not have to use CPU or memory
resources in order to execute the wireless driver’s functionality. The use of the dongle provides
the following benefits to the host:
Power savings
A reduction in driver size and complexity
Processor offloading for activities such as checksum calculation and Address Resolution
Protocol (ARP) execution
WLAN DONGLE OVERVIEW
The Dongle Host Driver (DHD) is the executable module that provides encapsulated
communication between the host device and the Ampak module over the SDIO bus.
The dongle software architecture is based on two major components:
Dongle Host Driver: A host-based driver used to provide a communication channel with the
dongle device firmware.
User-space configuration utilities, WL and DHD: These executable binaries are called “wl”
and “dhd” respectively.
3
Figure 1: Broadcom SDIO WLAN Dongle Concept
WWLLAANN SSOOFFTTWWAARREE PPAACCKKAAGGEE
The provided WLAN software package contains following files:
Dongle host driver (bcmdhd.ko)
Dongle device firmware (fw_bcmdhd.bin)
NVRAM (nvram.txt)
User space configuration utility (dhd and wl)
4
AANNDDRROOIIDD CCOONNFFIIGGUURRAATTIIOONN FFOORR WWLLAANN FFUUNNCCTTIIOONN
ENABLE CFG80211 IN LINUX KERNEL
Please add following items into your kernel configuration:
CONFIG_CFG80211=y
ENABLE WI-FI STATION FUNCTION IN ANDROID SOURCE
1. BoardConfig.mk
# Wi-Fi related defines
BOARD_WPA_SUPPLICANT_DRIVER := NL80211
WPA_SUPPLICANT_VERSION := VER_0_8_X
BOARD_WPA_SUPPLICANT_PRIVATE_LIB := lib_driver_cmd_bcmdhd
BOARD_HOSTAPD_DRIVER := NL80211
BOARD_HOSTAPD_PRIVATE_LIB := lib_driver_cmd_bcmdhd
BOARD_WLAN_DEVICE := bcmdhd
WIFI_DRIVER_FW_PATH_PARAM := "/sys/module/bcmdhd/parameters/firmware_path"
WIFI_DRIVER_FW_PATH_STA := "/system/etc/firmware/fw_bcmdhd.bin"
WIFI_DRIVER_FW_PATH_P2P := "/system/etc/firmware/fw_bcmdhd_p2p.bin"
WIFI_DRIVER_FW_PATH_AP := "/system/etc/firmware/fw_bcmdhd_apsta.bin"
WIFI_DRIVER_MODULE_NAME := "bcmdhd"
#WIFI_DRIVER_MODULE_PATH := "/system/lib/modules/bcmdhd.ko"
WIFI_DRIVER_MODULE_ARG := "iface_name=wlan
firmware_path=/system/etc/firmware/fw_bcmdhd.bin
nvram_path=/system/etc/firmware/nvram.txt"
5
2. init.rc
service wpa_supplicant /system/bin/wpa_supplicant \
-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
6
WWLLAANN OOPPEERRAATTIIOONN
This is a quick example for connection and you can refer to the website of WPA Supplicant for
more detail.
INSTALL DONGLE HOST DRIVER
# insmod bcmdhd.ko “firmware_path=fw_bcmdhd.bin nvram_path=nvram.txt iface_name=wlan”
# ifconfig [Interface Name] up
ADD WPA SUPPLICANT CONFIGURATION FILE
Please create wpa_supplicant.conf file with following content:
ctrl_interface=/data/misc/wifi/sockets
# Open system without encryption
network={
ssid="tttb"
key_mgmt=NONE
}
# Open/Shared authentication with WEP encryption
network={
ssid="tttb"
key_mgmt=NONE
auth_alg=OPEN SHARED
wep_key0=1234567890
}
# WPA/WPA2-PSK authentication with TKIP/AES encryption
network={
ssid="tttb"
psk="12345678"
}
7
INITIAL WPA SUPPLICATION
#wpa_supplicant -Dnl80211 -i [Interface Name] -c wpa_supplicant.conf -d&
Figure 2: Connect to WLAM AP
8
SCAN NETWORK
#wpa_cli -i [Interface Name] -p /data/misc/wifi/sockets/ scan
#wpa_cli -i [Interface Name] -p /data/misc/wifi/sockets/ scan_results
Figure 3: Scan WLAN network
9
WWLLAANN PPOOWWEERR SSAAVVIINNGG MMOODDEE
There’re three different power saving mode settings as follows:
PM_OFF
The driver is not in Power Saving mode
Can be activated by following command
./wl PM 0
PM_MAX
The driver is in Maximum Power Saving mode. The driver always goes into Sleep
mode and uses the PS_POLL mechanism to retrieve packets from the AP.
Performance is sacrificed for maximum power savings.
Can be activated by following command
./wl PM 1
PM_FAST
Fast Power Saving mode. As long as there’re active data transfers, the driver does not
go into Sleep mode. After data traffic stops, driver goes into Sleep mode. This allows
for power savings in IDLE times, but provides full performance when needed.
Can be activated by following command
./wl PM 2
10
WWLLAANN OOOOBB ((OOUUTT--OOFF--BBAANNDD)) IINNTTEERRRRUUPPTT MMOODDEE
Host can enter sleep mode, but keep Ampak module alive. Once Ampak module receives
packets, it can wake up host through a pre-defined GPIO pin.
MAKEFILE
Please add follwing flags in Makefile of driver
# DHDCFLAGS += -DSDIO_ISR_THREAD
DHDCFLAGS += -DOOB_INTR_ONLY -DHW_OOB -DCUSTOMER_OOB
GPIO PIN DEFINE
Register a gpio for WL_HOST_WAKE and change this gpio to interrupt pin.
dhd_customer_gpio.c:
int dhd_customer_oob_irq_map(unsigned long *irq_flags_ptr)
{
int host_oob_irq = 0;
#ifdef CUSTOMER_HW2
host_oob_irq = wifi_get_irq_number(irq_flags_ptr);
#elif defined(CUSTOMER_OOB)
printk("GPIO(WL_HOST_WAKE) = EXYNOS4_GPX0(7) = %d\n", EXYNOS4_GPX0(7));
host_oob_irq = gpio_to_irq(EXYNOS4_GPX0(7));
gpio_direction_input(EXYNOS4_GPX0(7));
printk("host_oob_irq: %d \r\n", host_oob_irq);
#else…
11
SSOOFFTTAAPP FFUUNNCCTTIIOONNAALLIITTYY OOVVEERRVVIIEEWW
Many smart phones have high-bandwidth cellular data connections using technologies such as
HSPA, UMTS, EVDO, and so on. In addition to provide access to network-based services from
the phone itself, many carriers want to enable their customers to use the connection for other
WLAN-enabled devices, such as computers and handheld video games.
For other devices to connect to the cellular phone, the WLAN chipset must be configured for
SoftAP operation. Multiple WLAN-enabled devices can then connect to the cellular phone and
share the connection. This capability is known as tethering.
Several other protocols are required, however, before the WLAN-enabled devices can
successfully share a connection with the cellular phone. These protocols include DHCP (for
giving associated devices their own IP address) and Network Address Translation (NAT). There
protocols are layer-3 protocols that exist entirely above Broadcom SoftAP implementation.
Following table introduce the SoftAP features:
Feature Description
Stations supported 8
Station power save support IEEE and WMM-PS
Security Open, WEP, WPA-PSK(TKIP), and WPA2-PSK(TKIP+AES)
WEP keys supported 4
SSID broadcast disable Yes
Allow/deny list Yes, through MAC address filtering
Association station list Yes
Limit station associations Yes, the maximum = 8
Table 1: SoftAP Features
The vast majority of the functionality required to implement a SoftAP solution is implemented in
the firmware that is executed by the on-chip processor. Consequently, the software and CPU
load on the host is relatively small.
12
SOFTAP FIRMWARE
If the target device requires SoftAP support, a firmware file with SoftAP support must be
downloaded to the module. The firmware binary file must have an ap in the file name, such as
fw_bcmdhd_apsta.bin.
ENABLE SOFTAP FUNCTION IN ANDROID SOURCE
1. BoardConfig.mk
# Wifi related defines
BOARD_WPA_SUPPLICANT_DRIVER := NL80211
WPA_SUPPLICANT_VERSION := VER_0_8_X
BOARD_WPA_SUPPLICANT_PRIVATE_LIB := lib_driver_cmd_bcmdhd
BOARD_HOSTAPD_DRIVER := NL80211
BOARD_HOSTAPD_PRIVATE_LIB := lib_driver_cmd_bcmdhd
BOARD_WLAN_DEVICE := bcmdhd
WIFI_DRIVER_FW_PATH_PARAM := "/sys/module/bcmdhd/parameters/firmware_path"
WIFI_DRIVER_FW_PATH_STA := "/system/etc/firmware/fw_bcmdhd.bin"
WIFI_DRIVER_FW_PATH_P2P := "/system/etc/firmware/fw_bcmdhd_p2p.bin"
WIFI_DRIVER_FW_PATH_AP := "/system/etc/firmware/fw_bcmdhd_apsta.bin"
WIFI_DRIVER_MODULE_NAME := "bcmdhd"
#WIFI_DRIVER_MODULE_PATH := "/system/lib/modules/bcmdhd.ko"
WIFI_DRIVER_MODULE_ARG := "iface_name=wlan
firmware_path=/system/etc/firmware/fw_bcmdhd.bin
nvram_path=/system/etc/firmware/nvram.txt"
13
WWII--FFII DDIIRREECCTT FFUUNNCCTTIIOONNAALLIITTYY OOVVEERRVVIIEEWW
KERNEL CONFIGURATION
Please add following items into your kernel configuration:
CFG80211=y
WI-FI DIRECT FIRMWARE
If the target device requires Wi-Fi Direct support, a firmware file with P2P support must be
downloaded to the module. The firmware binary file must have an p2p in the file name, such as
fw_bcmdhd_p2p.bin.
ENABLE WI-FI DIRECT FUNCTION IN ANDROID SOURCE
1. BoardConfig.mk
# Wifi related defines
BOARD_WPA_SUPPLICANT_DRIVER := NL80211
WPA_SUPPLICANT_VERSION := VER_0_8_X
BOARD_WPA_SUPPLICANT_PRIVATE_LIB := lib_driver_cmd_bcmdhd
BOARD_HOSTAPD_DRIVER := NL80211
BOARD_HOSTAPD_PRIVATE_LIB := lib_driver_cmd_bcmdhd
BOARD_WLAN_DEVICE := bcmdhd
WIFI_DRIVER_FW_PATH_PARAM := "/sys/module/bcmdhd/parameters/firmware_path"
WIFI_DRIVER_FW_PATH_STA := "/system/etc/firmware/fw_bcmdhd.bin"
WIFI_DRIVER_FW_PATH_P2P := "/system/etc/firmware/fw_bcmdhd_p2p.bin"
WIFI_DRIVER_FW_PATH_AP := "/system/etc/firmware/fw_bcmdhd_apsta.bin"
WIFI_DRIVER_MODULE_NAME := "bcmdhd"
#WIFI_DRIVER_MODULE_PATH := "/system/lib/modules/bcmdhd.ko"
WIFI_DRIVER_MODULE_ARG := "iface_name=wlan
firmware_path=/system/etc/firmware/fw_bcmdhd.bin
nvram_path=/system/etc/firmware/nvram.txt"
14
2. device.mk
PRODUCT_COPY_FILES += \
…
frameworks/base/data/etc/android.hardware.wifi.direct.xml:system/etc/permissions/android.
hardware.wifi.direct.xml \
…
3. WirelessSettings.java
if (!getPackageManager().hasSystemFeature(PackageManager.FEATURE_WIFI_DIRECT)) {
getPreferenceScreen().removePreference(wifiP2p);
} else {
mWifiP2pEnabler = new WifiP2pEnabler(activity, wifiP2p);
}
// getPreferenceScreen().removePreference(findPreference(KEY_WIFI_P2P_SETTINGS));
4. init.rc
service wpa_supplicant /system/bin/wpa_supplicant \
-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
15
WI-FI DIRECT OPERATION STEPS
1. Enable Wi-Fi direct
Figure 4: Enable Wi-Fi direct
2. Enter to Wi-Fi direct page then you will see the scan results of P2P devices
Figure 5: Scan p2p devices
16
3. Click the P2P device which you want to connect to and click “Connect” to connect the P2P
device.
Figure 6: Connect to p2p device
4. In sevaral time later, you will find the “Connected” string as following page after both P2P
devices connected with each other.
Figure 7: Connected with p2p device