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

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: