PaNiC Random Rant (or how we used to call it: .plan)
Porting WiFi drivers to Android
Update(19/05/2011): Verify validity against Gingerbread.
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 (
1. Enable building of wpa_supplicant in your BoardConfig.mk
This is by simply adding:
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
To enable more messages:
2.1 modify
2.2 modify
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
There are two different ways in which wpa_supplicant can be configured, one is to use a "private" socket in android namespace, created by
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
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 and
Since Google modified wpa_supplicant to run as wifi user/group the directory structure and file ownership should belong to wifi user/group (see
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, because
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
You also should have dhcpcd starting from init.rc
service dhcpcd /system/bin/dhcpcd wlan0
group system dhcp
disabled
oneshot
Newer AOSP versions after Gingerbread use dhcpcd_wlan0 as service name.
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
1.
You need to specify module name in that path too, usually should look something like /system/lib/modules/wlan.ko
2.
3.
Make sure you copy your kernel module when building android to the correct location.
- As built in kernel:
- First
setprop wifi.interface "wlan0"
setprop wlan.driver.status "ok"
Do NOT add
- Secondly
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
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
8. Make your driver work with Android custom wpa_supplicant commands and SIOCSIWPRIV ioctl.
Android uses
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 in
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
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
How to use the new driver:
1. In your
2. Change
AWEXT driver patch download: android_wext_emulation_driver_awext.patch
For Gingerbread patches see the post above.
Labels: android, wifi, wpa_supplicant
56 Comments:
Subscribe to Post Comments [Atom]
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
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/
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'
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 ?
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
Should have read access to wifi user/group. Also specify -Dwext as driver.
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~
@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.
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.
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 */
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
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.
panic,i want to use upnp-service discovery in andriod.Do you i/p's about that?
Any workiing library sources/refernces.
Thanks
Kiranmai
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?
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
Great stuff! Works like a charm on Eclair. What about Froyo and wpa_supplicant_6?
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
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
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.
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
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.
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.
Hi panic,
Thanks a lot for this beautiful guide.
I could now make wifi working on GingerBread.
The issue I am facing is, it doesn't scan any network(it doesnt give error thoug). (ping works fine)
wpa_supplicant.conf
--------------------
update_config=1
ctrl_interface=DIR=/data/system/wpa_supplicant GROUP=wifi
eapol_version=1
ap_scan=1
fast_reauth=1
What I do is,
"insmode wlan.ko"
To do it from shell, I have 2 shells open.
1. wpa_supplicant -dd -Dwext -imlan0 -c/data/misc/wifi/wpa_supplicant.conf
2. wpa_cli -p /data/system/wpa_cupplicant
> scan
Logcat
========
D/wpa_supplicant( 1450): CMD: PING
D/wpa_supplicant( 1450): CMD: SCAN
D/wpa_supplicant( 1450): Setting scan request: 0 sec 0 usec
D/wpa_supplicant( 1450): wpa_supplicant_scan: scan_req = 2, ap_scan = 1
D/wpa_supplicant( 1450): State: INACTIVE -> SCANNING
I/wpa_supplicant( 1450): CTRL-EVENT-STATE-CHANGE id=-1 state=2 BSSID=00:00:00:00:00:00
D/wpa_supplicant( 1450): Starting AP scan (broadcast SSID)
D/wpa_supplicant( 1450): wpa_driver_wext_combo_scan: Start
D/wpa_supplicant( 1450): Scan requested - scan timeout 10 seconds
D/wpa_supplicant( 1450): CMD: PING
D/wpa_supplicant( 1450): Scan timeout - try to get results
D/wpa_supplicant( 1450): Received 0 bytes of scan results (0 BSSes)
D/wpa_supplicant( 1450): New scan results available
D/wpa_supplicant( 1450): No suitable AP found.
D/wpa_supplicant( 1450): State: SCANNING -> INACTIVE
I/wpa_supplicant( 1450): CTRL-EVENT-STATE-CHANGE id=-1 state=1 BSSID=00:00:00:00:00:00
D/wpa_supplicant( 1450): CMD: PING
Can you please help out in terms of what I am missing???
Hi,
I followed the steps as you have mentioned in the post, using Android Sockets, but I get an error as follows:-
I/wpa_supplicant( 1221): CTRL_IFACE monitor[0]: 13 - Permission denied
I/wpa_supplicant( 1221): CTRL-EVENT-STATE-CHANGE id=-1 state=1 BSSID=00:00:00:00:00:00
I/wpa_supplicant( 1221): CTRL_IFACE monitor[0]: 13 - Permission denied.
Please let me know if you have come across this issue.
Thanks & Regards,
Yegnesh
http://blog.naver.com/ernice/20146498720
Thanks. I successed with RTL8188cu usb wifi modules and NFS
Panic,
Are you still taking some wifi related questions?
Next update will be for Android 4.x ICS
Hi !
What is the difference between Android private socket and Unix standard socket ? What should one prefer ?
Thanks,
Andrey
i am using panda board runs Android ICS and the on board wifi interface is enabled "wlan0"
Now i am trying to add another interface "wlan1" to android and i want when i enable the wifi on the GUI it turns on my interface , i have succeeded to do so with wpa_supplicant by setting wifi.interface wlan1 , but the problem is with the DHCP , the DHCP is always trying to run over wlan0 not wlan1
Is there is any property that i can sit to convince the GUI to run the DHCP over wlan1?
Salut, as dori si eu niste ajutor, am o tableta arnova 7c g2, filesystem yaffs, si am reusit sa folosesc un rom de zte v9, problema e ca, nu am wifi, telefonie, radio, bluetoth, am incercat sa portez asa cum zici tu aici, dar nu reusesc de nici un fel (am folosit driverele originale care erau pe room-ul de la arnova, editat init etc.)
Am aproximativ acelasi rezultat cu un tip care a postat pe aici, as aprea foarte mult orice tip de sfat.
Panic,
I have a hardware device very similar to the O2 joggler. Specifically it is an Atom-based Openpeak Openframe 7E.
There are some great Android builds out there for it's sister device, the o2 Joggler, but that device has a different WiFi radio.
http://www.jogglerwiki.com/forum/viewtopic.php?f=2&t=196&start=240
As a result it appears that the joggler image mentioned doesn't have the necessary WiFi driver for the Openframe hardware.
The Wireless hardware in the OpenFrame, verified by lspci, is the BCM43225. From this site, I believe the driver would be the brcmsmac.
Assuming that makes sense so far, here's my goal. I'd like to add the appropriate Android driver for this WiFi hardware to the custom build mentioned above. I believe it would entail the addition of the .ko driver, as well as the .bin firmware files as you outline.
My challenge, however, is that I cannot find an Android driver (.ko) already built, nor have I been able to verify that adding that driver would actually work.
Naively I took an ubuntu version of the brcmsmac.ko, added it to my device, and ran insmod on it. That errors out and fails to load.
Any suggestions? Any questions that would help clarify what I'm trying to do?
Bottom line, I have an andriod image that's 99% of the way there, I just need to "add" support for the specific wireless device installed in my hardware.
Any guidance would be greatly appreciated.
Thanks and best regards
AT
@AT you will need to get the kernel source for that device, and compile the kernel module for the wifi. It probably fails because of missmatched kernel version / arch. The ubuntu compiled .ko won't work since it's compiled for another kernel and probably with another march flags.
@globula_neagra If you change the kernel version by using another ROM the old modules won't work, they need to be recompiled.
@Adel Nour The latest gingerbread added support for multiple interface DHCPCD.
They are configured in init.rc by dhcpcd_wlan0, dhcpcd_wlan1
For older versions of android see my patch: https://gitorious.org/picopc-android-eclair/system-core/commit/515dbcf064d432d6a8f04a106f31287e1780e96b
Thanks Nicu! I have the source for the driver. Can I compile on OSX by specifying the proper target architecture??
Hi Nicu ,
According to following :
Android uses wireless-extensions to support its 802.11 drivers. The drivers that Android devices have up to this day used are all using wireless-extensions for communication.
It seems to said that a kernel driver implment via mac80211, cfg80211 API could not support Andorid now, right ?
I am trying to port a rtl81xx series driver (in linux 2.6.35, realtek chip) to support Android but failed; the Android setting UI - wifi enable checkbox appers to on then off again and again ...
I find this driver implement via mac80211 , cfg80211 API , issues seems to be related about after scanning ...
Is there any solution to resolve this ?
Thanks very much .
Hi Nicu ,
According to following :
Android uses wireless-extensions to support its 802.11 drivers. The drivers that Android devices have up to this day used are all using wireless-extensions for communication.
It seems to said that a kernel driver implment via mac80211, cfg80211 API could not support Andorid now, right ?
I am trying to port a rtl81xx series driver (in linux 2.6.35, realtek chip) to support Android but failed; the Android setting UI - wifi enable checkbox appers to on then off again and again ...
I find this driver implement via mac80211 , cfg80211 API , issues seems to be related about after scanning ...
Is there any solution to resolve this ?
Thanks very much .
Hi, thanks for this clear and complete tutorial. Very helpful!
But... one thing I miss, very basic I think. I have prepared my wpa_supplicant.conf and I have built my driver from the kernel. So, in opedr to pick them with my Andorid build, in my full_.mk I've added these copy operations:
PRODUCT_COPY_FILES += \
$(LOCAL_PATH)/bcm/dhd.ko:system/lib/modules \
$(LOCAL_PATH)/bcm/4329_nvram.txt:system/etc/firmware \
$(LOCAL_PATH)/bcm/fw4329.bin:system/etc/firmware \
$(LOCAL_PATH)/bcm/wpa_supplicant.conf:system/etc/wifi
but as neither system/etc/firmware nor system/etc/wifi exist in the AOSP out/target dir, the result is incomplete.
How to make the AOSP build create the missing directories?
thanks
PS- Anyone interested, this is he discussion group about the platform I'm working on:
https://groups.google.com/forum/?fromgroups#!forum/renesas-emev-osp
Hi Pavel, thanks a lot for this helpful tutorial.
One thing I miss. Once I have the kernel driver, firmware and wpa_supplicant.conf, in order to include these in the AOSP build I should add these copy operations in my full_.mk, I think:
PRODUCT_COPY_FILES += \
$(LOCAL_PATH)/bcm/dhd.ko:system/lib/modules \
$(LOCAL_PATH)/bcm/4329_nvram.txt:system/etc/firmware \
$(LOCAL_PATH)/bcm/fw4329.bin:system/etc/firmware \
$(LOCAL_PATH)/bcm/wpa_supplicant.conf:system/etc/wifi
But system/etc/firmware and system/etc/wifi directories aren't created by the standard build, so that isn't enough.
What do I miss?
thanks
Fabio
PS - anyone interested - this is the group where we discuss about the platform I'm building for: https://groups.google.com/forum/?fromgroups#!forum/renesas-emev-osp
Hi Techies,
I had downloaded the android ICS source code from google repositories.
I am able to compile and run the source code and build for emulator is working superb.Then I decided to burn on device Huawei Ascend G300 U8818.I had downloaded the Device configuration from github repository.
Now I started compiling for Huawei device.
When I execute the command make -j4 then I get the following error
make: *** No rule to make target `out/target/product/u8818/obj/STATIC_LIBRARIES/lib_driver_cmd_wext_intermediates/lib_driver_cmd_wext.a', needed by `out/target/product/u8818/obj/EXECUTABLES/wpa_supplicant_intermediates/LINKED/wpa_supplicant'. St
Please help in me.I am googling for almost 15 days but no guide no clues.
Thank You.
Hi Techies,
I had downloaded the android ICS source code from google repositories.
I am able to compile and run the source code and build for emulator is working superb.Then I decided to burn on device Huawei Ascend G300 U8818.I had downloaded the Device configuration from github repository.
Now I started compiling for Huawei device.
When I execute the command make -j4 then I get the following error
make: *** No rule to make target `out/target/product/u8818/obj/STATIC_LIBRARIES/lib_driver_cmd_wext_intermediates/lib_driver_cmd_wext.a', needed by `out/target/product/u8818/obj/EXECUTABLES/wpa_supplicant_intermediates/LINKED/wpa_supplicant'. St
Please help in me.I am googling for almost 15 days but no guide no clues.
Thank You.
Thanks a ton!
I got wifi running on CyanMobileX custom ROM for Galaxy 551 (GT-I5510)
THanks
Hello Nicu,
Thank you for this tutorial
I want to know if are you doing the update for Android 4.x.
Because I can't do this modifications in Android 4.0.
Thank you.
Best regards,
S.K
Hello Nicolae,
Do you have the update for android version 4.X ?
Thank you.
Best regards,
S.K
Hello Nicolae,
Do you have the update for android version 4.X ?
Thank you.
Best regards,
S.K
I will start working on ICS version in a few weeks. But probably rowboat, cyanogen might already have these patches ported to ICS so it's worth checking them out too.
Regarding the issue where wifi automatically turns off after enabling it, it's because it can't ifup the interface (missing firmware, driver has other name for interface instead of wlan0). Check logcat it should tell you more.
Hi Nicu,
I've amanged to complete the integration on GB and now I'm porting to JB. issue is that in GB I used to have the "wifi" option enabled under wireless settings, even before integrating the driver etc, while I miss this in JB. Any idea what could be missing?
thanks again
Fabio
Ok, got it. In order for the WiFi Settings sub-option to show up, the sfollowing file needs to be present in the build:
system/etc/permissions/android.hardware.wifi.xml
In ICS or JB we do something like this in device.mk to copy the file:
PRODUCT_COPY_FILES += \
frameworks/base/data/etc/android.hardware.wifi.xml:system/etc/permissions/android.hardware.wifi.xml
Content is simply something like:
- manu Thanks to Viesh , from https://groups.google.com/d/msg/android-porting/KDMjAcfPUtc/z9yYLPO9MowJ -
Thanks for letting me know. Also for some reason the content of android.hardware.wifi doesn't show up in comments.
Hi PaNic
Thank you very much
Here is my experiment
https://code.google.com/p/km233/wiki/WIFI_TO_ANDROID
Hope it's useful for everyone
Hi their,
I would like to port rlt8187 alfa usb external models on Android 4.x so will the above mentoned steps will work?
In GUI i am unable to see scanned networks list
it shows "Searching for wifi networks"
here is logcat
D/wpa_supplicant( 3166): Starting AP scan (broadcast SSID)
D/wpa_supplicant( 3166): wpa_driver_rsi_scan: specific scan = 0
D/wpa_supplicant( 3166): Scan requested (ret=0) - scan timeout 5 seconds
D/wpa_supplicant( 3166): CMD: DRIVER SCAN-PASSIVE
D/wpa_supplicant( 3166): wpa_driver_priv_driver_cmd SCAN-PASSIVE
D/wpa_supplicant( 3166): Scan Passive command
D/wpa_supplicant( 3166): EAPOL: disable timer tick
D/wpa_supplicant( 3166): Scan timeout - try to get results
E/wpa_supplicant( 3166): ioctl[SIOCGIWSCAN]: 11
D/wpa_supplicant( 3166): Failed to get scan results
D/wpa_supplicant( 3166): Failed to get scan results - try scanning again
D/wpa_supplicant( 3166): State: SCANNING -> INACTIVE
I/wpa_supplicant( 3166): CTRL-EVENT-STATE-CHANGE id=-1 state=1 BSSID=00:00:00:00:00:00
D/wpa_supplicant( 3166): CMD: DRIVER START
D/wpa_supplicant( 3166): wpa_driver_priv_driver_cmd START
D/wpa_supplicant( 3166): Start command
D/wpa_supplicant( 3166): RTM_NEWLINK: operstate=0 ifi_flags=0x11003 ([UP][LOWER_UP])
D/wpa_supplicant( 3166): RTM_NEWLINK, IFLA_IFNAME: Interface 'wlan0' added
D/wpa_supplicant( 3166): Wireless event: cmd=0x8b19 len=8
D/wpa_supplicant( 3166): Received 5084 bytes of scan results (47 BSSes)
D/wpa_supplicant( 3166): New scan results available
D/wpa_supplicant( 3166): No suitable AP found.
D/wpa_supplicant( 3166): State: INACTIVE -> SCANNING
I/wpa_supplicant( 3166): CTRL-EVENT-STATE-CHANGE id=-1 state=2 BSSID=00:00:00:00:00:00
D/wpa_supplicant( 3166): Cancelling authentication timeout
D/wpa_supplicant( 3166): State: SCANNING -> INACTIVE
I/wpa_supplicant( 3166): CTRL-EVENT-STATE-CHANGE id=-1 state=1 BSSID=00:00:00:00:00:00
D/wpa_supplicant( 3166): CMD: BSS RANGE=ALL MASK=0x1986
D/wpa_supplicant( 3166): CMD: DRIVER BTCOEXSCAN-STOP
D/wpa_supplicant( 3166): wpa_driver_priv_driver_cmd BTCOEXSCAN-STOP
D/wpa_supplicant( 3166): CMD: DRIVER RXFILTER-STOP
D/wpa_supplicant( 3166): wpa_driver_priv_driver_cmd RXFILTER-STOP
D/wpa_supplicant( 3166): Rx Data Filter Stop command
D/wpa_supplicant( 3166): CMD: DRIVER RXFILTER-STOP
D/wpa_supplicant( 3166): wpa_driver_priv_driver_cmd RXFILTER-STOP
D/wpa_supplicant( 3166): Rx Data Filter Stop command
D/wpa_supplicant( 3166): CMD: AP_SCAN 1
D/wpa_supplicant( 3166): ap_scan = 1
D/wpa_supplicant( 3166): CMD: RECONNECT
D/wpa_supplicant( 3166): CMD: STATUS
D/wpa_supplicant( 3166): CMD: SET ps 1
D/wpa_supplicant( 3166): CTRL_IFACE SET 'ps'='1'
D/wpa_supplicant( 3166): CMD: DRIVER START
D/wpa_supplicant( 3166): wpa_driver_priv_driver_cmd START
D/wpa_supplicant( 3166): Start command
D/wpa_supplicant( 3166): CMD: DRIVER START
D/wpa_supplicant( 3166): wpa_driver_priv_driver_cmd START
D/wpa_supplicant( 3166): Start command
what might be the possible reason
please suggest something
In android GUI i am unable to see list of scanned networks
It shows "Searching for wifi networks"
here is logcat
D/wpa_supplicant( 3166): Starting AP scan (broadcast SSID)
D/wpa_supplicant( 3166): wpa_driver_rsi_scan: specific scan = 0
D/wpa_supplicant( 3166): Scan requested (ret=0) - scan timeout 5 seconds
D/wpa_supplicant( 3166): CMD: DRIVER SCAN-PASSIVE
D/wpa_supplicant( 3166): wpa_driver_priv_driver_cmd SCAN-PASSIVE
D/wpa_supplicant( 3166): Scan Passive command
D/wpa_supplicant( 3166): EAPOL: disable timer tick
D/wpa_supplicant( 3166): Scan timeout - try to get results
E/wpa_supplicant( 3166): ioctl[SIOCGIWSCAN]: 11
D/wpa_supplicant( 3166): Failed to get scan results
D/wpa_supplicant( 3166): Failed to get scan results - try scanning again
D/wpa_supplicant( 3166): State: SCANNING -> INACTIVE
I/wpa_supplicant( 3166): CTRL-EVENT-STATE-CHANGE id=-1 state=1 BSSID=00:00:00:00:00:00
D/wpa_supplicant( 3166): CMD: DRIVER START
D/wpa_supplicant( 3166): wpa_driver_priv_driver_cmd START
D/wpa_supplicant( 3166): Start command
D/wpa_supplicant( 3166): RTM_NEWLINK: operstate=0 ifi_flags=0x11003 ([UP][LOWER_UP])
D/wpa_supplicant( 3166): RTM_NEWLINK, IFLA_IFNAME: Interface 'wlan0' added
D/wpa_supplicant( 3166): Wireless event: cmd=0x8b19 len=8
D/wpa_supplicant( 3166): Received 5084 bytes of scan results (47 BSSes)
D/wpa_supplicant( 3166): New scan results available
D/wpa_supplicant( 3166): No suitable AP found.
please suggest something
In GUI i am unable to see scanned networks list
it shows "Searching for wifi networks"
here is logcat
D/wpa_supplicant( 3166): Starting AP scan (broadcast SSID)
D/wpa_supplicant( 3166): wpa_driver_rsi_scan: specific scan = 0
D/wpa_supplicant( 3166): Scan requested (ret=0) - scan timeout 5 seconds
D/wpa_supplicant( 3166): CMD: DRIVER SCAN-PASSIVE
D/wpa_supplicant( 3166): wpa_driver_priv_driver_cmd SCAN-PASSIVE
D/wpa_supplicant( 3166): Scan Passive command
D/wpa_supplicant( 3166): EAPOL: disable timer tick
D/wpa_supplicant( 3166): Scan timeout - try to get results
E/wpa_supplicant( 3166): ioctl[SIOCGIWSCAN]: 11
D/wpa_supplicant( 3166): Failed to get scan results
D/wpa_supplicant( 3166): Failed to get scan results - try scanning again
D/wpa_supplicant( 3166): State: SCANNING -> INACTIVE
I/wpa_supplicant( 3166): CTRL-EVENT-STATE-CHANGE id=-1 state=1 BSSID=00:00:00:00:00:00
D/wpa_supplicant( 3166): CMD: DRIVER START
D/wpa_supplicant( 3166): wpa_driver_priv_driver_cmd START
D/wpa_supplicant( 3166): Start command
D/wpa_supplicant( 3166): RTM_NEWLINK: operstate=0 ifi_flags=0x11003 ([UP][LOWER_UP])
D/wpa_supplicant( 3166): RTM_NEWLINK, IFLA_IFNAME: Interface 'wlan0' added
D/wpa_supplicant( 3166): Wireless event: cmd=0x8b19 len=8
D/wpa_supplicant( 3166): Received 5084 bytes of scan results (47 BSSes)
D/wpa_supplicant( 3166): New scan results available
D/wpa_supplicant( 3166): No suitable AP found.
D/wpa_supplicant( 3166): State: INACTIVE -> SCANNING
I/wpa_supplicant( 3166): CTRL-EVENT-STATE-CHANGE id=-1 state=2 BSSID=00:00:00:00:00:00
D/wpa_supplicant( 3166): Cancelling authentication timeout
D/wpa_supplicant( 3166): State: SCANNING -> INACTIVE
I/wpa_supplicant( 3166): CTRL-EVENT-STATE-CHANGE id=-1 state=1 BSSID=00:00:00:00:00:00
D/wpa_supplicant( 3166): CMD: BSS RANGE=ALL MASK=0x1986
D/wpa_supplicant( 3166): CMD: DRIVER BTCOEXSCAN-STOP
D/wpa_supplicant( 3166): wpa_driver_priv_driver_cmd BTCOEXSCAN-STOP
D/wpa_supplicant( 3166): CMD: DRIVER RXFILTER-STOP
D/wpa_supplicant( 3166): wpa_driver_priv_driver_cmd RXFILTER-STOP
D/wpa_supplicant( 3166): Rx Data Filter Stop command
D/wpa_supplicant( 3166): CMD: DRIVER RXFILTER-STOP
D/wpa_supplicant( 3166): wpa_driver_priv_driver_cmd RXFILTER-STOP
D/wpa_supplicant( 3166): Rx Data Filter Stop command
D/wpa_supplicant( 3166): CMD: AP_SCAN 1
D/wpa_supplicant( 3166): ap_scan = 1
D/wpa_supplicant( 3166): CMD: RECONNECT
D/wpa_supplicant( 3166): CMD: STATUS
D/wpa_supplicant( 3166): CMD: SET ps 1
D/wpa_supplicant( 3166): CTRL_IFACE SET 'ps'='1'
D/wpa_supplicant( 3166): CMD: DRIVER START
D/wpa_supplicant( 3166): wpa_driver_priv_driver_cmd START
D/wpa_supplicant( 3166): Start command
D/wpa_supplicant( 3166): CMD: DRIVER START
D/wpa_supplicant( 3166): wpa_driver_priv_driver_cmd START
D/wpa_supplicant( 3166): Start command
what might be the possible reason
please suggest something
I do follow you guide.But when I use "svc wifi enable" to start wifi,it's very hard to connect to AP.When I start wpa_supplicant by start wpa_supplicant,It works,but need to set the ip address by myself(my network use static ip address).
I want to know that ,if there is a way to use android's origin wifi controller,instead of add the wpa_supplicant service?
best regards.
How to enable the building of wpa_supplicant if the value of the BOARD_WPA_SUPPLICANT_DRIVER is
BOARD_WPA_SUPPLICANT_DRIVER := NL80211 ?
I am using android jellybean version 4.3.
Thanks ,
Anjali