Bluetooth fix for December update


OK, can do this.



Sorry for the delay in replies here. It’s been busy.

@Den4t as you seem to be willing to tinker with this a bit, I’d recommend you get to where we were before we made changes to try and get it running out of system mode.

apt-get install git build-essential
git clone
cd osmc
git checkout 27a9e28b6d7224c540424445b45da87096042030
cd package/a2dp-app-osmc

That will give you a Deb package which you can install and run apt-get -f install on a fresh installation to get dependencies.

In my findings, A2DP won’t work properly.

But if you stop PulseAudio (systemctl stop pulseaudio) and run pulseaudio -vvv once as the OSMC user and kill it, it will then work without issue.

I couldn’t work out why this was (I checked directories were OK; auth cookies were fine). I did spend quite some time on this.

There’s probably work that needs to be done in files/DEBIAN/postinst to set up permissions properly.



Hi Sam !

Made a fresh installation (latest osmc 2018-02-01) with the git-version of a2dp-app-osmc, and here is my dicovering.
Firstly i disabled onboard bt (dtoverlay=pi3-disable-bt), then cloned git and made package,
right after install a2dp-app-osmc i have:

osmc@pi:~$ systemctl status pulseaudio
● pulseaudio.service - Pulse Audio
   Loaded: loaded (/lib/systemd/system/pulseaudio.service; enabled; vendor preset: enabled)
   Active: active (running) since Mon 2018-03-12 22:32:17 MSK; 3min 24s ago
 Main PID: 952 (pulseaudio)
   CGroup: /system.slice/pulseaudio.service
           └─952 /usr/bin/pulseaudio --system --disallow-exit --disable-shm --realtime --no-cpu-limit

system pulse unit started, but:

osmc@pi:~$ ps axwu|grep pulse
osmc       362  0.5  0.9  90120  7420 ?        Sl   22:29   0:01 /usr/bin/pulseaudio --start --log-target=syslog
pulse      952  0.2  0.9  99484  7512 ?        S<sl 22:32   0:00 /usr/bin/pulseaudio --system --disallow-exit --disable-shm --realtime --no-cpu-limit

we also have a user instance, thats why you can’t use bt headset.
In my case, i can connect headset (via kodi GUI):

osmc@pi:~$ sudo bluetoothctl
[NEW] Controller 00:1A:7D:DA:71:11 pi [default]
[NEW] Device 00:11:67:11:4C:EE BT-1005
[BT-1005]# paired-devices
Device 00:11:67:11:4C:EE BT-1005


osmc@pi:~$ pactl list short cards
0 alsa_card.platform-soc_audio module-alsa-card.c

This is because the headset connected to the system instance of pulseaudio,
kodi (as osmc user) connected to the user instance.

So, what we need to do now:
as osmc user disable pulseaudio user unit:

osmc@pi:~$ systemctl --user disable pulseaudio

and disable autostart server in /etc/pulse/client.conf:

autospawn = no

After reboot for clean start:

osmc@pi:~$ ps axwu|grep pulse
pulse 192 5.7 1.0 108924 8156 ? S<sl 22:57 2:57 /usr/bin/pulseaudio --system --disallow-exit --disable-shm --realtime --no-cpu-limit

Now connect headset:

osmc@pi:~$ pactl list short cards
0 alsa_card.platform-soc_audio module-alsa-card.c
2 bluez_card.00_11_67_11_4C_EE module-bluez5-device.c

Switch pulse in kodi and listen audio from headset. But in my case default card profile
not a2dp:

osmc@pi:~$ pactl list cards

Card #1
Name: bluez_card.00_11_67_11_4C_EE
Driver: module-bluez5-device.c
Owner Module: 16
device.description = "BT-1005"
device.string = "00:11:67:11:4C:EE"
device.api = "bluez"
device.class = "sound"
device.bus = "bluetooth"
device.form_factor = "speaker"
bluez.path = "/org/bluez/hci0/dev_00_11_67_11_4C_EE"
bluez.class = "0x240414"
bluez.alias = "BT-1005"
device.icon_name = "audio-speakers-bluetooth"
headset_head_unit: Headset Head Unit (HSP/HFP) (sinks: 1, sources: 1, priority: 20, available: yes)
a2dp_sink: High Fidelity Playback (A2DP Sink) (sinks: 1, sources: 0, priority: 10, available: yes)
off: Off (sinks: 0, sources: 0, priority: 0, available: yes)
Active Profile: headset_head_unit
speaker-output: Speaker (priority: 0, latency offset: 0 usec)
Part of profile(s): headset_head_unit, a2dp_sink
speaker-input: Bluetooth Input (priority: 0, latency offset: 0 usec)
Part of profile(s): headset_head_unit

I think this is my bt adapter feature, switch to a2dp:

osmc@pi:~$ pactl set-card-profile bluez_card.00_11_67_11_4C_EE a2dp_sink

Personally, I’m using a python script that tracks dbus events and runs this command when the bt headset is connected. It is possible, to add a module to module-card-restore
in this case the pulseaudio will restore the profile of the bt card when connected, in this way we only need to set the card profile once.

Tomorrow i try to make changes in postint and client.conf and make a new fresh install.



Thank you for such a detailed response and your efforts, which will no doubt benefit and be appreciated by many others.

We had a user instance before, and auto-spawning, which while not ideal, did not cause a problem with Jessie. It seems that does cause a problem now.

Yes – this is ideal.

The necessary files should already be diverted so you should be able to produce a package that makes the necessary changes.

Let me know how you get on



Hi !

I made a patches:

branch: a2dp

Remember, that after first headset connect, may be needed to switch card profile by hand:
osmc@pi:~$ pactl set-card-profile bluez_card.XX_XX_XX_XX_XX_XX a2dp_sink


Thanks. I’ll take a look at this shortly.