Updating BlueZ on Raspberry Pi (5.23 to 5.43)

Update (Sep 8, 2017):
Raspbian Stretch was released on 8/16/2017, and it has BlueZ 5.43 pre-installed. So these steps below won’t be necessary if you are using Stretch.  With pre-installed BlueZ 5.43, the on-board Bluetooth chip on Raspberry Pi 3 is working fine so far. 

 

BlueZ is an open source Bluetooth stack for Linux. This is how I updated BlueZ on my Raspberry Pi 3 from 5.23 (pre-installed version in Jessie) to 5.43. The motivation is that I wanted to test a Bluetooth Low Energy (BLE) feature and that is not supported in the original version.

Originally, I tried to update to 5.46 which is the latest version as of 7/27/2017. However, I found that hci tools have been not included in BlueZ since 5.44 for some reason. Since I wanted to use hci tools, I decided to update to 5.43, which still has hci tools.

Also, I should mention one more thing here. After update, I’ve been facing a problem with Raspberry Pi 3’s on-board Bluetooth module. So I decided to use a USB Bluetooth dongle instead. So if you’re planning to use on-board Bluetooth chip, this post is not probably for you…

 

Here is the list of contents of this post.

Contents
– Assumptions
– Steps
1. Disabling On-board Bluetooth Chip
2. Current Version Check
3. Uninstall Current BlueZ
4. Install BlueZ
5. Bluetooth Service Setting
6. Check If Everything is Fine

Let’s get started.

 

Assumptions
<Hardware>
Raspberry Pi 3 with Bluetooth dongle (Panda Bluetooth 4.0 USB Adapter)

<Software>
– Raspbian OS Jessie
– BlueZ (original version:5.23, target version 5.43)

 

Steps
1. Disabling On-board Bluetooth Chip
1-1. Boot up Raspberry Pi Board. If it’s not set up yet, please refer this post.
1-2. Let’s check if Bluetooth interfaces are recognized.

It looks both on-board chip and the dongle are recognized correctly. In this case, hci1 is the on-board chip (Broadcom) and hci0 is the dongle (CSR).
(* BD Addresses are replaced with “xx:xx:xx:xx:xx:xx” and “yy:yy:yy:yy:yy:yy”)

1-3. Since I don’t use the on-board BT chip, let’s disable it. Open “/etc/modprobe.d/raspi-blacklist.conf”,

1-4. Add two lines below and save.

1-5. Then reboot Raspberry Pi 3.

1-7. After reboot, type ‘hciconfig -a’ again.

The on-board chip is successfully disabled.

 

2. Current Version Check
2-1. BlueZ version can be retrieved by typing:

2-2. Also, let’s check the Bluetooth related packages.

 

3. Uninstall Current BlueZ
3-1. Uninstall the current version of BlueZ.

3-2. Remove unnecessary packages.

After uninstallation, the package list looks like this. (not sure why libbluetooth3 is still there…)

 

4. Install BlueZ
4-1. Update package list and installed packages.

4-2. Install dependencies.

4-3. Download and extract BlueZ 5.43.

4-4. Configure.

4-5. Compile the source code.

4-6. Install BlueZ.

You can ‘sudo make install’ instead of ‘sudo checkinstall’ as below:

4-7. Check the version if the installation is successfully done.

 

5. Bluetooth Service Setting
5-1. Enable Bluetooth service so that it will start on boot up.

It’ll create symlinks and output like below:

5-2. Reboot Raspberry Pi 3.

 

6. Check If Everything is Fine
6-1. After reboot, check if hci is UP.

6-2. If it’s DOWN, then type:

6-3. And check again.

Now it should be UP and RUNNING.
* If you want Bluetooth adapter powered up automatically at boot, see this.

6-4. Check if Bluetooth service is working.

If everything is fine, you should see like:

Make sure it’s ‘active (running)’.

6-5. Now you should be able to use bluetoothctl to pair devices.

 

 

Leave a Reply

Your email address will not be published. Required fields are marked *