Thomas' Tech Tips

How to pair bluetooth device with LibreElec using bluetooth authentication code

13 November 2022 - Thomas Damgaard

I recently tried pairing my Logitech MX Keys bluetooth keyboard with my LibreElec running on a raspberrypi.

While there are GUI controls to connect and pair with bluetooth devices, it seems it is not fully implemented yet as bluetooth authentication codes does not seem to work.

What happens when I set my keyboard in pairing mode and go to Settings -> LibreElec -> Bluetooth is that it finds my bluetooth keyboard just fine. I can then select it and click Pair.

Then I am asked to “Enter this code on your device”. And then no actual code is visible.

It seems that it is not possible to do this using GUI.

How I made it work was using the following procedure:

  1. While in the LibreElect Bluetooth GUI, make a note of the bluetooth MAC address of your device.
  2. Then enable SSH if you have not already done so.
  3. Then using another machine, ssh into your LibreElec device using ssh root@<your device address>. Default password for root is libreelec.
  4. Run bluetoothctl as root.

This will open a bluetoothctl prompt. Now type in the following commands:

# bluetoothctl
Agent registered
[bluetooth]# scan on
...
[bluetooth]# trust xx:xx:xx:xx:xx:xx
Changing C9:59:32:F7:14:D5 trust succeeded

[bluetooth]# pair xx:xx:xx:xx:xx:xx

Look for the following bit in the output:

[agent] Passkey: 123456

Now enter that code on your keyboard or device.

Wait to see this in the log:

Pairing successful

You have now successfully trusted and paired with your device.

Filed under: bluetooth, hardware, howto, libreelec, tips

Back to article list