Wind from all directions – Bluetooth Connections to Mobile Phones and Windows Mobile devices

Bluetooth – basics and pairing

Bluetooth is an excellent way to send contacts and files between machines and also allows the modem in one device to be used by another. Before you can do this the various devices must be ‘paired’ – this means that you set up a ‘PIN’ on both to give a secure communication without anybody else being able to hijack your mobile. The other security feature is that once paired you stop your devices being ‘discovered’ by other peoples machines which are searching for devices with Bluetooth (BT) turned on. This all sounds a bit complex and it does take a little while the first time.

When a Bluetooth dongle is inserted or a built in Bluetooth device such as that on the MSI Wind is turned on a Bluetooth icon appears in the system area . The first activity is to pair the Phone or Mobile Device to the computer.

The way Bluetooth is paired varies a little between machines so here I will use one of our Windows Mobile 5 devices, an O2 XDA Executive as an example for pairing etc. On the XDA do Start -> Settings -> Connections tab -> Bluetooth -> Mode tab and tick both Turn On and Make Discoverable. Then go to the Devices tab and tap New Partnership to pair the first time. The XDA will scan for other devices which are ‘Discoverable’ and find the Wind and come back with its name (wind-ubuntu) and also any other devices in range. Tap the wind-ubuntu and you will be asked to enter a code (‘PIN’) and you then have to rush to the Wind where a message asking if you want to continue and enter a matching ‘PIN’ pops up. At any future time you can work down the same menus to the devices which are paired and click on one to set which functions on your machine you will allow the other machine to use from a list – on Windows Mobile machines this may only be Dial-up-Networking as file and contact transfers are covered under the Beam settings.

Bluetooth Phone Dial-Up Network connection under Hardy Heron

Once you have Paired the phone and the computer you need to find out several pieces of information to enable you to set up the connection to the modem in the phone so you can set up a configuration file – the ends result is you have what looks like a local device. You can scan the Bluetooth connections looking for Dial Up Network (DUN) connections (modems) in the phones by typeing the following strings in a terminal, in this example both my T610 phone and the XDA have been paired and are with range.

hcitool scan
sdptool search DUN

which gives an output like this for with both my T610 Phone and O2 XDA Exec on::

pcurtis@satellite:~$ hcitool scan
Scanning …
00:12:37:C6:81:31 wind-ubuntu
00:0E:07:2C:E8:82 T610
pcurtis@satellite:~$ sdptool search DUN
Inquiring …
Searching for DUN on 00:12:37:C6:81:31 …
Service Name: Dial-up Networking
Service RecHandle: 0x10003
Service Class ID List:
“Dialup Networking” (0x1103)
Protocol Descriptor List:
“L2CAP” (0x0100)
“RFCOMM” (0x0003)
Channel: 4
Language Base Attr List:
code_ISO639: 0x656e
encoding: 0x6a
base_offset: 0x100
Profile Descriptor List:
“Dialup Networking” (0x1103)
Version: 0x0100
Searching for DUN on 00:0E:07:2C:E8:82 …
Service Name: Dial-up Networking
Service RecHandle: 0x10000
Service Class ID List:
“Dialup Networking” (0x1103)
“Generic Networking” (0x1201)
Protocol Descriptor List:
“L2CAP” (0x0100)
“RFCOMM” (0x0003)
Channel: 1
Profile Descriptor List:
“Dialup Networking” (0x1103)
Version: 0x0100

pcurtis@satellite:~$

I will include both set up the phone and the XDA in the configuration file as rfcomm0 and rfcomm1 – one can add extra devices to the configuration file as shown below:

The following is the contents of the file which contains the configuration information for both the T610 and the XDA and it lives in /etc/bluetooth/rfcomm.conf
. It is safest to make a copy then edit the existing ‘default’ rfcomm.conf file. The two important pieces of information are the addresses of the bluetooth devices and the channel numbers for the DUN connections

# RFCOMM configuration file /etc/bluetooth/rfcomm.conf
#
rfcomm0 {
bind yes;
# Bluetooth address of T610
device 00:0E:07:2C:E8:82;
#
# RFCOMM channel for the T610
channel 1;
# Description of the connection
comment “T610 Dial-up Networking via Bluetooth”;
}
#
rfcomm1 {
bind yes;
# Bluetooth address of XDA
device 00:12:37:C6:81:31;
#
# RFCOMM channel for the XDA
channel 4;
# Description of the connection
comment “XDA Dial-up Networking via Bluetooth”;
}

Remember when testing that whenever you change a configuration file such as the above which you are going to use you must reboot the machine or restart the relevant sub-system, in this case by:

sudo /etc/init.d/bluetooth restart

The extra device appears in /dev so it can be accessed via the Network Manager, a terminal program such as wvdial but my preference is for the GNOME-PPP Dialer.

Gnome-PPP

Gnome-PPP is a program to enable one to make Dial Up Network connections using any modems which are connected to the machine. GNOME PPP is installed via Add/Remove and seems to be an excellent way to get a simple dial up connection which also puts a icon in the bar which can be used to monitor and stop the connection – first class for a normal simple modem set up which detected my serial modem automatically and connected me up. I do not see a way built in to handle multiple connection but it is so simple to change that may be not worth worrying so having done my initial trials with wvdial with the Vodafone Connect Card I have now switched to GNOME PPP.

The modems appear as devices in /dev and the exact name depends on the sort of modem. In the case of bluetooth link to phone they look like /dev/rfcommx where x is 0, 1, 2 etc and the configuration is in the /etc/rfcomm.conf file we made above.

The main configuration in Gnome-PPP is done by a GUI interface and is all fairly obvious if you are making a simple land-line Dial-Up connection. The default modem initialisation strings and other settings will almost certainly work, so only the initial screen needs the username, password and telephone number entered for a land-line modem. The only thing missing with GNOME-PPP is help. It uses its own configuration file $HOME/.wvdial.conf which it is reported can have additions despite the warnings not to modify by hand.

If, however, you want to make a GPRS connection via most mobile phones you need to set up the APN via an initialisation string option on the second tab of the Setup Screen, and then use a special code in place of the phone number. Using Vodafone UK PrePay on the T610 as an example the Initialisation string 3 is set to:

Init 3 AT+CGDCONT=1,”IP”,”pp.vodafone.co.uk”

and the phone code used is

*99***1#

For other providers replace the pp.vodafone.co.uk with their APN (eg Vodafone UK Contract is internet, Guernsey Wave is pepper and Vodafone NZ is www.vodafone.net.nz)

In general the username and passwords are not checked but for most phones something needs to be present – check with your provider. I use web and web with vodafone. There are more details on my Global Communications and Computing page

My typical settings on the Setup screens for Gnome-PPP are:

  • Device chosen from /dev/rfcomm0 , /dev/rfcomm1, /dev/ttyS4, /dev/ttyUSB0 for T610, XDA, Zircon and Vodafone Connect Card.
  • The modem type is always analog.
  • The speeds will be normally be 115200 for the Land-line and 460800 for GPRS/3G.
  • Volume Off.
  • Init strings are typically
    • Init 2 = ATQ0 V1 E1 S0=0 &C1 &D2 +FCLASS=0 and
    • Init 3 = AT+CGDCONT=1,”IP”,”pp.vodafone.co.uk” for a VFUK Prepay
    • Init 3 = AT+CGDCONT=1,”IP”,”internet” for a VFUK contract
    • Init 3 is empty for XDA Exec or dial-up
  • For GPRS phone number is set to *99***1# (or *99# for XDA).
  • On Networking screen leave Dynamic IP and Automatic DNS ticked.
  • On Options screen a good start is:
    • Tick Dock in Notification Area;
    • Tick Abort connecting if line busy;
    • Tick Abort connecting if no dialtone and
    • Tick Stupid Mode.
    • Connection attempts at 1
    • Idle time 0 (disconnected).

Changes required in /etc/ppp/options

Some other options need to be set for most mobile network connections to prevent them timing out. These are not possible via the GUI interface and are taken from the the ‘master’ pppd set up file which is /etc/ppp/options. We can look at the current options which are set by:

sudo egrep -v ‘#|^ *$’ /etc/ppp/options

It is desirable to make a backup before editing the /etc/ppp/options file so to make a copy and open a terminal:

sudo cp /etc/ppp/options /etc/ppp/options_bak
sudo gedit /etc/ppp/options

I have made three changes to the file. The first two are essential for most GPRS connections and disable the sending and checking of the echo response sent to check the connection is alive – the echo is not implemented by most mobile service providers and the default result is that 4 echo response requests are sent at 30 second intervals and after the 4th failure to receive a response the connection is broken. If you are disconnected after 2 minutes that is the cause. The new values of 0 inhibit the sending and checking:

lcp-echo-failure 0
lcp-echo-interval 0

The third change is essential for the Vodafone Connect Card but does not impact other connections significantly so I do it routinely so I do not forget. It involves disabling negotiation of Van Jacobson style IP header compression by un-commenting

-vj

Note the information in the /etc/ppp/options file does not recommend that changes are made in this file. The documentation ( man pppd ) says that if there is a file ~/.ppprc it is used for user default options which could be used instead of modifying /etc/ppp/options – I have not tried that method as the simple way works for me and gives me a working system. I have the attitude that “if its not broken don’t fix it”

1 Comment

  1. Tory

    I’m imsresped you should think of something like that

    Reply

Leave a Comment

Your email address will not be published. Required fields are marked *