Page 1 of 2 12 LastLast
Results 1 to 10 of 16

Thread: 12.04 won't automatically switch audio to bluetooth headset

  1. #1
    Join Date
    Nov 2008
    Location
    Oita, Japan
    Beans
    419
    Distro
    Ubuntu

    12.04 won't automatically switch audio to bluetooth headset

    So I've spent the day looking into this, and managed to get fairly close.

    This is the behavior I expect

    0. During any audio stream (music, movie, game, whatever)

    1. Activate bluetooth headset.
    2. Audio redirects to the headset.
    3. Deactivate bluetooth headset.
    4. Audio redirects to the speakers.
    5. Rinse and repeat.

    This should work entirely hands-free.

    Just once I actually witnessed that this is possible, but bluetooth subsequently crashed and I have never been able to reproduce the miracle. It took considerable research and reconfiguration to get that far, and I've yet to find any other confirmed success stories.

    What is actually happening 99.999% of the time:

    1. On activation, headset connects, but no profile is selected, so nothing appears to happen.
    2. Manually select "Audio Sink" in blueman
    3. Audio redirects to the headset.
    4. Deactivate the headset
    5. Audio redirects to the speakers.
    6. At this point bluetooth support often fails entirely and the adapter becomes irrecoverably inoperative. This is has not happened for the last several attempts.
    7. If bluetooth is still working, it is possible to repeat this procedure.

    The failure seems to be somewhere between connecting the paired headset and selecting a profile for how it will be used. According to the configuration, both A2DP and HSP should be autoconfigured and autoconnected automatically, but in fact they are not.

    Gnome-bluetooth is not capable of properly configuring the connection as it has no facility to select profiles and crashes irrecoverably more often than not.

    By "irrecoverable" in the case of bluetooth support and gnome-bluetooth-applet I mean that no available means successfully restore functionality, from restarting the bluetooth service to manually configuring the adapter with hcitool and hciconfig. The only solution appears to be a complete reboot.
    Last edited by quequotion; October 10th, 2012 at 04:24 PM. Reason: bluetooth is either not crashing or crashing less often.

  2. #2
    Join Date
    Nov 2008
    Location
    Oita, Japan
    Beans
    419
    Distro
    Ubuntu

    Re: 12.04 won't automatically switch audio to bluetooth headset

    After a couple of reboots, bluetooth isn't crashing anymore, but I still have to manually set the "Audio Sink" profile to redirect audio to the headset.

  3. #3
    Join Date
    Nov 2008
    Location
    Oita, Japan
    Beans
    419
    Distro
    Ubuntu

    Re: 12.04 won't automatically switch audio to bluetooth headset

    I put together a bug report which will hopefully help narrow down what's going wrong here.

  4. #4
    Join Date
    Nov 2008
    Location
    Oita, Japan
    Beans
    419
    Distro
    Ubuntu

    Re: 12.04 won't automatically switch audio to bluetooth headset

    I found the missing link.

    Pulseaudio's default configuration is incorrect.

    module-bluetooth-discover is NOT activated, although pulseaudio-module-bluetooth is installed and a bluetooth transceiver is available.

    In order to get a bluetooth headset to automatically recieve a profile, the following must be added to /etc/pulse/system.pa:
    Code:
    ### Automatically detect bluetooth devices
    load-module module-bluetooth-discover
    I'll put together a full tutorial on this later.
    Last edited by quequotion; October 13th, 2012 at 09:30 PM. Reason: or maybe i just opened a huge can of worms

  5. #5
    Join Date
    Nov 2008
    Location
    Oita, Japan
    Beans
    419
    Distro
    Ubuntu

    Re: 12.04 won't automatically switch audio to bluetooth headset

    Nevermind that, everything just blew up again. Long story short: trying to do something neat like use bluetooth headphones hands-free turned out to be incredibly difficult and full of bugs.... and failed.

    I was right the first time--bluez is broken, but not the way I thought; unfortunately pulseaudio's bluetooth support is also broken.

    Furthermore Ubuntu's documentation on the matter is either very out of date or wildly inaccurate.

    Bluez becomes unsustainable once pulseaudio takes over assigning profiles. It will eventually crash, irrecoverably. I think the problem here is that bluez, not pulseaudio, should be making the device profiles available. Pulseaudio should only be responsible for streaming the audio, not creating or annihilating audio devices. Bluez can't seem to handle giving control of the hardware to pulseaudio.

    Pulseaudio's module-bluetooth-discover should be loaded with the default configuration, according to it's creator's blog, but it is not. In fact, even specifying that it should be loaded manually will usually fail and the module will often not load. It can be loaded temporarily via pacmd or pactl, but it will unload itself at some point either way. I can't find any other documentation on the module beyond the original author's blog posts.

    This module also has several other problems, among them crashing bluez, and more specifically: This bug, which is probably what I am dealing with, was dismissed for further testing that never happened. Then this patch, the only proposed solution with a patch available, was dismissed in favor of a better solution that was never implemented.


    I've gathered a lot of scattered tips into a brief rundown of how to get a bluetooth headset almost working handsfree.
    Start by changing the configuration of bluetooth audio (/etc/bluetooth/audio.conf, unchanged sections omitted):
    Code:
    # This section contains options which are not specific to any
    # particular interface
    [General]
    Enable=Socket #What does this actually do? Advised in Archlinux tutorial, undocumented.
    
    # Automatically connect both A2DP and HFP/HSP profiles for incoming
    # connections. Some headsets that support both profiles will only connect the
    # other one automatically so the default setting of true is usually a good
    # idea.
    AutoConnect=true #This is commented out by default, again undocumented.
    Changing the configuration of pulseaudio (/etc/pulse/system.pa, additions only):
    Code:
    ### Automatically detect bluetooth devices
    load-module module-bluetooth-discover #Maybe this does more harm than good
    
    ### Automatically redirect to newly available sinks
    load-module module-switch-on-connect #Probably necessary... probably....
    Don't forget to remove redundant surround sound configuration if you have one (/etc/pulse/daemon.conf, check this setting)
    Code:
    ; default-sample-channels = 2 #Commented out like so is best; must not be greater than 2
    ; default-channel-map = front-left,front-right # Again, commented out like so is best
    Install blueman and remove gnome-bluetooth
    Code:
    sudo apt-get remove gnome-bluetooth && sudo apt-get install blueman
    Last edited by quequotion; October 15th, 2012 at 04:21 PM.

  6. #6
    Join Date
    May 2012
    Beans
    1

    Re: 12.04 won't automatically switch audio to bluetooth headset

    I have been trying to get bluetooth working reliably, too.

    For me, the situation right now is that after every disconnect of the headset I have to remove the headset from blueman-manager and re-pair it, otherwise I can't re-connect the a2dp audio sink.
    The error message shown on the stderr from blueman-manager is:
    Code:
    fail (/usr/lib/python2.7/dist-packages/blueman/gui/manager/ManagerDeviceMenu.py:134)
    fail (DBusException(dbus.String(u'Stream setup failed'),),)
    I have tried two different bluetooth USB sticks ("lsusb" output):
    Code:
    Bus 001 Device 005: ID 0a5c:2101 Broadcom Corp. Bluetooth Controller   and
    Bus 001 Device 010: ID 0f4d:1000 Microtune, Inc. Bluetooth Dongle
    The headset I am using is a Sony DR-BT101 which supports A2DP with the SBC and MP3 codecs. I am on Ubuntu 12.04.

  7. #7
    Join Date
    Nov 2008
    Location
    Oita, Japan
    Beans
    419
    Distro
    Ubuntu

    Re: 12.04 won't automatically switch audio to bluetooth headset

    Quote Originally Posted by Cringster View Post
    I have been trying to get bluetooth working reliably, too.

    For me, the situation right now is that after every disconnect of the headset I have to remove the headset from blueman-manager and re-pair it, otherwise I can't re-connect the a2dp audio sink.
    The error message shown on the stderr from blueman-manager is:
    Code:
    fail (/usr/lib/python2.7/dist-packages/blueman/gui/manager/ManagerDeviceMenu.py:134)
    fail (DBusException(dbus.String(u'Stream setup failed'),),)
    I have tried two different bluetooth USB sticks ("lsusb" output):
    Code:
    Bus 001 Device 005: ID 0a5c:2101 Broadcom Corp. Bluetooth Controller   and
    Bus 001 Device 010: ID 0f4d:1000 Microtune, Inc. Bluetooth Dongle
    The headset I am using is a Sony DR-BT101 which supports A2DP with the SBC and MP3 codecs. I am on Ubuntu 12.04.
    I have similar error messages. Sometimes I even get a dialogue pop-up with an error like that or a red error bar in the bottom of the "Devices" window, but sometimes it fails silently.

    If I don't try to force loading module-bluetooth-discover (which usually doesn't work anyway) I have somewhat less trouble reconnecting, sometimes...

  8. #8
    Join Date
    Nov 2008
    Location
    Oita, Japan
    Beans
    419
    Distro
    Ubuntu

    Re: 12.04 won't automatically switch audio to bluetooth headset

    Looks like no one's going to acknowledge the bug report. I don't think it's chances are very good since Bluez, Pulseaudio, and Linux all use their own bug trackers.

    Bluez's upstream bug tracker is MIA and Pulseaudio isn't causing the bug, so Linux is the last option. I'll get around to making a report for the kernel devs, but I'm not sure if this can or will be addressed in the kernel.

  9. #9
    Join Date
    Jun 2008
    Beans
    30

    Re: 12.04 won't automatically switch audio to bluetooth headset

    incredible.. ive been trying for the past week to get my headrush set working and it just keeps disconnecting itself.. stuttering / jerky playback continuously.

    did you file a bug in launchpad ?

  10. #10
    Join Date
    Nov 2008
    Location
    Oita, Japan
    Beans
    419
    Distro
    Ubuntu

    Re: 12.04 won't automatically switch audio to bluetooth headset

    Quote Originally Posted by insaini View Post
    did you file a bug in launchpad ?
    Yes. Unfortunately it isn't getting any attention. Could you take a look at it and add yourself to "users affected"? Here's the link again.

Page 1 of 2 12 LastLast

Tags for this Thread

Bookmarks

Posting Permissions

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