OK, can do this.
Hi,
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 https://github.com/osmc/osmc
cd osmc
git checkout 27a9e28b6d7224c540424445b45da87096042030
cd package/a2dp-app-osmc
make
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.
Sam
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
but:
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
Properties:
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ā
Profiles:
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
Ports:
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 system.pa: 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.
Hi
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
Sam
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.
Sam
Before the a2dp-app-osmc package has been installed, the āuserā instance of pulseaudio still runs at startup, even though the service is already disabled. Iāve found that it is triggered by pulseaudio.socket, so disabling the service will have no effect - and it would probably need to be masked, instead.
After installing the a2dp-app-osmc package, two instances of pulseaudio do run, but the user instance ceases to run after a reboot, though I guess that it might still be activated via pulseaudio.socket.
So do you know whatās being sent to pulseaudio.socket that causes the user instance of pulseaudio.service to start? And is there still a possibility of whatever is sent happening again?
Nope, and Iām not sure stopping this is the solution, because it worked before under Jessie.
Stopping what?
Anything more concrete than that? Different versions of systemd and different versions of pulse.
Iāve now made some fixes available, and hopefully this will allow A2DP to work out of the box again.
- Login via the command line
- Edit the file
/etc/apt/sources.list
- Add the following line:
deb http://apt.osmc.tv stretch-devel main
- Run the following commands to update:
sudo apt-get update && sudo apt-get dist-upgrade && reboot
- Your system should have have received the update.
Please see if the issue is resolved.
I also recommend you edit /etc/apt/sources.list
again and remove the line that you added after updating. This will return you to the normal update channel.
Thanks sam.
Will give it a test near the weekend.
Cheers
Thanks Sam, Iāve worked through the different steps that you outlined above and everything proceeded smoothly. I.e it found the update and processed it without issue. However I still canāt seem to use OSMC (Raspberry Pi 2) as the output source with bluetooth.
Hi Sam
Just updated but unfortunately no change the bluetooth device automatically disconnects once connected using bluetoothctl see below. Iām using an external dongle which worked fine before the stretch update.
Anything else i can do to help let me know
[bluetooth]# connect 45:C6:59:42:A3:04
Attempting to connect to 45:C6:59:42:A3:04
[CHG] Device 45:C6:59:42:A3:04 Connected: yes
Connection successful
[CHG] Device 45:C6:59:42:A3:04 ServicesResolved: yes
[CHG] Device 45:C6:59:42:A3:04 ServicesResolved: no
[CHG] Device 45:C6:59:42:A3:04 Connected: no
Iāve tried the update on my RPi3. Still big issues pairing and no audio
Donāt know what SoundWire is unfortunately.
Did you try using it as intended (i.e. for A2DP sending / receiving?)
As reported in the linked reply, I tried to use a bluetooth headset and, apart from some issues in the pairing phase, I wasnāt unable to select it as an audio device for the output.
Soundwire is a small binary that (using a Pulseaudio sink) would stream the audio over the network to an Android app.
With the latest a2dp it works for me.
So suggest you try to update to latest devel version and if you still donāt have the Sink provide a screenshot and a debug log.
Iāve already updated with the devel Apt repo last friday, if there arenāt newer updates Iām stuckā¦ Or am I missing some setup step? Do I need to install/configure something additional? The only thing I did is pairing the headphones using bluetoothctl
and checking in Kodi under System/Audioā¦
Sam published an update on Sunday
Latest staging update fixed it. Bluetooth doesnāt disconnect after connecting.
All good so far will do more testing.
Thanks @sam_nazarko again