X
Tech

Using Bluetooth on Linux

I have mentioned before that I use a number of Bluetooth peripherals with my portable computers. This is one of those things where, the more I use it the more I like it.
Written by J.A. Watson, Contributor

I have mentioned before that I use a number of Bluetooth peripherals with my portable computers. This is one of those things where, the more I use it the more I like it. I've now gotten to the point where I feel like if you have a laptop/notebook/netbook computer and you aren't using Bluetooth with it, you're at least missing out on some things, and you're probably going to unnecessary trouble and/or expense. With the latest Linux distributions, Bluetooth is really easy to set up and use, and it works very well for a variety of peripherals. I currently use the following:

- Mouse: this is the obvious place to start. If you have a portable computer with built-in Bluetooth, you can save a USB port by using a Bluetooth mouse. Particularly on netbook systems, where there aren't a lot of USB ports, this can be a big advantage. But even on larger notebooks and laptops, if you make a lot of use of USB ports, you might be happy to recover one by using a Bluetooth mouse.

- Mobile Phone: This is another common use. The majority of mobile phones available today include Bluetooth support. While it is very commonly used to connect a headset, it can also be used to transfer files (such as pictures and videos) to your computer.

- Headset: This is a less-commonly used option, but if you frequently use audio in/out, for example with VoIP or video chat, or playing music and videos that you don't want to disturb those around you with, a Bluetooth headset can be a great option. The one I use is a simple mono-earpiece/microphone unit, which can also be used with a Bluetooth-enabled mobile phone.

- Printer: In all honesty, this was the one which surprised (and pleased) me the most. I didn't bother to try this for a long time, probably because I had previously tried to use Infrared connection with my Canon BJC 50/55/70/80 printers, and while that worked, it was so slow that you could pretty much watch the grass growing while you were waiting for the printing to finish. When I got a new HP h470 printer a few months ago, it came with a Bluetooth dongle, so I gave it a try. It is wonderful - it's SO nice to just put the printer on a shelf somewhere around my desk, and just turn it on and print when I need to, without worrying about cables. Of course, it is every bit as good when I am traveling, and I have one less cable to pack, and I don't have to worry about finding enough space on the hotel room desk for both the computer and printer.

The first question, of course, is does your portable system have Bluetooth support? One simple way to answer that, if you are running Linux, is to look for a Bluetooth icon on the Panel (taskbar). If you see one there, you should be in business - but even if you don't, it doesn't mean you don't have it. If you are running a KDE desktop, try going to Menu/Internet/kbluetooth (KDE Bluetooth). When you select that, it will start a configuration dialog, and then put the Bluetooth icon in the Panel. If you are running an Xfce desktop, look for the Bluetooth icon in the Panels, and if it is not there check the packages and configuration. All I had to do on my Xubuntu system, for example, was add the gnome-bluetooth package, and then it worked perfectly.

If your portable system doesn't have Bluetooth built-in, you can get a Bluetooth USB "Dongle" to add it. I am using a variety of these, from Trust, Belkin and others, and they have all worked without problem on every version of Linux I have tried. For convenience, look for the "nano" or "pico" dongle form, rather than the older and much larger "thumb" form. For functionality and compatibility, make sure the dongle is at least Bluetooth 2.0 compatible.

Once you have Bluetooth running on your computer, you are ready to start using Bluetooth peripheral devices. There are a few configuration options, which you can find by right-clicking the Bluetooth icon and choosing "Preferences", but the default settings are correct and appropriate for the vast majority of cases. When you want to use a Bluetooth device, you have to connect (pair) it with your computer the first time. It will then reconnect after shutdown, reboot, power cycles and whatever else. If you are using a Gnome desktop (most Debian/Ubuntu systems), just click the Bluetooth icon and choose "Setup new device". If you are using KDE, right-click the Bluetooth icon and choose "Device Manager", then click "New". Both of these will bring up a Bluetooth Device Setup window. Then you need to initiate "pairing" from your Bluetooth device; if it is a mouse, there is generally a "connect" button on it somewhere (usually on the bottom); headphones usually only have one or two buttons and an LED, so you have to press and hold a button until the LED starts to blink; mobile phones have a Bluetooth menu with something like "search for a connection"; printers will generally start searching for a connection as soon as they are turned on. Once your peripheral device starts broadcasting for "pairing" (lots of analogies to singles bars here which I will let pass...), it should take only a few seconds for it to show up in the Bluetooth setup window. It will usually show up in two stages; first, the MAC address shows up (something like 01:23:45:67:8A:BC), then a few seconds later a description of the device will replace the MAC address (something like "Logitech m555b mouse"). Select the device, and click "Next".

Now comes the only slightly tricky part of getting a device connected - the PIN code. Most mice (all of the ones I have tried) do not require a PIN code, so they will just connect. Mobile phones will usually give you a code on their display, and tell you to enter it on the computer. Headsets and printers usually have a PIN of "0000". If none of these works, you will have to go to the documentation for the peripheral device, and see what it says about PIN codes. The New Device setup window contains buttons for "just connect" (no PIN code), "PIN 0000", and "enter PIN", so any of the above situations is pretty straightforward.

Once a Bluetooth device is connected, you have to figure out how to use it (duh). For a mouse, there is nothing to figure out - it just works- instant gratification! - usually in parallel to the touchpad or whatever pointing device you were previously using. For a headset, you need to go to Audio Setup and select it as the Input and/or Output device, according to your hardware and needs. I was surprised at how easy this was, and how well it worked, by the way. For a mobile phone, you can then use the connection from either end; on the phone, you can go to a picture, video or whatever, and choose "send via Bluetooth" (there are WAY too many different phones and phone manufacturers for me to try to describe the steps for this in detail). The computer will then ask if you want to accept a file from the phone. On the computer, click the Bluetooth icon and then Browse the mobile phone. The phone memory will look like a disk (or multiple disks if you have a separate memory card), and you can drag-and-drop files from the phone to the computer.

Printers can be a bit more tricky, because the procedure depends on the specific distribution you are using, and even on what version of a distribution you have. The best news is that with the latest Ubuntu (9.10, Karmic Koala), it is pretty much a no-brainer. Go to System/Administration/Printing, and click New. It will search for a printer, and in addition to USB and network printers, it now also searches for Bluetooth printers. A box will come up with the printer description, you can confirm that the driver it chooses is correct, and you're ready to print! I was amazed, impressed and very pleased the first time I saw this. With older Ubuntu/Debian and many other distributions, there are couple more steps required. The printer search does not look for Bluetooth, so you will have to wait for that to finish, then click "Other", which brings up the "Device URI" input. Open a terminal window, and type hcitool search. It should find your Bluetooth printer, and in the information about it you will see the MAC address. Enter that address, without the colons, in the "Device URI" box, like this:

bluetooth://012345678ABC

That should then get you into the New Printer setup dialog, where you can confirm the driver selection, and print a test page.

If you are using a KDE desktop, you need to go to the Control Center, select Configure Printing and Scanning, and use the same procedure described above to enter the printer MAC address.

Once you have successfully connected a Bluetooth printer, the definition and connection are preserved across shutdowns, reboots, and printer power cycles. As I said, I have my printer on a shelf behind my desk at home, and I only turn it on when I actually need to use it. As soon as I turn it on, and it finishes its power-up dance, it is connected and ready to use.

So, there you have it. A rather long description for what is really a rather easy process. As I said at the beginning, if you have Bluetooth and aren't using it, you are missing out on some convenience and functionality that you would probably like. it's not hard, especially if you start out like I did, and just get a Bluetooth mouse. You can have it connected in less than a minute, and the confirmation that your system has Bluetooth, and it works, is a good feeling. The experience you gain from doing that can be used for the next step, which might be connecting your mobile phone, and transferring pictures. Then you're really on your way!

Good luck,

jw 21/12/2009

Editorial standards