Thursday, January 15, 2009

Linux, Bluetooth, GPRS and Internet

The other day I was messing up with my brand new Dell notebook under Linux(Ubuntu), I needed to get online quickly. I looked for my phone's data cable but couldn't locate it in the room. And in this freezing cold weather prevailing here I can't afford to get outta the quilt!! So, I thought about connecting using bluetooth. A little bit fiddling, and I figured out how do I hook myself to the Internet!! Ok, so here goes the tutorial. It should work perfectly on Ubuntu 8.10 and 8.04 and also on several other latest linux distributions, but I haven't tested it on anything except Ubuntu 8.04 Hardy Heron and Ubuntu 8.10 Intrepid Ibex.

1. Hit Alt+F2, type
and press enter.
2. Then jump into root mode by typing
sudo -s
and entering the root password when prompted.
3. Turn on the bluetooth on your phone and the notebook/PC and type
hcitool scan
and hit the enter.
4. Your notebook will search for bluetooth devices in range. And it will respond with your phone's MAC address and name. Now use this command to search the Dial Up Networking channel on your phone
sdptool search --bdaddr <your phone's MAC address here> DUN

sdptool search --bdaddr 00:1B:3C:4D:5E:6F DUN
5. You'll get a response of around 10 lines. Search for the channel number in it. For my SE P1i it was channel 7. On a Nokia6681 it was on channel 3.
6. Now use this command to create a bluetooth modem
rfcomm bind /dev/rfcomm0 <phone's MAC address> <DUN channel>

rfcomm bind /dev/rfcomm0 00:1B:3C:4D:5E:6F 7
You may be prompted by the PC to pair device. Do so by entering same BT pin in ur PC and phone.
7. Now configure your wvdial.conf file as follows.
gedit /etc/wvdial.conf

Append the following text below any existing settings in the file that opens up.
[Dialer bt]
Modem = /dev/rfcomm0
Phone = *99#
Username = 919815098150
Password = 12345
New PPPD = Yes
Init1 = AT+CGDCONT=1,"ip",""

Note that the above setting varies depending on your operator. But you just need to change the username, password and access point( to your operator specific.
8. Now to connect to net just type
wvdial bt
on terminal and press enter. Allow your phone to connect when prompted.

After a reboot, if you need to connect then perform only steps 6 and 8.

No comments: