HOWTO: Set up BlueZ in RedHat 8.0


Introduction

This is a summary of the steps I've taken to set up BlueZ on a vanilla RedHat 8.0 box, more for my own future reference than as a compreehensive setup guide.

Files Needed:

bluez-bluefw-0.9-1.i386.rpm
bluez-libs-2.3-1.i386.rpm
bluez-pan-1.1pre4-1.i386.rpm
bluez-sdp-1.0rc3-1.i386.rpm
bluez-utils-2.2-1.i386.rpm
  • For extra brownie points, you can also get the hcidump tarball here (oddly enough, it isn't included in the RPM distro, but can be compiled afterwards)
  • For my hardware (the Anycom Bluecard PCMCIA), you have to get the drivers here. I'm using version 0.3 on RedHat's updated 2.4.18-19.8.0 kernel.

Installing BlueZ:

Just rpm -ivh the lot:

cd /downloads/bluez.sourceforge.net/downloads/redhat
rpm -ivh *.rpm

Installing the driver:

Make sure your /usr/src/linux point to your kernel source tree (you do have the kernel sources installed, don't you?). RedHat kernel RPMs maintain a /usr/src/linux-2.4 link, so the easiest way is to simply

cd /usr/src
ln -s linux-2.4 linux

Then untar the drivers, compile and install:

cd
tar -zxvf bluecard-0.3.tar.gz
cd bluecard-0.3
make
make install

You can modprobe for it, but it won't do much for you besides showing up on lsmod.

Configuring BlueZ

Now the fun part begins. First off, you have to make sure your kernel understands what the modules are, so the following lines must be added to /etc/modules.conf:

# BlueZ modules and services
alias net-pf-31 bluez
alias bt-proto-0 l2cap
alias bt-proto-2 sco
alias bt-proto-3 rfcomm
alias bt-proto-4 bnep
alias tty-ldisc-15 hci-uart

The first three lines are standard fare, the fourth enables serial Bluetooth device support. This was the one that gave me the most trouble, since I read the official HOWTO in a hurry (and rather sleepy), so I skipped it the first time around.

Layer 2 Connectivity

Now depmod -a and do a manual hciconfig hci0 up. The output should be something like this:

hciconfig hci0 up
hciconfig hci0

hci0:   Type: PCCARD
        BD Address: 00:90:02:XX:XX:XX ACL MTU: 672:10  SCO MTU: 64:0
        UP RUNNING PSCAN ISCAN
        RX bytes:203 acl:0 sco:0 events:25 errors:0
        TX bytes:876 acl:0 sco:0 commands:25 errors:0

You now have Layer 2 connectivity and can do fun (and largely useless) stuff like hcitool inq or hcitool scan to find other devices (the first inquires raw capabilities and the second returns MAC addresses and device names).

If you have another Bluetooth device handy, you can l2ping it like this:

l2ping 00:07:e0:XX:XX:XX

Ping: 00:07:e0:XX:XX:XX from 00:90:02:XX:XX:XX (data size 20) ...
20 bytes from 00:07:e0:XX:XX:XX id 200 time 104.29ms
20 bytes from 00:07:e0:XX:XX:XX id 201 time 42.20ms
20 bytes from 00:07:e0:XX:XX:XX id 202 time 53.37ms
20 bytes from 00:07:e0:XX:XX:XX id 203 time 42.54ms
6 sent, 6 received, 0% loss

Services

But Layer 2 is useless without some sort of services, so we're going to set up the simplest one (and the only one I know how for now, anyway...): a serial device.

To conform to the nice startup script the BlueZ RPMs place in /etc/init.d/bluetooth, we must set up a serial device by placing a single line on /etc/bluetooth/uart:

echo "/dev/ttyS1 any 115200" > /etc/bluetooth/uart

And that's it, really. Doing a /etc/init.d/bluetooth start should start up the hcid daemon and a accompanying slpd

Which it doesn't, not at this point, and this is why this is a DRAFT. I'll get back to this later when I figure out what's wrong.

Note:

These instructions worked for me. There is no guarantee (express or implied) that they'll work for you, nor will I necessarily be able to help you if anything goes wrong.


See Also: