< Day Day Up > |
As with many emerging technologies, there are competing implementations of Linux Bluetooth support. The main two implementations are Affix and BlueZ. Affix was originally developed by Nokia and is now hosted as an open source project at SourceForge (http://affix.sourceforge.net). BlueZ is also hosted at SourceForge is (http:// bluez .sourceforge.net) and the official Bluetooth stack of the Linux kernel. Although Affix is a mature and functional project, BlueZ receives more testing and has more widespread adoption. For this reason, this chapter focuses on the uses of the BlueZ Linux Bluetooth stack and libraries. This section includes all the information that you need to install and configure Bluetooth support from scratch. It is possible that your Linux distribution already contains preconfigured Bluetooth support, which will save you effort. However, the installation instructions provide useful background information for troubleshooting. 7.4.1 DistributionsAs Bluetooth is a relative newcomer to Linux, BlueZ support across commercial distributions varies. Generally speaking, if the kernel shipping with your distribution is older than 2.4.22, it is a good idea to upgrade it. Users of "bleeding-edge" distributions such as Debian Unstable and Gentoo should find that Bluetooth is adequately supported. 7.4.2 Configuring the KernelBluetooth support under Linux requires a recent kernel. If your kernel is Version 2.4.22 or better, or a 2.6 series kernel, then you're all set. Otherwise, you must upgrade your kernel. Alternatively, if you do not wish to upgrade, and have kernel 2.4.18 or better compiled from source, you can apply the patches from the "kernel patches" area of the BlueZ web site (http://bluez.sourceforge.net). Regardless, it's worth checking out the patches, because there are often improvements available that have not yet been merged into the main Linux kernel source.
Chapter 2 explains how to configure and compile a kernel. Table 7-3 and Table 7-4 show the options that must be set in your kernel configuration to enable Bluetooth support. You can either configure Bluetooth support to be compiled into the kernel or to be loadable on-demand in the form of modules. Many Linux distributions choose to ship with modules, so we proceed on the assumption that you will use modules. This removes the need to recompile your kernel if you acquire a different type of Bluetooth device. Figure 7-3 and Figure 7-4 show the Bluetooth configuration options from the 2.4.24 kernel. Figure 7-3. Configuring Bluetooth support in the Linux kernelFigure 7-4. Configuring Bluetooth hardware support in the Linux kernelTable 7-3. BlueZ protocol configuration options
Table 7-4. BlueZ hardware support configuration options
Once your kernel is compiled and you have rebooted, you must configure Linux so it knows how to load the appropriate Bluetooth protocol modules. Most modern distributions come with /etc/modules.conf already set up for Bluetooth use, but you may be missing the required configuration. To verify this, ensure that the contents of Example 7-1 are present in /etc/modules.conf . If you need to change this file, run depmod -a to ensure automatic loading of modules by the kernel. You must be the root user to perform this operation. Example 7-1. Module configuration for BlueZ# BlueZ modules 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 alias char-major-10-250 hci_vhci
7.4.3 Supporting SubsystemsDepending on your hardware configuration, you must ensure you are running some extra supporting software to initialize your Bluetooth device. 7.4.3.1 PCMCIAIf your Bluetooth adapter is a PC card or a CF card, you must have kernel support for PCMCIA and the PCMCIA card services software installed. This software is responsible for initializing your adapter when it is plugged in and loading the required drivers into the kernel. BlueZ requires PCMCIA card services to be Version 3.2.2 or higher. If your Linux distribution has an older version, you can update it from http://pcmcia-cs.sourceforge.net. See Chapter 2 for complete instructions on compiling pcmcia-cs from source. 7.4.3.2 HotplugThe Linux hotplug subsystem enables you to plug in a device and have it immediately ready to use. It is similar in function to the card manager from PCMCIA card services, except it is generalized to include USB, Firewire (IEEE 1394), and network devices. The 2.6 series of Linux kernels adds hotplug capability to even more subsystems, such as SCSI and input devices. When hotplug detects a new device, it loads the necessary driver modules into the kernel, and it runs any scripts the user has configured. In the case of BlueZ, hotplug is required for certain Bluetooth devices that require firmware downloaded to them, such as the USB dongles based on the Broadcom chipset. Hotplug ships with most Linux distributions. Version 2002_08_26 or later is required. If you need to install it separately, download it from http://linux-hotplug.sourceforge.net/. |
< Day Day Up > |