2015-09-30, 16:16
Maybe its interesting for some peoples out there...
with help of different pages and users on other forums i found a solution to get
bluetooth speakers working on a raspberry with OSMC OS (no idea if this also works for other distributions)
Hardware: Raspberry PI2, Trust 18187 Bluetooth Dongle (Cambridge Silicon Radio CHIP)
OS: OSCM Release 2015.09-2
First i made this:
once installed everything i've tested if i can pair and connect my speakers with the bluetoothctl tool:
after this i changed inside Kodi the audio output to pulseaudio server
and how wonder it worked so far... but it didn't connect after reboot... i found out that bluetooth is not powered on automatically and i need to change or make some files:
New File /etc/udev/rules.d/10-local.rules
add line in /etc/pulse/default.pa
this changes power up the bluetooth on start, but still not connect automatically
then i made a script in /var/scripts/ called startBTaudio.sh
in /etc/systemd/system i create a file named BTspeaker.service
in /etc/systemd/system i create a file named BTspeaker.timer
and enable this service with
so at the end, i was troubling around that connect script starts before before pulseaudio starts and this won't work... now it waits 15 seconds after boot and this work fine for me.
the sound quality is not perfect but enough for my case
with help of different pages and users on other forums i found a solution to get
bluetooth speakers working on a raspberry with OSMC OS (no idea if this also works for other distributions)
Hardware: Raspberry PI2, Trust 18187 Bluetooth Dongle (Cambridge Silicon Radio CHIP)
OS: OSCM Release 2015.09-2
First i made this:
Code:
sudo apt-get update
sudo apt-get install
sudo apt-get install bluez pulseaudio pulseaudio-module-bluetooth
once installed everything i've tested if i can pair and connect my speakers with the bluetoothctl tool:
Code:
sudo bluetoothctl -a
agent on
default-agent
scan on
wait for your device to show and make it discoverable
then
trust YOURMACADROFTHEDEVICE
pair YOURMACADROFTHEDEVICE
connect YOURMACADROFTHEDEVICE
after this i changed inside Kodi the audio output to pulseaudio server
and how wonder it worked so far... but it didn't connect after reboot... i found out that bluetooth is not powered on automatically and i need to change or make some files:
New File /etc/udev/rules.d/10-local.rules
Code:
# Set bluetooth power up
ACTION=="add", SUBSYSTEM=="bluetooth", KERNEL=="hci[0-9]*", RUN+="/usr/bin/hciconfig %k up"
add line in /etc/pulse/default.pa
Code:
# automatically switch to newly-connected devices
load-module module-switch-on-connect
this changes power up the bluetooth on start, but still not connect automatically
then i made a script in /var/scripts/ called startBTaudio.sh
Code:
#!/bin/sh
echo "connect YOURMACADROFTHEDEVICE" | bluetoothctl -a
echo "exit" | bluetoothctl -a
in /etc/systemd/system i create a file named BTspeaker.service
Code:
[Unit]
Description=Bluetooth Speaker automatic connect
[Service]
Type=simple
ExecStart=/var/scripts/startBTaudio.sh
in /etc/systemd/system i create a file named BTspeaker.timer
Code:
[Unit]
Description=Run Script after some time
[Timer]
# Time to wait after booting before activation
OnBootSec=15
Unit=BTspeaker.service
[Install]
WantedBy=multi-user.target
and enable this service with
Code:
systemctl enable BTspeaker.timer
so at the end, i was troubling around that connect script starts before before pulseaudio starts and this won't work... now it waits 15 seconds after boot and this work fine for me.
the sound quality is not perfect but enough for my case