| 1 |
fox2mike |
1.1 |
<?xml version='1.0' encoding="UTF-8"?> |
| 2 |
|
|
<!DOCTYPE guide SYSTEM "/dtd/guide.dtd"> |
| 3 |
nightmorph |
1.16 |
<!-- $Header: /var/cvsroot/gentoo/xml/htdocs/doc/en/bluetooth-guide.xml,v 1.15 2007/10/22 05:28:14 nightmorph Exp $ --> |
| 4 |
fox2mike |
1.1 |
|
| 5 |
|
|
<guide link="/doc/en/bluetooth-guide.xml"> |
| 6 |
|
|
<title>Gentoo Linux Bluetooth Guide</title> |
| 7 |
|
|
|
| 8 |
|
|
<author title="Author"> |
| 9 |
|
|
<mail link="deathwing00@gentoo.org">Ioannis Aslanidis</mail> |
| 10 |
|
|
</author> |
| 11 |
|
|
<author title="Contributor"> |
| 12 |
|
|
<mail link="puggy@gentoo.org">Douglas Russell</mail> |
| 13 |
|
|
</author> |
| 14 |
|
|
<author title="Contributor"> |
| 15 |
|
|
<mail link="marcel@holtmann.org">Marcel Holtmann</mail> |
| 16 |
|
|
</author> |
| 17 |
neysx |
1.3 |
<author title="Author"> |
| 18 |
fox2mike |
1.1 |
<mail link="fox2mike@gentoo.org">Shyam Mani</mail> |
| 19 |
|
|
</author> |
| 20 |
|
|
<author title="Editor"> |
| 21 |
|
|
<mail link="rane@gentoo.org">Ćukasz Damentko</mail> |
| 22 |
|
|
</author> |
| 23 |
nightmorph |
1.16 |
<author title="Editor"> |
| 24 |
|
|
<mail link="nightmorph"/> |
| 25 |
|
|
</author> |
| 26 |
fox2mike |
1.1 |
|
| 27 |
|
|
<abstract> |
| 28 |
|
|
This guide will explain how to successfully install a host Bluetooth device, |
| 29 |
|
|
configure the kernel properly, explain all the possibilities that the Bluetooth |
| 30 |
neysx |
1.3 |
interconnection offers and how to have some fun with Bluetooth. |
| 31 |
fox2mike |
1.1 |
</abstract> |
| 32 |
|
|
|
| 33 |
|
|
<!-- The content of this document is licensed under the CC-BY-SA license --> |
| 34 |
|
|
<!-- See http://creativecommons.org/licenses/by-sa/2.5 --> |
| 35 |
|
|
<license/> |
| 36 |
|
|
|
| 37 |
nightmorph |
1.16 |
<version>1.11</version> |
| 38 |
|
|
<date>2009-07-16</date> |
| 39 |
fox2mike |
1.1 |
|
| 40 |
|
|
<chapter id="introduction"> |
| 41 |
|
|
<title>Introduction</title> |
| 42 |
|
|
<section> |
| 43 |
|
|
<title>What is Bluetooth?</title> |
| 44 |
|
|
<body> |
| 45 |
|
|
|
| 46 |
|
|
<p> |
| 47 |
|
|
Bluetooth is an industrial specification that provides users a way to connect |
| 48 |
|
|
and exchange information between devices like personal computers, PDAs or |
| 49 |
|
|
mobile phones. Using the Bluetooth technology, users can achieve wireless voice |
| 50 |
|
|
and data transmission between devices at a low cost. Bluetooth also offers the |
| 51 |
|
|
possibility to create small wireless LANs and to synchronize devices. |
| 52 |
|
|
</p> |
| 53 |
|
|
|
| 54 |
|
|
</body> |
| 55 |
|
|
</section> |
| 56 |
|
|
<section> |
| 57 |
|
|
<title>About the content of this guide</title> |
| 58 |
|
|
<body> |
| 59 |
|
|
|
| 60 |
|
|
<p> |
| 61 |
nightmorph |
1.16 |
The first part of this guide explains how to configure the system kernel, |
| 62 |
|
|
identify the Bluetooth devices installed on the system and detected by the |
| 63 |
|
|
kernel and install the necessary basic Bluetooth tools. |
| 64 |
fox2mike |
1.1 |
</p> |
| 65 |
|
|
|
| 66 |
|
|
<p> |
| 67 |
|
|
The second part covers how to detect remote devices and how to establish a |
| 68 |
|
|
connection from or to them by either setting up radio frequency communication |
| 69 |
nightmorph |
1.16 |
(RFCOMM)<!-- or by setting up a personal area network (PAN)-->. |
| 70 |
fox2mike |
1.1 |
</p> |
| 71 |
|
|
|
| 72 |
|
|
<p> |
| 73 |
|
|
The last part of the guide lists in detail applications that can take |
| 74 |
|
|
advantage of all the possibilities offered by the Bluetooth technology. |
| 75 |
|
|
</p> |
| 76 |
|
|
|
| 77 |
|
|
</body> |
| 78 |
|
|
</section> |
| 79 |
|
|
</chapter> |
| 80 |
|
|
|
| 81 |
|
|
<chapter id="kernel"> |
| 82 |
|
|
<title>Configuring the system</title> |
| 83 |
|
|
<section> |
| 84 |
|
|
<title>Kernel Configuration</title> |
| 85 |
|
|
<body> |
| 86 |
|
|
|
| 87 |
|
|
<p> |
| 88 |
|
|
As the latest Linux stable kernel is 2.6, the configuration will be done for |
| 89 |
|
|
these series of the kernel. Most Bluetooth devices are connected to a USB port, |
| 90 |
nightmorph |
1.12 |
so USB will be enabled too. Please refer to the <uri |
| 91 |
nightmorph |
1.16 |
link="/doc/en/usb-guide.xml">Gentoo Linux USB Guide</uri>. |
| 92 |
fox2mike |
1.1 |
</p> |
| 93 |
|
|
|
| 94 |
|
|
<pre caption="Configuration for 2.6 kernels"> |
| 95 |
swift |
1.5 |
Networking ---> |
| 96 |
fox2mike |
1.1 |
|
| 97 |
|
|
<*> Bluetooth subsystem support ---> |
| 98 |
|
|
|
| 99 |
|
|
--- Bluetooth subsystem support |
| 100 |
|
|
<M> L2CAP protocol support |
| 101 |
|
|
<M> SCO links support |
| 102 |
|
|
<M> RFCOMM protocol support |
| 103 |
|
|
[*] RFCOMM TTY support |
| 104 |
|
|
<M> BNEP protocol support |
| 105 |
|
|
[*] Multicast filter support |
| 106 |
|
|
[*] Protocol filter support |
| 107 |
|
|
<M> HIDP protocol support |
| 108 |
|
|
|
| 109 |
|
|
Bluetooth device drivers ---> |
| 110 |
|
|
<M> HCI USB driver |
| 111 |
|
|
[*] SCO (voice) support |
| 112 |
|
|
<M> HCI UART driver |
| 113 |
|
|
[*] UART (H4) protocol support |
| 114 |
|
|
[*] BCSP protocol support |
| 115 |
|
|
[*] Transmit CRC with every BCSP packet |
| 116 |
|
|
<M> HCI BCM203x USB driver |
| 117 |
|
|
<M> HCI BPA10x USB driver |
| 118 |
|
|
<M> HCI BlueFRITZ! USB driver |
| 119 |
|
|
<comment>(The four drivers below are for PCMCIA Bluetooth devices and will only |
| 120 |
|
|
show up if you have also selected PCMCIA support in your kernel.)</comment> |
| 121 |
|
|
<M> HCI DTL1 (PC Card) driver |
| 122 |
|
|
<M> HCI BT3C (PC Card) driver |
| 123 |
|
|
<M> HCI BlueCard (PC Card) driver |
| 124 |
neysx |
1.3 |
<M> HCI UART (PC Card) device driver |
| 125 |
fox2mike |
1.1 |
<comment>(The driver below is intended for HCI Emulation software.)</comment> |
| 126 |
|
|
<M> HCI VHCI (Virtual HCI device) driver |
| 127 |
|
|
|
| 128 |
|
|
<comment>(Move back three levels to Device Drives and then check if USB is |
| 129 |
|
|
enabled. This is required if you use a Bluetooth dongle, which are mostly USB |
| 130 |
|
|
based.)</comment> |
| 131 |
|
|
USB support ---> |
| 132 |
|
|
|
| 133 |
|
|
<*> Support for Host-side USB |
| 134 |
|
|
--- USB Host Controller Drivers |
| 135 |
|
|
<M> EHCI HCD (USB 2.0) support |
| 136 |
|
|
[ ] Full speed ISO transactions (EXPERIMENTAL) |
| 137 |
|
|
[ ] Root Hub Transaction Translators (EXPERIMENTAL) |
| 138 |
|
|
<*> OHCI HCD support |
| 139 |
|
|
<*> UHCI HCD (most Intel and VIA) support |
| 140 |
|
|
< > SL811HS HCD support |
| 141 |
|
|
</pre> |
| 142 |
|
|
|
| 143 |
|
|
<p> |
| 144 |
|
|
Now we'll reboot with our new kernel. If everything went fine, we will have a |
| 145 |
|
|
system that is Bluetooth ready. |
| 146 |
|
|
</p> |
| 147 |
|
|
|
| 148 |
|
|
<impo> |
| 149 |
|
|
Your USB device may have two modes the default of which may not be HCI, but HID. |
| 150 |
|
|
If this is your case, use <c>hid2hci</c> to switch to HCI mode. Your system |
| 151 |
|
|
will not remember this change when you next reboot. |
| 152 |
|
|
</impo> |
| 153 |
|
|
|
| 154 |
|
|
<pre caption="Checking the Bluetooth devices"> |
| 155 |
|
|
<comment>(One way to check for the device)</comment> |
| 156 |
|
|
# <i>cat /proc/bus/usb/devices | grep -e^[TPD] | grep -e Cls=e0 -B1 -A1</i> |
| 157 |
|
|
<comment>(The Cls=e0(unk. ) identifies the Bluetooth adapter.)</comment> |
| 158 |
|
|
T: Bus=02 Lev=02 Prnt=03 Port=00 Cnt=01 Dev#= 4 Spd=12 MxCh= 0 |
| 159 |
|
|
D: Ver= 1.10 Cls=e0(unk. ) Sub=01 Prot=01 MxPS=64 #Cfgs= 1 |
| 160 |
neysx |
1.3 |
P: Vendor=0a12 ProdID=0001 Rev= 5.25 |
| 161 |
fox2mike |
1.1 |
<comment>(Some might show up on lsusb from sys-apps/usbutils)</comment> |
| 162 |
|
|
# <i>lsusb</i> |
| 163 |
|
|
Bus 003 Device 002: ID 046d:c00e Logitech, Inc. Optical Mouse |
| 164 |
|
|
Bus 003 Device 001: ID 0000:0000 |
| 165 |
|
|
Bus 002 Device 002: ID 0db0:1967 Micro Star International Bluetooth Dongle |
| 166 |
|
|
</pre> |
| 167 |
|
|
|
| 168 |
|
|
</body> |
| 169 |
|
|
</section> |
| 170 |
|
|
</chapter> |
| 171 |
|
|
|
| 172 |
|
|
<chapter id="bluez"> |
| 173 |
|
|
<title>BlueZ - The Bluetooth Stack</title> |
| 174 |
|
|
<section> |
| 175 |
|
|
<title>Installing BlueZ</title> |
| 176 |
|
|
<body> |
| 177 |
|
|
|
| 178 |
|
|
<p> |
| 179 |
|
|
Now that the device is detected by the kernel, we need a layer that lets |
| 180 |
|
|
applications communicate with the Bluetooth device. BlueZ provides the official |
| 181 |
|
|
Linux Bluetooth stack. The ebuilds that provide what we need are |
| 182 |
|
|
<c>bluez-libs</c> and <c>bluez-utils</c>. Devices that need Broadcom firmware |
| 183 |
|
|
files or the like may need <c>bluez-firmware</c>. |
| 184 |
|
|
</p> |
| 185 |
|
|
|
| 186 |
|
|
<pre caption="Installing bluez-libs and bluez-utils"> |
| 187 |
|
|
# <i>emerge net-wireless/bluez-libs net-wireless/bluez-utils</i> |
| 188 |
|
|
</pre> |
| 189 |
|
|
|
| 190 |
|
|
</body> |
| 191 |
|
|
</section> |
| 192 |
|
|
<section> |
| 193 |
|
|
<title>BlueZ configuration and PIN pairing</title> |
| 194 |
|
|
<body> |
| 195 |
|
|
|
| 196 |
|
|
<p> |
| 197 |
|
|
Now it's time to see if the Bluetooth device is being picked up correctly by the |
| 198 |
|
|
system. We start up the required Bluetooth services first. |
| 199 |
|
|
</p> |
| 200 |
|
|
|
| 201 |
|
|
<pre caption="Running hciconfig"> |
| 202 |
|
|
<comment>(Start up Bluetooth)</comment> |
| 203 |
|
|
# <i>/etc/init.d/bluetooth start</i> |
| 204 |
|
|
* Starting Bluetooth ... |
| 205 |
|
|
* Starting hcid ... [ ok ] |
| 206 |
|
|
* Starting sdpd ... [ ok ] |
| 207 |
|
|
* Starting rfcomm ... [ ok ] |
| 208 |
|
|
|
| 209 |
|
|
# <i>hciconfig</i> |
| 210 |
|
|
hci0: Type: USB |
| 211 |
|
|
BD Address: 00:01:02:03:04:05 ACL MTU: 192:8 SCO MTU: 64:8 |
| 212 |
|
|
DOWN |
| 213 |
|
|
RX bytes:131 acl:0 sco:0 events:18 errors:0 |
| 214 |
neysx |
1.3 |
TX bytes:565 acl:0 sco:0 commands:17 errors:0 |
| 215 |
fox2mike |
1.1 |
</pre> |
| 216 |
|
|
|
| 217 |
|
|
<p> |
| 218 |
|
|
This shows that the Bluetooth device has been recognised. As you might have |
| 219 |
|
|
noticed the device is <e>DOWN</e>. Let's configure it so that we can bring it |
| 220 |
|
|
up. The configuration file is at <path>/etc/bluetooth/hcid.conf</path>. The |
| 221 |
|
|
required changes to the config file are shown below. For additional details |
| 222 |
|
|
please refer to <c>man hcid.conf</c>. |
| 223 |
|
|
</p> |
| 224 |
|
|
|
| 225 |
|
|
<pre caption="Editing /etc/bluetooth/hcid.conf"> |
| 226 |
|
|
<comment>(Recommended changes to be made to the file are shown)</comment> |
| 227 |
|
|
|
| 228 |
neysx |
1.6 |
# HCId options |
| 229 |
|
|
options { |
| 230 |
|
|
# Automatically initialize new devices |
| 231 |
|
|
autoinit yes; |
| 232 |
|
|
|
| 233 |
fox2mike |
1.1 |
<comment>(Change security to "auto")</comment> |
| 234 |
|
|
# Security Manager mode |
| 235 |
|
|
# none - Security manager disabled |
| 236 |
|
|
# auto - Use local PIN for incoming connections |
| 237 |
|
|
# user - Always ask user for a PIN |
| 238 |
|
|
# |
| 239 |
|
|
security auto; |
| 240 |
|
|
|
| 241 |
neysx |
1.6 |
# Pairing mode |
| 242 |
|
|
pairing multi; |
| 243 |
|
|
|
| 244 |
nightmorph |
1.13 |
<comment>(You only need a pin helper if you are using <=bluez-libs-2.x and <=bluez-utils-2.x) |
| 245 |
|
|
(Change pin_helper to use /etc/bluetooth/pin-helper)</comment> |
| 246 |
fox2mike |
1.1 |
# PIN helper |
| 247 |
|
|
pin_helper /etc/bluetooth/pin-helper; |
| 248 |
neysx |
1.6 |
} |
| 249 |
fox2mike |
1.1 |
|
| 250 |
neysx |
1.6 |
# Default settings for HCI devices |
| 251 |
|
|
device { |
| 252 |
fox2mike |
1.1 |
<comment>(Set your device name here, you can call it anything you want)</comment> |
| 253 |
|
|
# Local device name |
| 254 |
|
|
# %d - device id |
| 255 |
|
|
# %h - host name |
| 256 |
|
|
name "BlueZ at %h (%d)"; |
| 257 |
|
|
|
| 258 |
neysx |
1.6 |
# Local device class |
| 259 |
|
|
class 0x3e0100; |
| 260 |
|
|
|
| 261 |
|
|
# Inquiry and Page scan |
| 262 |
|
|
iscan enable; pscan enable; |
| 263 |
|
|
|
| 264 |
|
|
# Default link mode |
| 265 |
|
|
lm accept; |
| 266 |
|
|
|
| 267 |
|
|
# Default link policy |
| 268 |
|
|
lp rswitch,hold,sniff,park; |
| 269 |
|
|
|
| 270 |
fox2mike |
1.1 |
<comment>(Leave as is, if you don't know what exactly these do)</comment> |
| 271 |
|
|
# Authentication and Encryption (Security Mode 3) |
| 272 |
|
|
#auth enable; |
| 273 |
|
|
#encrypt enable; |
| 274 |
|
|
} |
| 275 |
|
|
</pre> |
| 276 |
|
|
|
| 277 |
|
|
<p> |
| 278 |
|
|
After that, we have to configure the Bluetooth device PIN. That will help in |
| 279 |
|
|
pairing this device with another one. |
| 280 |
|
|
</p> |
| 281 |
|
|
|
| 282 |
|
|
<pre caption="Editing /etc/bluetooth/pin"> |
| 283 |
nightmorph |
1.13 |
<comment>(Replace 123456 with your desired pin number.)</comment> |
| 284 |
fox2mike |
1.1 |
123456 |
| 285 |
|
|
</pre> |
| 286 |
|
|
|
| 287 |
|
|
<impo> |
| 288 |
|
|
This number (of your choice) must be the same in all your hosts with Bluetooth |
| 289 |
|
|
devices so they can be paired. This number must also be kept secret since anyone |
| 290 |
|
|
with knowledge of this number can essentially establish connections with your |
| 291 |
|
|
devices. |
| 292 |
|
|
</impo> |
| 293 |
|
|
|
| 294 |
nightmorph |
1.13 |
<note> |
| 295 |
|
|
Beginning with <c>>=bluez-libs-3.x</c> and <c>>=bluez-utils-3.x</c>, pin helpers |
| 296 |
|
|
have been replaced by passkey agents. There are a few different graphical |
| 297 |
|
|
passkey agents available to help manage your PIN, such as <c>bluez-gnome</c> and |
| 298 |
|
|
<c>kdebluetooth</c>. You can also use <c>passkey-agent</c> (found in |
| 299 |
|
|
<c>bluez-utils</c>) from the command line. |
| 300 |
|
|
</note> |
| 301 |
|
|
|
| 302 |
fox2mike |
1.1 |
</body> |
| 303 |
|
|
</section> |
| 304 |
|
|
<section> |
| 305 |
|
|
<title>Services configuration</title> |
| 306 |
|
|
<body> |
| 307 |
|
|
|
| 308 |
|
|
<p> |
| 309 |
|
|
Now that we have concluded with the configuration of BlueZ, it's time to restart |
| 310 |
|
|
the necessary services. |
| 311 |
|
|
</p> |
| 312 |
|
|
|
| 313 |
|
|
<pre caption="Starting the Bluetooth daemons"> |
| 314 |
|
|
# <i>/etc/init.d/bluetooth restart</i> |
| 315 |
|
|
<comment>(We can also add it to the default runlevel.)</comment> |
| 316 |
|
|
# <i>rc-update add bluetooth default</i> |
| 317 |
|
|
* bluetooth added to runlevel default |
| 318 |
|
|
* rc-update complete. |
| 319 |
|
|
</pre> |
| 320 |
|
|
|
| 321 |
|
|
<p> |
| 322 |
|
|
Let's be sure that the Bluetooth daemons started correctly. If we can see that |
| 323 |
|
|
both <c>hcid</c> and <c>sdpd</c> are running, then we configured Bluetooth the |
| 324 |
yoswink |
1.4 |
right way. After that, we can see if the devices are now up and running with |
| 325 |
fox2mike |
1.1 |
the configured options. |
| 326 |
|
|
</p> |
| 327 |
|
|
|
| 328 |
swift |
1.2 |
<pre caption="Checking whether Bluetooth daemons started correctly"> |
| 329 |
fox2mike |
1.1 |
<comment>(Check to see if the services are running)</comment> |
| 330 |
|
|
# <i>ps -ae | grep hcid</i> |
| 331 |
|
|
26050 ? 00:00:00 hcid |
| 332 |
|
|
# <i>ps -ae | grep sdpd</i> |
| 333 |
|
|
26054 ? 00:00:00 sdpd |
| 334 |
|
|
|
| 335 |
|
|
# <i>hciconfig -a</i> |
| 336 |
|
|
hci0: Type: USB |
| 337 |
|
|
BD Address: 00:0A:0B:0C:0D:0E ACL MTU: 192:8 SCO MTU: 64:8 |
| 338 |
neysx |
1.6 |
UP RUNNING PSCAN ISCAN |
| 339 |
fox2mike |
1.1 |
RX bytes:125 acl:0 sco:0 events:17 errors:0 |
| 340 |
|
|
TX bytes:565 acl:0 sco:0 commands:17 errors:0 |
| 341 |
|
|
Features: 0xff 0xff 0x0f 0x00 0x00 0x00 0x00 0x00 |
| 342 |
|
|
Packet type: DM1 DM3 DM5 DH1 DH3 DH5 HV1 HV2 HV3 |
| 343 |
|
|
Link policy: RSWITCH HOLD SNIFF PARK |
| 344 |
|
|
Link mode: SLAVE ACCEPT |
| 345 |
|
|
Name: 'BlueZ at bluehat (0)' |
| 346 |
|
|
Class: 0x3e0100 |
| 347 |
|
|
Service Classes: Networking, Rendering, Capturing, Object Transfer, |
| 348 |
|
|
Audio |
| 349 |
|
|
Device Class: Computer, Uncategorized |
| 350 |
|
|
HCI Ver: 1.1 (0x1) HCI Rev: 0x1e7 LMP Ver: 1.1 (0x1) LMP Subver: 0x1e7 |
| 351 |
|
|
Manufacturer: Cambridge Silicon Radio (10) |
| 352 |
|
|
</pre> |
| 353 |
|
|
|
| 354 |
|
|
</body> |
| 355 |
|
|
</section> |
| 356 |
|
|
</chapter> |
| 357 |
|
|
|
| 358 |
|
|
<chapter id="detect"> |
| 359 |
|
|
<title>Detecting and Connecting to Remote Devices</title> |
| 360 |
|
|
<section> |
| 361 |
|
|
<title>Detecting Bluetooth devices in other hosts</title> |
| 362 |
|
|
<body> |
| 363 |
|
|
|
| 364 |
|
|
<p> |
| 365 |
|
|
At this point we are now ready to detect Bluetooth devices installed in other |
| 366 |
|
|
machines. This is independent of the host Operating System. We will make use of |
| 367 |
|
|
the <c>hcitool</c> command for the same. |
| 368 |
|
|
</p> |
| 369 |
|
|
|
| 370 |
|
|
<pre caption="Checking for local devices"> |
| 371 |
|
|
# <i>hcitool dev</i> |
| 372 |
|
|
Devices: |
| 373 |
|
|
hci0 00:01:02:03:04:05 |
| 374 |
|
|
</pre> |
| 375 |
|
|
|
| 376 |
|
|
<pre caption="Scanning for remote devices"> |
| 377 |
|
|
# <i>hcitool scan</i> |
| 378 |
|
|
Scanning ... |
| 379 |
neysx |
1.3 |
00:0A:0B:0C:0D:0E Grayhat |
| 380 |
fox2mike |
1.1 |
</pre> |
| 381 |
|
|
|
| 382 |
|
|
<pre caption="Inquiring remote devices"> |
| 383 |
|
|
# <i>hcitool inq</i> |
| 384 |
|
|
Inquiring ... |
| 385 |
neysx |
1.3 |
00:0A:0B:0C:0D:0E clock offset: 0x5579 class: 0x72010c |
| 386 |
fox2mike |
1.1 |
</pre> |
| 387 |
|
|
|
| 388 |
|
|
<p> |
| 389 |
yoswink |
1.4 |
Now that we know the MAC address of the remote Bluetooth devices, we can check |
| 390 |
fox2mike |
1.1 |
if we paired them correctly. |
| 391 |
|
|
</p> |
| 392 |
|
|
|
| 393 |
|
|
<pre caption="Running l2ping"> |
| 394 |
|
|
# <i>l2ping 00:0A:0B:0C:0D:0E</i> |
| 395 |
|
|
Ping: 00:0A:0B:0C:0D:0E from 00:01:02:03:04:05 (data size 20) ... |
| 396 |
|
|
20 bytes from 00:0A:0B:0C:0D:0E id 200 time 69.85ms |
| 397 |
|
|
20 bytes from 00:0A:0B:0C:0D:0E id 201 time 9.97ms |
| 398 |
|
|
20 bytes from 00:0A:0B:0C:0D:0E id 202 time 56.86ms |
| 399 |
|
|
20 bytes from 00:0A:0B:0C:0D:0E id 203 time 39.92ms |
| 400 |
neysx |
1.3 |
4 sent, 4 received, 0% loss |
| 401 |
fox2mike |
1.1 |
</pre> |
| 402 |
|
|
|
| 403 |
|
|
</body> |
| 404 |
|
|
</section> |
| 405 |
|
|
<section> |
| 406 |
|
|
<title>Setting up Radio Frequency Communication (RFCOMM)</title> |
| 407 |
|
|
<body> |
| 408 |
|
|
|
| 409 |
|
|
<note> |
| 410 |
|
|
Please note that setting up radio frequency communication is optional. |
| 411 |
|
|
</note> |
| 412 |
|
|
|
| 413 |
|
|
<p> |
| 414 |
|
|
We can establish a radio frequency connection to another Bluetooth device using |
| 415 |
|
|
the <c>rfcomm</c> command. To make things a little easier especially for users |
| 416 |
|
|
with multiple devices that support Bluetooth, it is advisable to make a few |
| 417 |
|
|
changes to the default rfcomm config at <path>/etc/bluetooth/rfcomm.conf</path>. |
| 418 |
|
|
</p> |
| 419 |
|
|
|
| 420 |
|
|
<p> |
| 421 |
|
|
The whole segment of the config starting from <c>rfcomm0 {</c> and ending with |
| 422 |
|
|
<c>}</c> is the config for the device that will establish a connection at |
| 423 |
|
|
<path>/dev/rfcomm0</path>. In this case, we will only show one example, rfcomm0. |
| 424 |
|
|
You can add more devices as you see fit. |
| 425 |
|
|
</p> |
| 426 |
|
|
|
| 427 |
|
|
<pre caption="Editing /etc/bluetooth/rfcomm.conf"> |
| 428 |
|
|
<comment>(Only changes that might be needed are shown)</comment> |
| 429 |
|
|
rfcomm0 { |
| 430 |
|
|
# Automatically bind the device at startup |
| 431 |
|
|
<comment>(Creates the device node, /dev/rfcomm0 at start up)</comment> |
| 432 |
|
|
bind yes; |
| 433 |
|
|
|
| 434 |
|
|
# Bluetooth address of the device |
| 435 |
|
|
<comment>(Enter the address of the device you want to connect to)</comment> |
| 436 |
|
|
device 00:0A:0B:0C:0D:0E; |
| 437 |
|
|
|
| 438 |
neysx |
1.3 |
} |
| 439 |
fox2mike |
1.1 |
</pre> |
| 440 |
|
|
|
| 441 |
|
|
<p> |
| 442 |
|
|
After configuring RFCOMM, we can connect to any device. Since we've made the |
| 443 |
|
|
required settings to the <path>/etc/bluetooth/rfcomm.conf</path> file, we just |
| 444 |
|
|
issue the command shown below. In case you've not made changes to the config |
| 445 |
|
|
file, an alternative method is also shown in the code listing that follows |
| 446 |
|
|
</p> |
| 447 |
|
|
|
| 448 |
|
|
<pre caption="Establishing an RFCOMM connection"> |
| 449 |
|
|
<comment>(The 0 refers to the rfcomm0 in the config file)</comment> |
| 450 |
|
|
# <i>rfcomm connect 0 </i> |
| 451 |
|
|
Connected /dev/rfcomm0 to 00:0A:0B:0C:0D:0E on channel 1 |
| 452 |
|
|
Press CTRL-C for hangup |
| 453 |
|
|
|
| 454 |
|
|
<comment>(If you did not edit /etc/bluetooth/rfcomm.conf)</comment> |
| 455 |
|
|
# <i>rfcomm connect 0 00:0A:0B:0C:0D:0E 1</i> |
| 456 |
|
|
Connected /dev/rfcomm0 to 00:0F:DE:69:50:24 on channel 1 |
| 457 |
|
|
Press CTRL-C for hangup |
| 458 |
|
|
</pre> |
| 459 |
|
|
|
| 460 |
|
|
<p> |
| 461 |
|
|
The first parameter after the connect command is the RFCOMM TTY device node |
| 462 |
|
|
that will be used (usually 0). The second parameter is the MAC address of the |
| 463 |
|
|
remote device. The third parameter is optional and specifies the channel to be |
| 464 |
|
|
used. Please, note that in order to connect to a device, that device must be |
| 465 |
|
|
listening for incoming connections. To do that, we have to explicitly tell it |
| 466 |
|
|
to listen. We can cancel the communication at any moment by just hitting |
| 467 |
|
|
CTRL+C. |
| 468 |
|
|
</p> |
| 469 |
|
|
|
| 470 |
|
|
<pre caption="Listening for incoming RFCOMM connections"> |
| 471 |
|
|
# <i>rfcomm listen 0 1</i> |
| 472 |
neysx |
1.3 |
Waiting for connection on channel 1 |
| 473 |
fox2mike |
1.1 |
</pre> |
| 474 |
|
|
|
| 475 |
|
|
<p> |
| 476 |
|
|
In a similar way to the connect command, the listen command can receive two |
| 477 |
|
|
parameters. The first one explicits the RFCOMM TTY device node (usually 0) that |
| 478 |
|
|
will be used to accept a connection, while the second is the channel that will |
| 479 |
neysx |
1.3 |
be used. |
| 480 |
fox2mike |
1.1 |
</p> |
| 481 |
|
|
|
| 482 |
|
|
<p> |
| 483 |
|
|
Each time you call the <c>rfcomm</c> command, you can also specify the physical |
| 484 |
|
|
device you want to use. Below you can see a small example specifiying the |
| 485 |
|
|
physical device on the above two commands. |
| 486 |
|
|
</p> |
| 487 |
|
|
|
| 488 |
|
|
<pre caption="RFCOMM connections specifying physical device"> |
| 489 |
|
|
# <i>rfcomm -i hci0 listen 0 1</i> |
| 490 |
|
|
Waiting for connection on channel 1 |
| 491 |
|
|
<comment>(To listen to a determined device) </comment> |
| 492 |
|
|
# <i>rfcomm -i hci0 connect 0 00:0A:0B:0C:0D:0E 1</i> |
| 493 |
|
|
<comment>(To use a determined device when connecting to another one)</comment> |
| 494 |
|
|
</pre> |
| 495 |
|
|
|
| 496 |
|
|
</body> |
| 497 |
|
|
</section> |
| 498 |
nightmorph |
1.16 |
<!-- Deleting pan chapter, bug 266690, until we know how the hell to do this --> |
| 499 |
fox2mike |
1.1 |
</chapter> |
| 500 |
|
|
|
| 501 |
|
|
<chapter id="apps"> |
| 502 |
|
|
<title>Desktop Applications for Bluetooth</title> |
| 503 |
|
|
<section> |
| 504 |
|
|
<title>Introduction</title> |
| 505 |
|
|
<body> |
| 506 |
|
|
|
| 507 |
|
|
<p> |
| 508 |
|
|
We have quite a few Bluetooth applications that run on the desktop and this |
| 509 |
|
|
chapter has been divided into 3 parts, one each for Gnome, KDE and Miscellaneous |
| 510 |
|
|
applications. |
| 511 |
|
|
</p> |
| 512 |
|
|
|
| 513 |
|
|
</body> |
| 514 |
|
|
</section> |
| 515 |
|
|
<section> |
| 516 |
|
|
<title>For Gnome</title> |
| 517 |
|
|
<body> |
| 518 |
|
|
|
| 519 |
|
|
<p> |
| 520 |
|
|
If you are a gnome user, you will most probably go with <c>gnome-bluetooth</c>. |
| 521 |
|
|
It provides the most basic yet most used functionalities, as you can see below. |
| 522 |
|
|
</p> |
| 523 |
|
|
|
| 524 |
|
|
<ul> |
| 525 |
|
|
<li><c>gnome-bluetooth-manager</c>: To manage Bluetooth remote devices.</li> |
| 526 |
|
|
<li><c>gnome-obex-send</c>: To send files to other devices.</li> |
| 527 |
|
|
<li><c>gnome-obex-server</c>: To receive files.</li> |
| 528 |
|
|
</ul> |
| 529 |
|
|
|
| 530 |
|
|
<pre caption="Installing gnome-bluetooth"> |
| 531 |
|
|
# <i>emerge gnome-bluetooth</i> |
| 532 |
|
|
</pre> |
| 533 |
|
|
|
| 534 |
|
|
<p> |
| 535 |
|
|
This adds menu entries under Applications > System Tools from where you can |
| 536 |
|
|
easily start up the manager or File sharing to transfer files between devices. |
| 537 |
|
|
</p> |
| 538 |
|
|
|
| 539 |
|
|
<p> |
| 540 |
neysx |
1.3 |
To transfer files (the easy way): |
| 541 |
fox2mike |
1.1 |
</p> |
| 542 |
|
|
|
| 543 |
|
|
<ul> |
| 544 |
|
|
<li> |
| 545 |
|
|
From the Phone to the Computer - Send the file from the phone via Bluetooth |
| 546 |
|
|
and it will be picked up and saved to your <path>/home</path> always. |
| 547 |
|
|
</li> |
| 548 |
|
|
<!--FIXME : Doesn't work on Nautilus 2.10.x. Bug #103464 for details --> |
| 549 |
|
|
<!-- |
| 550 |
|
|
<li> |
| 551 |
|
|
From the Computer to the Phone - Fire up <c>nautilus</c> and select the |
| 552 |
|
|
file you want to send and right click on it. Select the Send via Bluetooth |
| 553 |
|
|
option and ask your phone to accept the file. |
| 554 |
|
|
</li> |
| 555 |
|
|
--> |
| 556 |
|
|
</ul> |
| 557 |
|
|
|
| 558 |
|
|
<p> |
| 559 |
|
|
<c>gnome-phone-manager</c> is a nifty app that you can use to send and receive |
| 560 |
|
|
messages to and from your phone, using only your system. You do not have to |
| 561 |
|
|
touch your phone to read or send messages since all that happens through the |
| 562 |
|
|
application. You are also notified of a new message on your screen if the option |
| 563 |
|
|
is enabled under Preferences. Installation is a breeze as always. |
| 564 |
|
|
</p> |
| 565 |
|
|
|
| 566 |
|
|
<pre caption="Installing gnome-phone-manager"> |
| 567 |
|
|
# <i>emerge gnome-phone-manager</i> |
| 568 |
|
|
</pre> |
| 569 |
|
|
|
| 570 |
|
|
</body> |
| 571 |
|
|
</section> |
| 572 |
|
|
<section> |
| 573 |
|
|
<title>For KDE</title> |
| 574 |
|
|
<body> |
| 575 |
|
|
|
| 576 |
|
|
<p> |
| 577 |
|
|
KDE makes use of <c>kdebluetooth</c> and provides more utilities than its Gnome |
| 578 |
|
|
counterpart as seen below. |
| 579 |
|
|
</p> |
| 580 |
|
|
|
| 581 |
|
|
<ul> |
| 582 |
|
|
<li><c>kbluetoothd</c>: Bluetooth Meta Server.</li> |
| 583 |
|
|
<li><c>kbtsearch</c>: Bluetooth device/service search utility.</li> |
| 584 |
|
|
<li><c>khciconfig</c>: KDE Bluetooth Monitor.</li> |
| 585 |
|
|
<li><c>kioclient</c>: KIO command line client.</li> |
| 586 |
|
|
<li><c>qobexclient</c>: Swiss army knife for obex testing/development.</li> |
| 587 |
|
|
<li><c>kbtobexclient</c>: A KDE Bluetooth Framework Application.</li> |
| 588 |
|
|
<li><c>kioobex_start</c></li> |
| 589 |
|
|
<li><c>kbtserialchat</c></li> |
| 590 |
|
|
<li><c>kbemusedsrv</c>: KDE Bemused Server.</li> |
| 591 |
|
|
<li><c>kbtobexsrv</c>: KDE OBEX Push Server for Bluetooth.</li> |
| 592 |
|
|
<li><c>kbluepin</c>: A KDE KPart Application.</li> |
| 593 |
|
|
<li> |
| 594 |
|
|
<c>auth-helper</c>: A helper program for kbtobexsrv that sends an |
| 595 |
|
|
authentication request for a given ACL link. |
| 596 |
|
|
</li> |
| 597 |
|
|
</ul> |
| 598 |
|
|
|
| 599 |
|
|
<pre caption="Installing kdebluetooth"> |
| 600 |
|
|
# <i>emerge kdebluetooth</i> |
| 601 |
|
|
</pre> |
| 602 |
|
|
|
| 603 |
|
|
</body> |
| 604 |
|
|
</section> |
| 605 |
|
|
<section> |
| 606 |
|
|
<title>Other Interesting Applications</title> |
| 607 |
|
|
<body> |
| 608 |
|
|
|
| 609 |
|
|
<ul> |
| 610 |
|
|
<li> |
| 611 |
|
|
<c>app-mobilephone/obexftp</c>: File transfer over OBEX for mobile phones |
| 612 |
|
|
</li> |
| 613 |
|
|
<li> |
| 614 |
|
|
<c>app-mobilephone/bemused</c>: Bemused is a system which allows you to |
| 615 |
|
|
control your music collection from your phone, using Bluetooth. |
| 616 |
|
|
</li> |
| 617 |
|
|
<li> |
| 618 |
|
|
<c>app-pda/multisync</c>: Multisync allows you to sync contacts, calendar |
| 619 |
|
|
entries and notes from your mobile phone with your computer, over a |
| 620 |
|
|
Bluetooth connection (amongst other things). It includes such features as |
| 621 |
|
|
backing up this information and restoring it later, and syncing with the |
| 622 |
|
|
Evolution e-mail client. You will need the <c>irmc</c> USE flag set to |
| 623 |
|
|
ensure that <c>multisync</c> has Bluetooth support. |
| 624 |
|
|
</li> |
| 625 |
nightmorph |
1.10 |
<li> |
| 626 |
|
|
<c>net-wireless/opd</c> and <c>net-wireless/ussp-push</c> are command line |
| 627 |
|
|
tools (server and client) that can be used to send files to your mobile |
| 628 |
|
|
phone. |
| 629 |
|
|
</li> |
| 630 |
fox2mike |
1.1 |
</ul> |
| 631 |
|
|
|
| 632 |
|
|
</body> |
| 633 |
|
|
</section> |
| 634 |
|
|
</chapter> |
| 635 |
|
|
|
| 636 |
|
|
<chapter> |
| 637 |
|
|
<title>Acknowledgements</title> |
| 638 |
|
|
<section> |
| 639 |
|
|
<body> |
| 640 |
|
|
|
| 641 |
|
|
<p> |
| 642 |
|
|
Special thanks to <mail link="marcel@holtmann.org">Marcel Holtmann</mail> |
| 643 |
|
|
for his time and dedication to the Bluetooth development and for reviewing this |
| 644 |
|
|
guide. And big thanks to <mail link="puggy@gentoo.org">Douglas Russell</mail> |
| 645 |
|
|
for performing additional hardware tests and improving this guide. |
| 646 |
|
|
</p> |
| 647 |
|
|
|
| 648 |
|
|
</body> |
| 649 |
|
|
</section> |
| 650 |
|
|
</chapter> |
| 651 |
|
|
</guide> |