Bluetooth

This article describes the setup of bluetooth controllers.

Prerequisites
Bluez uses udev, so set it up first.

Kernel
You need USB and/or PC-Card support. Bluetooth device does not show in 'lsusb' if USB support not present. Also you need to activate the following kernel options:

Software
Portage knows the global USE flag bluetooth for enabling support for Bluetooth in other packages. Enabling this USE flag will pull in automatically:

The USE flags of bluez are:

After setting this you want to update your system so the changes take effect:

Boot service
You can now start bluetooth:

To start bluetooth at boot time, add it your default runlevel:

Permissions
If you have the USE flag acl enabled globally and are using ConsoleKit (i.e you're using a desktop profile) permissions to bluetooth devices will be handled automatically.

A broader solution 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.

Where hci0 is the first device ID and 60:D8:19:B6:C3:1F is the MAC address.

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:

Device Attach/Pairing
Before a device can be used, it must be attached (paired in Bluetooth-lingo). 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.

After an upgrade to BlueZ 5, pairing has to be redone.

Using simple-agent
Configuration can either be performed using the BlueZ test programs (available if you enable the test-programs USE flag for ), 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, 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.

Desktop integration

 * for KDE
 * for GNOME, Xfce, GTK+