Saturday, April 17, 2010

Wifi-ADHoc support in Android

wifi connectivity using AP mode and GPRS works great

This post is related to enabling Wifi-ADHoc support in android 1.5, its simple and it works great. I tried this in HTC hero, i beleive it should be same for other make.

- Your phone should be rooted. Take a look at this link to root, http://theunlockr.com/2009/08/27/how-to-root-your-htc-hero-in-one-click/

- You should have android SDK in your computer. If not download from this http://developer.android.com/sdk/index.html

- We need to edit 2 files "tiwlan.ini" & "wpa_supplicant.conf". Ensure you take the backup of these files before editing.

- Pull the both the files from the mobile to the computer, this would be easy for editing.

adb pull /system/etc/wifi/tiwlan.ini tiwlan.ini
adb pull /data/misc/wifi/wpa_supplicant.conf wpa_supplicant.conf

- Edit the file as below
* In twilan.ini file set WiFiAdhoc = 1 (Will be 0 by default)
* Add the below 2 lines to the file
dot11DesiredSSID = Android (Wifi adhoc name configured in the computer)
dot11DesiredBSSType = 0

* In wpa_supplicant.conf, replace the contents with the below.
ctrl_interface=tiwlan0
ap_scan=2
network={
ssid="android"
scan_ssid=1
mode=1
key_mgmt=NONE
}

- Restart Wifi, it should detect your wifiadhoc networks.

Enjoy & have fun!

5 comments:

eric m said...

For Android 2.2 (Froyo) wpa_supplicant.conf can now be found at: /system/etc/wifi/wpa_supplicant.conf

I just saved you an hour - you're welcome :)

Rajeev said...

Cool. Thanks Eric :)

Hayat said...

Hi, im using x10mini with 2.1,

How do I get AdHoc wirless in my phone from my laptop.

or

how can i re-configure ''wpa_supplicant'' for adhoc.

Thanks for your post.

Anonymous said...

thanks for your post....I followed all steps and succeeded . BUT ONE PROB..
after restart WiFi, its able to create ad hoc network and I am able to see device's ad hoc network in my laptop also ...but its not obtaining IP address.. wpa_cli log details showed that after restarting WiFi, DHCP has been stopped ....
In ad hoc mode , how can i get ip address statically or dynamically ....how can i?

doe0731 said...

I'm trying to get this to work on a Casio Commando. I rooted as described. There is no tiwlan.ini file that I can find. wpa_supplicant.conf is there.

Any suggestions?