Thursday, December 14, 2006

Internet Access via bluetooth DUN

Usually I want to boot into Windows only for two reasons. First, to check whether the Windows installation is working. Second, to connect to the Internet using my mobile phone whenever I couldn't able to find a socket to plug in. The software shipped with the Samsung E730 (has very good screen resolution and you can plug it to your USB port to charge it) is only run in Windows.

I am using a Mobitel connection and GPRS is working fine for me. The settings are as follows.

DSN1=0.0.0.0
APN=isp
use blanks for username and password

In Windows I can just plugin the cable to PC and use the program "Internet Access" which shipped with the phone to access the Internet. Also I can connect using bluetooth DUN using a bluetooth software. But in Linux I tried to talk to the modem using the cable but fed up with the error messages. So I decided to give bluetooth a try. This is how it should be done.

You need to have the 2.6 kernel which has adequate support for bluetooth.

root@sapumal:~# hcitool scan
Scanning ...
00:12:47:EB:57:AC sapumal

Open the file /etc/bluetooth/hcid.conf and uncomment the following lines

auth enable;
encrypt enable;

also notice the line
pin_helper /usr/bin/bluez-pin;

create a file /usr/bin/bluez-pin and make it executable. File contents should be

#!/bin/sh
echo "PIN:1234"

the number 1234 is the PIN which you need to enter in your mobile phone when pairing the devices.

edit /etc/bluetooth/rfcomm.conf. My file looks like this after the modifications.

rfcomm0 {
bind yes;
# Bluetooth address of the device
device 00:12:47:EB:57:AC;
# RFCOMM channel for the connection
channel 1;
# Description of the connection
comment "My Phone";
}

You need to replace the device name with the one you got when you scan for devices.

Now restart the bluetooth service
root@sapumal:~# /etc/init.d/bluez-utils restart
* Restarting Bluetooth services... [ ok ]

Connect to the device using hcitool
root@sapumal:~# hcitool cc 00:12:47:EB:57:AC
Here the phone will prompt for the PIN.

Search for DUN service
root@sapumal:~# sdptool search DUN
Inquiring ...
Searching for DUN on 00:12:47:EB:57:AC ...
Service Name: Dial-up networking
Service RecHandle: 0x10002
Service Class ID List:
"Dialup Networking" (0x00001103)
Protocol Descriptor List:
"L2CAP" (0x00000100)
"RFCOMM" (0x00000003)
Channel: 1
Segmentation fault

Create a file /etc/wvdial.conf that looks like this:

[Modem0]
Modem = /dev/rfcomm0
Baud = 115200
SetVolume = 0
Dial Command = ATDT
Init1 = ATZ
Init3 = ATM0
FlowControl = crtscts

[Dialer gprs]
Username = test
Password = test
Phone = *99***1#
Stupid Mode = 1
Inherits = Modem0

Now connect DUN
root@sapumal:~# wvdial gprs
--> WvDial: Internet dialer version 1.54.0
--> Cannot get information for serial port.
--> Initializing modem.
--> Sending: ATZ
ATZ
OK
--> Sending: ATM0
ATM0
OK
--> Modem initialized.
--> Sending: ATDT*99***1#
--> Waiting for carrier.
ATDT*99***1#
CONNECT
--> Carrier detected. Starting PPP immediately.
--> Starting pppd at Thu Dec 14 22:31:16 2006
--> pid of pppd: 13061
--> Using interface ppp0
--> local IP address 192.168.52.5
--> remote IP address 192.168.52.1
--> primary DNS address 203.115.24.221
--> secondary DNS address 12.0.0.0

when you want to disconnect just press ctr-c and the process will terminate gracefully

In case of I/O errors you can try to remove the computer from the bluetooth devices in the phone and retry connecting.

112,0-1 B