There is something to be said about the convenience of using a wireless keyboard and mouse, especially when using them with a laptop. They’re easy to manage, easy to move, and easy to “disconnect” when you take the laptop away. There are two different types of wireless keyboards and mice: radio frequency (including bluetooth) and infrared.

Setting up bluetooth peripherals in Linux used to be a pain. It would involve working with command-line programs and editing text files. With Fedora 10, this is largely a thing of the past.

Out of the box, Fedora supports bluetooth peripherals like keyboards and mice and makes them simple to configure. When logging into GNOME, an icon for the bluetooth manager will sit at the top-right of the screen (if the system has bluetooth hardware, of course). Clicking on it provides the option to set up a new device; right-clicking does the same, but also allows you to set preferences, as well as send and receive files from bluetooth devices.

Clicking on “setup new device” will start the Bluetooth Device Wizard. On the bluetooth device there may be a “connect” type button to put it into discoverable mode. If it does, push the button and click the Forward button. The next screen will show a list of all the bluetooth devices found. Simply click on the device and, if the device is capable of entering a PIN, enter the PIN displayed on the screen. The device will now be connected.

If, however, you are using an older distribution, or a different distribution that doesn’t have things set up quite the same, you may have to do it old school. It’s not so painful as to not be worth mentioning, but certainly isn’t as convenient.

To scan for bluetooth devices from the command-line, use:

$ hcitool scan
Scanning ...
        00:07:61:BC:A2:48 Logitech MX Revolution Mouse
        00:07:61:C3:86:B9 Logitech Revolution 5500

The hcitool program will print out a list of devices that it does not already know about (so running this on a system with paired peripherals already will not display them). Make note of the device ID (similar to an ethernet MAC address). Next, open /etc/bluetooth/hcid.conf in your favourite text editor; the location may differ depending on the distribution, so if you cannot find it, try executing find /etc -name hcid.conf.

At the bottom of the file, add a new entry for your bluetooth device:

device 00:07:61:BC:A2:48 {
    name "Logitech MX Revolution Mouse";
device 00:07:61:C3:86:B9 {
    name "Logitech Revolution 5500";
    auth enable;
    encrypt enable;

Restart the bluetooth service (usually “service bluetooth restart”), and then you can finish off the process by pairing the devices. Now execute:

# hidd --search

It will indicate the devices it found and will attempt to pair them. You may have to enter a PIN code on the keyboard; when I set this up with Red Hat Enterprise Linux 5, I did not have to, so this may depend on the distribution.

At this point, your bluetooth devices will be paired and the connection information should persist across reboots. It may take a few seconds of typing a key or wiggling the mouse to “wake up” the connection after booting, but there should be no need to reconfigure once they are paired.

Obviously, using the bluetooth applet in GNOME is much easier, and I suspect KDE must have something to make it fairly straightforward as well, but if the tools don’t work or don’t work well enough, using the command-line will definitely do the trick.

Get the PDF version of this tip here.

Delivered each Tuesday, TechRepublic’s free Linux and Open Source newsletter provides tips, articles, and other resources to help you hone your Linux skills. Automatically sign up today!