Page 1 of 1

Pulseaudio does not automatically discover bluetooth sink

Posted: Tue Jan 31, 2017 7:12 pm
by pwalden
I have pulseaudio working on my headless Pi3 with a bluetooth speaker.

However, if the speaker is powered off and then on, although it automatically reconnects through bluetooth (as seen by bluetoothctl), the pulseaudio no longer lists it as a sink.

I have to use bluetoothctl to disconnect and (re)connect the device. Only then will pulseaudio (re)list the bluetooth speaker as a sink.

Am I missing some set up or configuration?

Code: Select all

$ uname -a
Linux walden0 4.4.38-v7+ #938 SMP Thu Dec 15 15:22:21 GMT 2016 armv7l GNU/Linux

Code: Select all

$ pactl list short modules
0	module-device-restore		
1	module-stream-restore		
2	module-card-restore		
3	module-augment-properties		
4	module-switch-on-port-available		
5	module-udev-detect		
6	module-alsa-card	device_id="0" name="0" card_name="alsa_card.0" namereg_fail=false tsched=yes fixed_latency_range=no ignore_dB=no deferred_volume=yes use_ucm=yes card_properties="module-udev-detect.discovered=1"	
7	module-bluetooth-policy		
8	module-bluetooth-discover		
9	module-bluez5-discover		
10	module-bluez4-discover		
11	module-native-protocol-unix		
12	module-native-protocol-tcp	auth-anonymous=1	
13	module-zeroconf-publish		
14	module-gconf		
15	module-default-device-restore		
16	module-rescue-streams		
17	module-always-sink		
18	module-intended-roles		
19	module-suspend-on-idle		
20	module-console-kit		
21	module-systemd-login		
22	module-position-event-sounds		
23	module-role-cork		
24	module-filter-heuristics		
25	module-filter-apply		
27	module-cli-protocol-unix		
28	module-bluez5-device	path=/org/bluez/hci0/dev_FC_58_FA_B8_1D_46	

Re: Pulseaudio does not automatically discover bluetooth sin

Posted: Wed Mar 01, 2017 4:33 pm
by pwalden
I have not solved my problem, but I use the script below to reconnect the device to pulseaudio.

Code: Select all

#! /bin/bash
if ! pactl list sinks short | grep bluez >/dev/null;
then
    echo bluez sink not found, attempting to disconnect-reconnect;
    while ! pactl list sinks short | grep bluez >/dev/null;
    do
        echo loop begin
        bluetoothctl <<EOF
disconnect FC:58:FA:B8:1D:46
quit
EOF
        sleep 10
        bluetoothctl <<EOF
connect FC:58:FA:B8:1D:46
quit
EOF
        sleep 10
    done
    pactl set-default-sink bluez_sink.FC_58_FA_B8_1D_46
    pactl set-sink-volume bluez_sink.FC_58_FA_B8_1D_46 32000
else
    echo bluez sink found
fi