Bluetooth Audio

Version 2 (mihanson, 03/03/2011 12:33 pm) → Version 3/4 (mihanson, 03/03/2011 12:33 pm)

h3. h1. Bluetooth Audio

You will need two things:
# Bluetooth dongle (i.e. USB type) or integrated Bluetooth on your system
# Bluetooth audio device (Speakers, headphones, etc.)

Plug in your Bluetooth dongle
Install _bluez_
<pre>$ pacman -Sy bluez</pre>
Ensure your dongle is showing _UP RUNNING_. _UP_
<pre>$ hciconfig -a

hci0: Type: BR/EDR Bus: USB
BD Address: 00:0A:94:02:9C:8C ACL MTU: 310:10 SCO MTU: 64:8
UP RUNNING PSCAN
RX bytes:1074400 acl:20 sco:0 events:153362 errors:0
TX bytes:88752435 acl:319268 sco:0 commands:25 errors:0
Features: 0xff 0xff 0x8f 0xfe 0x9b 0xf9 0x00 0x80
Packet type: DM1 DM3 DM5 DH1 DH3 DH5 HV1 HV2 HV3
Link policy: RSWITCH HOLD SNIFF PARK
Link mode: SLAVE ACCEPT
Name: 'zotac-0'
Class: 0x480104
Service Classes: Capturing, Telephony
Device Class: Computer, Desktop workstation
HCI Version: 1.1 (0x1) Revision: 0xc5c
LMP Version: 1.1 (0x1) Subversion: 0xc5c
Manufacturer: Cambridge Silicon Radio (10)</pre>
If not _UP_
<pre>$ hciconfig hci0 up</pre>
Place your Bluetooth audio device in pairing mode, then scan for it and make a note of the MAC address.
<pre>$ hcitool scan</pre>
Use bluez-simple-agent to pair your audio device to your dongle.
<pre>$ bluez-simple-agent hci0 <MAC Address></pre>
Enter your audio device's PIN number when prompted.
If you do not have an /etc/asound.conf, create one with the following information. If you already have that file, append the following to the end. Substitute the correct MAC Address.
<pre>#/etc/asound.conf

pcm.btheadset {
type plug
slave {
pcm {
type bluetooth
device <MAC Address>
profile "auto"
}
}

hint {
show on
description "Bluetooth headset audio output device"
}
}

ctl.btheadset {
type bluetooth
}</pre>
Check that your audio device is seen by ALSA
<pre>$ aplay -L
...<snip>...
btheadset
Bluetooth headset audio output device</pre>
Main Menu -> Service Menu -> MythTV Configuration -> Setup -> General -> 4th Page
<pre>Audio output device: ALSA:btheadset</pre>
_Note: you may have to manually type the above setting into the "Audio Audio output device" device field_


Test out your new Bluetooth headset!

h1. h3. Troubleshooting

(Work in progress)
* _bluez-simple-agent_ bails out complaining about dbus.
>
No audio: Try rebooting your machine. I had some issues getting the _bluez-simple-agent_ step to complete successfully until I rebooted. This probably had something to do with bluetoothd, hal and dbus starting in the right order. In theory hal and dbus should be started before bluetoothd, but when I restarted the services manually it still complained. After reboot this came up fine.
* Adjust the class in /etc/bluetooth/main.conf

<pre>$ sudo hciconfig hci0 class
hci0: Type: BR/EDR Bus: USB
BD Address: 00:0A:94:02:9C:8C ACL MTU: 310:10 SCO MTU: 64:8
Class: 0x480104
Service Classes: Capturing, Telephony
Device Class: Computer, Desktop workstation
</pre>
> Define the hexidecimal value for Class (0x480104 in the above case) in _/etc/bluetooth/main.conf_