Sunday, August 2, 2009

Use your mobile phone via bluetooth as modem

All commands should be run as root.

First pair your phone.
There are many HOWTOS or just look at the source at the bottom.
At this step you should get the bluetooth address for your phone, if not use

$ hcitool scan


Another way is to put the pin code into file pincodes in the directory /var/lib/bluetooth/<address of your bt adapter>
The first entry of a line is the address of your bluetooth device, the second the pin code, eg:
00:1E:3B:10:7A:88 1234


Bind the phone.
First you need to find out which channel the DUN (Dial Up Networking) uses. Usually it's channel 1. But ...

$ sdptool search dun

or to get all services ...

$ sdptool browse [bluetooth address]



Add the following to /etc/bluetooth/rfcomm.conf
rfcomm0 {
# Automatically bind the device at startup
bind yes;

# Bluetooth address of the device
device 00:1E:3B:10:7A:88;

# RFCOMM channel for the connection
channel 1;

# Description of the connection
comment "Mobile Modem";
}


Replace the bluetooth ID after device with the mobile phone's bluetooth ID and check if the channel is the right one.
If bind is set to yes, the mobile phone is bind when rfcomm starts. Of course, if there is another rfcomm0 section, use rfcomm1 and so on ...

Bind the phone (if bind is set to yes and the bluetooth service is active, the command will be run at startup)
$ rfcomm bind rfcomm0

You can check it with
$ rfcomm

Output is something like
rfcomm0: 00:1E:3B:10:7A:88 channel 1 clean


Set up a modem connection

Now your are ready to start an internet connection via /dev/rfcomm0
The connection settings you should get from your mobile service.

Usually you need an init string something like
at+cgdcont=1,"IP","internet"


Most mobile services accept for the username and password dummy values.


http://linux.frankenberger.at/Huawei_E220_Daten.html is a good place to look for connection settings.


Ref

I tried it with a Nokia 2630 and worked great.

Good source with details HOWTO : http://davesource.com/Solutions/20070520.T-Mobile-Nokia-E65-Ubuntu-Linux.html