Next Previous Contents

4. Bluetooth

This section became a bit too large to be a subsection of the " The kernel and specific hardware" section, so here we go.

4.1 The kernel

First you need to get your Bluetooth hardware (on the computer's side) working. I use a Sitecom CN-521 and it works perfectly. The kernel drivers you need are:

Networking  --->
 Bluetooth subsystem support  --->
 <*>   RFCOMM protocol support
Besides that, choose your driver from the "Bluetooth device drivers" section. For most USB devices "HCI USB driver" will do the trick.

4.2 Bluez utils

With the kernel driving the hardware, the bluez-utils package contains programs to control your hardware. I could install it with the package manager from my distro, but you can also find them here at My distro took care of the dependencies, but if you download them manually i guess you'll need bluez-libs and blues-utils. With this installed, in /etc/bluetooth you'll find some specific configuration. The most important is a file called pin. This contains the pin code a device needs to enter when it tries to connect to your PC.

4.3 Finding your phone

With the bluetooth hardware working, it's time to locate your phone and pair them. An important tool is hcitool, and you can scan for bluetooth devices with the command hcitool scan. The output may look like this:

user@localhost ~ $ hcitool scan
Scanning ...
        xx:xx:xx:xx:xx:xx       K610im
As you can see it found a device called K610im, which is my phone. Now search for it's capabilities with the sdptool command, but you need the device's bluetooth address which was listed in the previous output. This may result in a very long output, but you need to look for the Dial-Up Networking service.
user@localhost ~ $ sdptool browse xx:xx:xx:xx:xx:xx
Service Name: Dial-up Networking
Service RecHandle: 0x10002
Service Class ID List:
  "Dialup Networking" (0x1103)
  "Generic Networking" (0x1201)
Protocol Descriptor List:
  "L2CAP" (0x0100)
  "RFCOMM" (0x0003)
    Channel: 2
Profile Descriptor List:
  "Dialup Networking" (0x1103)
    Version: 0x0100
There important information here is the channel number, 2 in my case. Now you can edit /etc/bluetooth/rfcomm.conf accordingly. Mine looks like this:
rfcomm0 {
        # Automatically bind the device at startup
        bind yes;

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

        # RFCOMM channel for the connection
        channel 2;

       # Description of the connection
       comment "k610im";
The number at the device statement is the same address you used for the sdptool browse command. The channel is the channel number you found in the output. The comment is just some free text. /dev/rfcomm0 will be the name of the device.

Now, you should be able to open /dev/rfcomm0 with minicom for example, and you should be able to handle it like a normal serial port.

4.4 More information

This section should not be seen as a replacement for a bluetooth howto. It's just some stuff i learned when i was testing bluetooth to get it working. For more information see the Bluetooth HOWTO. Also this Page with Bluetooth links may be useful.

Next Previous Contents