现在的位置: 首页 > 综合 > 正文

Porting WiFi drivers to Android

2018年04月16日 ⁄ 综合 ⁄ 共 21261字 ⁄ 字号 评论关闭

经过一周多的奋战,终于把WiFi成功的移植到了android2.3,我的硬件平台是s3c6410处理器,  android2.3的无线设置中 成功检测到无线网络,且连接到无线路由,可以使用自带的浏览器上网,祝贺一下,下面把移植过程给大家分享,免得大家走弯路。

 

   先给大家推荐外国朋友写的一篇博客,我发现国内的软件研发人员好多都是翻译这篇文章,我给大家推荐看原版的,因为有的人翻译过来,可能误解了作者的原意,且原文章下面的讨论也非常的有意义,也是需要看看的,博客地址  http://blog.linuxconsulting.ro/2010/04/porting-wifi-drivers-to-android.html,国内用户直接打不开该网站,需要翻墙,

下面是作者的原文及用户讨论:

 

PaNiC
Random Rant (or how we used to call it: .plan)

 

Wednesday, August 11, 2010

Porting WiFi drivers to Android

 

Update (11/08/2010): Updated patch to fix the loading of awext driver at run time. 
Added STOP and RESTART commands.
 

For mini-box.com
picoPC 
we want to support several USB and miniPCI WiFi dongles, this guide provides a step by step explanation of what's involved in adding a new wifi driver and making wifi work in a custom Android build  (this guide was written for android 2.1
but should be applicable to previous android releases and hopefully future releases).
 
Contents
0. Understand how Android WiFi works.
 
1. Enable building of wpa_supplicant in your BoardConfig.mk
 
2. (Optional) Enable debug for wpa_supplicant.
 
3. Provide a proper wpa_supplicant.conf for your device
 
4. Have the correct paths and permissions created from init.rc
 
5. Make sure your wpa_supplicant and dhcpcd (optional) are starting from init.rc 
 
6. Provide your driver either as a module or built in kernel and proper kernel support for it and modify Android source code accordingly.
 
7. Provide a firmware if your module needs it.
 
8. Make your driver work with Android custom wpa_supplicant commands and SIOCSIWPRIV ioctl
 

Now onto details. 

0. Understand how Android WiFi works.
Android uses a modified wpa_supplicant ( external/wpa_supplicant )
daemon for wifi support which is controlled through a socket by
 hardware/libhardware_legacy/wifi/wifi.c (WiFiHW)
that gets controlled from Android UI through
 android.net.wifi package from frameworks/base/wifi/java/android/net/wifi/and
it's corresponding jni implementation in
 frameworks/base/core/jni/android_net_wifi_Wifi.cppHigher level network management is done in frameworks/base/core/java/android/net 

1. Enable building of wpa_supplicant in your BoardConfig.mk
This is by simply adding: BOARD_WPA_SUPPLICANT_DRIVER := WEXT to your BoardConfig.mk .
This will set 
 WPA_BUILD_SUPPLICANT to true in external/wpa_supplicant/Android.mk enabling
building ofdriver_wext.c
If you have a custom wpa_supplicant driver (like madwifi or my custom android private commands emulation - see last paragraph) you can replace WEXT with AWEXT or your driver name (MADWIFI, PRISM etc).
 

2. (Optional) Enable debug for wpa_supplicant. 
By default wpa_supplicant is set to
 MSG_INFO that doesn't tell much. 
To enable more messages:
 
  2.1 modify
 common.c and set wpa_debug_level
= MSG_DEBUG
 
  2.2 modify
 common.h and change #define
wpa_printf
 from if ((level) >= MSG_INFO) to if
((level) >= MSG_DEBUG)
 

3. Provide a proper wpa_supplicant.conf for your device 
Providing a wpa_supplicant.conf it's important because the control socket for android is specified in this file (ctrl_interface= ). This file should be copied by your
 AndroidBoard.mk to $(TARGET_OUT_ETC)/wifi(usually /system/etc/wifi/wpa_supplicant.conf ).
This location will be used on wpa_supplicant service from init.rc.
 
There are two different ways in which wpa_supplicant can be configured, one is to use a "private" socket in android namespace, created by
 socket_local_client_connect() function
in
 wpa_ctrl.c and another is by using a standard unix socket. 

Minimum required config options in wpa_supplicant.conf : 
- Android private socket
 

ctrl_interface=wlan0 
update_config=1
 

- Unix standard socket 

ctrl_interface=DIR=/data/system/wpa_supplicant GROUP=wifi 
update_config=1
 

Depending on your driver you might also want to add: 
ap_scan=1
 

If you have AP association problems with should change to ap_scan=0 to let the driver
do the association instead of wpa_supplicant.
 
If you want to let wpa_supplicant connect to non-WPA or open wireless networks (by default it skips these kind) add:
 

network={ 
key_mgmt=NONE
 
}
 

4. Have the correct permissions and paths created from init.rc 
Incorrect permisions will result in wpa_supplicant not being able to create/open the control socket andlibhardware_legacy/wifi/wifi.c
 won't connect. 
Since Google modified wpa_supplicant to run as
 wifi user/group the directory
structure and file ownership should belong to wifi user/group (see
 os_program_init() function
in
 wpa_supplicant/os_unix.c ).

Otherwise errors like: 
E/WifiHW  (  ): Unable to open connection to supplicant on "/data/system/wpa_supplicant/wlan0": No such file or directory will appear.
 

Also wpa_supplicant.conf should belong to wifi user/group because wpa_supplicant will want to modify this file. If your system has /system as read-only use a location like /data/misc/wifi/wpa_supplicant.conf and modify wpa_supplicant service in init.rc with
new location. 
Make sure the paths are correctly created in init.rc:
 

mkdir /system/etc/wifi 0770 wifi wifi 
chmod 0770 /system/etc/wifi
 
chmod 0660 /system/etc/wifi/wpa_supplicant.conf
 
chown wifi wifi /system/etc/wifi/wpa_supplicant.conf
 
#wpa_supplicant control socket for android wifi.c (android private socket)
 
mkdir /data/misc/wifi 0770 wifi wifi
 
mkdir /data/misc/wifi/sockets 0770 wifi wifi
 
chmod 0770 /data/misc/wifi
 
chmod 0660 /data/misc/wifi/wpa_supplicant.conf
 
chown wifi wifi /data/misc/wifi
 
chown wifi wifi /data/misc/wifi/wpa_supplicant.conf
 

If you use a Unix standard socket in wpa_supplicant.conf (see above)
add:
 

# wpa_supplicant socket (unix socket mode) 
mkdir /data/system/wpa_supplicant 0771 wifi wifi
 
chmod 0771 /data/system/wpa_supplicant
 
chown wifi wifi /data/system/wpa_supplicant
 

Do not add these if you use Android private socket because it will make wpa_supplicant non-functional, becausehardware/libhardware_legacy/wifi/wifi.c check for existence of the/data/system/wpa_supplicant folder
and will pass a wrong interface name to
 wpa_ctrl_open()function. 

5. Make sure your wpa_supplicant and dhcpcd are starting from init.rc 

For wpa_supplicant the init.rc startup like should be depending on which path you chosen: 
- Android private socket:
 

service wpa_supplicant /system/bin/wpa_supplicant -dd -Dwext -iwlan0 -c /system/etc/wifi/wpa_supplicant.conf 
socket wpa_wlan0 dgram 660 wifi wifi
 
group system wifi inet
 
disabled
 
oneshot
 

- Unix standard socket: 

service wpa_supplicant /system/bin/wpa_supplicant -dd -Dwext -iwlan0 -c /system/etc/wifi/wpa_supplicant.conf 
group system wifi inet
 
disabled
 
oneshot
 

If your wifi driver creates a wifi interface with other name than wlan0 you will have
to modify the above line accordingly.
 
You also should have dhcpcd starting from init.rc
 

service dhcpcd /system/bin/dhcpcd wlan0 
group system dhcp
 
disabled
 
oneshot
 

6. Provide your driver either as a module or built in kernel and proper kernel support for it. 
 First make sure that 
 CONFIG_PACKET and CONFIG_NET_RADIO (wireless extensions)  are enabled in your kernel. The driver can be built as module (default android way) or built
in kernel (if you want to rely in kernel auto probing to support multiple driver eg. USB wifi) but will require source code modifications (see below).
 
 - As kernel module:
 
   Define in your
 BoardConfig.mk : 
   1.
 WIFI_DRIVER_MODULE_PATH := path to the module to be loaded 
       You need to specify module name in that path too, usually should look something like /system/lib/modules/wlan.ko
 
   2. 
 WIFI_DRIVER_MODULE_NAME:= the name of the network interface that the driver creates,
for example wlan0
 
   3.
 WIFI_DRIVER_MODULE_ARG:= any arguments that you want to pass to the driver on insmod,
for example nohwcrypt
 
  
 
   Make sure you copy your kernel module when building android to the correct location.
 
- As built in kernel:
 
  - First
 init.rc needs to be modified to inform hardware/libhardware_legacy/wifi/wifi.c about
the name of the interface, that the driver  is already loaded and set the status of wpa_supplicant to running:
 

setprop wifi.interface "wlan0" 
setprop wlan.driver.status "ok"
 

Do NOT add setprop
init.svc.wpa_supplicant "running"
 as I previously mentioned as it will prevent wpa_supplicant from starting from init. 
 - Secondly
 hardware/libhardware_legacy/wifi/wifi.c need to be modified so the functions insmod()and rmmod() return
0
 (simply add return 0; as
the first line in functions since they are not needed when driver is built in kernel) and return before checking for
 /proc/modules in  check_driver_loaded()function. 
You might encounter problems with WifiHW module not being able to connect to wpa_supplicant socket even with the correct permisions. Try to turn off / turn on Wifi from the GUI.
 

 7. Provide a firmware if your driver needs it 

If your driver needs a firmware you will have to copy this firmware file to /etc/firmware on
your android build. Android doesn't use a standard hotplug binary (although there is an implementation available on
 android-x86system/code/toolbox/hotplug.c )
instead the init process takes care of firmware events and loads the firmware file from
 /etc/firmware (see: system/core/init/devices.c handle_firmware_event()function). 
Firmware file name is defined by the driver and might also contain a folder like: RTL8192SU/rtl8192sfw.bin, entire file path should be available in
 /etc/firmware 

8. Make your driver work with Android custom wpa_supplicant commands and SIOCSIWPRIV ioctl. 

 Android uses SIOCSIWPRIV ioctl to send commands to modify driver behaviour and receive
information like signal strength, mac address of the AP, link speed etc. This ioctl is usually not implemented in any known wireless drivers except bcm4329 which is in google
 msm
kernel branch 
.
 
The errors from not having this ioctl implemented will look like:
 
E/wpa_supplicant(  ): wpa_driver_priv_driver_cmd failed wpa_driver_priv_driver_cmd RSSI len = 4096 
 
E/wpa_supplicant(  ): wpa_driver_priv_driver_cmd failed 
 
D/wpa_supplicant(  ): wpa_driver_priv_driver_cmd LINKSPEED len = 4096
 
E/wpa_supplicant(  ): wpa_driver_priv_driver_cmd failed 
 
I/wpa_supplicant(  ): CTRL-EVENT-DRIVER-STATE HANGED
 

After 4, WEXT_NUMBER_SEQUENTIAL_ERRORS errors, android will abort using the device. 

To quickly test your wifi from interface you can disable error checking inexternal/wpa_supplicant/driver_wext.c by simply making ret
= 0;
 inwpa_driver_priv_driver_cmd() function after the SIOCSIWPRIV ioctl call. This
will make all access points in android UI appear without signal or MAC address.
 
To proper implement the ioctl you will need to modify your kernel driver to reply to SIOCSIWPRIV ioctl with RSSI (signal strength) and MACADDR commands being the most important.
 
A better way is to add a custom driver_xxx.c to google
 external/wpa_supplicant/ implementingwpa_driver_priv_driver_cmd() function
that will take care of RSSI, MACADDR and others, through calls to SIOCGIWSTATS, SIOCGIFHWADDR ioctls, with the rest of the functions being called from driver_wext.c.
 
Below is a link to a patch for wpa_supplicant that I did for
 mini-box.com
picoPC 
Android build. It creates a new driver
 awext which "emulates" android
driver commands using wireless extensions ioctls.
 

How to use the new driver: 

1. In your BoardConfig.mk define:  BOARD_WPA_SUPPLICANT_DRIVER
:= AWEXT
 
2. Change
 init.rc wpa_supplicant service command line by replacind -Dwext with -Dawext 

AWEXT driver patch download:   android_wext_emulation_driver_awext.patch

Labels: android

posted by panic @ 11:39
AM

22 Comments:

At May
10, 2010 8:23 AM 
,
   yonathana said...

Hi, 
Was trying the same but have been facing some errors. E/WifiHW ( ): Unable to open connection to supplicant on "/data/system/wpa_supplicant/wlan0"
Even though i have added permissions as mentioned. Would like to compare my files with yours. Would you mind sharing a copy of the modified files ?
 
Thanks
 
Yonathana

At May
10, 2010 9:36 AM 
,
  panic said...

Add a chown wifi wifi on the folders and verify with ls -l /data/system/ on console. I placed the files here: 

http://www.linuxconsulting.ro/android/files/wifi/

At May
10, 2010 12:41 PM 
,
  panic said...

Also try to turnoff/turnon wifi, maybe wpa_supplicant hasn't yet created the socket. I've seen this on my build.
You should see something similar to this in logcat (if you enabled wpa_supplicant debug):

D/wpa_supplicant( 843): Initializing interface 'wlan0' conf '/system/etc/wifi/wpa_supplicant.conf' driver 'awext' ctrl_interface 'N/A' bridge 'N/A'
D/wpa_supplicant( 843): Configuration file '/system/etc/wifi/wpa_supplicant.conf' -> '/system/etc/wifi/wpa_supplicant.conf' 
D/wpa_supplicant( 843): Reading configuration file '/system/etc/wifi/wpa_supplicant.conf'
 
D/wpa_supplicant( 843): ctrl_interface='wlan0'

At May
10, 2010 5:24 PM 
,
  yonathana said...

This is what i did panic : drop both your files in the respective dir and cross check in the rfs if they are same 
Check permissions of
 
s -l /data/system
-rw-rw-r-- system system 35326 2000-01-01 00:00 packages.xml
-rw------- system system 8 2000-01-01 00:01 syncmanager.prefs
drwxrwx--x system system 2000-01-01 00:00 registered_services
drwxrwxrwx wifi wifi 2000-01-01 00:00 wpa_supplicant
-rw------- system system 4096 2000-01-01 00:00 entropy.dat
-rw------- system system 171 2000-01-01 00:00 wallpaper_info.xml
-rw-rw---- system system 16384 2000-01-01 00:00 accounts.db
-rw------- system system 604 2000-01-01 00:00 batterystats.bin
drwx------ system system 2000-01-01 00:00 usagestats
-rw------- system system 64 2000-01-01 00:00 appwidgets.xml

I/ActivityManager( 802): Starting activity: Intent { act=android.intent.action.MAIN cmp=com.android.settings/.WirelessSettings }
D/dalvikvm( 802): GC freed 9763 objects / 499352 bytes in 96ms
I/ActivityManager( 802): Displayed activity com.android.settings/.WirelessSettings: 556 ms (total 556 ms)
W/WifiHW ( 802): Could not open /proc/modules: No such file or directory
I/StatusBarPolicy( 802): received intent android.net.wifi.WIFI_STATE_CHANGED
D/SettingsWifiEnabler( 985): Received wifi state changed from Disabled to Enabling
D/WifiService( 802): ACTION_BATTERY_CHANGED pluggedType: 1
E/WifiHW ( 802): Unable to open connection to supplicant on "/data/system/wpa_supplicant/wlan0": No such file or directory
D/SettingsWifiEnabler( 985): Received wifi state changed from Enabling to Enabled
I/StatusBarPolicy( 802): received intent android.net.wifi.WIFI_STATE_CHANGED
E/WifiHW ( 802): Unable to open connection to supplicant on "/data/system/wpa_supplicant/wlan0": No such file or directory
E/WifiHW ( 802): Unable to open connection to supplicant on "/data/system/wpa_supplicant/wlan0": No such file or directory
I/StatusBarPolicy( 802): received intent android.intent.action.TIME_TICK
E/WifiHW ( 802): Unable to opeinit: no such service 'dhcpcdwlan0'
n connection to supplicant on "/data/system/wpa_supplicant/wlan0": No such file or directory
V/WifiStateTracker( 802): Supplicant died unexpectedly
E/WifiStateTracker( 802): Could not stop DHCP
D/NetworkStateTracker( 802): setDetailed state, old =IDLE and new state=DISCONNECTED
D/ConnectivityService( 802): ConnectivityChange for WIFI: DISCONNECTED/DISCONNECTED
I/EthernetService( 802): setEthState from 2 to 2
init: no such service 'dhcpcdwlan0'
D/SettingsWifiEnabler( 985): Received wifi state changed from Enabled to Disabling
I/StatusBarPolicy( 802): received intent android.net.wifi.supplicant.CONNECTION_CHANGE
I/StatusBarPolicy( 802): received intent android.net.wifi.WIFI_STATE_CHANGED

Am i at loss of ideas, Any clues what could be wrong ?

At May
10, 2010 5:32 PM 
,
  yonathana said...

Also when i do a command line init as soon as system boots 
wpa_supplicant -iwlan0 -c/system/etc/wifi/wpa_supplicant.conf -ddI/StatusBarPolicy( 802): received intent android.intent.action.TIME_TICK

D/wpa_supplicant( 989): Initializing interface 'wlan0' conf '/system/etc/wifi/wpa_supplicant.conf' driver 'default' ctrl_interface 'N/A' bridge 'N/A'
D/wpa_supplicant( 989): Configuration file '/system/etc/wifi/wpa_supplicant.conf' -> '/system/etc/wifi/wpa_supplicant.conf'
D/wpa_supplicant( 989): Reading configuration file '/system/etc/wifi/wpa_supplicant.conf'
E/wpa_supplicant( 989): Failed to read or parse configuration '/system/etc/wifi/wpa_supplicant.conf'.
D/wpa_supplicant( 989): Failed to add interface wlan0
D/wpa_supplicant( 989): Cancelling scan request
D/wpa_supplicant( 989): Cancelling authentication timeout
# I/StatusBarPolicy( 802): received intent android.intent.action.TIME_TICK

# cat /system/etc/wifi/wpa_supplicant.conf
ctrl_interface=DIR=/data/system/wpa_supplicant GROUP=wifi
update_config=1

This is what i see ? Wonder why the wpa_supplicant .conf is not being parsed

At May
10, 2010 5:57 PM 
,
  panic said...

Should have read access to wifi user/group. Also specify -Dwext as driver.

At May
12, 2010 5:11 AM 
,
  Oramon said...

Dear sir, I had setup my device with wpa_supplicant working good. But the message "ioctl[SIOCGIWRATE]: No such device" is showed after linkspeed command parsed by driver_awext.c.
Would you please help me to figure out where to setup the correct interface in this situation? Thank you~

At May
12, 2010 2:36 PM 
,
  panic said...

@yonathana You have syntax errors on your dhcpcd line also check permissions for /system/etc/wifi

@Oramon Your driver doesn't support WRATE ioctl that means you will have no link speed information but wifi should be working without.

At June
2, 2010 6:36 PM 
,
  Sireesha said...

Hi

In Step6, building it as a module, 
When you say:
"Make sure you copy your kernel module when building android to the correct location."

What is the correct location ? I built my driver on linux and copied the generated wl.ko file to the out/target/product/xxx/system/lib/modules/2.6.29-android-x86/kernel/drivers/net/wireless/wl/wl.ko

But, I get "Exec format error" when I try to do insmod wl.ko.

How do I include the module to be built by android ? Mine is a broadcom 4311 wireless card.

Regards
Sireesha.

At August
3, 2010 5:14 PM 
,
  pyro said...

Hi panic,

thanks for your work. It helped me a lot.

Here some improvements:

@ point 4
if you use dhcp in init.rc you should also add a working folder.

mkdir /data/misc/dhcp 0770 dhcp dhcp
chmod 0770 /data/misc/dhcp

@ point 5
you have to use the wpa_supplicant.conf in /data/misc/wifi because in /system/etc/wifi/ is only a template which is write protected. to save configured networks you need to have write access to the conf file.

@ point 8
your awext driver patch misses a small part.
diff --git a/drivers.c b/drivers.c
index 45c2f55..cc5621c 100644
--- a/drivers.c
+++ b/drivers.c
@@ -15,6 +15,9 @@
#include "includes.h"

+#ifdef CONFIG_DRIVER_AWEXT
+extern struct wpa_driver_ops wpa_driver_awext_ops; /* driver_awext.c */
+#endif /* CONFIG_DRIVER_AWEXT */
#ifdef CONFIG_DRIVER_WEXT
extern struct wpa_driver_ops wpa_driver_wext_ops; /* driver_wext.c */
#endif /* CONFIG_DRIVER_WEXT */
@@ -62,6 +65,9 @@ extern struct wpa_driver_ops wpa_driver_custom_ops; /* driver_ti.c */

struct wpa_driver_ops *wpa_supplicant_drivers[] =
{
+#ifdef CONFIG_DRIVER_AWEXT
+ &wpa_driver_awext_ops,
+#endif /* CONFIG_DRIVER_AWEXT */
#ifdef CONFIG_DRIVER_WEXT
&wpa_driver_wext_ops,
#endif /* CONFIG_DRIVER_WEXT */

At August
10, 2010 2:34 PM 
,
  kiran said...

Hi,

I'm trying to build wpa_supplicant_6 (Andriod 2.1),have made the modifications as said.But im getting build errors
-----------------------------------------
config.c:60: error: expected declaration specifiers or ‘...’ before ‘size_t’
config.c: In function ‘wpa_config_parse_string’:
config.c:66: warning: implicit declaration of function ‘os_strrchr’
config.c:66: warning: assignment makes pointer from integer without a cast
config.c:67: error: ‘NULL’ undeclared (first use in this function)
config.c:67: error: (Each undeclared identifier is reported only once
config.c:67: error: for each function it appears in.)
config.c:69: error: ‘len’ undeclared (first use in this function)
config.c:70: warning: implicit declaration of function ‘os_malloc’
----------------------------------------

Also pls clarify where the kernel module needs to copied.

Thanks
Kiranmai

At August
11, 2010 9:49 AM 
,
  panic said...

Kiran the patch and howto is for wpa_supplicat not for the wpa_supplicant_6 that appeared on froyo. I will look on _6 version soon.

At August
11, 2010 1:38 PM 
,
  kiran said...

panic,i want to use upnp-service discovery in andriod.Do you i/p's about that?
Any workiing library sources/refernces.

Thanks
Kiranmai

At August
23, 2010 4:47 PM 
,
  guru said...

Hi, I followed the steps to enable wifi on froyo. wifi is getting enabled but when tried to connect it is not setting system properties like dhcp.eth0.ipaddress and other. it is
setting only dhcp.eth0.dns1, dhcp.eth0.dns2 and dns3. whether I need to configure or change to set all system properties?

At September
3, 2010 2:28 AM 
,
  Eric
Nelson
 said...

Thanks Nicu. I wish I had found your post a couple of days earlier, but even so, it saved me considerable time configuring things for one of our customers.

I posted some notes on my experiences on our blog:

http://boundarydevices.com/blogs/?p=284

At September
28, 2010 8:08 PM 
,
  G2 said...

Great stuff! Works like a charm on Eclair. What about Froyo and wpa_supplicant_6?

At November
1, 2010 7:38 AM 
,
  G2 said...

If you are interested, I have done it for supplicant 0.6.10: it's here:

http://git.alwaysinnovating.com/cgit.cgi/ai.android/tree/preprocess/froyo/wifi.patch

The only notable difference is .get_scan_results2

At January
22, 2011 12:39 AM 
,
  Blake said...

Hi,

I'd like very much to speak to you about your informative post on porting Wi-Fi drivers to Android. Are you interested in freelance consulting work? I'd be really grateful if you could contact me - blake@hfield.com. I look forward to hearing from you.

-Blake

At February
22, 2011 4:06 PM 
,
  proveyourselfthom said...

Sorry but I haven't found any way to contact you. So, why your sis drivers aren't part of Xorg?
Is it updated?
Thank you.

At March
4, 2011 11:43 AM 
,
  hoyushen said...

Dear Sir

First, thank you for your shares, it really helps me a lot. Now I have a question of supporting multi-WiFi drivers at the same time. Is there any possibility not to init interface name(ex.wlan0,wpa_supplicant -iwlan0 -c xxxxx......) in init.rc? Because different
WiFi drivers have different interface names. Or could you provide any other suggestions for this purpose? My work-arounded solution is to modify the same interface name for different WiFi drivers in src code(ex.wlan0). Then modify wifi.c(hardware/libhardware_legacy/wifi)
to load different WiFi modules base on VID/PID table, which I've added for this purpose. But I think it's not a good solution. I'd appreciate of your comments. Thank you for your kindly help again.

ps. my email is hoyushen@gmail.com

Sincerely, Kevin

At March
22, 2011 5:19 PM 
,
  panic said...

proveyourselfthom:

No the X11 drivers are no longer updated, although Mandriva had picked up my driver and added fixes and updates. I think the driver name was sisimedia or something similar.

At March
22, 2011 5:20 PM 
,
  panic said...

hoyushen:

Might be possible with gingerbread, since I've seen that the wpa_supplicant and dhcp are now started from wifi.c in hardware_legacy/wifi
You will need to modify wifi.c to get the interface name from sysfs and build up the wpa_supplicant command.

 

 

/××××××××××××××××××××××××××××××××××××××××××××/

呵呵,就是这样的,我使用的是内核集成驱动,没有使用模块形式加载。另外我使用 android私有socket driver_wext.c驱动,是android源代码带有的,在android  BoardConfig.mk文件里关于WiFi的配置:

 

 BOARD_HAVE_LIBWIFI := true

BOARD_WPA_SUPPLICANT_DRIVER := WEXT

 

另外需要非常注意的一个地方是android中跟目录下面的 init.rc 文件,里面的

 

# we will start as root and wpa_supplicant will switch to user wifi

# after setting up the capabilities required for WEXT

 

service wpa_supplicant /system/bin/wpa_supplicant /

    -Dfawext -iwlan0 -c/data/misc/wifi/wpa_supplicant.conf -dd

# user wifi

# group wifi inet keystore

    socket wpa_wlan0 dgram 660 wifi wifi

    disabled

    oneshot

wpa_supplicant 启动是需要root权限,否则如果你没有注释掉下面两行

# user wifi

# group wifi inet keystore

那么在android2.3 (我的tag-----Android
2.3.3_r1) 
中无法成功启动wifi,我就是因为这个原因找了一周的时间,才发现是这里的问题,查找问题的关键是看logcat 的打印信息。

 

我的关于WiFi的其他配置,主要是(init.rc)与作者的基本一样,你可以参考他的init.rc文件。

 

如果您在移植wifi,那么一定要静下心来读读上面那位外国朋友写的文章,受益非浅,感谢作者panic.

抱歉!评论已关闭.