Find the answer to your Linux question:
Results 1 to 4 of 4

Thread: Bluetooth audio

Enjoy an ad free experience by logging in. Not a member yet? Register.
  1. #1
    Just Joined!
    Join Date
    May 2009

    Bluetooth audio


    I bought a bluetooth audio device, and I am using slackware 12 - 13.1 and would like to get it working. Not seeing any step by steps for Slackware, I decided to post my attempt here -- and perhaps someone with experience will help where I got stuck.

    I am using kernel presently, and have installed as well.

    The particular device I bought is *stereo* headset bluetooth device. The label on the device just says "Tech" I can't find the manual now, but I bought it in 2010 because it is supposed to support *all* the main bluetooth audio standards that were available in 2010. ESP. A2DP.

    My normal (motherboard) audio source is a snd_ac97_codec, snd_intel8x0 device which I have working correctly, but which I would like to bypass in favor of a wireless bluetooth headset.
    I am running alsa.

    From lsusb, I have installed:
    btusb 7560 0
    bluetooth 35800 1 btusb

    So, I start by installing all bluez*txz packages from slackware/n .

    Looking in my /lib/modules/ path, I find:
    bfusb.ko btsdio.ko btusb.ko hci_uart.ko hci_vhci.ko

    The startup scripts have some bluetooth configuration, so I edit:

    # vim /etc/bluetooth/audio.service
    [Bluetooth Service]
    Name=Audio service
    Description=Bluetooth Audio service

    ...and next ...
    # vim /etc/bluetooth/audio.conf

    ... and At this point I start the bluetooth scripts ...
    # cd /etc/rc.d
    # chmod +x rc.messagebus rc.bluetooth rc.bluetooth.conf
    # ./rc.messagebus start
    # ./rc.bluetooth start

    At this point I can do:

    hciconfig hci0 up # Causes USB bluetooth dongle to be up for sure.

    And then I turn my bluetooth stereo headset on by holding the large button down until the LED flashes blue, a tone appears in the headset, and I continue holding the button until it begins flashing red and blue which ought to be "pairing" mode. That works.

    and then I look for my headset doing:
    #hcitool scan
    00:11:67:00:xx:xx R36

    And that number returned is the MAC address, I assume, of my bluetooth headset.
    So I found other sites suggesting I make an alsa startup file in my home directory:
    It doesn't help.

    If I try to pair with the device by doing a:
    hidd --connect 00:11:67:00:xx:xx

    It will tell me that the connection timed out, or if it drops out of pairing mode it will say: Transport endpoint is not connected.

    If I try to do hcid -a -n, it will not load for the "bluetooth main.conf" file is supposedly missing.
    I re-installed slackware/a/dbus-1.2.14-... package just to be sure, but it changes nothing; and in /var/log/debug

    May 16 00:35:40 rabbitry hcid[2394]: Parsing /etc/bluetooth/main.conf failed: No such file or directory
    May 16 00:35:40 rabbitry hcid[2394]: Unable to get on D-Bus

    I haven't been able to find an example bluetooth/main.conf file and slackware doesn't create one. Any ideas of what I am missing?
    Last edited by andrewr; 05-16-2011 at 06:17 AM.

  2. #2
    Just Joined!
    Join Date
    May 2009


    I have figured out that a connection is being made; runing 'hcidump -V -x' while executeing . hcitool gives,
    #hcitool cc 0D:01:00:67:xx:xx

    < HCI Command: Create Connection (0x01|0x0005) plen 13
    bdaddr xx:xx:67:00:01:0D ptype 0xcc18 rswitch 0x01 clkoffset 0x0000
    Packet type: DM1 DM3 DM5 DH1 DH3 DH5
    > HCI Event: Command Status (0x0f) plen 4
    Create Connection (0x01|0x0005) status 0x00 ncmd 1
    > HCI Event: Connect Complete (0x03) plen 11
    status 0x04 handle 0 bdaddr xx:xx:67:00:01:0D type ACL encrypt 0x00
    Error: Page Timeout

    The hcitool hangs until the Page timeout occurs, but if one breaks it ctrl-c, after hcidump reports the "> HCI Event: Command Status", I can run 'hcitool con' :

    #hcitool con
    < ACL 00:11:67:00:xx:xx:xx handle 0 state 2 lm MASTER

    Which clearly shows an asynchronous connection was successfully made. After the timeout, however, the connection is lost. hcitool in libbluetooth v3.36 is too dumb to pair correctly on its own. Attempting to connect to an unpaired device simply results in a timeout IO/ERROR.
    There is no PIN being sent by hcitool.

    I found my manual, and there are three possible PIN's for my headset device, 0000, 1234, and 8888. The slackware installation works with the PIN's, but you need to edit:
    And place the number on a line by itself with no carridge returns or anything. Then execute a
    #./rc.bluetooth restart

    To register the new PIN to do pairing with, put the headset in pairing mode by holding the power button down to turn on and get the red/blue alternating flash. Then just do a:

    hidd --connect 00:11:67:00:xx:xx
    with the MAC number of your device (or name, mine is an A36 headset) and the headset will pair for the first time with Slackware Linux.

    If it doesn't work, the pin number needs to be changed in the default file ... mine turned out to be 8888, the last one I tried.

    I can observe the headset do the five blue flashes and one tone to indicate it paired. But the hidd command comes back with:

    "Can't get device information: Success"

    Unfortunately, even this isn't repeatable. I assume once it paired, it remains paired.

    I also found that hciconfig has a "simple" pairing mode:
    # hciconfig hci0 sspmode 1

    And once executed, that seems to enable usable bluetooth interaction with my R36 headset.
    However, it isn't at all obvious how to test the device using hcitool. Watching with hcidump -X, and then using the "hcitool cc" command I can observe my headset connecting, reprorting remote features, and then hcitool disconnects automatically. It's very frustrating, but it is at least partially working now.

    Correction, it is fully working. Putting it in simple pairing mode and running:

    $aplay -D bt a_sound.wav
    Playing WAVE 'a_sound.wav' : Unsigned 8 bit, Rate 11025 Hz, Mono
    aplay: set_params:901: Sample format non available

    re-routes the audio to the headset. Now all I need to do is figure out how to make alsa route the audio to my headset by default rather than by explicit redirection.
    Last edited by andrewr; 05-17-2011 at 04:36 AM.

  3. #3
    Just Joined!
    Join Date
    May 2009
    Ok, I can get alsa to do a default to my headset by just editing an .asoundrc file and putting a pcm.!default in it:

    pcm.!default {
    type bluetooth
    device 00:11:67:00:XX;XX
    profile "auto"

    It complains that I need "uinput" module if I don't modprobe that. And it will only play S16_LE audio files. BUt it does work. For some reason, adobe flash player crashes with bluetooth audio as default, but that seems to be the only problem I have with it.

    I think the ALSA lib isn't using the A2DP enhanced capabilities.... but I don't know how to find out. Anyone have suggestions on why Flash would crash?

  4. $spacer_open
  5. #4
    Just Joined!
    Join Date
    May 2009
    The crashing appeared to have to do with when the earphone was turned on. It actually works fine if the earphones are on before I start the browser on a flash video page. I still don't know if it is full A2DP, but It is playing in both ears. If I go out of range and the connection drops -- it doesn't like to re-establish without my restarting the browser; but these are annoyances that I will hopefully find solutions to in the future.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts