«

Android:wpa_supplicant决定选择哪种驱动

时间:2024-3-2 17:05     作者:韩俊     分类: Android


1, main 函数的入口:

external/wpa_supplicant_8/wpa_supplicant/main.c


2, init.rc中通过参数指定要加载哪个驱动



3, wpa_supplicant中加载驱动的原理


main.c: main()

--> wpa_supplicant.c: wpa_supplicant_add_iface()

--> wpa_supplicant.c: wpa_supplicant_init_iface()

-->wpa_supplicant.c: wpa_supplicant_set_driver()

-->wpa_supplicant.c: select_driver()

-->此处根据driver的索引i, 初始化对应的驱动。 wpa_drivers[i]->global_init.


4. 各个驱动的配置:

在文件 src/drivers/drivers.c中有所支持全部驱动的一个数组:

struct wpa_driver_ops *wpa_drivers[] =
{
#ifdef CONFIG_DRIVER_WEXT
&wpa_driver_wext_ops,
#endif /* CONFIG_DRIVER_WEXT */
#ifdef CONFIG_DRIVER_NL80211
&wpa_driver_nl80211_ops,
#endif /* CONFIG_DRIVER_NL80211 */
#ifdef CONFIG_DRIVER_HOSTAP
&wpa_driver_hostap_ops,
#endif /* CONFIG_DRIVER_HOSTAP */
#ifdef CONFIG_DRIVER_MADWIFI
&wpa_driver_madwifi_ops,
#endif /* CONFIG_DRIVER_MADWIFI */
#ifdef CONFIG_DRIVER_BSD
&wpa_driver_bsd_ops,
#endif /* CONFIG_DRIVER_BSD */
#ifdef CONFIG_DRIVER_NDIS
&wpa_driver_ndis_ops,
#endif /* CONFIG_DRIVER_NDIS */
#ifdef CONFIG_DRIVER_WIRED
&wpa_driver_wired_ops,
#endif /* CONFIG_DRIVER_WIRED */
#ifdef CONFIG_DRIVER_TEST
&wpa_driver_test_ops,
#endif /* CONFIG_DRIVER_TEST */
#ifdef CONFIG_DRIVER_ROBOSWITCH
&wpa_driver_roboswitch_ops,
#endif /* CONFIG_DRIVER_ROBOSWITCH */
#ifdef CONFIG_DRIVER_ATHEROS
&wpa_driver_atheros_ops,
#endif /* CONFIG_DRIVER_ATHEROS */
#ifdef CONFIG_DRIVER_NONE
&wpa_driver_none_ops,
#endif /* CONFIG_DRIVER_NONE */
NULL
};

各个驱动的具体实现则放在drivers_xxx.c的文件中。其中wext的实现放在driver_wext.c中。


标签: android

热门推荐