[Deprecated] [TESTING] Bluetooth audio streaming (A2DP)

@nokia3660
good and bad news, I tested my bose speakers with the Pi3 built-in bt controller and all worked fine. So I can confirm if everything is configured right it even works with the built-in controller.
Means we need to figure out whats wrong on your setup. Are you able to do a fresh install on a second SD Card?

EDIT!!!
While it initially works the speaker disconnects after a minute or so and then when I try to reconnect I get (similar like you) Failed to connect: org.bluez.Error.NotRead so yes it seems to be an issue with the built-in controller. Suggest to get a BT Dongle.

Damn… Well thanks for trying mate. Cheers

Later on I got also issues with external dongle, so I may continue my testing

Hey mate, just wondering if you had any luck with it

Haven’t tested further as I was focusing on a new Bluetooth setup on my Vero.
Might can spend some time tomorrow.

Hello,

I’m a bit lost here. is it supposed to work straight after installing the package? Looks like I’m having some issue with the BT. I can’t find the PI when I scan BT devices from my phone (can see other devices)

I’m running OSMC 18.6 on a RPI1 (fresh install), with a wifi dongle and BT dongle and trying to stream audio from my phone to the PI.

I tried two BT dongles :

Bus 001 Device 004: ID 0b05:17cb ASUSTek Computer, Inc. Broadcom BCM20702A0 Bluetooth

and :

Bus 001 Device 006: ID 0a12:0001 Cambridge Silicon Radio, Ltd Bluetooth Dongle (HCI mode)

I tried with bluetoothctl, and here’s what I get for each:

[NEW] Controller 5C:F3:70:71:61:04 AudioPI [default]
[bluetooth]# agent on
Agent registered
[bluetooth]# default-agent
Default agent request successful
[bluetooth]# discoverable on
Failed to set discoverable on: org.bluez.Error.Failed
[bluetooth]# scan on
Failed to start discovery: org.bluez.Error.NotReady
[bluetooth]#
[bluetooth]# quit
Agent unregistered
[DEL] Controller 5C:F3:70:71:61:04 AudioPI [default]

and :

[NEW] Controller 00:15:83:4C:32:A1 AudioPI [default]
[bluetooth]#
[bluetooth]# agent on
Agent registered
[bluetooth]# default-agent
Default agent request successful
[bluetooth]# discoverable on
Failed to set discoverable on: org.bluez.Error.Failed
[bluetooth]# scan on
Failed to start discovery: org.bluez.Error.NotReady
[bluetooth]# quit
Agent unregistered
[DEL] Controller 00:15:83:4C:32:A1 AudioPI [default]

With the Asus dongle plugged-in, systemctl status bluetooth :

  • bluetooth.service - Bluetooth service
    Loaded: loaded (/lib/systemd/system/bluetooth.service; enabled; vendor preset: enabled)
    Drop-In: /etc/systemd/system/bluetooth.service.d
    -local.conf Active: active (running) since Mon 2020-04-20 16:19:52 CEST; 32min ago Docs: man:bluetoothd(8) Main PID: 384 (bluetoothd) Status: "Running" CGroup: /system.slice/bluetooth.service -384 /usr/libexec/bluetooth/bluetoothd

Apr 20 16:19:51 AudioPI systemd[1]: Starting Bluetooth service…
Apr 20 16:19:52 AudioPI bluetoothd[384]: Bluetooth daemon 5.43
Apr 20 16:19:52 AudioPI systemd[1]: Started Bluetooth service.
Apr 20 16:19:52 AudioPI bluetoothd[384]: Starting SDP server
Apr 20 16:19:53 AudioPI bluetoothd[384]: Bluetooth management interface 1.14 initialized
Apr 20 16:19:53 AudioPI bluetoothd[384]: Failed to obtain handles for “Service Changed” characteristic
Apr 20 16:19:53 AudioPI bluetoothd[384]: Endpoint registered: sender=:1.8 path=/MediaEndpoint/A2DPSource
Apr 20 16:19:53 AudioPI bluetoothd[384]: Endpoint registered: sender=:1.8 path=/MediaEndpoint/A2DPSink

Don’t know wher to go from that now… I probably missed something.

Thanks.
Manu.

Edit :
ok, with some more digging I came across something :

root@AudioPI:/home/osmc# hciconfig hci0 up
Can’t init device hci0: Operation not possible due to RF-kill (132)

root@AudioPI:/home/osmc# rfkill list
0: phy0: Wireless LAN
Soft blocked: no
Hard blocked: no
1: hci0: Bluetooth
Soft blocked: yes
Hard blocked: no

So I unblocked the BT adapter which is now showing “UP”:

root@AudioPI:/home/osmc# rfkill unblock 1
root@AudioPI:/home/osmc# rfkill list
0: phy0: Wireless LAN
Soft blocked: no
Hard blocked: no
1: hci0: Bluetooth
Soft blocked: no
Hard blocked: no
root@AudioPI:/home/osmc# hciconfig hci0 up
root@AudioPI:/home/osmc# hciconfig
hci0: Type: Primary Bus: USB
BD Address: 5C:F3:70:71:61:04 ACL MTU: 1021:8 SCO MTU: 64:1
UP RUNNING
RX bytes:1506 acl:0 sco:0 events:73 errors:0
TX bytes:1093 acl:0 sco:0 commands:73 errors:0

and after that I could Pair my phone :

root@AudioPI:/home/osmc# bluetoothctl
[NEW] Controller 5C:F3:70:71:61:04 AudioPI [default]
[bluetooth]# agent on
Agent registered
[bluetooth]# default-agent
Default agent request successful
[bluetooth]# discoverable on
Changing discoverable on succeeded
[CHG] Controller 5C:F3:70:71:61:04 Discoverable: yes
[NEW] Device F4:BF:80:7C:05:46 Raoul’s phone
Request confirmation
[agent] Confirm passkey 034105 (yes/no): yes
[CHG] Device F4:BF:80:7C:05:46 Modalias: bluetooth:v00E0p107Ed1436
[CHG] Device F4:BF:80:7C:05:46 UUIDs: 0000046a-0000-1000-8000-00805f9b34fb
[CHG] Device F4:BF:80:7C:05:46 UUIDs: 00001105-0000-1000-8000-00805f9b34fb
[CHG] Device F4:BF:80:7C:05:46 UUIDs: 0000110a-0000-1000-8000-00805f9b34fb
[CHG] Device F4:BF:80:7C:05:46 UUIDs: 0000110c-0000-1000-8000-00805f9b34fb
[CHG] Device F4:BF:80:7C:05:46 UUIDs: 00001112-0000-1000-8000-00805f9b34fb
[CHG] Device F4:BF:80:7C:05:46 UUIDs: 00001115-0000-1000-8000-00805f9b34fb
[CHG] Device F4:BF:80:7C:05:46 UUIDs: 00001116-0000-1000-8000-00805f9b34fb
[CHG] Device F4:BF:80:7C:05:46 UUIDs: 0000111f-0000-1000-8000-00805f9b34fb
[CHG] Device F4:BF:80:7C:05:46 UUIDs: 0000112f-0000-1000-8000-00805f9b34fb
[CHG] Device F4:BF:80:7C:05:46 UUIDs: 00001132-0000-1000-8000-00805f9b34fb
[CHG] Device F4:BF:80:7C:05:46 UUIDs: 00001200-0000-1000-8000-00805f9b34fb
[CHG] Device F4:BF:80:7C:05:46 UUIDs: 00001800-0000-1000-8000-00805f9b34fb
[CHG] Device F4:BF:80:7C:05:46 UUIDs: 00001801-0000-1000-8000-00805f9b34fb
[CHG] Device F4:BF:80:7C:05:46 UUIDs: 0000fe35-0000-1000-8000-00805f9b34fb
[CHG] Device F4:BF:80:7C:05:46 ServicesResolved: yes
[CHG] Device F4:BF:80:7C:05:46 Paired: yes
Authorize service
[agent] Authorize service 0000110d-0000-1000-8000-00805f9b34fb (yes/no): yes
[CHG] Device F4:BF:80:7C:05:46 UUIDs: 0000046a-0000-1000-8000-00805f9b34fb
[CHG] Device F4:BF:80:7C:05:46 UUIDs: 00001105-0000-1000-8000-00805f9b34fb
[CHG] Device F4:BF:80:7C:05:46 UUIDs: 0000110a-0000-1000-8000-00805f9b34fb
[CHG] Device F4:BF:80:7C:05:46 UUIDs: 0000110c-0000-1000-8000-00805f9b34fb
[CHG] Device F4:BF:80:7C:05:46 UUIDs: 0000110d-0000-1000-8000-00805f9b34fb
[CHG] Device F4:BF:80:7C:05:46 UUIDs: 00001112-0000-1000-8000-00805f9b34fb
[CHG] Device F4:BF:80:7C:05:46 UUIDs: 00001115-0000-1000-8000-00805f9b34fb
[CHG] Device F4:BF:80:7C:05:46 UUIDs: 00001116-0000-1000-8000-00805f9b34fb
[CHG] Device F4:BF:80:7C:05:46 UUIDs: 0000111f-0000-1000-8000-00805f9b34fb
[CHG] Device F4:BF:80:7C:05:46 UUIDs: 0000112f-0000-1000-8000-00805f9b34fb
[CHG] Device F4:BF:80:7C:05:46 UUIDs: 00001132-0000-1000-8000-00805f9b34fb
[CHG] Device F4:BF:80:7C:05:46 UUIDs: 00001200-0000-1000-8000-00805f9b34fb
[CHG] Device F4:BF:80:7C:05:46 UUIDs: 00001800-0000-1000-8000-00805f9b34fb
[CHG] Device F4:BF:80:7C:05:46 UUIDs: 00001801-0000-1000-8000-00805f9b34fb
[CHG] Device F4:BF:80:7C:05:46 UUIDs: 0000fe35-0000-1000-8000-00805f9b34fb

But no sound is coming out of the PI’s jack.
pactl looks ok to me :

osmc@AudioPI:~$ pactl list sources short
1 alsa_output.platform-soc_audio.analog-stereo.monitor module-alsa-card.c s16le 2ch 44100Hz IDLE
3 bluez_source.F4_BF_80_7C_05_46.a2dp_source module-bluez5-device.c s16le 2ch 44100Hz RUNNING

and

osmc@AudioPI:~$ pactl list sinks short
1 alsa_output.platform-soc_audio.analog-stereo module-alsa-card.c s16le 2ch 44100Hz RUNNING

I tried setting the audio output device in OSMC to
“ALSA: bcm2835 ALSA, bcm2835 ALSA”
or
“ALSA: Playback/recording through the PulseAudio sound server”

but no change.

I can play music directly from OSMC music library using output : Analog, but this option does not work either for BT streaming from my phone.

Looks like I’m getting closer somehow…

Edit2:
After each reboot, for some reason i have to unblock hci0 with rfkill as it got “Soft blocked” again:

root@AudioPI:/home/osmc# rfkill list
0: phy0: Wireless LAN
Soft blocked: no
Hard blocked: no
1: hci0: Bluetooth
Soft blocked: yes
Hard blocked: no

after that the pactl sources show bluez entry as soon as I start streaming audio from my phone:

osmc@AudioPI:~$ pactl list sources short
0 alsa_output.platform-soc_audio.analog-stereo.monitor module-alsa-card.c s16le 2ch 44100Hz IDLE
3 bluez_source.F4_BF_80_7C_05_46.a2dp_source module-bluez5-device.c s16le 2ch 44100Hz RUNNING

Also the process pulseaudio raise from ~10% cpu (when no BT device is connected) usage to ~40% (when streaming audio to the RPI), I guess that’s a good sign (I mean something is happening at least). But still no sound outputs from the audio jack.

Edit3 :
ok… stupid me… I left the HDMI plugged-in !
unplug HDMI, reboot, now the audio out goes to the jack.

So basically the only issue left is with the rfkill softblock.

Edit4:

connman thing… it’s now fixed and working properly :slight_smile:

@nokia3660, I did a bit more test and still seeing disconnects any now end then.
Seems same as in this bug report

There seems to be finally a fix, maybe @sam_nazarko can check if this made it into his kernel

I am assuming that when OSMC is running and I have connected my BT speakers (Teufel Stereo L) via PulseAudio before that it would just reconnect but what I have to do is to go into My OSMC to connect the speakers and then in settings → player → audio change from PulseAudio to something else and then back to PulseAudio for it to play sound when connected. Quite a tedious process if you ask me. :slight_smile:

I am all for a working BT from the box and would support testing and sending logs if that is what is required.

Well it is definitively working for me. Suggest to remove via MyOSMC and then go to command line and add via bluetoothctl - pair / trust / connect.
That should then allow autoconnect

I managed to pair and trust my Sony BT Headphones but then when trying to connect, I get: Failed to connect: org.bluez.Error.Failed

Could this have to do with the fact that I chose BCM2358 as Audio Output under Settings->System?

EDIT: I re-tried and now it worked after the connect command was issued a couple of minutes later. But I still doubt that my RPi 3 will connect to it automatically if it is available.

EDIT: it connects but there is no sound coming over the headphones, just static. I tried both ALSA outputs.

With my Teufel Stereo L it works but ONLY if I switch under settings->system->audio from PI:Analogue (where I have plugged in other speakers) over to PulseAudio. And it doesn’t auto-connect the speakers though, I guess they “want” to be found actively although it connects fine on the headphones automatically when OSMC is up and I power up my headphones.

Did you use the trust command?

I have entered several EDITs above and yes, I used the trust command.

Just keep that settings on Pulseaudio don’t change

Check this thread

Did you also trust them?

Hi everyone,

first I hope my issue hasn’t been brought up already; I searched through this lengthy thread and could not find anything really.

I just got the official bluetooth dongle and installed a2dp-app-osmc, the connection of my phone to OSMC (running on a Vero 2) works and audio plays on the Vero when I start it on the phone. But: Only with very heavy annoying stuttering, to the extent that you cannot really understand anything.

It felt somehow like the system was overloaded, so I just did a fresh reinstall of the latest OSMC version (2020-06-1) and tried again. Same issue. I tested with two phones (so far, did not manage to connect the laptop to try with that) and tried lying them immediately next to the Vero and the bluetooth dongle.

Any help would be appreciated and I am happy to provide logs if you tell me which might help.

Thanks in advance for any help with this!
flrns

Edit:
These are the outputs of dmesg -w when I start playing something on the phone: http://paste.osmc.io/izinuwinun.coffee
Not sure if that helps.

This method is almost deprecated. We will have a new solution soon.

Which port is the dongle in on the Vero?

1 Like

Thanks for your quick reply, Sam! I’m excited for the new solution now. :slight_smile:
Is there a difference between the ports? I’ve been trying two of the three to one side of the case (not the “back” where the power port is).

Try the one at the back

package not available. how to get it working?

osmc@osmc:~$ sudo apt-get install a2dp-app-osmc
Reading package lists… Done
Building dependency tree
Reading state information… Done
E: Unable to locate package a2dp-app-osmc

Try this [How-to] set up Bluetooth audio

Thx.
How to get the addon installed for showing track title and interpret or is it not working anymore?