Fix for Raspberry Pi not connecting to Bluetooth keyboard

problem

I tried connecting my Anne Pro 2 (bluetooth keyboard) to Raspberry pi 4B with no luck, getting errors like org.bluez.failed.

solution

SSH into Raspberry from other computer ssh pi@raspberrypi (or whatever hostname you have set). Now do the whole bluetooth dance:

bluetoothctl
scan on

Wait for it to find your keyboard and then:

pair [YOUR_KEEB_MAC]
trust [YOUR_KEEB_MAC]
connect [YOUR_KEEB_MAC]

Now you’ll probably get the error I was talking about org.bluez.failed.

actual solution

  1. sudo su
  2. cd /var/lib/bluetooth/[SOME_MAC_ADDRESS]/[YOUR_KEEB_MAC]
  3. vi info

You’ll see something like this:

[General]
Name=ANNE PRO 2
SupportedTechnologies=BR/EDR;
Trusted=true
Blocked=false

Now add these lines starting with Class and Services as in this snippet:

[General]
Name=ANNE PRO 2
Class=0x000540
SupportedTechnologies=BR/EDR;
Trusted=true
Blocked=false
Services=00001000-0000-1000-8000-00805f9b34fb;00001124-0000-1000-8000-00805f9b34fb;00001200-0000-1000-$
  1. Exit vim :wq or shift+zz
  2. systemctl restart bluetooth.service

Do the bluetoothctl dance once again:

  1. sudo bluetoothctl
  2. remove [YOUR_KEEB_MAC]
  3. pair [YOUR_KEEB_MAC]
  4. trust [YOUR_KEEB_MAC]
  5. connect [YOUR_KEEB_MAC]

should work now