This article describes the setup of Bluetooth controllers.
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.
|RFCOMM protocol support||rfcomm||RFCOMM is a requirement of the OBEX file transfer, dialup connections and more Bluetooth applications.|
|RFCOMM TTY support||-||Enables terminal emulator connections over RFCOMM.|
|BNEP protocol support||bnep||Enables network support, e.g. for the PAN profile.|
|Multicast filter support||-||Enables multicast filter support.|
|Protocol filter support||-||Enables protocol filter support.|
|HIDP protocol support||hidp||Enables input device support. See the Bluetooth Input devices article.|
|HCI USB driver||btusb||Enables USB Bluetooth device support.|
|HCI UART driver||hci_uart||Enables UART based PCMCIA and CF Bluetooth device support.|
Bluetooth user space support is provided by net-wireless/bluez. 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.
An alternative is to add the user you want to be able to access Bluetooth devices to the plugdev group.
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:
To start Bluetooth:
To start Bluetooth at boot:
Before a device can be used, it must be attached (paired in Bluetooth terminology). This is done by entering a PIN (or other code) on both devices.
In order to pair, you must first have the interaction agent active. Most desktop environments have Bluetooth integration so will automatically support the interaction agent. For example, KDE has net-wireless/bluedevil.
Configuration can either be performed using the BlueZ test programs (available if you enable the test-programs USE flag for net-wireless/bluez), or by using the D-Bus API. The first way is described here.
- 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 Enter, then enter the same PIN at the device. If you don't know the PIN, then it is probably 0000. It could be 1234.
- 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.
- 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.