1 / 10

Android 4.0 wifi 框架与启动流程分析

Android 4.0 wifi 框架与启动流程分析. wifi的层次结构. wifi setting 应用程序. frameswork层. JNI. wifi管理层. socket. 守护进程wpa_supplicant. driver. wifi 设备. wpa_supplicant. 位置: external/wpa_supplicant_8 简介:

ria-english
Download Presentation

Android 4.0 wifi 框架与启动流程分析

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. Android 4.0 wifi框架与启动流程分析

  2. wifi的层次结构 wifi setting 应用程序 frameswork层 JNI wifi管理层 socket 守护进程wpa_supplicant driver wifi 设备

  3. wpa_supplicant 位置: external/wpa_supplicant_8 简介: wpa_supplicant本是开源项目源码,被谷歌修改后加android平台,它主要是用来支持WEP,WPA/WPA2和WAPI无线协议和加密认证的,而实际上的工作内容是通过socket(不管是wpa_supplicant与上层还是wpa_supplicant与驱动都采用socket通讯)与驱动交互上报数据给用户,而用户可以通过socket发送命令给wpa_supplicant调动驱动来对WiFi芯片操作。 简单的说,wpa_supplicant就是WiFi驱动和用户的中转站外加对协议和加密认证的支持。

  4. wifi setting应用程序层 • 位置: • packages/apps/Settings/src/com/android/settings/wifi/wifisetting.java • 功能: • wifi人机交互界面,响应用户操作触发framesworks的wifi操作类,在用户界面上实现下层传递过来的事件。

  5. wifi framesworks层 • 位置 • frameworks/base/services/java/com/android/server/ • frameworks/base/wifi/java/android/net/wifi/ • 涉及到的文件: • SystemServer.java • WifiManager.java • WifiService.java • WifiStateMachine.java • Wifinative.java

  6. wifi.c • 功能:wifi的管理库 • 位置:hardware/libhardware_legacy • 简介: • 实现wifi驱动模块的加载与卸载,开启wpa_supplicant,与wpa_supplicnat通过socket方式进行通信,传递上层发送的信息给wpa_supplicant,接收wpa_supplicant的消息传递给上层进行相应的处理。

  7. wifi.c的主要函数 •   驱动的加载卸载: •   wifi_load_driver():   • wpa_unload_driver() •   Wpa_supplicant相关: •   wifi_start_supplicant():   • wifi_start_supplicant_common(const char *config_file)   wifi_connect_to_supplicant():  •   数据的传输: •   wifi_command(const char *command, char *reply, size_t *reply_len)   • wifi_send_command(struct wpa_ctrl *ctrl, const char *cmd, char *reply, size_t *reply_len)   • wifi_wait_for_event(char *buf, size_t buflen) •   wifi_ctrl_recv(struct wpa_ctrl *ctrl, char *reply, size_t *reply_len)

  8. wifi 启动流程简单归纳为三部分 • 加载驱动 • 开启wpa_supplicant • 开启监视器,阻塞监听来自下层发送的消息

  9. 驱动模块加载原理: • 扫描usb wifi设备的vid_pid是否与程序中vid_pid表中的其中一个相同,有则加载驱动 • wifi.c与wpa_supplicant通信方式: • socket • 监听wpa_supplicant向上传递信息: • 调用wifi_wait_for_event(char *buf, size_t buflen)函数

  10. wifi启动流程

More Related