Android WIFI Boot Process

Source: Internet
Author: User

Reference: http://blog.chinaunix.net/uid-26215986-id-3260413.html

I. WIFI work steps

1. WiFi Module Initialization

2. WiFi Boot

3. Find Hotspots (APs)

4. Configure the AP

5. Configure the AP Parameters

6. WiFi connection

7. IP address configuration

two . WIFI Core Module

1. Wifiservice

Created by Connecttivityservice initiated by Systemserver,

Responsible for starting off wpa_supplicant, Wifimonitor threads,

Send the command to Wpa_supplicant and update the status of WiFi.

2. Wifimonitor

Responsible for receiving event notifications from Wpa_supplicant.

3. Wpa_supplicant

1. Read the configuration file

2. Initialize configuration parameters, drive function

3, let the drive scan current all BSSID

4, check whether the parameters of the scan and the user set the want to No

5, if the match, notify the driver for permission authentication operation

6, connect the AP

4. WiFi Driver Module

Vendor-supplied source, primarily for load firmware and kernel wireless communication

5. WiFi Power Management Module

Primary control of hardware Gpio and upper and lower power, allowing the CPU and WiFi modules to communicate through the Sdio interface

three . WIFI Module Code distribution

1. Wifi Application

Packages/apps/settings/src/com/android/settings/wifi

2. Wifi Framework

Frameworks/base/wifi/java/android/net/wifi

Frameworks/base/services/java/com/android/server

3. Wifi JNI

Frameworks/base/core/jni/android_net_wifi_wifi.cpp

4. Wifi Hardware (HAL)

Hardware/libhardware_legacy/wifi/wifi.c

5.Wifi Tool

External/wpa_supplicant

6.Wifi Kernel (BRCM,QCOM,MTK)

Net/wireless drivers/wlan_sd8688 ARCH/ARM/MACH-PXA/WLAN_PM.C

four . Sequence Diagram

initialization of the WIFI module :

when the Systemserver is started, an instance of Connectivityservice is generated, the Connectivityservice constructor creates the Wifiservice,

Wifistatetracker will create wifimonitor to receive events from the underlying, Wifiservice and Wifimonitor are the core of the entire module.

Wifiservice is responsible for starting off Wpa_supplicant, wifimonitor Monitor the thread and send the command to Wpa_supplicant,

Wifimonitor is responsible for receiving event notifications from Wpa_supplicant.

WIFI Module Start-up:

Wirelesssettings configured by Wifienabler to handle the WiFi button at initialization time, when the user presses the WiFi button, calls the Wifienabler Onpreferencechange,

Again by the Wifienabler call Wifimanager setwifienabled interface function, through the aidl, the actual call is Wifiservice setwifienabled function,

Wifiservice then sends a MESSAGE_ENABLE_WIFI message to itself, making real work in the code that handles the message:

First load the WiFi kernel module (the module's position is hardcoded to "/system/lib/modules/wlan.ko"),

Then start wpa_supplicant (the configuration file is hard-coded to "/data/misc/wifi/wpa_supplicant.conf"),

The monitoring thread in the Wifimonitor is then started through Wifistatetracker.

Find Hotspots (APs):

WiFi on) will send wifi_state_changed_action when the WiFi module is turned on. The action receiver is registered in the Wifilayer. The process of starting scan when Wifilayer receives this action, as follows

When wpa_supplicant finishes processing the scan command, it sends an event notification scan to the control channel, which receives the event from the Wifi_wait_for_event function, from which the monitorthread in Wifimonitor will be executed to come out of this event:

To configure the AP parameters:

When the user selects an AP on the Wifisettings interface, a dialog box is displayed that configures the AP parameters:

WiFi connection:

Configuration of IP Address:

Android WIFI Boot Process

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.