« Previous - Version 3/4 (diff) - Next » - Current version
mihanson, 03/03/2011 12:33 pm


Bluetooth Audio

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

Plug in your Bluetooth dongle
Install bluez

$ pacman -Sy bluez

Ensure your dongle is showing UP RUNNING.
$ 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)

If not UP
$ hciconfig hci0 up

Place your Bluetooth audio device in pairing mode, then scan for it and make a note of the MAC address.
$ hcitool scan

Use bluez-simple-agent to pair your audio device to your dongle.
$ bluez-simple-agent hci0 <MAC Address>

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.
#/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
 }

Check that your audio device is seen by ALSA
$ aplay -L
...<snip>...
btheadset
    Bluetooth headset audio output device

Main Menu -> Service Menu -> MythTV Configuration -> Setup -> General -> 4th Page
Audio output device: ALSA:btheadset

Note: you may have to manually type the above setting into the "Audio output device" field

Test out your new Bluetooth headset!

Troubleshooting

  • bluez-simple-agent bails out complaining about dbus.

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
$ 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

Define the hexidecimal value for Class (0x480104 in the above case) in /etc/bluetooth/main.conf

toggleBT.sh - Bash script to toggle BT audio output. (909 Bytes) mihanson, 03/03/2011 12:36 pm