This document is very outdated. Perhaps I will sometimes do a newer version, perhaps I won't.

Bluetooth Installation HOWTO

Frank Kargl (frank@kargl.net)

Version 0.03 - 20.09.2001


Content

  1. Location
  2. History
  3. Bluetooth Stacks
    1. Openbt Stack
    2. Bluez Stack
    3. IBM Blue Drekkar Stack
    4. Other Stacks
  4. Supported Hardware
    1. CSR Chipset
    2. Ericsson Chipset
    3. Other Hardware
  5. Credits etc.

Location

A current version of this document is available at http://medien.informatik.uni-ulm.de/~frank/bluetooth/bluetooth-howto.html .


History

V 0.01
This is a first preliminary version. Expect lots of errors and send me back tons of feedback to get it done better ;-) I started writing this HOWTO because I needed Bluetooth running with Linux for some research project. Brainboxes gave us some demo cards and in exchange we promised to deliver documentation how to setup Bluetooth with Linux. This is what you find here.
V 0.02
Mattias Agren from Axis advised us to use the experimental tools of openbt instead of the older btd. Changed.
V 0.03
Included description for CSR BCSP with openbt

Bluetooth Stacks

When using an Internet connection on your computer, you need a network adapter, a suiting driver software and the protocol software (called the TCP/IP stack) in order to communicate with other devices. With Bluetooth the case is very similar. You need a Bluetooth adapter, driver software and a Bluetooth Protocol stack. As many Bluetooth devices present themselves as a serial device, there is usually no special driver needed. For Linux there are several Bluetooth stacks you can choose from.


OpenBT

OpenBT was the first Linux Bluetooth stack available. It was originally developed by Axis Communications Inc. and is now an open source project hosted at Sourceforge.

Project Homepage: http://developer.axis.com/software/bluetooth/
Latest official version: 0.0.5
Download: http://sourceforge.net/projects/openbt/
Features: to be done
Supported Chipsets: CSR, Ericsson, ...


BlueZ

BlueZ was originally developed by Qualcom and later made OpenSource. Since version 2.4.6 it is included in the Linux kernel districution.

Project Homepage: http://bluez.sourceforge.net/">
Latest official version: XXX
Download: http://bluez.sourceforge.net/">
Features: to be done
Supported Chipsets: to be done


BlueDrekar

BlueDrekar is a middleware project from IBM that includes a complete Bluetooth stack. Only the transport driver is open source.

Project Homepage: http://www.alphaWorks.ibm.com/tech/bluedrekar
Latest official version: 1.3.0
Download: http://www.alphaWorks.ibm.com/tech/bluedrekar
Features: to be done
Supported Chipsets: Ericsson


Other Stacks

I don't know of any other Bluetooth Stacks for Linux. But if you do, just tell me.


Supported Hardware

Although there are lots of Bluetooth products available on the market, there is only a small number of chipset manufacturers. To the Bluetooth stack, there should be no significant difference if two devices use the same chipset. So we group our description according to the chipset used. If I don't have a description for a chipset yet, you can either provide me the hardware, so I can figure out how to do it myself or you can send me a detailed description (similar to the ones below) that I can include in the HOWTO.


CSR Chipset

URL: http://www.csr.com/
Products: Brainboxes
Supported by: OpenBT

CSR and OpenBT

The description is based on OpenBT version 0.0.5 which was installed on a vanilla SuSE Linux 7.2 Professional with kernel version 2.4.4. It should run on most other systems and with any 2.x kernel although we haven't tested it. We have also tested newer CVS checkouts (e.g. from 16.07.2001). The installation is completely analogous to the work described here.

First get the distribution from URL, unpack it in a directory using
$ tar xvf openbt-0_0_5.tar
Change into the directory and source the init_env file:
$ cd openbt
$ . init_env

Next you have to make some changes to the distribution in order to compile correctly. You can make these changes either manually or use this diff file. Apply it using patch:
$ cd openbt; patch -p1 < ../csr_openbt.dif
Essentially the following steps need to be done:

  1. Edit openbt/Makefile and comment out all lines related to userstack. In my attempts, the userstack simply didn't work, so use the kernel module and everything is fine. The Makefile should look like this:
    all:
        make -C linux/drivers/char/bluetooth
        make -C libs install
        #make -C apps/bluetooth/userstack links
        make -C apps/bluetooth
        #make -C apps/bluetooth/sdp_server sdp_user
        make -C apps/bluetooth/sdp_server sdp_server
    
    install:
        install apps/bluetooth/btd/btd $(INSTDIR)
        #install apps/bluetooth/userstack/btduser $(INSTDIR)
        install apps/bluetooth/sdp_server/sdp_server $(INSTDIR)
        #install apps/bluetooth/sdp_server/sdp_user $(INSTDIR)
        install apps/bluetooth/sdp_server/sdp.xml $(CONFDIR)
    
    For the same reason comment out the userstack in openbt/apps/bluetooth/Makefile:
    SUBDIRS = btd sdp_server # userstack 
    
  2. In linux/drivers/char/bluetooth/Makefile you may need to comment out the modversions.h include, depending on wether your kernel was build with modversions or not. On my system this produced trouble in both cases, so just comment it out, it won't hurt anyway.
    #MODFLAGS  = -DMODVERSIONS -include $(INCLUDEDIR)/linux/modversions.h
    
    Supply the path to your kernel include files:
    # The INCLUDEDIR variable allows LSB compliant distros to be able to compile
    # the module correctly. Use 'make INCLUDEDIR=/usr/src/linux/include' where
    # /usr/src/linux/include is the directory that was used to build the kernel.
    INCLUDEDIR = /usr/src/linux/include
    
  3. Next you have to change the default configuration from ERICSSON to CSR. Therefore edit openbt/linux/include/linux/bluetooth/btconfig.h, undefine CONFIG_BLUETOOTH_ERICSSON and define CONFIG_BLUETOOTH_CSR:
     /* This sets current HW */
     #undef CONFIG_BLUETOOTH_NOINIT
     #define CONFIG_BLUETOOTH_CSR
     #undef CONFIG_BLUETOOTH_DIGIANSWER
     #undef CONFIG_BLUETOOTH_ERICSSON
     #undef CONFIG_BLUETOOTH_INFINEON_BMI
     #undef CONFIG_BLUETOOTH_GENERIC
     #undef CONFIG_BLUETOOTH_USBMODULE  /* Not implemented */
    
  4. The following changes are obsolete, because we are not longer using btd any more. Nevertheless they are needed for make to run without errors.
    When using the CSR-based cards from Brainboxes, we had some trouble because the stack searches for a device with the identification of "CSR". On the other hand, the cards identify themselves with "CSR (H4)". So we patched the detection routine a little bit, to do a strncmp() instead of a strcmp(). In openbt/apps/bluetooth/btd/btd.c edit line 3299:
    if (!vendor)
        hw_vendor = HW_UNKNOWN;
    else if (!strncmp(vendor, "CSR", 3)) # detect ALL CSR cards
        hw_vendor = HW_CSR;
    else if (!strcmp(vendor, "Digianswer"))
        hw_vendor = HW_DIGIANSWER;
    
    And when you are just inside btd.c, you should evtl. also add another line to allow a bitrate setting of 921600. In line 1187 insert:
       case 921600:
        speed_c = B921600;
        break;
    

Now you are ready for make, make install and make devs. There will still be some warnings which you can ignore. For this to succeed, you need a couple of other libraries, e.g. libtermcap, libreadline etc. You should find these included in your favorite linux distribution and if they are not installed on your system, just install them from your distribution CDs.

If you have BCSP programmed cards instead of the H4 mode cards, you should say make INCLUDE_BCSP_SUPPORT=1 instead of just make.

There are some command-line tools in the directory apps/bluetooth/experimental which can be used as a replacement of the btd. As these tools are more up-to-date and some errors have been fixed there, we strongly advise to use these. So do a make there and also make install.

You should copy openbt/linux/drivers/char/bluetooth/bt.o to your modules directory (usually /lib/modules/<kernelversion>/pcmcia/). Next you may want to insert

alias char-major-124    bt
in /etc/modules.conf and do a depmod -a to get the module loaded automatically. Otherwise you have to do an insmod bt manually.

Next you need to know on what serial device your card is bound. In case of an serial device, this is easy. Just look what port you connected that device to. In case of an pcmcia card, cardinfo should give you more information. When using USB, perhaps usbview may help you. Due to a lack of USB Bluetooth devices, we haven't tested that yet. For the Brainxboxes CSR cards, there are two serial devices reported by cardinfo. You need the device with the higher ID.

Now init the Bluetooth stack: bti -u /dev/ttySx -s 921600

When bti is running, you can use the btcon to connect the two devices:

$ btcon -d /dev/ttyBT0 -a <mac of server device> -S 1
Now you are able to use /dev/ttyBT1 for serial communication between the two devices.

CSR and BlueZ

As far as we have tested it, CSR isn't currently supported by BlueZ. A port shouldn't be to hard, as you only have to adapt the initialization code. Eventually we will try later.

CSR and BlueDrekar

As far as we know BlueDrekar supports only Ericsson modules.

Ericsson

URL: very_long_URL
Products: Ericsson Bluetooth Modules
Supported by: OpenBT, BlueZ, BlueDrekar

Ericsson and OpenBT

As I don't have an Ericsson module available, this section is currently missing.

Ericsson and BlueZ

As I don't have an Ericsson module available, this section is currently missing.

Ericsson and BlueDrekkar

As I don't have an Ericsson module available, this section is currently missing.


Other hardware

As said above, if you think there is some major point missing in here, either send me the hardware to figure it out myself or send me a detailed description. If you succeded in running a new device based on one of the chipsets already covered, please also drop me a note so I can list it here.


Credits

There were a number of people who helped me a lot when creating this document.

Stefan Schlott
A colleague from the University of Ulm. Together we did most of the compiling, testing and rebooting needed to write this documentation.
Michael Attenborough
and the others at Brainboxes who supplied us with the first two Bluetooth cards.