September 21, 2005

Bluetooth and GNU/Linux

Author: Jem Matzan

Bluetooth is an open, IEEE connection standard for wireless device communications. Here's an introduction to Bluetooth on GNU/Linux, including how to enable support for it, some programs that monitor Bluetooth communications, and some hardware devices that use Bluetooth.

You're probably already familiar with the 802.11 standards for wireless Ethernet local area network (LAN) communications, which allow several machines to communicate and exchange data. But what about 802.15? That's the IEEE group for wireless personal area networks (PAN), which allow several devices, such as cellular phones, printers, PDAs, and computers, to connect to one another. Even if you have heard of it, you probably know 802.15 better as "Bluetooth."

As far as it concerns personal computers, the initial vision for Bluetooth was to eliminate corded peripheral devices for PCs. Your printer, mouse, keyboard, and even your digital camera could theoretically connect to your computer using the same secure wireless standard. Unfortunately, manufacturers never really integrated Bluetooth receivers well with computer motherboards and peripheral devices. More commonly today Bluetooth is used to transfer data between cellular phones and other devices, especially other cell phones and computers.

It's probably not worth your while to invest in any Bluetooth equipment if you don't have a specific need for it. But if you already have a Bluetooth-enabled device (such as your cell phone), or if you cannot use standard wireless peripherals, you might want to look into making it work.

Modern Bluetooth devices can transfer data from up to 100 meters away at a rate of up to 2.1 megabits per second. Earlier Bluetooth transmitters that use the 1.2, 1.1, or 1.0 standards are slower and can have a shorter range and fewer features. Any new peripherals you buy today should conform to the Bluetooth 2.0 standard. If not, Bluetooth 2.0 hubs, which can connect to as many as seven Bluetooth devices simultaneously, are backwards compatible with all previous standards.

Hardware

Although many PC motherboards advertise Bluetooth support, few come with all the necessary hardware to enable that support; often times you'll have to contact the computer or motherboard manufacturer and separately purchase a Bluetooth antenna or add-on card to connect to your computer.

A potentially cheaper and certainly easier way to add Bluetooth support to any computer is to use a USB Bluetooth receiver. Belkin makes a good 100 meter Bluetooth 1.1 receiver for around $70. It's about the size of a disposable cigarette lighter (only much flatter) and plugs into a spare USB port. It's perfectly compatible with GNU/Linux and, assuming your kernel has Bluetooth support, the device is almost instantly available and ready to connect to peripherals after insertion.

What about Bluetooth peripherals? Both Microsoft and Logitech offer Bluetooth keyboard and mouse desktop sets. The Microsoft set is twice the price of its standard cordless cousin; the Logitech set is a mere 50% more costly than its standard cordless counterpart. It's not clear whether they offer any noticeable difference in performance, although due to special attention to power efficiency, the Bluetooth devices may offer longer battery life than standard wireless peripherals.

Enabling Bluetooth

If you're using a commercial desktop GNU/Linux distribution, chances are you already have the Bluetooth kernel drivers compiled as modules and ready to load upon detection of a Bluetooth hub and a Bluetooth peripheral device. In that case, all you need is a Bluetooth hub, software to detect and manage devices, and some Bluetooth-enabled peripheral hardware to wirelessly connect to your computer.

If you're a do-it-yourselfer or if your distro doesn't have Bluetooth support compiled by default, you'll have to go into the kernel configuration and add them by hand. Bluetooth has its own kernel modules within the Networking subsection of the Device Driver heading in the Linux kernel menu. You'll want to enable each of the protocols within the Bluetooth subsystem support menu. If you build them as modules, you'll have to load them by hand using modprobe, or load them at boot time automatically according to your distribution's specific method. For the least amount of hassle, just build Bluetooth support into your kernel, recompile it, install it, and adjust your boot loader configuration if necessary.

Monitoring software

Commercial GNU/Linux distributions will also probably have all of the Bluetooth utilities you need. If you didn't install them initially, you can add them via your package manager or software installation framework.

If you're setting Bluetooth up yourself on a gratis GNU/Linux distribution, there are software frameworks you can download and install to connect to Bluetooth devices. This is the last step to making your GNU/Linux computer Bluetooth-ready. For KDE users there's KDE Bluetooth, and for GNOME fans there's GNOME Bluetooth. Both are a collection of programs that integrate with their respective desktop environments to provide Bluetooth connectivity and data transfer capabilities.

The BlueZ utilities, which are normally included with graphical Bluetooth packages such as those mentioned above, provide command-line programs for Bluetooth exploration and connectivity. Of particular interest are the hciconfig program, which shows the status of the Bluetooth hub, and the hcitool program, which scans for and identifies Bluetooth peripherals. The manual page for each command tells you everything you need to know to use them.