原文
https://scribles.net/updating-bluez-on-raspberry-pi-5-43-to-5-48/
Updating BlueZ on Raspberry Pi (5.48)
This post shows how to update BlueZ from 5.43 (the default version comes with Raspbian Stretch November 2017 version) to 5.48 (the latest as of 2/14/2018) on Raspberry Pi.
According to the release notes [1], many issues (especially GATT related issues) have been fixed and also, Advertising Manager API, which was previously marked as experimental, is now stable in 5.48.
Here is the list of contents of this post.
– Assumptions
– Steps
1. Check Current BlueZ Version
2. Install Dependencies
3. Install Latest BlueZ
4. Verify Update
– Reference
Assumptions
In this post, I assume that you already have Raspberry Pi 3 or Raspberry Pi Zero W running Raspbian Stretch November 2017 version.
Steps
1. Check Current BlueZ Version
1-1. Before starting, let’s check the current BlueZ version.
1
|
bluetoothctl -v
|
In case you are using Raspbian Stretch (November 2017 version), the BlueZ version should be 5.43.
1
2
|
$ bluetoothctl -v
5.43
|
2. Install Dependencies
2-1. Update the package list.
1
|
sudo apt-get update
|
2-1. Install the dependencies.
1
|
sudo apt-get install libdbus-1-dev libglib2.0-dev libudev-dev libical-dev libreadline-dev -y
|
其它有需要的相依性庫 可以先裝
sudo apt-get install libglib2.0-dev
sudo apt-get install libudev-dev
sudo apt-get install libical-dev
sudo apt-get install libreadline-dev
3. Install Latest BlueZ
3-1. Download the latest version of BlueZ source code.
1
|
wget www.kernel.org/pub/linux/bluetooth/bluez-5.48.tar.xz
|
3-2. Uncompress the downloaded file.
1
|
tar xvf bluez-5.48.tar.xz && cd bluez-5.48
|
3-3. Configure.
1
|
./configure --prefix=/usr --mandir=/usr/share/man --sysconfdir=/etc --localstatedir=/var --enable-experimental
|
出現問題與解決 https://blog.csdn.net/twy76/article/details/23851587
bluez的編譯安裝依賴好些軟體,下面記錄下,可能比較簡陋。
configure: error: GLib >= 2.28 is required
解決方法:
一般glib會被安裝,主要是一些開發檔,如標頭檔被安裝,ubuntu如下解決:
sudo apt-get install libglib2.0-dev
ubuntu 12.04的版本達不到要求,就升級到14.04。
configure: error: D-Bus >= 1.6 is required
解決方法:
將ubuntu升級到最新的版本,然後看下dbus的開發包是否安裝,如沒安裝,安裝就可以了
configure: error: libudev >= 143 is required
解決方法:
sudo apt-get install libudev-dev
configure: error: libical is required
解決方法:
sudo apt-get install libical-dev
configure: error: readline header files are required
解決方法:
sudo apt-get install libreadline-dev
checking systemd system unit dir... configure: error: systemd system unit directory is required
checking systemd user unit dir... configure: error: systemd user unit directory is required
解決方法:
./configure --disable-systemd
或者
./configure --with-systemdsystemunitdir=/lib/systemd/system --with-systemduserunitdir=/usr/lib/systemd
3-4. Compile the source code.
1
|
make -j4
|
3-5. Install.
1
|
sudo make install
|
3-6. Reboot Raspberry Pi 3.
1
|
sudo reboot
|
4. Verify Update
4-1. Verify the BlueZ version by issuing the command below.
1
|
bluetoothctl -v
|
The result should be like this:
1
2
|
$ bluetoothctl -v
bluetoothctl: 5.48
|
References
[1] BlueZ Release Notes
[2] Installing Bluez 5.44 onto Raspbian? – Raspberry Pi Stack Exchange