20.04 - Logitech MX Keys won't pair with Bluetooth

I am using Ubuntu 20.04.1 and I am trying to pair my MX Keys keyboard via Bluetooth.

I start the process with the Bluetooth control panel, and I get stuck in this window.

enter image description here

Even though I type the right PIN and press ENTER, still the process does not complete. In fact, it gets stuck in that mode, with the PIN window unable to be closed.

I have also tried using "Blueman" with a similar result. I start the "Setup" process, and this is what I get in the end.

enter image description here

I have also tried with bluetoothctl

➜ bluetoothctl connect CB:DD:B4:5C:4E:E3
Attempting to connect to CB:DD:B4:5C:4E:E3
[CHG] Device CB:DD:B4:5C:4E:E3 Connected: yes
Connection successful

~ took 8s 
➜ bluetoothctl trust CB:DD:B4:5C:4E:E3
[CHG] Device CB:DD:B4:5C:4E:E3 Trusted: yes
Changing CB:DD:B4:5C:4E:E3 trust succeeded

~ 
➜ bluetoothctl pair CB:DD:B4:5C:4E:E3
Attempting to pair with CB:DD:B4:5C:4E:E3
[CHG] Device CB:DD:B4:5C:4E:E3 ServicesResolved: yes
[CHG] Device CB:DD:B4:5C:4E:E3 ServicesResolved: no
[CHG] Device CB:DD:B4:5C:4E:E3 Connected: no
Failed to pair: org.bluez.Error.AuthenticationCanceled

~ took 30s 

What could be done about it, to get it to work?

UPDATE

I have managed to get a PIN with bluetoothctl if I reset Bluetooth in my PC, but even if I type the PIN, the authentication fails. It is as if it was ignoring what I type...

[bluetooth]# pair CB:DD:B4:5C:4E:E3
Attempting to pair with CB:DD:B4:5C:4E:E3
[CHG] Device CB:DD:B4:5C:4E:E3 Connected: yes
[agent] Passkey: 610148
[CHG] Device CB:DD:B4:5C:4E:E3 Connected: no
Failed to pair: org.bluez.Error.AuthenticationCanceled

I fixed it, installing some missing firmware. All I had to do is run this command:

cd /lib/firmware/brcm && sudo wget https://github.com/winterheart/broadcom-bt-firmware/raw/master/brcm/BCM20702A1-0a5c-21e8.hcd

and unplug and plug again my bluetooth dongle


I had the same kind of issue with a Lenovo keyboard. basically I could enter the pin code but after hitting return nothing happened.

$bluetoothctl
[bluetooth]# agent KeyboardDisplay
[bluetooth]# default-agent 
[bluetooth]# scan on
[bluetooth]# pair <MAC-address>
Attempting to pair with <MAC-address>
[CHG] Device <MAC-address> Connected: yes
[agent] Passkey: xxxxxx
[agent] Passkey: xxxxx
[agent] Passkey: xxxx
[agent] Passkey: xxx
[agent] Passkey: xx
[agent] Passkey: x
[agent] Passkey: 
[CHG] Device <MAC-address> Modalias: usb:<ALIAS>
[CHG] Device <MAC-address> UUIDs: <UUID>
[CHG] Device <MAC-address> ServicesResolved: yes
[CHG] Device <MAC-address> Paired: yes
Pairing successful
[CHG] Device <MAC-address> ServicesResolved: no
[CHG] Device <MAC-address> Connected: no
[CHG] Device <MAC-address> Class: 0x00000540
[CHG] Device <MAC-address> Icon: input-keyboard
[CHG] Device <MAC-address> Connected: yes
Authorize service
[agent] Authorize service <UUID> (yes/no): yes

It looks like the last step [agent] Authorize serviceis not shown in the GUI