Help using USB bluetooth dongle to connect to bluetooth speakers

Hi,

I wanna use an USB bluetooth dongle to send audio to a bluetooth speaker.

I'm running 18.06 version

After reading this and this, I installed these modules:

kmod-input-uinput
pulseaudio
sbc
bluez5
dbus
kmod-bluetooth
bluez-libs
bluez-utils
kmod-usb-core
kmod-usb-uhci
kmod-usb2
usbutils
bluez-daemon

The USB device is detected flawesly and with bluetoothctl command I run these commands without issues

agent on
power on
scan on
pair XX:XX:XX:XX:XX:XX

but when I execute the connect command

connect XX:XX:XX:XX:XX:XX

It shows this error

Attempting to connect to XX:XX:XX:XX:XX:XX
Failed to connect: org.bluez.Error.Failed

The logread shows me this message

daemon.err bluetoothd[21134]: a2dp-sink profile connect failed for XX:XX:XX:XX:XX:XX: Protocol not available

I've read that this error occurs when pulseaudio-bluetooth module is not installed, but this module is not available in openwrt.

Anybody knows if it is possible to solve this?

Thanks in advanced

1 Like

Some advance.

I see that with pulseaudio-daemon there is not a bluetooth module in /usr/lib/pulse-11.1/modules

Then, I saw that there is a package named pulseaudio-daemon-avahi

**pulseaudio-daemon-avahi - 11.1-2** - PulseAudio (formerly Polypaudio) is a cross-platform, networked sound server. This package enables avahi,bluez and is compiled against dbus, sbc, and avahi.

When it is installed there is these modules

/usr/lib/pulse-11.1/modules/module-bluetooth-discover.so
/usr/lib/pulse-11.1/modules/module-bluetooth-policy.so

I edited the file /etc/pulse/system.pa with the content that says in bluetooth.audio page

#!/usr/bin/pulseaudio -nF
#
# This file is part of PulseAudio.

### Automatically load driver modules depending on the hardware available
.ifexists module-detect.so

### Use the static hardware detection module (for systems that lack udev/hal support)
load-module module-detect
.endif

### Automatically restore the volume of streams and devices
load-module module-stream-restore
load-module module-device-restore
load-module module-card-restore


### Automatically restore the default sink/source when changed by the user
### during runtime
### NOTE: This should be loaded as early as possible so that subsequent modules
### that look up the default sink/source get the right value
# load-module module-default-device-restore

### Bluetooth
load-module module-bluetooth-discover
load-module module-bluetooth-policy

load-module module-zeroconf-publish

### Should be after module-*-restore but before module-*-detect
load-module module-switch-on-port-available

### Automatically move streams to the default sink if the sink they are
### connected to dies, similar for sources
load-module module-rescue-streams

### Make sure we always have a sink around, even if it is a null sink.
load-module module-always-sink

### Honour intended role device property
load-module module-intended-roles

### Automatically suspend sinks/sources that become idle for too long
load-module module-suspend-on-idle

### Enable positioned event sounds
load-module module-position-event-sounds

### Load several protocols
.ifexists module-esound-protocol-unix.so
load-module module-esound-protocol-unix
.endif
load-module module-native-protocol-unix auth-group=pulse-access

### Load the RTP receiver module (also configured via paprefs, see above)
load-module module-rtp-recv

### Load the RTP sender module (also configured via paprefs, see above)
load-module module-null-sink sink_name=rtp format=s16be channels=2 rate=44100 sink_properties="device.description='RTP Multicast Sink'"
load-module module-rtp-send source=rtp.monitor

### Modules to allow autoloading of filters (such as echo cancellation)
### on demand. module-filter-heuristics tries to determine what filters
### make sense, and module-filter-apply does the heavy-lifting of
### loading modules and rerouting streams.
load-module module-filter-heuristics
load-module module-filter-apply

#load-module module-loopback source=bluez_source.AA_BB_CC_DD_EE_FF sink=_name=alsa_output.0.analog-stereo rate=44100 adjust_time=0

However, it doesn't work

It seems than the pulseaudio daemon doesn't start. When I try to start it shows this:

W: [pulseaudio] main.c: Running in system mode, but --disallow-exit not set.
W: [pulseaudio] main.c: Running in system mode, but --disallow-module-loading not set.
N: [pulseaudio] main.c: Running in system mode, forcibly disabling SHM mode.
N: [pulseaudio] main.c: Running in system mode, forcibly disabling exit idle time.
W: [pulseaudio] main.c: OK, so you are running PA in system mode. Please make sure that you actually do want to do that.
W: [pulseaudio] main.c: Please read http://www.freedesktop.org/wiki/Software/PulseAudio/Documentation/User/WhatIsWrongWithSystemWide/ for an explanation why system mode is usually a bad idea.
W: [pulseaudio] module.c: module-detect is deprecated: Please use module-udev-detect instead of module-detect!
W: [pulseaudio] module-detect.c: failed to detect any sound hardware.
E: [pulseaudio] module.c: Failed to load module "module-detect" (argument: ""): initialization failed.
E: [pulseaudio] main.c: Module load failed.
E: [pulseaudio] main.c: Failed to initialize daemon.

I forgot to mention that the goal is to send some text-to-speech sentences when occurs some triggers

Nobody thought to make this? :innocent:

1 Like

Hi TMT,
after Years I've got it working.

Do you have edited the init script of pulseaudio ? /etc/init.d/pulseaudio

The Wiki Howto [1] is still working for me. Except the /etc/mpd.conf output section.

Therefore you have to pic some steps out of this Howto [2] .

The clue is, to make the pulseaudio visible in the network and connect mpd to it.

[1] https://openwrt.org/docs/guide-user/hardware/bluetooth/bluetooth.audio
[2 ]https://openwrt.org/docs/guide-user/hardware/audio/pulseaudio

1 Like