Interesting but as @fzinken says it shouldn’t be. You seem to have missed out scan on from the bluetoothctl commands and there shouldn’t be a need for power on. TBH it should all be possible from My OSMC which is programmed to do things in the right order.
I think what can happen is a device can end up connected but only for non-audio services (like what’s needed for volume buttons). A difficult thing to debug. Removing the device completely and starting again is always a good strategy.
I’m certainly not an authority on this and somehow got to where I am with try and error.
Quite possibly the bluetoothctl sequence ended up with the speaker not being connected, and only the GUI sequence did that. Maybe connect after pair would have done the trick just as well.
During one of my attempts I did in fact miss scan on, which resulted in a different error message (device not found). That implies there’s a different issue.
I can’t guarantee every part of the BT commands in the sequence is required (particularly default-agent and power on), it would take some extra commands to figure that out. A that point I was simply trying out solutions to similar-looking problems one by one.
What I can tell for sure is that pair – trust – connect reproducibly failed at the pair stage for me, whereas connect – trust –pair at least gave me a correctly paired device. However, if you have previously paired the device and not removed all traces, you might still have the trust stored somewhere, so a pair operation without a previous trust would succeed in your case, but not for a fresh setup.
If anyone else runs into similar issues, I would suggest trying the following sequence:
agent on
scan on
trust <mac>
pair <mac>
connect <mac>
scan off
agent off
It’s not high on the todo list, unfortunately. It was implemented by a virtual audio player which someone developed for earlier Kodi versions but it hasn’t been updated and the author is no longer around. Quite a lot of work for someone to pick up. How are your coding skills?
i have not tried to stream to my BT-Headphone’s yet but at least both were listed in Settings->Audio->Output with the provided .asoundrc-template.
This really should find it’s place back in ~/.asoundrc.template or at least in here.
Am I correct to look into /usr/share/kodi/addons/script.module/omcsetting.networking/ressources/lib/osmcnetworking/*py, especially osmc_bluetooth.py, to try to implement an ‘Add Alsa-Plug’-Button in the Drop-Down-Field?
First i thought about a shell-script but now that i found the Python-Files I would need to comb through them…
Or maybe just an dirty os.exec()/shutil…with a Shell-Script. My Python-Skills aren’t that sophisticated.
But on the other hand, one should first check if the device can stream Audio before allowing this action. So even more to look up…
Maybe I will first write a shell-script as helper for lets say adding a device with connectbot from my mobile’ or just being lazy… echo "exit" |bluetoothctl |grep Device |cat -A |cut -c59- |rev |cut -c2-|rev
… got rid of everything ‘nasty’ and the rest will have to do later when i have the time.
That is, if anyone would be interested.
with regards,
Christopher
PS: This would even be my second official contribution to osmc after one in ~2014
this doesn’t solve a problem, it just makes things easier… as i mentioned…
I couldn’t switch to my headset until i found this thread. i didn’t need it… it was just annoying that i even had to look around why the … my Headset wasn’t shown in the Audio-Output. And didn’t have that much time either.
With my former device , an wetek play 2 and libreelec it just worked out of the box…
And know that i got myself a new Vero, i just thought this would be a given… my bad.
And for the Shell-Script. One could wrap ‘dialog’ or ‘whiptail’ around and read the current .asoundrc… to check if the Device is already listed. or something or just overwrite it …
i would have welcomed a executable to just generate the config a week ago.