Bluetooth Interface

This is quite a challenging one. First of all, you will need to find and download the following files:

  1. The Toshiba Linux utilities, available at http://www.buzzard.org.uk/toshiba/download.html
  2. An extension to the Toshiba utilities allowing the Bluetooth interface to be activated/deactivated - (this version of dmabt modified by Holger Paschke)
  3. The Bluetooth RF communications driver (rfcomm.o). I have provided a copy here for convenience, as it is not included in the standard kernel.
  4. Note: Skip the next step (4) if you are happy to use the native bluetooth support built into the RH8.0 kernel. If you want to use the latest drivers, then you will have to disable bluetooth - "CONFIG_BLUEZ is not set" - in the kernel configuration, and re-compile. Then do step 4.
  5. The Bluetooth Library and Utility tarballs (get these from the Download page on the BLUEZ official site) You will need bluez-libs-2.3.tar.gz and bluez-utils-2.2.tar.gz

Login as root and copy the tarballs to your /usr/local directory, then do the usual tar -xvzf stuff. Read the associated README files as you cd into each uncompressed directory for installation instructions (install in the order given above).

Find out your current kernel version (do uname -r). Copy rfcomm.o to /lib/modules/current-kernel-version/kernel/drivers/bluetooth/

The Toshiba driver (which is included in the 2.4.x kernel) needs to be compiled as a module. To do this, add the following line to /etc/modules.conf :

   alias char-major-10-181 toshiba

Add the Bluetooth extensions to modules.conf also:

   alias net-pf-31 bluez  # 31 - that's number 3 number 1
   alias bt-proto-0 l2cap  # l2 - that's letter L (in lower case) number 2
   alias bt-proto-2 sco

Create the special devices /dev/toshiba : mknod -m 666 /dev/toshiba c 10 181
and /dev/rfcomm0 : mknod -m 666 /dev/rfcomm0 c 216 0
then do a depmod -a



Testing Time...

Make sure your Bluetooth/Wireless interface is switched on (switch at left side of machine at front).

Each time you want to want to activate Bluetooth on your machine, the following commands should be typed in (or run as a shell script):

   # modprobe hci_usb
   # dmabt
   # modprobe rfcomm
   # hciconfig hci0 up

Assuming no errors were encountered, you can check the local interface by typing:

   # hciconfig -a

and you should get something like this:

hci0:   Type: USB
        BD Address: 00:03:7A:01:40:03 ACL MTU: 60:20  SCO MTU: 64:0
        UP RUNNING PSCAN ISCAN
        RX bytes:1215 acl:0 sco:0 events:54 errors:0
        TX bytes:272 acl:0 sco:0 commands:32 errors:0
        Features: 0xff 0x02 0x04 0x00
        Packet type: DM1 DM3 DM5 DH1 DH3 DH5 HV1
        Link policy:
        Link mode: SLAVE ACCEPT
        Name: ''
        Class: 0x000000
        Service Classes: Unspecified
        Device Class: Miscellaneous,
        HCI Ver: 1.1 (0x1) HCI Rev: 0x0 LMP Ver: 1.1 (0x1) LMP Subver: 0x514
        Manufacturer: Silicon Wave (11)

So far, so good. To enable serious communication (other than scan and discover) it is necessary to define the HCI daemon configuration and set a PIN number. To start with, you can use the default conf. file (/etc/bluetooth/hcid.conf). It's always a good idea to make a backup of it, but in case you need to revert to default any time, here is my copy.

Get your remote Bluetooth device (I used a Sony-Ericsson T68i mobile phone) and set the Bluetooth "Discoverable" option on it. This will make it visible to communicating devices for 3 minutes. On the PC, type:

# hcitool scan
and you should get something like:
Scanning...
      00:80:37:B5:A8:3A     T68i
where the 12 hex digits indicate the device address and the T68i is of course the device descriptor.

Try pinging the phone:

# l2ping 00:80:37:B5:A8:3A  # Note - that's L(lower case)2ping

and you should get a sequence of data packets returned (CTRL c to stop).


It's time to connect:

On the 'phones Bluetooth menu, select "Discover". After a few seconds, you will a list of Bluetooth devices within range. In the default configuration, your laptop will appear as "Bluez". Select it, press YES and then choose "Add to paired".

The phone will now ask you for a Passkey (PIN). Enter a sequence of numbers, 4 digits or more, e.g. 123456.

Enter exactly the same sequence of numbers in the /etc/bluetooth/pin file (replacing the "Bluez" line you will see there), save, and restart the hci daemon by typing

# hcid -f /etc/bluetooth/hcid.conf

By now, the phone's pairing will probably have timed out, so "Retry". Hopefully, pairing will succeed and you will be Bluetooth-connected! ...

And finally: setting up a PPP session to your ISP. If you have followed everything so far, all that should be needed is:

# rfcomm bind 0 00:80:37:B5:A8:3A 1 (Note the 0 preceding and 1 following the phone's address)
# chmod 664 /dev/rfcomm0
# chgrp uucp /dev/rfcomm0
# ln -s /dev/rfcomm0 /dev/modem

and you will then be able to use your favourite dialer (eg. kppp) to set up a connection on /dev/modem, working via GSM @ 9600 bps. GPRS is faster, but requires a separate account and a different setup. I have not tried it yet.

By the way, don't forget to change your network configuration as described on my modem page, or your route to the network will not be open.

To learn more about Bluetooth, try this document or visit the Bluez website for the most up-to-date information.

You can also find some very useful information on Marcel Holtmann's site, to whom I am indebted for getting me started on this track!



Automating your Bluetooth connection:

You will not want to go through all the above rigmarole every time you want to connect a Bluetooth device, so I have written a little shell script to help. You can start it from an icon on your desktop (right click on desktop, create new link to application, execute command "sh bluez.sh" using options: run in terminal, run as different user (root))

If you intend to use a PCMCIA card modem in addition to the Bluetooth-connected modem, be aware that your symbolic link from /dev/modem to /dev/rfcomm0 will be overwritten each time you plug in the PC card. In that case, unplug the PC card modem and do ln -s -f /dev/rfcomm0 /dev/modem before re-opening the Bluetooth connection.


A warning for users of external Bluetooth USB dongles.

Read this only if you are planning to network your laptop into a Linux Server equipped with a Bluetooth USB dongle. There are two different device drivers for USB Bluetooth devices: bluetooth.o (Axis bluetooth) and hci_usb.o (Bluez stack). The hci_usb.o is the correct driver for most devices. If ON THE SERVER the 'CONFIG_USB_BLUETOOTH' kernel option is set to 'm' - the default for Red Hat 8.0 - the Axis driver (bluetooth.o) will be loaded and your Bluetooth device will not work...Unless, of course, it's an Axis one!

There are two ways to stop the bluetooth.o driver from loading. Either:

  1. Remove the driver from the system.
               # rm /lib/modules/(kernel version)/kernel/drivers/usb/bluetooth.o
               #  depmod -a
    

    - or -
  2. Ensure that 'CONFIG_USB_BLUETOOTH is not set' in your kernel source .config file, then re-compile.

Either of these steps should ensure that only the hci_usb.o (Bluez) driver is loaded when external USB Bluetooth devices are connected to the Server.



Previous Contents Next