Forum

Full Version: Bluetooth Audio output (Transmitter)
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Pages: 1 2 3 4 5 6
This works 90% of the time, but not always.

So treat it as in development.


Well after some digging, I finally got Xbian to output the audio stream from a bluetooth dongle to a bluetooth headset (I guess it should be the same for headphones)

(This was done on a RPi2 with the DEVEL sources) - but shouldn't make a difference.

1) Install the necessary packages

Terminal
sudo apt-get install pulseaudio pulseaudio-module-bluetooth bluez-firmware

NB: bluez-firmware should only be required if your dongle is a based on a BCM203x chipset

Reboot

2) Now connect the bluetooth device (This is similar to a keyboard, but no password is required.

Check the adapter has been found.

Something like this should show up.

Terminal
xbian@xbian ~ $ lsusb
Bus 001 Device 005: ID 0a12:0001 Cambridge Silicon Radio, Ltd Bluetooth Dongle (HCI mode)
Bus 001 Device 004: ID 046d:c52b Logitech, Inc. Unifying Receiver
Bus 001 Device 003: ID 0424:ec00 Standard Microsystems Corp. SMSC9512/9514 Fast Ethernet Adapter
Bus 001 Device 002: ID 0424:9514 Standard Microsystems Corp.
Bus 001 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub

Now scan for the adaptor - make sure it is turned on and is in discover mode.

Terminal
xbian@xbian ~ $ hcitool scan
Scanning ...
94:CE:2C:FA:1A:C7 SBH20
(Note this number, yours will be different)

Now in Xbian System --> System -> Audio Output, select "Playback recording through the PulseAudio sound server"

This will ensure the pulseaudio is running

check with ps -ef|grep -i pulse

Sometimes there are two instances running. If that is the case, try a reboot until there is only one

Terminal
xbian@xbian ~ $ sudo bluetoothctl
[NEW] Controller 00:1A:7D:DA:71:13 xbian [default]
[bluetooth]# power on
Changing power on succeeded
[bluetooth]# pairable on
Changing pairable on succeeded
[bluetooth]# scan on
Discovery started
[CHG] Controller 00:1A:7D:DA:71:13 Discovering: yes
[NEW] Device 94:CE:2C:FA:1A:C7 SBH20
[CHG] Device 94:CE:2C:FA:1A:C7 RSSI: -96
[CHG] Device 94:CE:2C:FA:1A:C7 RSSI: -54
[bluetooth]# pair 94:CE:2C:FA:1A:C7
Attempting to pair with 94:CE:2C:FA:1A:C7
[CHG] Device 94:CE:2C:FA:1A:C7 Connected: yes
[CHG] Device 94:CE:2C:FA:1A:C7 UUIDs:
00001108-0000-1000-8000-00805f9b34fb
0000110b-0000-1000-8000-00805f9b34fb
0000110c-0000-1000-8000-00805f9b34fb
0000110e-0000-1000-8000-00805f9b34fb
0000111e-0000-1000-8000-00805f9b34fb
[CHG] Device 94:CE:2C:FA:1A:C7 Paired: yes
Pairing successful
[CHG] Device 94:CE:2C:FA:1A:C7 Connected: no
[bluetooth]# trust 94:CE:2C:FA:1A:C7
[CHG] Device 94:CE:2C:FA:1A:C7 Trusted: yes
Changing 94:CE:2C:FA:1A:C7 trust succeeded
[bluetooth]# connect 94:CE:2C:FA:1A:C7
Attempting to connect to 94:CE:2C:FA:1A:C7
[CHG] Device 94:CE:2C:FA:1A:C7 Connected: yes
Connection successful
[bluetooth]# quit
[DEL] Controller 00:1A:7



If all has gone well, you should hear audio through your bluetooth headset, and the girlfriend/wife/dog/goldfish can sleep undisturbed while you watch DeadPool on full volume.
Thanks for this 'mini' Howto. Will help me for a better start with BT (want to build BT dialog for config-xbmc for next Kodi version)
The problem I had was there were too many WRONG (albeit for other versions) HowTo's that used obsolete commands or as is always the case totally wrong commands.

This seems to work for the current 16.1 Kodi but it will not work with earlier releases as the packages are different as too are the commands.

I think the crucial additions are pulseaudio and pulseaudio-module-bluetooth. Bluez-firmware I believe is already included in the latest upgrade.

So really the xbian package A2DP need only those two modules.

I've yet to try on a RPiA or B but I guess it should work.

A xbian-config addition must be possible, as OE have done something, albeit not the best.

If bluetoothctl can accept batch commands with passed variables, then it should be pretty easy (Sucky face)

Give me shout if you want something tested.
I have two bluetooth speakers, one is Levono something and other is Sony MW600, neither of them is working, and I indeed followed your instructions, step by step. everything went right except the final step of "connecting to the device", always "fail".
jeeeze I am going crazy.
Could you experts/developers create some gui-based things like what they have in OpenElec (only exists in the beta release, and its video performance is shit.)
sorry for the attitude. but I really enjoy xbian, cutting edge and also a well maintained linux distro.
A gui based BT connection screen is in development. We just need to obtain the equipment to test it on as many BT devices to prove it works.

As to your problem, without any debug messages or any other information, it's impossible to tell what has gone wrong.
(10th May, 2016 07:54 PM)IriDium Wrote: [ -> ]A gui based BT connection screen is in development. We just need to obtain the equipment to test it on as many BT devices to prove it works.

As to your problem, without any debug messages or any other information, it's impossible to tell what has gone wrong.

Software
XBian version: XBian 1.0 (knockout)(kernel:Linux 4.4.9+)
XBMC/Kodi version: Kodi 16.1 Git:2016-04-28-195c90b
Overclock settings: no

Hardware
Device type and model: Raspberry Pi Model 2B 1024 MB
Power supply rating: 5V2A
SD card size and make/type: 16G sandisk
Network (Ethernet or wireless): wireless
Connected devices (TV, USB, network storage, ...): Philips 190CW hdmi2dvi

Debugged kodi log is HERE
Can you confirm that the pulseaudio-module-bluetooth is installed.

If so restart pulse audio

pulseaudio -k
pulseaudio --start
(12th May, 2016 07:38 PM)IriDium Wrote: [ -> ]Can you confirm that the pulseaudio-module-bluetooth is installed.

If so restart pulse audio

pulseaudio -k
pulseaudio --start

yes i did, i use

sudo apt-get install pulseaudio-module-bluetooth

and it automatically installed pulseaudio-module-bluetooth pulseaudio bluez

but since you said, i will try immediately and let you know the results. thx

(12th May, 2016 07:38 PM)IriDium Wrote: [ -> ]Can you confirm that the pulseaudio-module-bluetooth is installed.

If so restart pulse audio

pulseaudio -k
pulseaudio --start

Latest News~
I also tried Kodi in RetroPie 3.7
bluetooth speakers works perfectly!!
then what's wrong about xbian?
(10th May, 2016 03:35 PM)schiway Wrote: [ -> ]Could you experts/developers create some gui-based things like what they have in OpenElec (only exists in the beta release, and its video performance is shit.)
sorry for the attitude. but I really enjoy xbian, cutting edge and also a well maintained linux distro.

In your case a GUI would help absolutely nothing. Your issue goes deeper and we have to figure out what it is
OK, can now replicate the error.

Just need to find out what is causing it!!

1) Could this be relevant?
xbian@xbian ~ $ sudo systemctl status bluetooth
Failed to get D-Bus connection: Unknown error -1

2) [bluetooth]# scan on
Discovery started
[CHG] Controller B8:27:EB:B8:EB:AA Discovering: yes
[CHG] Device 94:CE:2C:FA:1A:C7 RSSI: -80
[CHG] Device 94:CE:2C:FA:1A:C7 RSSI: -66
(13th May, 2016 12:05 AM)IriDium Wrote: [ -> ]OK, can now replicate the error.

Just need to find out what is causing it!!

1) Could this be relevant?
xbian@xbian ~ $ sudo systemctl status bluetooth
Failed to get D-Bus connection: Unknown error -1

No, we do not use systemd, we're using upstart
Use service instead:

Terminal

sudo service bluetooth status
[ ok ] bluetooth is running.
I've successfully connected a BT keyboard but not the audio device. Looking around, always seems to suggest the pulseaudio-module-bluetooth package.

Ok - I've now got it working, but I'm unsure what I did to get it to work.

What I seemed to do was:

Upgrade to staging, but this seemed to just be CEC updates.

(Remove offending Audio device)

Terminal
xbian@xbian ~ $ sudo bluetoothctl -a
[bluetooth]# devices
Device 94:CE:2C:FA:1A:C7 SBH20
<---------------- Get rid of this one
Terminal
Device 00:00:00:00:17:41 Caseflex BT Keyboard
[bluetooth]# remove 94:CE:2C:FA:1A:C7
[DEL] Device 94:CE:2C:FA:1A:C7 SBH20
Device has been removed
[bluetooth]# quit
I then went through the whole process of registering and pairing it again.

Then

Terminal
xbian@xbian ~ $ sudo service bluetooth status
[ ok ] bluetooth is running.
xbian@xbian ~ $ pulseaudio --kill
E: [pulseaudio] main.c: Failed to kill daemon: No such process
xbian@xbian ~ $ pulseaudio --start
xbian@xbian ~ $ sudo bluetoothctl -a
[NEW] Controller B8:27:EB:B8:EB:AA xbian [default]
[NEW] Device 94:CE:2C:FA:1A:C7 SBH20
<------------------------- This is the audio device
Terminal
[NEW] Device 00:00:00:00:17:41 Caseflex BT Keyboard
Agent registered
[bluetooth]# power on
Changing power on succeeded
[CHG] Device 94:CE:2C:FA:1A:C7 Connected: yes
[CHG] Device 94:CE:2C:FA:1A:C7 Connected: no
[bluetooth]# connect 94:CE:2C:FA:1A:C7
Attempting to connect to 94:CE:2C:FA:1A:C7
[CHG] Device 94:CE:2C:FA:1A:C7 Connected: yes
Connection successful
[bluetooth]# quit

I have a feeling it was the pulseaudio bit that was the killer, as it was not running when I tried to kill it.
(13th May, 2016 12:48 AM)IriDium Wrote: [ -> ]I have a feeling it was the pulseaudio bit that was the killer, as it was not running when I tried to kill it.

That would make sense Smile
Just need someone else to confirm that it is now working.

If it turns out to be the case, we just have to figure out why it is not auto starting. Could it be that it expects systemd and not upstart?

Also is /etc/profile.d/xbian-load-pulseaudio.sh anything to do with it?

This might also be relevant:Pulseaudio
Pages: 1 2 3 4 5 6
Reference URL's