Saturday, July 18, 2009

Connecting Android Phone Through Adhoc Wifi Network

An Android phone works perfectly when you have a wireless connection, either through wifi wireless AP or mobile network GPRS. However, when it comes to places where only wired connectivity is available, for instance an Ethernet connection or a dial-up connection, or when you're roaming and using mobile network's data roaming might cost you a fortune, some workaround must be done.

My HTC Magic works fine back at home. I got both unlimited wifi and GPRS connectivities. But when I roam elsewhere, which I do a lot, the data roaming cost would be too high and most hotels I stay have no wifi but only wired Ethernet in-room.

One thing which I know will work is to carry with you a wireless AP, plug the LAN cable in, and you're all set. But I don't want to add any more weight to my bags. So I think about turning the laptop into an access point instead.

So I did some searches and found a very useful information at's forum. The thread mentioned configuring your G1 Android phone to connect to a laptop's ad-hoc wireless network. That's exactly what I need!

I didn't modify the files directly on the phone, but instead I used adb pull the 2 files onto my laptop, then edited the files, then adb push them back. So the steps were:

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

[.edit tiwlan.ini and wpa_supplicant.conf according to the guide]

> adb shell
# mount -o rw,remount -t yaffs2 /dev/block/mtdblock3 /system

# exit

> adb push tiwlan.ini /system/etc/wifi/tiwlan.ini

> adb push wpa_supplicant.conf /data/misc/wifi/wpa_supplicant.conf
> adb shell
# mount -o ro,remount -t yaffs2 /dev/block/mtdblock3 /system
# exit


You will see your ad-hoc wifi network name in networks list (Settings -> Wireless controls -> Wi-Fi settings). Phone modification part is complete.

Now back to the laptop. An ad-hoc wireless connection has to be created and Internet Connection Sharing enabled. There are many guides available on the Internet. (for example here.) When it's created, in "Choose a wireless network" window, select your ad-hoc network and click "Connect." Your phone and laptop should try to connect to each other and you're all done!

In case you're unlucky and your hotel network assigns IP address in net, ICS will not work. Try create a network bridge between the wireless connection and LAN connection instead.

Have fun with your Android! ;-)

Tuesday, March 10, 2009

Lost My Wallet

Last Saturday I had to go to Chiangmai to attend my girlfriend's best friend's wedding. We're booked for the earliest 6.30am flight.

I got up at 4.30am and on the way to the airport I stopped at 7-eleven at a PTT gas station to grab a cup of coffee and to get some cash from the ATM nearby.

Everything went fine until the plane had landed at Chiangmai Airport when I reached for my wallet to pay for the car rent and... it wasn't there!

The following hour was spent trying to locate the wallet in every bags, figuring out whether I'd left it in my car in Bangkok and finally calling banks to suspend the credit cards (some were kind enough to let me suspend temporarily).

After a while I managed to get over it and went on with the trip.


Later that day my girlfriend's sister was kind enough to drop by the gas station just in case someone had found it.

Guess what? It was there! A 7-eleven cashier found it!!

You might wonder why I'm so excited but in Bangkok when you lose your wallet or another valuable things you rarely get them back.

Now I'm thinking what I should do to show my appreciation to the girl.