Bluetooth/rfcomm

From openSUSE

Contents

Setting Up rfcomm Devices

The rfcomm-devices are some kind of virtual serial port, which can be used e.g. to dialup via a GPRS / 3G capable phone and pppd.

This HOWTO is quite crude and hopefully this all will be much easier in the future, due to the usage of the bluetooth serial-service, but until then, you can find the necessary steps here.

First steps

Finding Out The BDADDR Of Your Device

First, you need to find out the so called Bluetooth Address (BDADDR) of your device. This can be done e.g. with kbluemon from the kdebluetooth-package. Note that you need to make your device visible so that kbluemon can detect it.

Finding Out The RFCOMM Channel Of The Dial-Up Service

Once you got the BDADDR of your device, you need to find out the rfcomm channel which is used by the dialup networking service. This is not hard, just do a

sdptool browse <BDADDR>

replacing <BDADDR> with your 6 byte hex address of your device, written as e.g. 00:11:22:33:44:55 In the sdptool output, look for "Service Name: Dial-up Networking" and below that for "Channel: X". In my case it looks like the following:

Service Name: Dial-up Networking
Service RecHandle: 0x10001
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

probably a

sdptool browse <BDADDR> | grep -A 11 "^Service Name: Dial-up"

will give you the correct record. In this case, it is channel 1.

Configuring /etc/bluetooth/rfcomm.conf

With the channel number you have now, you can simply do (as root)

rfcomm bind rfcomm0 <BDADDR> <CHANNEL>

of course again replacing <BDADDR> with the address of your device and <CHANNEL> with the channel you found out in the step before. Since you probably don't want to type this after every reboot, you can automate this by creating a file called /etc/bluetooth/rfcomm.conf with the following contents:

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

        # Bluetooth address of the device
        device 01:23:45:67:89:AB;

        # RFCOMM channel for the connection
        channel 1;

        # Description of the connection
        comment "a comment";
}

Of course, again add your BDADDR to device and your channel to channel. Now you should have a device /dev/rfcomm0 which you should be able to use for e.g. dialup or generally in any application that expects a serial port device.