raspberry piでUSB Bluetooth ドングルを使えるようにしてみます
USB Bluetooth ドングル
確認したUDBBluetoothドングルは以下になります
なお、以下のものでも動作するようです
セッティング
では、raspberry piに接続して、認識させてみましょう
参考にさせていただいたのは、以下のサイト
Raspberry Pi 2 で USB-Bluetooth アダプターを使ってみた – しばやん雑記
Raspberry Pi + Bluetooth – もっふもふの電子回路
- raspberry piにBluetoothドングルをさす
- 認識するか確認lsusb
認識はしてるみたい - Bluezの最新をダウンロード
BluezはLinuxで一般的に使われているBluetoothスタックらしいです
apt-get でインストール出来るものは BLE非対応らしいので、
最新版をダウンロードしてインストールします
(2017/05時点の)最新は5.9らしいのでそれをインストールしました$ wget https://www.kernel.org/pub/linux/bluetooth/bluez-5.9.tar.xz
- 解凍してビルド前のチェック
$ xz -d bluez-5.9.tar.xz $ tar xvf bluez-5.9.tar $ cd bluez-5.9 $ ./configure --disable-systemd --enable-library
- ライブラリを追加でインストール
$ sudo apt-get install libdbus-1-dev libdbus-glib-1-dev libglib2.0-dev libical-dev libreadline-dev libudev-dev libusb-dev make
- 再度、ビルド前のチェック
$ ./configure --disable-systemd --enable-library
- ビルドしましょう
makeなんですが、けっこう時間がかかりました(10分ぐらい?$ make $ sudo make install
- makeでインストールできないやつをインストール
$ sudo cp attrib/gatttool /usr/local/bin/
- libbluetooth-dev の各種ヘッダファイルを置き換え
$ sudo cp -ipr lib/ /usr/include/bluetooth.5.9 $ cd /usr/include $ sudo ln -s bluetooth.5.9/ bluetooth
- raspberry piを再起動しておく
$ sudo reboot
- ドングルの状態を確認
$ lsusb
$ hciconfig