How to connect to Ad Hoc networks using Tmobile G1 Android
by HydTech on Sep.14, 2009, under Android, Linux (Ubuntu)
Intro
The G1 does not connect to ad hoc networks through the wifi manager but we can hack it to allow scanning and connecting to ad hocs. I’ve been trying to figure this out for the longest time. Before you begin, you need to root your G1 and be comfortable using the command line. We will be editing tiwlan.ini and wpa_supplicant.conf. I will be showing you 2 ways to edit the files. Using vi and adb.
Settings
edit tiwlan.ini to read:
WiFiAdHoc = 1
dot11DesiredSSID = HydtechAdhoc (or whatever name u want)
dot11DesiredBSSType = 0
edit wpa_supplicant.conf to read:
ctrl_interface=tiwlan0
update_config=1
eapol_version=1
ap_scan=2 (tells wpa_supplicant to scan hidden networks)
network={
ssid=”HydtechAdhoc”
scan_ssid=1 (for APs with multiple SSIDS)
mode=1
key_mgmt=NONE
group=WEP104
auth_alg=SHARED
wep_key0=”MyWepKey” (replace MyWepKey with your key)
}
How to edit using vi:
Download terminal from the market and type:
su (for superuser mode)
mount -o rw,remount -t yaffs2 /dev/block/mtdblock3 /system (mount partition as writable)
vi /system/etc/wifi/tiwlan.ini (open tiwlan.ini in vi text editor)
now type A to enter editing mode, finish editing your file and hold trackball+1 to stop editing. To save and exit type :wq
vi /data/misc/wifi/wpa_supplicant.conf (open file for editing)
edit with the settings given above and exit and don’t forget to change the partition back to read only
mount -o ro,remount -t yaffs2 /dev/block/mtdblock3 /system
reboot
How to edit files with adb on Ubuntu:
Connect your g1 to the computer using a usb cable and make sure USB debugging in enabled
Open up terminal and type
cd /home/hydtech/[android sdk folder]/tools (navigate to the directory which has you adb tool)
get the files from the device and place them in the root folder
sudo ./adb pull /system/etc/wifi/tiwlan.ini /
sudo ./adb pull /data/misc/wifi/wpa_supplicant.conf /
edit and save the files with the settings provided above using gedit or kate or what have you
make the partition read writable
adb shell
mount -o rw,remount -t yaffs2 /dev/block/mtdblock3 /system
exit
place the files back onto the device
sudo ./adb push /tiwlan.ini /system/etc/wifi/tiwlan.ini
sudo ./adb push /wpa_supplicant.conf /data/misc/wifi/wpa_supplicant.conf
make partition read only again
adb shell
mount -o ro,remount -t yaffs2 /dev/block/mtdblock3 /system
exit
reboot device.
Troubleshooting
shows connected but no internet
1. I was having a problem where the connection would keep disconnecting and when it would connect, it wouldn’t load pages. To fix this I had to disable my WEP key.
SSID not showing
2. If the SSID isn’t showing up in the list, make sure you have ap_scan=2 in your wpa_supplicant
Unsuccessful connection
3. Try enabling static IP if DHCP isn’t working for you. It’s under advanced menu.
16 Comments for this entry
1 Trackback or Pingback for this entry
-
How to connect to Ad Hoc networks using Tmobile G1 Android « HydTech
December 30th, 2009 on 5:54 pm[...] to connect to Ad Hoc networks using Tmobile G1 Android moved to: http://hydtechblog.com/2009/09/14/how-to-connect-to-ad-hoc-networks-using-tmobile-g1-android/ Possibly related posts: (automatically [...]



September 14th, 2009 on 11:43 pm
If you found this from my tutorial then you should have mentioned me in this post so people know who found this solution first.
Good thing you mentioned how to edit files using ADB and another good thing is this ap_scan=2 thing which i totally forget to mention in my post.
September 15th, 2009 on 6:48 pm
Great tutorial. I have the following problem on a G1 with modded Rogers rom . I connect to the created network but I don’t have an actual internet connection. I tried all the troubleshooting steps and disabled firewalls on PC but browser and other apps say they don’t have internet connection. WiFi is connected full bars and so on. Can’t really see what’s the problem…
September 15th, 2009 on 8:17 pm
take off your security key
September 16th, 2009 on 7:32 pm
Could you please upload the modded files so we could just use them? Not sure where to enter the commands and doing a search doesnt find “dot11DesiredSSID = HydtechAdhoc (or whatever name u want)”. Thanks
September 16th, 2009 on 7:42 pm
do i delete all the other stuff and just enter the info above?
September 17th, 2009 on 1:32 pm
hey I’m so glad to find a website here.
My problem is, can I make share my VPN connection as an adhoc connection? if so, how can I do this?
September 18th, 2009 on 7:50 am
Hi,
I did the exactly steps you stated on my G2 magic, but it doesn’t work.
the SSID was showed but my G2 can not search out my IBM T60’s signal.
Pls give some help. thanks in advance.
September 18th, 2009 on 2:43 pm
ap_scan=2 make sure it didnt get erased when you restarted.
September 20th, 2009 on 9:59 pm
Hi
At start – sory for my english , i speak not good.
Me and my friend have the same problem.
I have HTC Hero and laptop (he have G1 and laptop)
At first day this method (editing these two files) works perfectly.
Next day when i turn on wi-fi in my HTC Hero… big problem.
On phone I see my ad-hoc network on list but it still OUT OF RANGE.
I try STATIC IP and nothing work.
Other my phones (Nokia – Symbian) dont have any problem to connect to laptop.
Any solutions ?
Thanks
This is my wpa_supplicant.conf file:
ctrl_interface=tiwlan0
update_config=1
eapol_version=2
ap_scan=2
fast_reauth=1
network={
ssid=”SIEC”
scan_ssid=1
mode=1
key_mgmt=NONE
auth_alg=SHARED
}
And this is tiwlan0.ini (not full of course):
WiFiAdhoc = 1
dot11DesiredSSID = SIEC
dot11DesiredBSSType = 0
September 21st, 2009 on 3:41 pm
you have to reedit the file to include ap_scan=2 sometimes the wpa_supplicant gets reset. I am currently trying to figure out how to fix this.
September 21st, 2009 on 3:52 pm
thanks to the members from xda-developers who discovered the adhoc tether and especially to chax for his efforts.
September 23rd, 2009 on 6:12 am
Сайт очень качественный. Награду бы Вам за него или просто орден почета.
November 9th, 2009 on 4:54 pm
Hi,
Is it possible to have an infrastructure mode instead of ad-hoc mode? How hard can it be to develop something like that?
Michael
November 21st, 2009 on 3:36 am
I continually rea blogs in similar issue, but I never visited your blog. bookmarked and i’ll be your constant reader. Thanks
November 21st, 2009 on 7:33 am
[...]hydtechblog.com is another must see source of tips. Yeah Imagine getting paid for giving your opinion ! [...]
December 10th, 2009 on 3:58 pm
Cheers for the useful page – I loved reading it! I always love reading this blog.