Gentoo/Bluetooth

Page last edited 1,392 days 13 hours ago
From Alon Bar-Lev's Site
Jump to: navigation, search

Bluethooth

Configuration

Linux Kernel Configuration:
  [*] Networking support  --->
    <M>   Bluetooth subsystem support  --->
      [*]   L2CAP protocol support
      Bluetooth device drivers  --->
         <M> HCI USB driver

Add:

File: /etc/conf.d/modules
modules="${modules} bluethooth"
emerge net-wireless/bluez
rc-update add bluetooth default
/etc/init.d/bluetooth start

Most probably you would like to access bluetooth daemon from regular user, most desktop environments will require that, modify:

File: /etc/dbus-1/system.d/bluetooth.conf
  <policy context="default">
<!-- @LOCAL-BEGIN -->
    <allow send_destination="org.bluez"/>
<!-- @LOCAL-END -->
  </policy>
/etc/init.d/dbus reload

Device Attach

Before a device can be used, it must be attached. In order to do so, you must first have interaction agent active, if you are using desktop environment, with bluetooth integration you probably have one already, for example KDE has net-wireless/bluedevil. If you are unsure or need console mode only there is a simple-agent utility within the bluez sources.

Using the simple-agent

Temporary emerge required dependencies:

emerge dev-python/dbus-python

Extract bluez sources from upstream.

tar -xf bluez-0.96.tar.bz
cd bluez-0.96/test
python2 ./simple-agent
 Agent registered

If you get the following output, it means that you probably have already interaction agent in your system, no need to use the simple-agent.

 <snip>
 dbus.exceptions.DBusException: org.bluez.Error.AlreadyExists: Already Exists

Scan for devices:

hcitool scan
 Scanning ...
       00:24:7C:2F:92:7C       orange Nokia E71

Attach device:

hcitool cc 00:24:7C:2F:92:7C && hcitool auth 00:24:7C:2F:92:7C

Notice that the simple-agent request interaction:

 RequestPinCode (/org/bluez/13983/hci0/dev_00_24_7C_2F_92_7C)
 Enter PIN Code: 1234

Enter a PIN and press <Enter> then enter the same PIN at device.

You are now ready to proceed.

Desktop integration

KDE

emerge net-wireless/bluedevil

Troubleshooting

Find device

hcitool dev should show your bluetooth devices.

hcitool dev

lsusb will show your bluetooth devices if you have USB bluetooth device or laptop integrated device (in most cases).

lsusb
   Bus 002 Device 005: ID 0930:0508 Toshiba Corp. Integrated Bluetooth HCI

Toshiba laptops

Some Toshiba laptops have switcher to enable/disable Wi-Fi and Bluetooth. In new version of kernel you have to enable the following option to make bluetooth working:

Linux Kernel Configuration:
  [*] Device drivers  --->
    [*]   X86 Platform Specific Device Drivers  --->
      [*]   Toshiba Bluetooth RFKill switch support

Maintainer

Alon Bar-Lev

Authors

Originally written by: Alon Bar-Lev - 2011-11-17


Authors are people who have worked on this document and have made significant changes to its content. If you have edited this article and wish to add yourself to the authors list please read "Who are Authors".