14

When trying to connect a new device through the Raspberry Pi I take the following steps without success. I can re-pair as many times as I want with any device, but I can never connect.

Other devices can create a connection with the Pi when it's discoverable (after being paired).

[bluetooth]# discoverable on
Changing discoverable on succeeded
[CHG] Controller 33:22:11:CC:BB:AA Discoverable: yes
[bluetooth]# pairable on
Changing pairable on succeeded
[bluetooth]# agent on
Agent registered
[bluetooth]# default-agent 
Default agent request successful
[bluetooth]# pair AA:BB:CC:11:22:33
Device AA:BB:CC:11:22:33 not available
[NEW] Device AA:BB:CC:11:22:33 Pixel XL
Request confirmation
[agent] Confirm passkey 123456 (yes/no): yes
[CHG] Device AA:BB:CC:11:22:33 Modalias: bluetooth:v000Fpw83523957
[CHG] Device AA:BB:CC:11:22:33 UUIDs:
        [[UUIDS-123456-234324-25325-23532523tu]]
[CHG] Device AA:BB:CC:11:22:33 Paired: yes
[bluetooth]# connect AA:BB:CC:11:22:33
Attempting to connect to AA:BB:CC:11:22:33
Failed to connect: org.bluez.Error.Failed
[CHG] Device AA:BB:CC:11:22:33 Connected: no
[CHG] Controller 33:22:11:CC:BB:AA Discoverable: no

This is a Raspberry Pi3 and the version info from bluetooth ctl is here:

Version 5.23
jkfuyaflkjd
  • 411
  • 1
  • 3
  • 9

4 Answers4

17

So it turns out that when I looked into the bluetoothctl logs on the Raspberry Pi that I was getting this error:

a2dp-source profile connect failed for AA:BB:CC:11:22:33: Protocol not available

You can look this by running:

sudo cat /var/log/syslog | grep -i protocol 

Which is reported all over the internet as being resolveable through this command:

pactl load-module module-bluetooth-discover

Which gives THIS error:

Failure: Module initialization failed

This answer here resolved my issue with that command (I added 2 more steps after for clarity): https://askubuntu.com/a/689297/82021

After performing the file modifications in this answer do the following:

  1. Reboot your Pi
  2. pactl load-module module-bluetooth-discover

After all this, I can now pair AND connect any bluetooth device using Raspbian on my RPi3.

jkfuyaflkjd
  • 411
  • 1
  • 3
  • 9
6

I realize this is over 3 years old now, but after looking at the answers given here, I found that I didn't even have pulse audio installed (Pi OS Lite (Buster) on RPi4).

After installing bluez-tools and pulseaudio, I was able to run: pactl load-module module-bluetooth-discover and got the error: Failure: Module initialization failed

I started installing pulse audio modules one by one (eg. pulseaudio-module-bluetooth), but in the end decided they all looked pretty important for future shenanigans. This resolved all issues for me:

sudo apt-get install pulseaudio*

result:

~$ pactl load-module module-bluetooth-discover

20

1

I solved this fixing two things:

  1. Changes the permissions at /etc/dbus-1/system.d/bluetooth.conf
    I crudely changed the default permission to allow. A more elgant solution is probably possible.

    <policy context="default"> <allow send_destination="org.bluez"/>
    </policy>

2. A timing bug fixed by running this:

  pactl unload-module module-bluetooth-discover
  pactl load-module module-bluetooth-discover

YMMV

Ronenz
  • 111
  • 1
0

On my Raspberry Pi 2 running Debian stretch armv7, I had to install bluez-utils from https://packages.debian.org/wheezy/all/bluez-utils/download as apt-get install did not find such a packet.

Chetan Bhargava
  • 1,252
  • 3
  • 15
  • 29