Bluetooth security failing on windows machine
I've been using a split/nice!nano handwired built for a few months already with no issues on my personal PC. On the other hand, The keyboard pairs correctly with the my work laptop but doesn't send any keypresses. Both of these are windows 10 machines. I finally took the initiative to enable debugging and saw this happen constantly (a couple of times per second)
[00:25:58.514,068] <err> zmk: Security failed: <redacted> (public) level 1 err 2
[00:25:58.639,770] <dbg> zmk.split_central_disconnected: Disconnected: <redacted> (public) (reason 19)
[00:25:58.639,831] <dbg> zmk.disconnected: Disconnected from <redacted> (public) (reason 0x13)
[00:25:58.639,862] <dbg> zmk.update_advertising: advertising from 2 to 2
[00:25:58.678,680] <dbg> zmk.split_central_connected: Connected: <redacted> (public)
[00:25:58.678,680] <dbg> zmk.split_central_process_connection: Current security for connection: 1
[00:25:58.679,901] <dbg> zmk.split_central_process_connection: New connection params: Interval: 48, Latency: 0, PHY: 1
[00:25:58.679,992] <dbg> zmk.connected: Connected thread: 0x20002e40
[00:25:58.679,992] <dbg> zmk.connected: Connected <redacted> (public)
[00:25:58.680,023] <dbg> zmk.update_advertising: advertising from 0 to 2
I may have the beginning/end of the log wrong but this is still the part that repeats. Does anybody know what the problem could be? Is there anything else I can I do to find more data about the problem?
Have you tried switching the bluetooth profile for your work machine? It's right here in the docs https://zmkfirmware.dev/docs/behaviors/bluetooth/#bluetooth-pairing-and-profiles
I've tried these two scenarios
Personal + work PCs
- Pair personal PCs on profile 0 (keyboard pairs and connects)
- Pair work PC on profile 1 (keyboard only pairs, shows the logs in the description)
Only work PC
- Clear all profiles
- Pair work PC on profile 0 (keyboard only pairs, shows the logs in the description)
Maybe related: I've noticed an issue when using BT_CLR you have to remove+repair the paired device from the list and restart the pc before it will register input.
It may be worth doing a full settings clear and trying again without touching BT_CLR https://zmkfirmware.dev/docs/troubleshooting/#split-keyboard-halves-unable-to-pair
This is not a new problem BTW. I've dealt with it for around 5 months. I've done all the permutations of resets (BT_CLR and flashing), restarts and even tried a separate bluetooth dongle. No luck.
The other thing I've noticed though is some of the time the board will just not pair at all after clearing. I get the message "Couldn't connect. Try connecting again."
I'm having the same problem with my nrf52840 based custom board, it will connect, allow me to type a couple inputs, and then disconnects, on both my mac and my iphone.
I'm having the same problem with my nrf52840 based custom board, it will connect, allow me to type a couple inputs, and then disconnects, on both my mac and my iphone.
I seem to have a different problem than yours. Windows displays the device as connected briefly but it never detects any input.
I just rebuilt and flashed firmware with latest ZMK hoping that maybe the zephyr 2.5 thing fixed the issue but it didn't. Is there something else I can do to further debug this problem? It's kind of a bummer that I have this wireless keyboard that I can't use wirelessly... I was considering building another one but I'm having doubts since it's likely going to have the same problem.
Edit: added reply to @Kikokeyco
I just tested my board with BlueMicro and that firmware does connect to the work laptop successfully.
I got the same problem.On Windows it can’t detect any input.But on my Ubuntu,and my IOS,it works.Also,I tested my keyboard with BlueMicro on my Windows,it works, too .
Just to add to the list here, I have experienced the same thing. I have tested two different keyboards on 6 different devices.
Consistent behavior between Keyboard A and Keyboard B (both nice!nanos). All machines are Windows or Android OS:
- Laptop 1 (personal, windows 10) - Failed
- Laptop 2 (work, windows 11) - Success
- Laptop 3 (personal / kids, windows 10) - Success
- Desktop (personal, windows 11) - Failed
- Phone - Success
- Tablet - Success
Similar to comments above, I have tried clearing profiles, flashing the reset settings uf2, clearing and re-pairing. I even tried connecting after a full reformat and reinstallation of windows on the personal laptop 1. Consistent behavior.
@sadekbaroudi Are you sure your BT adapters support BLE? It needs to support BT version 4.2 for the security ZMK uses, if I remember correctly.
@caksoylar I went and checked bluetooth versions on all my laptops / desktop. Interestingly, the ones that work are Bluetooth 5.0, and the ones that don't are Bluetooth 5.2
I see, following this my adapter (AX200-based PCIe) reports LMP 11.9210 which indicates 5.2 also; it worked on both Windows 10 and 11. Maybe it is some other factor.
Thanks for confirming that!
I also have had alot of trouble with a BT60. I have done every possible combination of clearing profiles, using reset firmware, etc, and have also done usb logging, tried different zmk versions, etc. For me it is also several months and I am wondering if it isn't the AX200, perhaps there was a problematic driver update. I installed the latest driver from Intel and that didn't help.
I think this might be a zmk firmware issue with BT5.2 or greater. I have another nicenano with kmk (ble enabled) and I can connect, remove, clear and re-pair for the same host. Where as with ZMK, I'm unable to repair entirely.
As for other systems with BT5.0, zmk works accordingly.
I think this might be a zmk firmware issue with BT5.2 or greater. I have another nicenano with kmk (ble enabled) and I can connect, remove, clear and re-pair for the same host. Where as with ZMK, I'm unable to repair entirely.
As for other systems with BT5.0, zmk works accordingly.
It seems that Pete's branch [zephyr/3.1](git clone --branch zephyr/3.1-upgrade https://github.com/petejohanson/zmk.git) might be a good fix. I have a corne (simple, no oled or rgb) with nice_nanos and so far I'm able to clear the profile and remove the device from windows and re-pair the keyboard. One thing to note is that once you remove the device from windows you need to restart the host, then you can re-pair the keyboard.
I'm assuming zephyr 3.1[3.2 based on app/west.yml] seems to improve bluetooth connectivity with hosts.
For reference, #1499 is the associated PR for the Zephyr upgrade.
For reference, #1499 is the associated PR for the Zephyr upgrade.
Awesome, looking forward to the merge. If I run into any issues with the PR branch, I report them accordingly.
Oooh, yay! Looking forward to trying that out as well!
I also really hope this gets resolved. My new Corne with niceNano are not staying reliably connected to my Win10 machine. I increased the bluetooth power, and removed all profiles and started over to no avail. IT will work temporarily then stop until I remove and re-pair.
My laptop has a Intel® Wi-Fi 6E AX210 No vPro®... My laptop reports LMP 12.14198
I also really hope this gets resolved. My new Corne with niceNano are not staying reliably connected to my Win10 machine. I increased the bluetooth power, and removed all profiles and started over to no avail. IT will work temporarily then stop until I remove and re-pair.
My laptop has a Intel® Wi-Fi 6E AX210 No vPro®... My laptop reports LMP 12.14198
If you don't have too much features with your corne keyboard, you can use the following repo and branch: https://github.com/petejohanson/zmk/tree/zephyr/3.1-upgrade
I've been running this for over a month and I don't experience any connectivity issues.
I hate to ask this kind of question here @greyhatmiddleman but I am out of practice. With this branch I will have to run and compile on my local machine, and I can follow the ZMK docs to get that going yes? (rather than use github actions) Also why if I don't have too many features? Is this branch lacking in features? Thank you for the info.
With this branch I will have to run and compile on my local machine, and I can follow the ZMK docs to get that going yes?
You can do that following ZMK development docs, or change which ZMK fork/branch your config repo points to to build using Github actions.
Also why if I don't have too many features? Is this branch lacking in features? Thank you for the info.
This branch is related to PR #1499, features like underglow/displays might have issues potentially, but I believe it is pretty much ready for final testing so you shouldn't expect many issues.
@vanessa-luna @caksoylar beat me to answer your questions. He is correct with his response.
It seems that both master and PR #1499 don't work with BT 5.2( Window 10 with LMP 11). My Macbook Pro works fine.
It seems that both master and PR #1499 don't work with BT 5.2( Window 10 with LMP 11). My Macbook Pro works fine.
The PR has worked for me in Win10 with LMP 12. Have you also ensured you remove ALL BT profiles on the keyboard before pairing after the firmware update? It will be discouraging if this doesn't fix it for everyone. When you say it doesn't work, does it fail in the same way others are describing above?
@vanessa-luna Yeah, I tried it for several times. and the Split battery reporting branch works at the first time, it fails to connect after restart. PR https://github.com/zmkfirmware/zmk/pull/1499 fails at the first time.
@vanessa-luna Yeah, I tried it for several times. and the Split battery reporting branch works at the first time, it fails to connect after restart. PR #1499 fails at the first time.
When I reflash my controllers, I normally would initially flash with a 'settings_reset' uf2 firmware to clear anything in the controllers before flashing any new firmware. Check Troubleshooting, although this is in reference to the halves not pairing, it ensures anything stuck in Flash is cleared.
Once you've created a 'settings_reset' uf2 firmware you can keep this for future resets, no need to constantly recompile a settings reset uf2.
I'm seemingly having the same connection issues, using Zephyr 3.2.
On Windows 11 : device is detected, but most of the time I get the following error message : "try connecting your device again". When I don't get this error, connection is successful, but I can only type for a few seconds, then status switches randomly between "connected" and "paired". If I try to connect via bluetooth when USB is connected on the main side of my split keyboard only, the connection works. Both sides are functional, until I unplug the main side.
On Manjaro : Connection fails immediately, no specific message.
On Android : sometimes it works, but most of the time I get an error about incorrect PIN or security key.
I tried to reset the firmware and to clear bluetooth profiles, no cookie so far.
It looks like PR #1499 was merged, but unfortunately the Windows BLE 5.1+ issue still persists.
My nice!nano board does not connect on Windows 10 w/ BLE 5.1. I get the error "Couldn't connect. Try connecting again."
It works when the connected via USB. It works on the same machine while booted into different flavors of Linux. It also works on a different Windows 10 device w/ BLE 4.2.