This article describes the configuration and usage of Bluetooth controllers and devices.
[*] Networking support ---> <*> Bluetooth subsystem support ---> [*] Bluetooth Classic (BR/EDR) features <*> RFCOMM protocol support [ ] RFCOMM TTY support < > BNEP protocol support [ ] Multicast filter support [ ] Protocol filter support <*> HIDP protocol support [*] Bluetooth High Speed (HS) features [*] Bluetooth Low Energy (LE) features Bluetooth device drivers ---> <*> HCI USB driver <*> HCI UART driver <*> RF switch subsystem support ---> Device Drivers ---> HID support ---> <*> User-space I/O driver support for HID subsystem
Bluetooth support can be enabled system-wide by setting the USE variable to
The system needs to be updated if the USE variable was set to
emerge --ask --changed-use --deep @world
emerge --ask --noreplace net-wireless/bluez
Alternatively, adding a user to the plugdev group will allow that user to access Bluetooth devices:
gpasswd -a <user> plugdev
rc-service bluetooth start
Start bluetooth at boot:
rc-update add bluetooth default
systemctl start bluetooth
Start bluetooth at boot:
systemctl enable bluetooth
Display controller information:
hci0: Type: BR/EDR Bus: USB BD Address: 00:02:72:2F:A9:33 ACL MTU: 1021:8 SCO MTU: 64:1 UP RUNNING PSCAN RX bytes:1166 acl:0 sco:0 events:43 errors:0 TX bytes:960 acl:0 sco:0 commands:43 errors:0 Features: 0xbf 0xfe 0xcf 0xfe 0xdb 0xff 0x7b 0x87 Packet type: DM1 DM3 DM5 DH1 DH3 DH5 HV1 HV2 HV3 Link policy: RSWITCH SNIFF Link mode: SLAVE ACCEPT Name: 'BlueZ 5.21' Class: 0x000104 Service Classes: Unspecified Device Class: Computer, Desktop workstation HCI Version: 4.0 (0x6) Revision: 0x1000 LMP Version: 4.0 (0x6) Subversion: 0x220e Manufacturer: Broadcom Corporation (15)
hci0 is the name of the controller, and
UP (3rd line) indicates that the controller is enabled.
Enable the controller if hciconfig indicates (with
DOWN) (3rd line) that the controller is disabled:
hciconfig hci0 up
When attempting to enable the controller, the following message may be displayed:
hciconfig hci0 up
Can't init device hci0: Operation not possible due to RF-kill
In this case, query the state of the Bluetooth radio transmitter with net-wireless/rfkill:
rfkill list bluetooth
0: hci0: Bluetooth Soft blocked: no Hard blocked: no
If Bluetooth is blocked or disabled in the BIOS/UEFI, rfkill may incorrectly list the controller as
Hard blocked: no.
Unblock the controller if rfkill indicates (with
Soft blocked: yes) that the controller is blocked:
rfkill unblock bluetooth
If rfkill indicates (with
Hard blocked: yes) that the controller is blocked, unblock the controller by physical switch or keyboard function key.
Bluetooth controllers can be enabled automatically by setting
AutoEnable=true in /etc/bluetooth/main.conf:
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 bluetoothctl, which is a command-line interaction agent provided by the net-wireless/bluez package. If a graphical desktop environment is being used, device paring can be done with a graphical interaction agent. For KDE use kde-plasma/bluedevil, for GNOME use net-wireless/gnome-bluetooth, and for GTK+ use net-wireless/blueman.
Previously paired devices will need to be paired again when upgrading from BlueZ 4.
List the available controllers:
Display information about a controller:
Set the default controller:
Power on the controller:
Enable the agent and set it as default:
Set the controller as discoverable (temporarily for 3 minutes) and pairable:
Scan for devices:
Put the device into pairing mode. This generally involves pressing a button or a combinations of buttons, usually for several seconds.
Discover the device MAC address:
Pair with the device:
Enter the PIN if prompted:
PIN code: ####
Allow the service authorization if requested:
Authorize service service_uuid (yes/no): yes
Trust the device:
Connect to the device:
Display information about the device:
The device is now paired: