Bluetooth/zh-cn

这篇文章Article description::介绍了蓝牙控制器和蓝牙设备的配置和使用.

准备
本文假设 udev 和 USB 之前已经配置好.

内核
In most cases enabling RFCOMM ( CONFIG_RFCOMM ), HIDP ( CONFIG_BT_HIDP ), HCI USB ( CONFIG_BT_HCIBTUSB ) and/or HCI UART ( CONFIG_BT_HCIUART ) should be sufficient. The User-space I/O driver for HID input devices ( CONFIG_UHID ) should be enabled for Bluetooth keyboards and mice.

固件
Most Bluetooth controllers need firmware to function. If the controller is supported by Linux, will usually indicate if firmware is needed. The package should provide the needed firmware, although some devices may need firmware that is only available from the manufacturer.

USE 标记
BlueZ is an implementation of the Bluetooth protocol stack for Linux, and it is provided by the package.

Bluetooth support can be enabled system-wide by setting the USE variable to :

Emerge
The system needs to be updated if the USE variable was set to :

安装 BlueZ:

权限
Permissions for Bluetooth devices will be handled automatically if the USE variable is set to, and ConsoleKit or systemd or elogind is being used.

Alternatively, adding a user to the group will allow that user to access Bluetooth devices:

OpenRC
启动蓝牙：

开机时启动蓝牙：

systemd
启动蓝牙：

开机时启动蓝牙：

安装蓝牙控制器
显示控制器信息：

Where  is the name of the controller, and   (3rd line) indicates that the controller is enabled.

Enable the controller if indicates (with  ) (3rd line) that the controller is disabled:

In this case, query the state of the Bluetooth radio transmitter with :

can be installed with the package, or the >=-2.31 package.

Unblock the controller if indicates (with  ) that the controller is blocked:

If indicates (with  ) that the controller is blocked, unblock the controller by physical switch or keyboard function key.

Bluetooth controllers can be enabled automatically by setting  in :

In some instances Bluetooth controllers may have been soft-blocked by power management tools in udev. Make sure state is set to  in the corresponding rule file, or remove the following line entirely:

配对设备
Bluetooth devices need to be paired with a Bluetooth controller before they can be used. This is done by entering a PIN (or other code) on both devices via an interaction agent. Certain devices such as headsets do not allow entering an arbitrary PIN. These devices use a static PIN, which is usually 0000, 1111, 1234 or 9999. There are also devices (e.g. Sony BD Remote Control) that do not require PIN entry, and attempting to enter a PIN when prompted will result in failure. Paring can be skipped with such devices.

This article only covers device pairing with, which is a command-line interaction agent provided by the package. If a graphical desktop environment is being used, device paring can be done with a graphical interaction agent. For KDE use, for GNOME use , and for GTK use or.

启动 ：

列出可用控制器：

显示一个控制器的信息：

设置默认控制器：

Power on the controller:

Enable the agent and set it as default:

Set the controller as discoverable (temporarily for 3 minutes) and pairable:

扫描设备：

Put the device into pairing mode. This generally involves pressing a button or a combinations of buttons, usually for several seconds.

发现设备 MAC 地址：

与设备配对：

按照提示输入 ：

Allow the service authorization if requested:

信任设备：

连接设备：

显示设备信息：

现在设备已经配对完成：