Skip to content

Bluetooth™, GPRS mobile phone with Debian GNU/Linux

bluetooth_logo.pngThis short guide will detail the steps needed to set up Bluetooth™ on Debian GNU/Linux, make your laptop communicate with your mobile phone, and use the latter as a modem to connect to the Internet.

I have recently purchased a Sony Ericsson K750i, which I will take as an example in this article, which should however be applicable to most of the current mobile phones.

Although I will focus on the Bluetooth™ connection, you can easily replace it with an irda connection, or use the USB cable provided with your phone, although I haven’t tried any of these alternatives with my current mobile phone.

I take for granted that the reader is already used to PPP connections using pppd, and all the examples will be based on the French mobile phone provider Orange.

Setting up Bluetooth™ on Debian GNU/Linux

The bluez project goal is to make an implementation of the Bluetooth™ wireless standards specifications for GNU/Linux. On Debian, you have to install the bluetooth meta-package, which will automatically pull in the required dependencies.

When inserting a Bluetooth™ USB-adapter, you should see these entries in the logs:

usb 1-2: new full speed USB device using uhci_hcd and address 2
usb 1-2: configuration #1 chosen from 1 choice
Bluetooth: HCI USB driver ver 2.9
usbcore: registered new interface driver hci_usb

If you are a GNOME user and have installed the bluez-gnome package, you should be able to see the bluetooth™ icon in the notification area. A right click on this icon will give you access to the options (visibility, connectivity etc.).

Communicationg with a mobile phone over a bluetooth™ connection

You should now be able to communicate with the phone.

Run hcitool scan and check that your phone name appears in the device list:

$ hcitool scan
Scanning ...
        00:1B:59:2F:5E:E1       K750i

With nautilus-sendto, you can send files from your laptop to the mobile phone:
nautilus-sendto.png
Make sure the phone is visible to other devices.

To send a file from the phone to the computer, you have to install the deprecated gnome-bluetooth package, available from my repository.
gnome-bluetooth.png

After starting gnome-bluetooth, and making the computer visible (edit the preferences from the bluetooth applet), you will be able to transfer files from your mobile phone to the laptop.

Using the modem

Setting up rfcomm device

Edit /etc/bluetooth/rfcomm.conf as follows:

rfcomm0 {
        bind yes;
        device 00:1B:59:2F:5E:E1;
        channel 1;
        comment "Example Bluetooth device";
}

Where:

  • the device is what you can see thanks to hcitool
  • the channel is the number referring asthe “Dial-up Networking” service when running sdptool browse

After restarting the bluetooth service, you will have a new /dev/rfcomm0 device which you will use a the modem device in the pppd configuration files.

GSM connection

A GSM connection will allow 9,600 bps, but can be usefull if you are out of the GPRS network.
Simply create a new connection with the newly created device as modem device. I would suggest you use the pppconfig to create the ISP connection.
For the French ISP Free, you can use the following national phone number: 01 73 92 20 00

GPRS connection

Thanks to GPRS, you can reach the speed of 56 Kbps. For information only, Edge allows 247 Kbps and UMTS 384 Kbps.

Before trying to connect from your laptop, please be sure you are able to connect to GPRS from your mobile phone.
If you haven’t yet configured your mobile phone, most of the providers have the settings available publicly on their website.

Note that Orange requires a free option to be activated (this is automatically done if you are a new subscriber, but took me ages to figure out why it didn’t work for me – ask to talk to the technical team if you call the hotline). Also pay attention to your SIM card which should be GPRS aware – I had to change mine agasint a new one (the operation was free).

Here is the configuration file I use to connect to Orange:

hide-password
noauth
connect "/usr/sbin/chat -f /etc/chatscripts/orange-gprs"
/dev/rfcomm0
57600
defaultroute
user "orange"
 
ipparam orange-gprs
idle 300
 
# most of the phones don't answer to LCP echo requests
lcp-echo-failure 0
lcp-echo-interval 0
 
usepeerdns
noproxyarp
noccp
novj
nobsdcomp
novjccomp
nopcomp
noaccomp
 
# pppd must not propose any IP address to the peer!
noipdefault
 
# Accept peers idea of our local address
ipcp-accept-local
 
# Ignore carrier detect signal from the modem
local

Here is the chat script:

# ispauth chat
# abortstring
ABORT BUSY ABORT 'NO CARRIER' ABORT VOICE ABORT 'NO DIALTONE' ABORT 'NO DIALTONE' ABORT 'NO ANSWER' ABORT DELAYED
# modeminit
'' ATZ
OK-AT-OK 'ATD*99***1#'
# ispconnect
CONNECT \c

The phone number is very important. The last digit must be the external ID of the GPRS profile setup in your mobile phone. This seems to be closely tied to Orange, but if you can’t connect, contact your provider to get a valid dialing sequence.

You can test the connection running pon orange-gprs. Debugging can be improved by adding a nodetach option in the configuration file. Also add a line debug debug debug to increase the verbosity.