Using T-Mobile Symbian Phone as a bluetooth modem for Ubuntu Linux

I wanted to use my Nokia E65 as a bluetooth modem for my Ubuntu Linux laptop using my T-Mobile GPRS cellular plan.

The Nokia E65 is a Symbian phone (Series 60 v9.1 3rd Edition) and has Bluetooth v1.2, so chances are these instructions would apply to just about any Symbian phone under Ubuntu. In fact, I'm told that this at least partially works for some non-symbian phones.

The directions for other linux distributions would be different regarding getting bluetooth working and getting/installing all the required software, but are otherwise conceptually the same.

Here are the steps:

  1. Get internet on the phone working
  2. Get bluetooth working
  3. Setup networking
  4. Pair the phone
  5. Bind bluetooth to an rfcomm device
  6. Start pppd to connect.
And at the bottom I've added:
  1. Mounting the phone filesystem over bluetooth

Get internet on the phone working

You should also be able to use the browser to access tzones and the internet on your phone.

Then you need to construct the Data Comm account for the internet. T-Mobile can send this to your phone if you have the unlimited internet plan.

On phone: Main Menu -> Tools -> Settings -> Connection -> Access points
  Options -> New access point
    Connection name:         "T-Mobile Internet" or some such
    Data bearer:             Packet data
    Access point name:       internet2.voicestream.com
	  other APN to try is:   wap.voicestream.com (non-EDGE!)
    User name:               none
    Prompt password:         no
    Password:                (none needed)
      - if that doesn't work try user/pass=guest/guest
    Authentication:          Normal
    Homepage:                None

Get bluetooth working

Now you need to get bluetooth working on your Linux box. There is an excellent HOWTO on this topic. The executive summary is:
% apt-get install bluez-utils
% /etc/init.d/bluetooth restart
% lsusb | grep -i bluetooth
(should show the bluetooth device)
% hcitool dev
(also lists bluetooth devices)

Setup networking

Now we get pppd ready. We need three chat scripts: (Thanks to http://kapsi.fi/~mcfrisk/linux_gprs.html for the original scripts!)

Put these into /etc/ppp/peers. They'll be used by the pppd command in the last step.

Pair the phone

We need to find the bluetooth ID of the phone. You can get it with either hcitool or hidd:

% hcitool scan

% hidd --search

Or just type "*#2820#" on your phone.

For the rest of this document we'll assume we're given a bluetooth ID of "11:22:BE:EF:44:33". Either way, you need to pair the phone. I had some problems here initiating the connection from the linux box. This command should work:

% hidd --connect 11:22:BE:EF:44:33

But unfortunately it wouldn't work on my system. So I initiated the connection on my phone:

Bluetooth -> right arrow (Paired devices) -gt;
	Options -gt;
		New paired devices (search)
		Choose your linux box and then type the pairing keys.
If you have the bluetooth-applet installed and running, it should handle everything for you, showing the connection and asking for the pin. If not:
% apt-get install bluez-gnome
It might be worth getting bluez-pin as another method for handling bluetooth PINs.

Here's the unfortunate bit. If the pairing ever gets disconnected, I can't simply reconnect in the bluetooth menu. This may be a problem with my bluetooth adaptor, so your mileage may vary. My "solution" for now is to delete the pairing in the phone and create a new one each time. If anyone comes up with a better solution, I'd love to hear it.

Bind bluetooth to an rfcomm device

... We use "rfcomm" to bind the bluetooth connection to a device. First we need to figure out what "channel" of the phone's bluetooth system is setup for DUN (Dial Up Networking). You can do this with sdptool (Service Discovery Protocol tool):
% sdptool search dun
Service Name: Dial-Up Networking
Service RecHandle: 0x1001e
Service Class ID List:
  "Dialup Networking" (0x1103)
Protocol Descriptor List:
  "L2CAP" (0x0100)
  "RFCOMM" (0x0003)
    Channel: 2
Language Base Attr List:
  code_ISO639: 0x454e
  encoding:    0x6a
  base_offset: 0x100
Profile Descriptor List:
  "Dialup Networking" (0x1103)
    Version: 0x0100
Note the "Channel: 2" which tells us what channel to bind. You can also avoid browsing
% sdptool browse 11:22:BE:EF:44:33
Then to bind the channel (in this case #2) to one of the rfcomm devices (we'll pick 0 here):
% rfcomm bind 0 11:22:BE:EF:44:33 2
We can see the binding with:
% rfcomm
rfcomm0: 11:22:BE:EF:44:33 channel 2 clean 
Here I'm having another unfortunate problem. After each connection attempt, I sometimes see the rfcomm close (it says "closed" instead of "clean" in the above output. I find that releasing the bind and restarting it fixes the problem:
% rfcomm release 0
% rfcomm bind 0 11:22:BE:EF:44:33 2
If you want, you can edit the settings in "/etc/bluetooth/rfcomm.conf," set bind to "yes" and give the device and channel for rfcomm0. Then you can put these commands into /etc/init.d/bluetooth and it will automatically bind and release the rfcomm device:
# At the end of the "start)" section
rfcomm bind all
# At the beginning of the "stop)" section
rfcomm release all

Start pppd to connect.

Before starting up pppd you may need to bring down your normal network interfaces, something along the lines of:
% ifconfig eth0 down
% ifconfig eth1 down
There's probably a better way to handle this routing, but I don't know what it is. Make sure to bring the interfaces back up as needed after shutting down pppd.

Now startup pppd:

% pppd call gprs
You should now have a ppp0 interface in your 'ifconfig' output that is up and running. The output should look something like this:
# pppd call gprs
Press CTRL-C to close the connection at any stage!
defining PDP context...
waiting for connect...

If the following ppp negotiations fail,
try restarting the phone.

Serial connection established.
using channel 1
Using interface ppp0
Connect: ppp0 <--> /dev/rfcomm0

You can hit control-c on the pppd process and it will shut down the connection, then you can release the rfcomm binding.

More info:

The dial string is usually *99# for Nokia Phones, but might be *99***1#, *99***2#,.. for other phones.
T-Mobile Unlimited Internet (APN: internet2.voicestream.com for $19.99/mo)
T-Mobile VPN (APN: internet3.voicestream.com for $19.99/mo).
Also see, T-Mobile Wireless Data Configurator: http://us.t-mobile.mywds.com/
Also consider: http://www.gammu.org/
Thanks: http://kapsi.fi/~mcfrisk/linux_gprs.html, http://gagravarr.org/series-60/

Mounting your phone filesystem over bluetooth

I know this is only slightly related, but it's too excellent to not mention. With the obexfs package you can mount your phone filesystem over bluetooth. Steps:
  1. Install obexfs: apt-get install obexfs
  2. Install fuse tools: apt-get install fuse-utils
  3. Add your user to the 'fuse' group in /etc/groups (then log back in to get the group)
  4. As root: chgrp fuse /dev/fuse (fix a possible bug)
  5. Use sdptool to find the OBEX file transfer channel (as in binding above)
  6. Create mount point (as root): mkdir /mnt/e65
  7. Permissions (as root): chmod ugo+rwx /mnt/e65
  8. Add to /etc/fstab:
    obexfs#-b11-22-BE-EF-44-33\040-B11 /mnt/e65 fuse user,noauto 0 0
    In this case we change the address to use '-' and put it after the -b and before the \040, and then put the channel (in this case 11) after the -B. The use of whitespace is important
  9. Mount: mount /mnt/e65
  10. Unmount: fusermount -u /mnt/e65
It's a shame you can't just use 'umount' but evidently it's not smart enough to deal with fuse mount points. So it goes.

You can also mount/unmount without changing /etc/fstab or the fuse group by using the commands:

root% obexfs -b11:22:BE:EF:44:33 -B11 /tmp/e65
root% fusermount -u /tmp/e65

Back to Solutions.

DaveSource.com - Dave's geek site GetDave.com - all the current Dave Pointers. MarginalHacks - I have an elegant script for that, but it's too small to fit in the margin.