Failed to set card profile to 'a2dp_sink' , help

9,252

Solution 1

I have seen this error and it is due to a bug with either pulseaudio or bluez. You may likely find that setting the audio profile to off, then disconnect from the headphones, reconnect to the headphones and then you may have no issues using A2DP. It appears that your script may do that but you may find pylover's a2dp.py python script will work for you

wget https://gist.githubusercontent.com/pylover/d68be364adac5f946887b85e6ed6e7ae/raw/d698974910bbb7d016ec0ad08c1bf41b4b524364/a2dp.py
alias headphones="a2dp.py 04:52:C7:0D:9E:13"

Then when you want to use your headphones, just type headphones

Solution 2

On Elementary OS Hera 5.1.7 (based on 18.04.4) using kernel 5.8.0-39 (necessary for hardware compatibility reasons), I was able to resolve this issue by

  1. installing pavucontrol and blueman and
  2. editing /etc/bluetooth/main.conf "MultiProfile=multiple" under "general" (see https://wiki.archlinux.org/index.php/Bluetooth_headset#A2DP_not_working_with_PulseAudio) change "AutoEnable=false" (not sure if that did anything)

Before this, I couldn't connect to bluetooth audio sinks, period, unless I used bluetoothctl. At that point, it would only connect to the duplex low quality sink (HSP/HFP) and not A2DP (high audio quality).

Now it appears to be able to work well enough in either mode, with mode-switching on the fly, however, with consistent errors:

[  994.225669] Bluetooth: hci0: urb 0000000085e83e50 submission failed (90)
[  994.225675] Bluetooth: hci0: sending frame failed (-90)
[  994.238145] Bluetooth: hci0: SCO packet for unknown connection handle 0
[  994.238153] Bluetooth: hci0: SCO packet for unknown connection handle 0
[  994.238155] Bluetooth: hci0: SCO packet for unknown connection handle 0
[  994.238157] Bluetooth: hci0: SCO packet for unknown connection handle 0

Solution 3

EDIT - please see warning from Sam Jaques below. This worked for me, but use at your own risk.

I've tried setting the profile to off, disconnecting and reconnecting the bluetooth device, but still could not switch to a2dp_sink. I finally found a working solution here on the Debian wiki

If you're using Gnome, Gnome Display Manager (GDM) 'captures' the A2DP sink on session start, which is why it's not available for the device to use. If you try to change the profile using the sound settings GUI, you'll notice that you can select A2DP Sink from the dropdown, but it simply switches back upon closing the dialogue. If you hit test speakers you'll notice it still only shows Mono.

The article has details but to summarise:

Create and add these lines to /var/lib/gdm3/.config/pulse/client.conf:

autospawn = no
daemon-binary = /bin/true

Change the file's owner and group:

sudo chown gdm:gdm /var/lib/gdm3/.config/pulse/client.conf

Then disable pulseaudio startup:

rm /var/lib/gdm3/.config/systemd/user/sockets.target.wants/pulseaudio.socket

add this to /etc/pulse/default.pa:

load-module module-switch-on-connect

Then restart.

Solution 4

The way I fixed it is by doing away with gdm entirely, since it's so jealous of my A2DP sink and it doesn't look like anyone is fixing it. I consider it broken.

sudo apt-get -y install slick-greeter

And then select "lightdm". Good riddance.

Share:
9,252

Related videos on Youtube

user1685095
Author by

user1685095

Updated on September 18, 2022

Comments

  • user1685095
    user1685095 over 1 year

    I'm using my bluetooth headphones with ubuntu desktop, which has bluetooth dongle. Right now I can connect headphones every time (wasn't so at the start, needed to repair them about every time I wanted to connect). So now it connects, but doesn't output any sound. Sometimes restarting pulse audio helps, sometimes it doesn't, I'm very tired of it and I would like to dig to the root of a problem.

    pacmd set-card-profile $(pacmd list-cards | grep -Pzo '(?<=index: )(\d+\n)(?=.*bluez_card)') a2dp_sink;

    This gives me Failed to set card profile to 'a2dp_sink'. Help me to dig further.

    #! /usr/bin/env zsh
    pacmd set-card-profile $(pacmd list-cards | grep -Pzo '(?<=index: )(\d+\n)(?=.*bluez_card)') off;
    echo -e 'disconnect 04:52:C7:0D:9E:13\n quit'|bluetoothctl
    sleep 5
    echo -e 'connect 04:52:C7:0D:9E:13\n quit'|bluetoothctl
    sleep 5
    pacmd set-card-profile $(pacmd list-cards | grep -Pzo '(?<=index: )(\d+\n)(?=.*bluez_card)') a2dp_sink;
    

    This isn't helping.

  • lamino
    lamino almost 7 years
    It's not working for me
  • merge delete
    merge delete about 6 years
    This py script worked like a charm for me..
  • Clément Baconnier
    Clément Baconnier over 4 years
    Thank you so much!
  • Sam Jaques
    Sam Jaques about 3 years
    On Ubuntu 18.04.5 this broke pulseaudio altogether and I had to reinstall it to get any audio back.
  • Casey L
    Casey L about 3 years
    @Sam Jaques yikes, I'm sorry to hear that. Feel free to downvote as justified. I'm adding a warning.
  • Saijin_Naib
    Saijin_Naib over 2 years
    Solved it for me under Alpine Linux Edge (v3.15 with Kernel 5.11.22-r1).
  • mondjunge
    mondjunge about 2 years
    I tried that. after disconnecting the headphones they will not show up as connactable again.. :(