Logitech K380 Keyboard won't remember bluetooth pairing

Discussion of keyboards, gamepads, joysticks and other input related peripherals.
crabfists
Posts: 11
Joined: Fri Jun 05, 2020 9:20 am
Has thanked: 6 times
Been thanked: 1 time

Logitech K380 Keyboard won't remember bluetooth pairing

Unread post by crabfists »

Hello,

Has anybody managed to get a Logitch K380 keyboard to work reliably with MiSTer? The only way I can get it to work is by running the Bluetooth pairing script every time I want to use it. It won't reconnect automatically after I turn the keyboard off or restart the MiSTer. Also, after it's initially paired via the bluetooth script it fails to pair by using the F11 pairing dialog.

Running the bluetooth pairing script from the scripts menu gives me the following output:

Code: Select all

Got device: F4:73:35:40:D9:80
Pairing...

Removing existing pairing...
Pairing...
Authentication failed.
ERROR: Pairing failed
Add to trust list...
Connecting...
Done.
It pairs successfully even though it says pairing failed. I do not need to type any PIN number on the keyboard for it to pair. After this the keyboard works fine. However, if I reboot the MiSTer or turn the keyboard off and on again it fails to reconnect. If I try to pair again using the F11 pairing dialog I get this:

Code: Select all

Searching...

Found: Keyboard K380
MAC: F4:73:35:40:D9:80
Removing existing pairing...
Pairing...
Authentication failed.
ERROR: Pairing failed
After that pairing message the keyboard does not pair and fails to work. If I run the bluetooth pairing script again from the scripts menu it will start working again.

Keyboard used: Logitech K380 bluetooth keyboard
Bluetooth dongle(s): Belkin F8T065 and Aukru CSR 4.0 (CSR8510 based)
Hub: USB Hub 2.1 from misterfpga.co.uk
PSU: NorthPada 5V 3A

I've tried all the USB sockets in the hub with the same results. I've also unplugged every other USB device (except a controller needed to control the menu)

I have a Logitech K400 and that works fine without needing to pair, but then it has it's own USB receiver.

I also tried to use an Apple A1314 wireless keyboard but that has a similar issue, where it will not connect automatically once paired.

Is there a list of known working bluetooth keyboards that will reconnect automatically or is it pot-luck? Not sure if this is a software issue or a HW issue?
Another-Frank
Posts: 9
Joined: Tue Mar 02, 2021 7:39 pm
Has thanked: 7 times
Been thanked: 1 time

Re: Logitech K380 Keyboard won't remember bluetooth pairing

Unread post by Another-Frank »

I have the exact same problem using a Microsoft Wedge Mobile keyboard. Help would be much appreciated as I finally found a reason to use that keyboard :D
Another-Frank
Posts: 9
Joined: Tue Mar 02, 2021 7:39 pm
Has thanked: 7 times
Been thanked: 1 time

Re: Logitech K380 Keyboard won't remember bluetooth pairing

Unread post by Another-Frank »

I found a solution for my case, using the Wedge Mobile keyboard and keeping this error:

Code: Select all

Removing existing pairing...
Pairing...
Authentication failed.
ERROR: Pairing failed
Add to trust list...
Connecting...
Done.
By default, the Wedge Mobile expects a passcode for pairing. When trying to pair with MiSTer this way, I get the above output (I also tried entering 0000[Enter] and 1111[Enter] with no success). However, there is a way to start the pairing mode without a passcode by holding the FN key and the BT button as the same time. Pairing this way led to success! The keyboard is paired and connects automatically even after shut down.

If you have the same issue, see if your device has a specific pairing mode without using a passkey.
MrMr
Posts: 2
Joined: Tue Sep 14, 2021 4:38 am

Re: Logitech K380 Keyboard won't remember bluetooth pairing

Unread post by MrMr »

Thanks for the Wedge info as it got me on the right path for the K380 (and the Wedge is the other large(ish) Bluetooth keyboard I have as well).

Looks like the K380 has "OS-adaptive" functionality for Apple/iOS (Fn + I) and Windows/Android (Fn + P). It must default to Apple/iOS on MiSTer, but holding down the (Fn + P) combo for 3 seconds allowed the BT pairing script to properly prompt for the 6-digit pairing code. Never got it to pair before, but it pairs without a hitch for me now. Maybe the recent back-end update helped with this, too - I can't be sure.

Hope this helps!
DoubleA
Posts: 33
Joined: Sat Dec 26, 2020 8:11 am
Been thanked: 1 time

Re: Logitech K380 Keyboard won't remember bluetooth pairing

Unread post by DoubleA »

MrMr wrote: Tue Sep 14, 2021 5:03 am Maybe the recent back-end update helped with this, too - I can't be sure.
Yes, i think so.
Had the same problem with my Logitech Y-X5A77.
But since last update i've been prompted with a 6 digit pin.
And that did the trick.
Had almost lost hope :-) ...
kahuna
Posts: 7
Joined: Sun Sep 26, 2021 5:24 am
Been thanked: 5 times

Re: Logitech K380 Keyboard won't remember bluetooth pairing

Unread post by kahuna »

Hi all,
First post here!

I also have a K380, I can pair it to my Linux laptop running Mint without any issues.
However, when I try to do the same with the MiSTer, I never got a message asking for the PIN, it just fails (see below).

Note: I updated to the latest MiSTer distro tonight, which changed the bluetooth pairing stuff.
Before the software upgrade, I experienced the same behaviour that was reported in this post, i.e. it was working but MiSTer forgot the pairing when I powered off the system.

Any ideas?
Thanks!

Code: Select all

/root# bluetooth_pair.sh 
Switch input devices(s)
to pairing mode.

Press Finish when done

Searching...

NAME: Keyboard K380
MAC:  F4:73:35:59:1C:7A

Pairing...
Authentication Canceled
Pair error!
kahuna
Posts: 7
Joined: Sun Sep 26, 2021 5:24 am
Been thanked: 5 times

Re: Logitech K380 Keyboard won't remember bluetooth pairing

Unread post by kahuna »

Hey folks.

Has anyone tried Bluetooth pairing recently?
I think it’s a nasty bug since the Kernel was updated to 5.x and the Bluetooth_pair.sh was updated as well. Specially with devices that don’t use 0000 as password.

Thanks.
kahuna
Posts: 7
Joined: Sun Sep 26, 2021 5:24 am
Been thanked: 5 times

Re: Logitech K380 Keyboard won't remember bluetooth pairing

Unread post by kahuna »

Hello again,
I'm still struggling with this issue. Altough, I made some progress.

So, it seems the bluetoot_pair.sh calls the /sbin/btpair script, which actually executes /sbin/btpair.

I have enabled debug logging level on the /sbin/btpair python script.
The issue is that instead of prompting me to type the connection password, as happens for instance when I connect this keyboard to my Linux laptop, it just assumes "0" which is not the right key and therefore the pairing fails. See below:

Code: Select all

Searching...

DEBUG: <module>: Agent registered
NAME: Keyboard K380
MAC:  F4:73:35:59:1C:7A

DEBUG: <module>: new device: F4:73:35:59:1C:7A /org/bluez/hci0/dev_F4_73_35_59_1C_7A
Pairing...
DEBUG: DisplayPasskey: DisplayPasskey (/org/bluez/hci0/dev_F4_73_35_59_1C_7A, 168020 entered 0)
Authentication Canceled
Pair error!
Any ideas to solve this issue?
Is there anyway to open a bug about this behaviour?

Thanks!
kahuna
Posts: 7
Joined: Sun Sep 26, 2021 5:24 am
Been thanked: 5 times

Re: Logitech K380 Keyboard won't remember bluetooth pairing

Unread post by kahuna »

Alright, I managed to get it working. Instead of using the provided bluetooth_pair.sh script and all the other scripts that are called from this one... I'm just using the standard bluetoothctl.
The configuration remains after reboots, power off / power on. I do not need to pair my input devices everytime I reboot the MiSTer.

These are the steps I followed, in case helps:
Connected over SSH to the MiSTer and run bluetoothctl, then did the following:
agent on
advertise on


On my Logitech K380 Keyboard I pressed Fn + P to get it in an Android/PC type of configuration.
Then I pressed F1 (yellow bluetooth 1) until the led starts blinking fast.
This may change or not be needed, if you have a different keyboard.

Going back to the bluetoothctl prompt, ran the following:
scan on
pair F4:73:35:59:1C:7A
(that's my keyboard's MAC, yours will be similar, but different)

Then it prompted me to type the code, which you have to type in your bluetooth keyboard.

Final steps:
scan off
connect F4:73:35:59:1C:7A
trust F4:73:35:59:1C:7A


Hope it helps!

Reference: https://ubuntu.com/core/docs/bluez/refe ... troduction
filkry
Posts: 1
Joined: Fri Dec 24, 2021 3:56 am
Has thanked: 1 time

Re: Logitech K380 Keyboard won't remember bluetooth pairing

Unread post by filkry »

Thank you kahuna, thanks to your post I was able to get my keyboard paired nicely with my MiSTer.
thorr
Posts: 627
Joined: Mon Jul 06, 2020 9:37 pm
Has thanked: 245 times
Been thanked: 119 times

Re: Logitech K380 Keyboard won't remember bluetooth pairing

Unread post by thorr »

Thanks kahuna. In my case there were some extra characters printed in my ssh session that caused me to overlook that it was prompting me the code to type into my keyboard. Once I saw the numbers, I typed them in and hit enter and it worked! It is NOT 0000. Thanks!!
Post Reply