--- bluetooth-guide.xml?revision=1.17.orig 2010-08-03 22:31:10.000000000 +0100 +++ bluetooth-guide.xml?revision=1.17 2010-08-07 15:41:38.000000000 +0100 @@ -172,32 +172,103 @@ BlueZ - The Bluetooth Stack
-Installing BlueZ +What is BlueZ?

Now that the device is detected by the kernel, we need a layer that lets applications communicate with the Bluetooth device. BlueZ provides the official -Linux Bluetooth stack. The ebuilds that provide what we need are -bluez-libs and bluez-utils. Devices that need Broadcom firmware +Linux Bluetooth stack. The ebuild that provides what we need is +bluez. Devices that need Broadcom firmware files or the like may need bluez-firmware.

+ +
-
-# emerge net-wireless/bluez-libs net-wireless/bluez-utils
+
+BlueZ permission control + + +

+Before installing, it is a good idea to choose how to control users' ability to +use bluetooth. +

+ +

+There are two methods: +

    + +
  • "consolekit": identifies users who are sat in front of the computer, + and grants them access;
  • +
  • "plugdev": allows members of the plugdev group to use bluetooth
  • +
+

+ +

+Although the permission policy can be tuned by editing the dbus permission rules +for bluez, the consolekit USE flag must be set accordingly +

    +
  • consolekit — means the consolekit method is used and requires + it to be enabled in some dependencies
  • +
  • -consolekit — selects the plugdev method, and does not + require any consolekit support in dependencies.
  • +
+

+ +
+ +
+Installing bluez + + +

+Now we can install the package, using the following command. +

+
+# emerge net-wireless/bluez
 
+ +

+This ebuild might require certain USE flags to be enabled for other ebuilds: +

    +
  • sys-fs/udev must have the extras flag enabled
  • +
  • When bluez is built with consolekit enabled (see above), + sys-auth/pambase must have it enabled too.
  • +
+

+ +

+Now the bluetooth stack is completely installed, but you need other tools to do +anything useful with it. +

+ +

+You can get some tools enabling the test-programs USE flag +for bluez, which will install some testing utilities. But this is a +limited set of tools, mainly intended for testing — you probably want to +install an external bluetooth utilities package. +

+
-BlueZ configuration and PIN pairing +BlueZ configuration

Now it's time to see if the Bluetooth device is being picked up correctly by the -system. We start up the required Bluetooth services first. +system. We start up the required Bluetooth services first. (It may have been +started when you plugged the device, if it uses some hotpluggable interface +(like USB).)

+ +
 (Start up Bluetooth)
 # /etc/init.d/bluetooth start
@@ -273,9 +344,14 @@
         #encrypt enable;
 }
 
+ +
+
+PIN pairing (<c><bluez-4</c>) +

-After that, we have to configure the Bluetooth device PIN. That will help in +After configuration, we have to configure the Bluetooth device PIN. That will help in pairing this device with another one.

@@ -298,9 +374,65 @@ kdebluetooth. You can also use passkey-agent (found in bluez-utils) from the command line. + +
+ +
+PIN Pairing (<c>=bluez-4</c>, with <c>simple-agent</c>) + +

+In =bluez-4, there is no global PIN — when a device is paired you +need some bluetooth utility to input a PIN. One such utility +is simple-agent, part of bluez testing utilities (when built +with USE="test-programs"). +

+ +

+Before pairing, you must know the bluetooth adapter id +(run /usr/sbin/hciconfig, if you have several adapters, you need to +choose which one you want to pair. +

+ +

+ +You also need the MAC address of the device you want to pair with the +adapter. Some devices have this written in some label, others don't. To find it +out, make the device visible and run hcitool scan — the result is a +list of devices, with their friendly names and MAC addresses. +

+ +
+  Find the MAC address:
+$ hcitool scan
+Scanning ...
+	05:04:03:02:01:00	friendly-name
+
+  Find the adapter ID:
+$ /usr/sbin/hciconfig
+hci0:   Type: USB
+        BD Address: 00:01:02:03:04:05 ACL MTU: 192:8  SCO MTU: 64:8
+        UP RUNNING PSCAN
+        RX bytes:131 acl:0 sco:0 events:18 errors:0
+        TX bytes:565 acl:0 sco:0 commands:17 errors:0
+
+  And then pair the device
+$ simple-agent hci0 05:04:03:02:01:00
+RequestPinCode (/org/bluez/..../hci0/dev_05_04_03_02_01_00)
+Enter PIN Code: 1234
+  (Now the remote device will ask you for this same PIN.)
+Release
+New device (/org/bluez/..../hci0/dev_05_04_03_02_01_00)
+
+

+Other bluetooth packages might be able to handle pairing. This involves a tool +which initiates pairing or a tool which listens for pairing requests, or both. + +

+
Services configuration