分类: LINUX
2012-12-13 17:55:12
3:从不 --采用deepsleep模式睡眠,休眠后wifi不连接
底层驱动有四种状态:
enum {
WLAN_POWER_STATE_ON = 0,
WLAN_POWER_STATE_CUT_PWR = 1,
WLAN_POWER_STATE_DEEP_SLEEP,
WLAN_POWER_STATE_WOW
};
上层鱼底层通过文件/sys/android_wlan/wlan_power/sleep_policy进行通信
1:始终 对应WLAN_POWER_STATE_WOW
2,3是WLAN_POWER_STATE_DEEP_SLEEP
上层有关的文件:
frameworks/base/services/java/com/android/server/WifiService.java
frameworks/base/core/java/android/provider/Settings.java
中间层设置此文件的文件为frameworks/base/services/java/com/android/server/WifiService.java中
在第三种情况,在屏灭后wifi默认会在15分钟后进行休眠,这里需注意
android:wpa_supplicant中使用的四个套接字
上行接口:
static struct wpa_ctrl *ctrl_conn;控制接口,用于发送命令,获取信息,发送request,接受response
static struct wpa_ctrl *monitor_conn;用于监听wpa_supplicant的event
主要调用到的接口是
wpa_ctrl_open
wpa_ctrl_close
wpa_ctrl_request
简历client端节点
wpa_supplicant_ctrl_iface_receive
wpa_supplicant_ctrl_iface_send
sever端消息的接受和发送,也就是sever端套接字的处理流程
1.ioctl_sock:发送命令道kernel(driver_nl80211.c)wpa_driver_nl80211_init
drv->ioctl_sock = socket(PF_INET, SOCK_DGRAM, 0);
和framework层进行通信的
2.netlink sock:接受kernel发上来的event(driver_nl80211.c)wpa_driver_nl80211_init---netlink_init---
netlink->sock = socket(PF_NETLINK, SOCK_RAW, NETLINK_ROUTE);
3.monitor_sock:i802_init---wpa_driver_nl80211_set_mode---nl80211_create_monitor_interface
drv->monitor_sock = socket(PF_PACKET, SOCK_RAW, htons(ETH_P_ALL));
4.l2 packet sock:处理802.1x报文 l2_packet_init
l2->fd = socket(PF_PACKET, l2_hdr ? SOCK_RAW : SOCK_DGRAM,
htons(protocol));