Kết nối G1 vào mạng ad hoc network?

tun cua di
tun cua di
Trả lời 14 năm trước

Sau bao ngày tìm tòi và chờ đợi, em đã tìm thấy lời giải cho việc kết nối G1 vào mạng adhoc, chia sẻ kết nối internet của laptop cho G1 ^^ Tuy nhiên vì máy em chưa kịp hack root nên chưa thử nghiệm được. Bác nào có đk thì làm rồi thông báo kết quả cho mọi người phát nhé. Thanks a lot!

This guide will help you to connect your G1 to laptop's Ad-hoc wireless network.

Requirements:
1. Rooted G1 phone.
2. Terminal emulator. (You can download it here or from Android market)
3. Busybox for android. (download)

Steps:
1. Install Terminal emulator
I assume that most of you guys already have this since it is essential for root access.
For those who don't have this installed you will have to make sure that you have root access first.
The easyest way to install this application is to download it from Android market, but if you don't have access to internet from your phone, you could install it over ADB or some other way.

2. Install busybox for android

Open Terminal emulator and type following commands:
Become super user:

Code:
su
Make new directory for busybox and navigate to it:

Code:
mkdir /data/busyboxcd /data/busybox
Now you should copy your downloaded busybox file to this new directory. You could do this simply by connecting your phone to the computer over usb cable and copy file to the sdcard or you could push it using ADB service directly to our directory. If you wish to do this over ADB you should do the following.

a) ADB is part of Android SDK and you can freely download it for Windows, Linux or even Mac, just google it. Your downloaded busybox file must be in the same folder with adb or you can specify the different path in adb command if you have it somewhere else. To push the file to the phone using ADB you could type the following command on your computer (offcourse you must first navigate to the folder in which is your Android SDK and then to the subfolder tools):

Code:
adb push busybox /data/busybox/busybox
b) The other way is to copy the file to your sdcard and then move it to our folder with cat command, since we don't have cp command to copy the file. To do this you must type the following commands on your phone assuming we didn't leave Terminal emulator and we are still in /data/busybox/ directory.

Code:
cat /sdcard/busybox > ./busybox
Now that you have it in your folder you should do the following:
Make busybox binary executable

Code:
chmod 755 ./busybox
Execute following command to install busybox:

Code:
./busybox --install
Make all the installed tools in folder executable like you did with the first one:

Code:
chmod 755 *
Last step is to export it to PATH to make it usable at all time.

Code:
export PATH=/data/busybox:$PATH
3. Now you can modify two important files to make your phone able to connect to Ad-hoc
First gain root access with su command like before:

Code:
su
Remount /system partition as read-write with the following command:

Code:
mount -o rw,remount -t yaffs2 /dev/block/mtdblock3 /system
Navigate to /system/etc/wifi/

Code:
cd /system/etc/wifi
Now you must edit tiwlan.ini file in current directory. I did this with VI editor which is part of busybox. You must know some basic things about VI editor befor you do this. VI operates in two modes. When you open editor you are in command mode and you can't edit your file yet.
To edit file type:

Code:
vi tiwlan.ini
First you must navigate trough file with your trackball. Find the following line:

Code:
WiFiAdhoc = 0
This is the line we need to edit. To enter edit mode press A on your phone's keyboard. Now move the cursor with trackball to the end off this line. Replace 0 with 1. You must add two more lines in order this to work. To add new line press enter key and then type:

Code:
dot11DesiredSSID = HTCG1
dot11DesiredBSSType = 0

Replace HTCG1 with whatever you like. This is SSID of your wireless Ad-hoc network.
Now you must exit back again to command mode. This is done with escape key, and since our keyboard doesn't have escape key we must click down trackball and simultaniously press 1. This is the same as you pressed escape on regular computer keyboard. In command mode again we can't edit the file but we can type commands. Command for saving file is 'w' and for exiting editor is 'q'. Every command is typed after ':' so our command to save file and exit editor will be:

Code:
:wq
The next file we need to edit is /data/misc/wifi/wpa_supplicant.conf
Edit it the same way as previous file and add these lines:

Code:
network={

ssid="HTCG1"
key_mgmt=NONE
mode=1

}
Save and exit
'mode = 1' indicate that this is Ad-hoc network

4. Make Ad-hoc network on your laptop or computer.
I assume you know how to do that and I won't explain it because you can google it. Only thing to know when you do this is that you have to set SSID for the network same as the SSID in two files you edited and that you must make open network without wep or other security. Yet if you decide to have protected network you must also edit wpa_supplicant.conf file and modify it. Again google it if you want to know more.

5. Finally connect
If you configured correctly your computer wireless network and selected it to connect, you should then disable and enable wireless in your mobile phone settings. If SSID is broadcasted you should see your network and signal strenght in network list. Connect.

Source: http://modmygphone.com/forums/showthread.php?t=22681