Hands-On: Using Bluetooth on Linux

A survey of connecting Bluetooth devices to various Linux distributions, and a technical tip about Bluetooth with Broadcom wireless adapters.

I haven't written about using my Bluetooth devices on Linux in quite some time. That is good, because it means that they are all just working so there is not a lot to write about. But there have been some interesting and useful developments in Bluetooth support for various Linux distributions recently, so I think it will be useful to run through a survey of Bluetooth devices and Linux distributions.

In fact, it has turned out to be even more useful that I expected, especially for myself! While going through and testing all of my laptops for this post, I discovered that Bluetooth didn't work at all on my Acer Aspire V3-111. I hadn't noticed this until now simply because I hadn't tried to use any of my Bluetooth peripherals with it. After considerable searching on the web, and poking, prodding and testing on my own, I finally got it working. The details are below in the 'Other Hardware and Hiccups' section.

The first part of this survey will use one laptop with a number of different distributions, so that I can concentrate on the differences in Bluetooth support without having to worry about hardware issues. The second part will then look at a number of other laptops, and will concentrate on the hardware differences without trying to look at every distribution on each laptop.

Bluetooth support in Linux today is divided between two sets of packages. The first is the bluez packages, which provide the driver stack for Bluetooth adapters, and various utilities for CLI administration of Bluetooth. As all of the Linux distributions I am testing here include at least the bluez driver package in the base distribution, I am not going to dwell on that.

I am going to be looking at this primarily from a GUI perspective, using the desktop tools to manage Bluetooth devices. If you want/need to manage Bluetooth devices from the command line, the bluez-tools package provides the necessary programs. I will not be covering that here.

Each desktop manager has its own set of packages for Bluetooth management, so they all look slightly different but as I intend to show in this post, the general approach is very similar.

One last thing. I don't want to scare anyone by over-complicating this, because in general it is very easy. Connecting a Bluetooth mouse, for example, typically takes less than a minute and requires about four clicks.

So, to get started on this I am going to use an Acer Aspire V laptop and several different pointing devices - a Logitech V470 Bluetooth Laser Travel Mouse, a Logitech T630 Ultrathin Touch Mouse, and a Kensington Slimblade Trackball Mouse. I have all of my commonly-used Linux distributions installed on this laptop, so I will simply walk through them and give a description and screen shots of configuring the Bluetooth pointing devices.

screenshot20160223112653.png

KDE Plasma: First up (for no better reason than it is first in the boot list) is KDE Plasma. If your computer has a Bluetooth adapter, you should see the Bluetooth icon among the control and status icons at the right side of the KDE panel, as shown here.

screenshot20160223122503.png

Right-click on the Bluetooth icon and choose Configure Bluetooth to get the Bluetooth Devices screen. There are two interesting things here; first, it is informing you that your computer is not visible to other Bluetooth devices (that's good news), and second, you can click the button in the middle of the window to add a new Bluetooth device.

screenshot20160223131113.png

Click Add a Device in this window, and then press the Connect button on the mouse (or whatever device you want to add). After a few seconds, the new device will be listed in this window - along with any other visible Bluetooth devices within 10 meters of you.

Select the mouse and click Next to pair with the device and complete the connection. Note that the connection procedure no longer asks for a "dummy" PIN code, as it used to.

screenshot20160223131256.png

After the pairing is complete, you can return to the Bluetooth Devices screen to see what devices are configured, and you can select one to get a bit more information about that device such as its exact model and the hardware address.

screenshot20160223112443.png

One other interesting thing. When a configured and active Bluetooth device is in range, the Bluetooth icon in the KDE task bar will be modified to indicate that, as shown here.

screenshot20160223134440.png

Clicking on that icon brings up a detailed Bluetooth status window which shows Connected and Available Bluetooth devices.

Ok, that was fun, and pretty easy on KDE Plasma. The Linux packages involved in this example are bluez, which is the Bluetooth stack for Linux, and bluedevil, which includes the Bluetooth Wizard for connecting new devices.

panel.png

Gnome 3: The Bluetooth status and control panel is contained in the System Status drop-down at the right end of the Gnome 3 top panel. Simply click any of the icons there, and you will see the drop-down panel.

Here you can see that at the moment I have no WiFi connection, and Bluetooth is not in use (meaning that no Bluetooth devices are currently connected).

devices.png

Click the Bluetooth line, and then select Bluetooth Settings to get to the Bluetooth management utility. There is no separate "Add a Device" mode to this, the management utility comes up and starts searching for Bluetooth devices immediately. All you have to do is push the Connect button on the mouse, and wait a few seconds for it to show up in the device list.

There is also no separate "Connecting" screen, when you click on the mouse in the device list it will immediately connect and configure the device, and notify you when it is ready to use.

mouse.png

Once the device is connected and ready to use, you can click on it again in the management screen to get a detailed hardware information window.

There are buttons in this screen to disconnect the device, and to completely remove the device from the Bluetooth configuration, and to start the Mouse & Touchpad Settings utility. That's a nice touch.

The Linux packages required for Bluetooth support in Gnome are bluez (again, Duh) and gnome-bluetooth.

devices.png

Xfce, LXDE and i3: All of these distributions usually use the blueman graphical bluetooth manager package. Xfce and LXDE have the GUI icon included in their default panel; on i3 you have to autostart blueman-applet in the config file.

Clicking Bluetooth icon in the panel brings up the Bluetooth Devices control. Click Search in that window, and press Connect on the line for the mouse to initiate a connection.

When the mouse shows up in the Devices window, select it and then click Setup.

setup.png

After pairing with the Bluetooth device, the Setup dialog asks you to confirm the type of bluetooth configuration to associate with it. In the case of a mouse, the only reasonable selection is Human Interface Device Service. You could choose Don't Connect, but then it would be a paperweight rather than a mouse.

When the Setup process is finished, the mouse should be working - you can even use it to close the window if you want!

Cinnamon and MATE: This is a rather interesting story. For several years, the Linux Mint developers put a lot of effort into maintaining separate Bluetooth packages for Cinnamon and MATE. The Cinnamon package had to be compatible with gnome-bluetooth, which was a moving target, and on MATE they used the GTK+ blueman package, which is also used for Xfce and LXDE above.

They finally got tired of that (many would say that they finalled wised up...), and decided to develop their own Bluetooth management package which would be usable on both Cinnamon and MATE. So bluebarry was born. Some of the details of this are explained in Clem's Segfault blog.

As we have seen with the other desktops, there is a Bluetooth icon in the Cinnamon or MATE panel. Click on that to get the control menu, and select Bluetooth Settings from that window.

bluetooth.png

The Bluetooth control window shows whether connectivity in enabled or disabled, whether the system is visible to other Bluetooth devices which are searching for connections, and a list of currently known/connected Bluetooth devices. To connect a new device, click the "+" at the bottom left corner of the window.

newdevice.png

The Bluetooth New Device Setup window will appear, and start searching for other Bluetooth devices in range. Select the device you want to connect from this list, and click Continue. The device will be paired and assigned to the appropriate type, then it is ready to use.

appicon.png

When Bluetooth devices are connected, they will also be shown in the pop-up window for the panel icon. Selecting one of those devices gives you another device-function specific set of commands. For a pointing device (mouse/trackball) the options are to connect/disconnect and start the mouse settings utility.

Other Hardware and Hiccups: I repeated all of these tests on most of the laptop systems I own. The results were exactly as I expected (everything worked in the same way) until I got to Debian Testing on the Acer Aspire V5. I had already tested that system with openSuSE Leap and Korora, and everything worked perfectly so I knew there should not be a problem. But Debian didn't recognize or configure the Bluetooth adapter. When I went to the Bluetooth manager and selected Adapters, it simply didn't list anything.

I assumed that this had something to do with a non-free driver which was not being loaded on Debian. After a bit of scratching around with dmesg, synaptic, and a few web searches, I finally figured out that I needed to install the firmware-misc-nonfree package. I still don't know exactly what firmware is needed from that package - the package description says that it includes a variety of firmware "blobs" which are not individually large enough to warrant their own package - or even exactly what device needed the firmware. But after installing that, and rebooting, Bluetooth came right up and worked flawlessly.

My Acer Aspire One 725 doesn't have a Bluetooth adapter, but even on this there is a little bit to report. With all of the desktops, when no adapter is detected or configured, the Bluetooth icon is not displayed on the panel.

The Acer Aspire V3-111, which I already knew has a pain-in-the-rear Broadcom WiFi adapter, turns out to be an even bigger pain-in-the-rear for Bluetooth. Even with the correct Broadcom driver and firmware installed and WiFi working normally, none of the Linux distributions I tried was able to recognize and configure the Bluetooth adapter. They all seemed to recognize the Bluetooth adapter, so all of the Bluetooth configuration and add-device screens above came up without complaints, but they just never saw any Bluetooth devices. Grrr!

Checking the boot logs (dmesg) I found that the driver was looking for a firmware file called BCM.hcd that it wasn't finding. A few web searches showed that this is not an unknown problem, and a lot of reading later I found that if you still have Windows installed for dual boot, the simplest solution is to copy and convert the firmware file from Windows and put it in the correct place for the Linux driver to find it. A simplified version of the steps is:

  • Mount the windows partition on the Linux system
  • Look in /windows/system32/drivers for a file called BCM43142*.hex
  • I suspect that the exact name of that file may vary depending on the version of the Broadcom chip and the Windows driver in use, but it must start and end as shown.
  • Copy that file to your Linux system, and unmount the Windows partition
  • Get the hex2hcd utility source code from github. It's only one file, and a Makefile.
  • Convert the Windows .hex file to .hcd format, using the utility.
  • Move the converted file to /lib/firmware/bcrm/BCM.hcd
  • Reboot

Yeah, I know that this is a royal pain in the neck, and elsewhere. I'm not terribly surprised, because I already knew that the Broadom WiFi adapter was a pain, but this takes it to a whole new level. If that series of steps looks too difficult or intimidating for you, then I have another alternative - Don't buy a system for Linux with a Broadcom wireless adapter. I don't meant that to be sarcastic, I'm serious. Unfortunately, I also know that it is not easy to stick to that advice, because you might not be able to tell exactly what hardware a system has until you get it home and start setting it up. Well, do the best you can, and remember that there is a lot of help out there when you need it, as I just found out again.

One last note about this. After I got Bluetooth working on the Aspire V3 with the first Linux distribution, I just copied the BCM.hcd file to the firmware directory on the other partitions, and it worked just fine, every time - except for Debian Testing (jessie).

I had installed Debian with the Xfce desktop, and for some reason it had not installed the Bluetooth GUI packages. Perhaps this was related to the adapter not working, or to the proprietary firmware required for the adapter. Whatever, the result was that there was no Bluetooth icon on the Debian Xfce panel.

This was easy to fix, I just went to synaptic and installed the blueman package, then rebooted. When Debian came back up the Bluetooth icon was there, and it worked just fine. Lovely.

Read more about Linux and open source:

Newsletters

You have been successfully signed up. To sign up for more newsletters or to manage your account, visit the Newsletter Subscription Center.
Subscription failed.
See All
See All