Bluetooth

This article describes the setup of Bluetooth controllers.

Prerequisites
This article assumes that udev, USB and/or PC-Card have been previously configured.

Kernel
Use the table below to determine which Bluetooth subsystem you need to enable. In most cases enabling RFCOMM, HIDP, HCI USB and/or HCI UART will be sufficient.

Software
Bluetooth user space support is provided by. Portage has ebuilds for BlueZ 4 (deprecated) and BlueZ 5.

You can enable Bluetooth support globally by adding bluetooth to the USE variable.

If you require BlueZ 4 you can mask BlueZ 5 to prevent it from being installed.

If you enabled the bluetooth USE flag globally you should update your system. This will automatically install BlueZ.

If you didn't enable the bluetooth USE flag globally you will need to manually install BlueZ.

Permissions
If you have the acl USE flag enabled globally and are using ConsoleKit or systemd, then permissions for Bluetooth devices will be handled automatically.

An alternative is to add the user you want to be able to access Bluetooth devices to the plugdev group.

Adapter Information
Check that your Bluetooth adapter is working.

Bring interface up at bootup time
In case you need to use trusted Bluetooth devices before a GUI is up and running, you can use an udev rule:

Starting
To start Bluetooth:

To start Bluetooth at boot:

Device pairing
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. They always use the same PIN which is usually 0000 or 9999. If you don't know the PIN check your devices user manual.

This article only covers device pairing with command-line interaction agents. If you have a graphical desktop environment you can perform device paring with graphical interaction agents. You can use for KDE,  for GNOME and  for GTK+.

BlueZ 4
Device paring is done via  and requires that you enable the test-programs USE flag for.


 * Retrieve the address of the mouse. Most of the devices need you to press a special button, possibly for several seconds, to render them discoverable.


 * Where 00:1F:20:1D:1B:4B is the MAC address for your device.


 * Pair the device.


 * Enter a PIN and press, then enter the same PIN at the device.


 * Mark the device as trusted so it can connect automatically.


 * Devices are not trusted by default. You can check trust status by leaving off the "yes" from the previous command.


 * "1" is trusted, "0" is not trusted.


 * Connect the device (this only needs to be done once, it will be done automatically after that).


 * Your device should now be paired. You are now ready to proceed.

BlueZ 5
Device paring is done via  and is available with all  installations.


 * Start bluetoothctl.


 * 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.


 * Discover the device MAC address.


 * Pair with the device.


 * If requested enter the PIN code.


 * Trust the device.


 * Connect to the device.


 * Display information about the device.

Desktop integration

 * for KDE
 * for GNOME, Xfce, GTK+