teleost.org

Navigation:
Home  Comments

Tags:
linux  bluetooth  phone  gprs  umts  3g  ppp 

How to use a Bluetooth phone as modem in Linux

You should be able to use this with 3G/UMTS, GPRS and dialup connections as long as you know the CID number of the connection. The connection details are specified in the phone, all linux has to do is to tell the phone which connection to use.

I won't go into distro specific things like installing the neccesary software, it should be pretty obvious.

Install pppd and make sure your kernel has ppp support (Fedora etc. has this by default, this is probably only an issue on gentoo).

Edit /etc/bluetooth/rfcomm.conf like this:

rfcomm0 {
# Automatically bind the device at startup
bind yes;

# Bluetooth address of the device
device 00:00:00:00:00:00;

# RFCOMM channel for the connection
channel 1;

# Description of the connection
comment "bluetooth phone";
}

find out your phone's mac address by running

hcitool scan

and replace 00:00:00:00:00:00 in rfcomm.conf with it.

Pair with your phone. Easiest way is if you just search for the computer on the bluetooth menu on the phone and add it there. A pin dialogue should pop up.

Find the bt channel by running

sdptool search DUN|grep Chan

It will probably be 1, but you never know.

install wvdial and 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

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

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

[Dialer dialup]
Username = un
Password = pass
Phone = *99***2#
Stupid Mode = 1
Inherits = Modem1

Put in the correct user & pass for your network provider. The 1 and 2 in the 'Phone =' lines are the CID numbers of the connections. You can find these in the phone, but try with 1 and 2 first. It will probably just work.

Restart the bluetooth service or just reboot if you don't know how to do it. If you have other network devices make sure to deactivate them so that ppp0 (the phone's connection) becomes the default. There's probably a more elegant way to do this...

As root, run

wvdial gprs

or dialup. Wait until you get a pair of DNS servers listed, and you should be connected.

Some phones may require you to set your DNS servers manually.

Tested on gentoo with a Sony Ericsson k700i and a Nokia 7650 but should be fairly universal.


Comments:
By Ivan on May 6, 2006:
dmesg Shows various rfcomm_tty_ioctl: TIOCGSERIAL is not supported and never gets connected (pppd dies).
By n on May 16, 2006:
Are you sure you have ppp support compiled into the kernel (or have the module loaded)?
By geek on Jun 9, 2006:
i have the same trouble (connection drop in 3-4 minutes):

kernel says "rfcomm_tty_ioctl: TIOCGSERIAL" and pppd dies.
By sombrero on Jul 27, 2006:
Thank you for this most excellent post. I just got things going with a T-Mobile MDA (a windows mobile 5.0 smartphone). The differences for me were that I used channel 4 (as grepped from sdptool search), and that I used a username of "*", a password of "*", and a phone number of *99#. The latter I took from a blogpost at http://www.marstononline.com/2006/os-x-bluetooth-tethering-on-the-qtek-9100-htc-wizard-mda-vario-etc-in-wm5/.
By dmitry on Dec 6, 2006:
Me too, i've ran into the same:
Bluetooth usb dongle inserted, BlueZ configured and started.
"hcitool scan" - scans other bluetooth devices (i.e., my mobile); i can "l2ping" them.
"rfcomm bind" also works.

But when i try to "wvdial" to /dev/rfcomm0 -- no answer, and i see "rfcomm_tty_ioctl: TIOCGSERIAL" in logs.
It is both from root and non-root.

Trying to "pppd" to /dev/rfcomm0 -- still no answer from modem (not even "AT -- OK", but! my mobile shows bluetooth activity).

Any help is appreciated...

Fedora 5, 2.6.15, pppd 2.4.3, wvdial 1.54.0.
By DaveQB on Jan 17, 2007:
Awesome! Just what I was after. Look forward to trying this with my laptop and Nokia 6280 when I get home.
By Marcos Leone Filho on Apr 24, 2007:
For those having this issue:

rfcomm_tty_ioctl: TIOCGSERIAL is not supported

I figured out that is a conflict when more than one service uses dbus system (also used by bluetooth devices connecting through ppp). In my case, HAL Daemon was also using dbus. By the time I stopped it (/etc/init.d/hald stop), everything worked perfectly.
By Danuary on Jun 1, 2007:
I had the same problem some others above described with rfcomm_tty_ioctl: TIOCGSERIAL messages. I was driving myself crazy but after a few hours I noticed the line mentioning "sdptool search DUN|grep Chan" -- turns out DUN is on channel 3 and not channel 1. Amazing what a difference that will make. ;-)

I'm now stuck on another issue whereby I can dial and connect, but after about 30 seconds, pppd dies with "Receive serial link is not 8-bit clean: Problem: all had bit 7 set to 0"... If anyone has any ideas, I'd love to hear 'em. This is with VerizonWireless (1xEV-DO) in the states.
By Korny on Jun 17, 2007:
Thanks Danuary - this was a life saver. It seems my phone is using a different channel to when I set it up initially - it used to work on channel 2, now it seems to be on channel 4.

Time to write a script that checks this and updates /etc/bluetooth/rfcomm.conf automatically ...
By fast_rizwaan on Jul 21, 2007:
hcitool scan|tail -n1|cut -f2 #will print your phone's mac address

#alternately you can use this to bind your phone to rfcomm0

1. enable bluetooth on your phone
2. cd /dev && mknod rfcomm0 c 216 0
3. rfcomm bind /dev/rfcomm0 `hcitool scan|tail -n1|cut -f2`
4. pppd call gprs

"Atleast half of the settings work", dialing doesn't work :(
By bose on Oct 25, 2007:
life saver info ....
thanx a lot will try on nokia6085 and my lap asap
thanx again...
By khairi on Nov 20, 2007:
Where to wvdial deb package .. I cannot install after download ... some depedencies is missing ....

Can give this two link for wvdial and the depedencies ...

Using Synaptic to search and install but fail as nor depencies and repo library

using eee pc 4g, trying to connect to Nokia 6120c 3G

Leave a comment:

Name:  
URL:  
Comment:  


Home   Top  RSS