Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Cannot pair UHK80 via Bluetooth to my Linux laptop via settings UI #999

Open
mhantsch opened this issue Sep 14, 2024 · 22 comments · May be fixed by #1108
Open

Cannot pair UHK80 via Bluetooth to my Linux laptop via settings UI #999

mhantsch opened this issue Sep 14, 2024 · 22 comments · May be fixed by #1108
Assignees

Comments

@mhantsch
Copy link
Contributor

Framework Laptop 13 running Pop_OS! 22.04 (based on Ubuntu 22.04).

I am trying to connect & pair the UHK80. It shows up in the Bluetooth settings as "Not set up" but when I click on it, nothing happens. I don't get prompted with pairing code, nor does the UHK show anything.

Pairing works fine from my Android phone.

If I try manually from commandline, I see this:

(base) max@max-framework:~/src/lampster$ bluetoothctl pair D2:89:0A:CA:61:05
Attempting to pair with D2:89:0A:CA:61:05
[CHG] Device D2:89:0A:CA:61:05 Connected: yes
[CHG] Device D2:89:0A:CA:61:05 Connected: no
Failed to pair: org.bluez.Error.AuthenticationCanceled

However, if I manually just issue a "connect", it then starts pairing:

(base) max@max-framework:~/src/lampster$ bluetoothctl connect D2:89:0A:CA:61:05
Attempting to connect to D2:89:0A:CA:61:05
[CHG] Device D2:89:0A:CA:61:05 RSSI: -53
[CHG] Device D2:89:0A:CA:61:05 Connected: yes
Connection successful

So I finally got it to pair and it works fine now, but I couldn't have done that through the UI.
Seems like there is still room for improvement.

Let me know how I can provide you with further traces, or anything else you need.

@mhantsch mhantsch changed the title Cannot pair UHK80 via Bluetooth to my Linux laptop Cannot pair UHK80 via Bluetooth to my Linux laptop via settings UI Sep 14, 2024
@mondalaci
Copy link
Member

For me, pairing works from blueman-manager 2.4, but it's not intuitive.

When I first tried it, I entered the pairing code on my UHK. But by then, the pairing notification disappeared on Linux Mint, making me forget to pair it on my PC, so pairing didn't succeed, seemingly for no reason.

Later, I retried pairing and realized that I should open my notifications. When confirming the pairing on my PC, it immediately worked.

Which GUI do you use exactly, and have you confirmed pairing on your laptop?

@mhantsch
Copy link
Contributor Author

mhantsch commented Sep 15, 2024

I am using the Pop_OS! system configuration UI. It looks like this:

image of Bluetooth settings

You can see that the UHK 80 is currently "Not Set Up". That is because I just disconnected and removed it, so it's now considered unknown, unconnected, and unpaired. I can now reproduce the issue. On other BT devices, I just click on the entry and it would start pairing mode, I'd be asked for passkeys etc. until the device is connected and paired.

With the UHK 80, I can click on the entry and I get a spinner for about 1 second, then it goes back as "Not Set Up". Nothing happens on the UHK; I don't get prompted to enter anything.

I then tried the above sequence again (bluetoothctl connect D2:89:0A:CA:61:05) but this time the pairing did not come up. I tried a few variants but I couldn't get the UHK to start pairing.

Then I tried again with my Android phone, and the pairing started. I stopped it on the phone, and entered an incorrect code on the UHK.

After that, the bluetoothctl connect D2:89:0A:CA:61:05 command started pairing, the Laptop displayed a pairing code, and I entered that on the UHK and now it's paired again.

It's certainly not correct that I need an Android device first to get the UHK to start pairing with my Linux Laptop.

@mondalaci
Copy link
Member

Please check the executable name of this configuration GUI. I'd install it on Linux Mint and try to reduce it. In any case, I'm curious about the exact application.

@mhantsch
Copy link
Contributor Author

Oh I also want to mention that some of my pairing and connection attempts got the right half to reboot. At least that's what I think it did. The backlight went out for 1-2 seconds and then everything came back.

The settings app is "GNOME Settings". There's a Bluetooth section in there.

@mondalaci
Copy link
Member

I've reproduced the issue using Gnome settings.

On the first connection attempt, Zephyr crashed:

uhk80:right$ I: BAS Notifications enabled
Connected to unknown (e8:9c:25:57:11:5f)
assertion "false" failed: file "WEST_TOPDIR/firmware-uhk80/device/c2usb/c2usb/port/zephyr/udc_mac.cpp", line 353, function: void usb::df::zephyr::udc_mac::process_ep_event(net_buf*)
abort()
E: r0/a1:  0x00000004  r1/a2:  0x00000000  r2/a3:  0x00000000
E: r3/a4:  0x0005a675 r12/ip:  0x00075fed r14/lr:  0x00048a45
E:  xpsr:  0x41000000
E: r4/v1:  0x000928e4  r5/v2:  0x00092714  r6/v3:  0x00000000
E: r7/v4:  0x00000081  r8/v5:  0x00000000  r9/v6:  0x00000000
E: r10/v7: 0x00000000  r11/v8: 0x00000000    psp:  0x20032468
E: EXC_RETURN: 0x0
E: Faulting instruction address (r15/pc): 0x00048a50
E: >>> ZEPHYR FATAL ERROR 4: Kernel panic on CPU 0
E: Current thread: 0x2000e230 (c2usb)
*** Booting nRF Connect SDK v3.5.99-ncs1-1-3-g14e7c2ccfad0 ***
----------
UHK 80 right half started
...

Right afterward, however, I could pair my UHK 80 on the second attempt from the GUI.

We'll fix this firmware bug.

@benedekkupper
Copy link
Contributor

I need to know whether you had the right half connected over USB at the time of pairing.

@mondalaci
Copy link
Member

@benedekkupper I had the right half connected over USB during pairing.

@benedekkupper
Copy link
Contributor

How does it behave if you don't have it connected?

@mondalaci
Copy link
Member

According to my limited testing, I can't reproduce this bug if USB is disconnected.

@mhantsch How about you?

@mhantsch
Copy link
Contributor Author

I don't remember. I'll have to retest.

In any case it shouldn't behave like that.

@mhantsch
Copy link
Contributor Author

I tried reproducing it today with and without the USB cable connected. But after installing firmware 11.1.0 #64396d1 I was not able to pair with bluetooth at all.

@mhantsch
Copy link
Contributor Author

When I have USB disconnected, I get this:

(base) max@max-framework:~/src/keylightd$ bluetoothctl connect D2:89:0A:CA:61:05
Attempting to connect to D2:89:0A:CA:61:05
[CHG] Device D2:89:0A:CA:61:05 Connected: yes
Connection successful
(base) max@max-framework:~/src/keylightd$ bluetoothctl pair D2:89:0A:CA:61:05
Attempting to pair with D2:89:0A:CA:61:05
[CHG] Device D2:89:0A:CA:61:05 Connected: yes
[CHG] Device D2:89:0A:CA:61:05 Connected: no
Failed to pair: org.bluez.Error.AuthenticationCanceled

From the UI it also does not start the pairing.

If I have USB connected then the right half will restart when I try to connect or pair.

@mhantsch
Copy link
Contributor Author

I've finally - after lots of tinkering around with UI clicking and occasional bluetoothctl commands - suddenly got my UHK80 to pair to my Laptop again, and I can use it over bluetooth. But it's a weird process. From time to time, I can see two devices, both named "UHK 80" in my bluetooth selection window. I am assuming one is the left half and the other is the right half? Or one is the mouse interface and the other is the keyboard interface? They have two different bluetooth mac addresses.

I'm now scared to ever forget the pairing on my Laptop again as it was so tiring and needed many attempts to get it to show a pairing code.

I don't know what made it do the pairing now.

@mondalaci
Copy link
Member

Do these two devices have different icons?

@mhantsch
Copy link
Contributor Author

There are no icons in my UI:

image

@mhantsch
Copy link
Contributor Author

Only connected and paired devices get icons in a different part of the UI:

image

But unfortunately, you don't see these if you are trying to connect and pair a new device.

@mondalaci
Copy link
Member

I can see this on Android:

image

Pairing only works if I click on the entry with the keyboard icon.

@benedekkupper Why do we see two entries? It's confusing from a user standpoint, and only one should be shown.

@kareltucek
Copy link
Collaborator

I expect one of them is the Nus advertisement.

I have made uhk advertise both interfaces all the time given that we want to allow connecting multiple hosts. (Yes I know you prefer different implementation, but let's go with the simpler one for the moment.)

@mhantsch
Copy link
Contributor Author

Can we at least give them different names? As in "UHK 80 keyboard" and "UHK 80 control", and on systems that do not show the icons you would at least know to click on the entry that says "UHK 80 keyboard"?

@mondalaci
Copy link
Member

We can probably do better by tweaking advertising parameters so that only the relevant connection appears. But first, let's wait for @benedekkupper's answer to be sure what's causing this issue.

@mhantsch
Copy link
Contributor Author

mhantsch commented Dec 1, 2024

The problem with pairing bluetooth keyboards to Linux seems to affect ZMK too. And indeed, I cannot pair my ErgoTravel keyboard using SuperMini nRF52840 boards (compatible to nice!nano) and running ZMK firmware. Here is the corresponding issue from ZMK where people are reporting the same errors that I have been seeing with the UHK 80:

zmkfirmware/zmk#1487

@mondalaci mondalaci transferred this issue from UltimateHackingKeyboard/firmware80 Dec 12, 2024
@benedekkupper benedekkupper linked a pull request Jan 31, 2025 that will close this issue
@mhantsch
Copy link
Contributor Author

mhantsch commented Feb 1, 2025

For reference, for my ZMK keyboard, compiling the ZMK firmware with CONFIG_ZMK_BLE_EXPERIMENTAL_FEATURES=y fixed all Bluetooth related issues. It connects, pairs, and works flawlessly and reliably with multiple hosts running Linux and Windows 11.

The UHK 80 still doesn't pair to the same Laptop.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants