2018/08/04

Install BlueZ on the Raspberry Pi


sudo systemctl stop bluetooth
sudo apt-get update
sudo apt-get install libusb-dev libdbus-1-dev libglib2.0-dev libudev-dev libical-dev libreadline-dev libdbus-glib-1-dev unzip libcap2-bin
wget http://www.kernel.org/pub/linux/bluetooth/bluez-5.44.tar.xz
tar xf bluez-5.44.tar.xz
mv bluez-5.44 bluez
cd bluez
./configure --prefix=/usr --sysconfdir=/etc --localstatedir=/var --enable-library
make
sudo make install
sudo ln -svf /usr/libexec/bluetooth/bluetoothd /usr/sbin/
sudo install -v -dm755 /etc/bluetooth
sudo install -v -m644 src/main.conf /etc/bluetooth/main.conf
sudo systemctl daemon-reload
sudo systemctl start bluetooth
bluetoothd --version
sudo setcap 'cap_net_raw,cap_net_admin+eip' `which hcitool`
getcap !$

參考資料:
https://github.com/getsenic/gatt-python
Bluetooth LE scan as non root?