BlueZ-5.71

BlueZ の概要

BlueZ パッケージは Linux における Bluetooth プロトコルへの対応を行います。

[注記]

注記

LFS や依存パッケージが本ブックに示す最新安定バージョンでなかった場合には、BLFS 開発版においては、パッケージのビルドや処理実行が適切に行われないことがあります。

パッケージ情報

BlueZ の依存パッケージ

必須

dbus-1.14.10, GLib-2.78.3, libical-3.0.17

Optional

docutils-0.20.1 (to generate man pages)

カーネルの設定

If you are building this package to use bluetooth devices (rather than as a build dependency), enable the following options in the kernel configuration, also the options in the Cryptographic API section if you intend to run the tests, and recompile the kernel if necessary:

General setup --->
  # If it is disabled, [TIMERFD] and [EVENTFD] will be hidden and
  # enabled implicitly.  We DO NOT recommend to enable [EXPERT]
  # unless you are really an expert user:
  [ /*] Configure standard kernel features (expert users) --->          [EXPERT]
    [*] Enable timerfd() system call                                   [TIMERFD]
    [*] Enable eventfd() system call                                   [EVENTFD]

[*] Networking support --->                                                [NET]
  <*/M> Bluetooth subsystem support --->                                    [BT]
    [*]   Bluetooth Classic (BR/EDR) features                         [BT_BREDR]
    <*/M>   RFCOMM protocol support                                  [BT_RFCOMM]
    [*]       RFCOMM TTY support                                 [BT_RFCOMM_TTY]
    <*/M>   BNEP protocol support                                      [BT_BNEP]
    [*]       Multicast filter support                       [BT_BNEP_MC_FILTER]
    [*]       Protocol filter support                     [BT_BNEP_PROTO_FILTER]
    <*/M>   HIDP protocol support                                      [BT_HIDP]
    Bluetooth device drivers --->
      # Select the appropriate drivers for your bluetooth hardware.
      # There are more vendor-specific drivers not listed here:
      < /*/M> HCI USB driver                                       [BT_HCIBTUSB]
      < /*/M> HCI SDIO driver                                     [BT_HCIBTSDIO]
      < /*/M> HCI UART driver                                       [BT_HCIUART]
  <*/M> RF switch subsystem support --->                                [RFKILL]

-*- Cryptographic API --->                                              [CRYPTO]
  Crypto core or helper --->
    <*/M> Userspace cryptographic algorithm configuration          [CRYPTO_USER]
  Block ciphers --->
    <*/M> AES (Advanced Encryption Standard)                        [CRYPTO_AES]
  AEAD (authenticated encryption with associated data) ciphers --->
    <*/M> CCM (Counter with Cipher Block Chaining-MAC)              [CRYPTO_CCM]
  Hashes, digests, and MACs --->
    <*/M> CMAC (Cipher-based MAC)                                  [CRYPTO_CMAC]
  Userspace interface --->
    <*/M> Hash algorithms                                 [CRYPTO_USER_API_HASH]
    <*/M> Symmetric key cipher algorithms             [CRYPTO_USER_API_SKCIPHER]
    <*/M> AEAD cipher algorithms                          [CRYPTO_USER_API_AEAD]

BlueZ のインストール

以下のコマンドを実行して BlueZ をビルドします。

./configure --prefix=/usr         \
            --sysconfdir=/etc     \
            --localstatedir=/var  \
            --disable-manpages    \
            --enable-library      &&
make

ビルド結果をテストする場合は make check を実行します。

root ユーザーになって以下を実行します。

make install &&
ln -svf ../libexec/bluetooth/bluetoothd /usr/sbin

root ユーザーになって、主要な設定ファイルをインストールします。

install -v -dm755 /etc/bluetooth &&
install -v -m644 src/main.conf /etc/bluetooth/main.conf

API ドキュメントが必要な場合は root ユーザーになって以下を実行します。

install -v -dm755 /usr/share/doc/bluez-5.71 &&
install -v -m644 doc/*.txt /usr/share/doc/bluez-5.71

コマンド説明

--disable-manpages: This switch disables generating the manual pages because of the reliance on 'rst2man' in docutils. Remove this switch if you have docutils-0.20.1 installed and wish to generate the manual pages.

--enable-library: This switch enables building the BlueZ 4 compatibility library which is required by some applications.

ln -svf ../libexec/bluetooth/bluetoothd /usr/sbin: This command makes access to the bluetooth daemon more convenient.

BlueZ の設定

設定ファイル

/etc/bluetooth/main.conf is installed automatically during the installation. Additionally, there are two supplementary configuration files. You can optionally install the following files as the root user:

cat > /etc/bluetooth/rfcomm.conf << "EOF"
# Start rfcomm.conf
# Set up the RFCOMM configuration of the Bluetooth subsystem in the Linux kernel.
# Use one line per command
# See the rfcomm man page for options


# End of rfcomm.conf
EOF
cat > /etc/bluetooth/uart.conf << "EOF"
# Start uart.conf
# Attach serial devices via UART HCI to BlueZ stack
# Use one line per device
# See the hciattach man page for options

# End of uart.conf
EOF

Systemd Bluez Services

To start the bluetoothd daemon at boot, enable the previously installed systemd unit by running the following command as the root user:

systemctl enable bluetooth

To start the obexd daemon for a user session (to support some Bluetooth programs using it), enable the previously installed systemd unit for all users by running the following command as the root user:

systemctl enable --global obex
[注記]

注記

Systemd will start the Bluetooth daemon only when a bluetooth device is detected on the system.

パッケージ構成

インストールプログラム: bluemoon, bluetoothctl, bluetoothd (symlink), btattach, btmon, hex2hcd, l2ping, l2test, mpris-proxy, and rctest
インストールライブラリ: libbluetooth.so
インストールディレクトリ: /etc/bluetooth, /usr/{include,libexec}/bluetooth, and /usr/share/doc/bluez-5.71

概略説明

bluemoon

is a Bluemoon configuration utility

bluetoothctl

is the interactive Bluetooth control program

bluetoothd

is the Bluetooth daemon

btmon

provides access to the Bluetooth subsystem monitor infrastructure for reading HCI traces

hex2hcd

is used to convert a file needed by Broadcom devices to hcd (Broadcom bluetooth firmware) format

l2ping

is used to send a L2CAP echo request to the Bluetooth MAC address given in dotted hex notation

l2test

is a L2CAP testing program

rctest

is used to test RFCOMM communications on the Bluetooth stack

libbluetooth.so

contains the BlueZ 4 API functions