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

Bluetooth security failing on windows machine #805

Open
aureumleonis opened this issue May 24, 2021 · 69 comments
Open

Bluetooth security failing on windows machine #805

aureumleonis opened this issue May 24, 2021 · 69 comments

Comments

@aureumleonis
Copy link

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?

@haywirephoenix
Copy link

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

@aureumleonis
Copy link
Author

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)

@haywirephoenix
Copy link

haywirephoenix commented Jun 3, 2021

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

@aureumleonis
Copy link
Author

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."

@Kikokeyco
Copy link

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.

@aureumleonis
Copy link
Author

aureumleonis commented Nov 1, 2021

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

@aureumleonis
Copy link
Author

I just tested my board with BlueMicro and that firmware does connect to the work laptop successfully.

@Avada-sao
Copy link

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 .

@sadekbaroudi
Copy link
Contributor

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.

@caksoylar
Copy link
Contributor

@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.

@sadekbaroudi
Copy link
Contributor

@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

@caksoylar
Copy link
Contributor

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.

@sadekbaroudi
Copy link
Contributor

Thanks for confirming that!

@claviger-pc
Copy link
Contributor

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.

@whitehatmiddleman
Copy link

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.

@whitehatmiddleman
Copy link

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.

@caksoylar
Copy link
Contributor

For reference, #1499 is the associated PR for the Zephyr upgrade.

@whitehatmiddleman
Copy link

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.

@sadekbaroudi
Copy link
Contributor

Oooh, yay! Looking forward to trying that out as well!

@vanessa-luna
Copy link

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

@whitehatmiddleman
Copy link

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.

@vanessa-luna
Copy link

vanessa-luna commented Feb 2, 2023

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.

@caksoylar
Copy link
Contributor

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.

@whitehatmiddleman
Copy link

@vanessa-luna @caksoylar beat me to answer your questions. He is correct with his response.

@zhenchaopro
Copy link

zhenchaopro commented Feb 6, 2023

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.

@vanessa-luna
Copy link

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?

@zhenchaopro
Copy link

zhenchaopro commented Feb 10, 2023

@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.

@whitehatmiddleman
Copy link

@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.

@MajykOyster
Copy link

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.

@j-ea
Copy link

j-ea commented May 22, 2023

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.

@TomzBench
Copy link

For anyone who started getting this in the last couple of months, check the version of your Bluetooth driver (Settings > Apps > Installed Apps > search for "bluetooth"). If you have Intel Wireless Bluetooth driver version 22.250.0, try uninstalling it and installing version 22.240.0 instead.

I used the Roll Back Driver feature in my Win11 device manager, which put it back at 22.230.0.2. I can confirm with this driver, my ZMK corne works over bluetooth on my machine now.

Though I'm not sure how I feel on recommending that people downgrade crucial drivers as a fix... but it does work for now.

Can confirm this solution worked for me as well! (And I couldnt give a shit about the security of my windows shitbox. its a fine solution. Though I'm curious if this is something that needs to be patched on the keyboard side? or a bug in intel driver that can eventually be patched in a future update)

@phuertay
Copy link

Solved by following #1487. I'm using a custom split w/Nice!nanos on Windows 11 with the newest Intel driver (22.250.0.2)

  1. Add "CONFIG_BT_CTLR_PHY_2M=n" to the .conf file (in my case, zmk-config/config/dacman56.conf)
  2. Load settings_reset.uf2 on both sides
  3. Load firmware on both sides
  4. Re-paired

@jakubgrygiel
Copy link

For anyone who started getting this in the last couple of months, check the version of your Bluetooth driver (Settings > Apps > Installed Apps > search for "bluetooth"). If you have Intel Wireless Bluetooth driver version 22.250.0, try uninstalling it and installing version 22.240.0 instead.

I had the same issue (corne split, 2x nice nanos). I recently updated my Windows drivers and returning to an older bluetooth version solved the problem

@gabeklavans
Copy link

gabeklavans commented Feb 26, 2024

Looks like the latest release that includes Zephyr 3.5 fixes this issue. I've rebuilt my firmware using the docker container at the main tag, and I am having no issues connecting when my Intel Bluetooth driver is updated to 22.250.0.2

@sharifrazzaque
Copy link

Same here. My keyboard (running ZMK from July 2023) would not pair with my new Windows 11 laptop. I Rebuilt with 3.5 just now and it paired to the same win 11 laptop w/o any problems. I did not have to reset keyboard settings, roll back Bluetooth drivers or anything else besides update to ZMK 3.5

@rayanpiro
Copy link

rayanpiro commented Mar 31, 2024

Zephyr 3.5 Corne keyboard and NRF52840.

Same here. Using win11 and a BT 5.3 dongle. If I try to connect with my win10 laptop's intel card it works properly.

I've tried #805 (comment) too and isn't working for me.

@maslomeister
Copy link

maslomeister commented May 27, 2024

Zephyr 3.5 Corne, NRF52840, Win 11 23H2, Generic bluetooth adapter 5.3 (tried 2 different ones)

I am able to pair my keyboard fine and use it, but whenever I reboot my PC, the keyboard shows up as "not connected" and doesn't want to connect at all. "Forget this device.", clearing BT profile and re-pairing is the only thing that works. After I enabled debug and rebooted, the keyboard periodically sent the same error as in this issue. The keyboard reconnects just fine on MB pro 14.1.1 and another win 10 22H2 with same generic ble adapter 5.3.

@BambooRaptor
Copy link

Same here. My keyboard (running ZMK from July 2023) would not pair with my new Windows 11 laptop. I Rebuilt with 3.5 just now and it paired to the same win 11 laptop w/o any problems. I did not have to reset keyboard settings, roll back Bluetooth drivers or anything else besides update to ZMK 3.5

How did you rebuild with 3.5? Did you change something in the build.yml file? As far as I can tell, 3.5 is on the main branch now, and so should be the default choice when building, but I'm still facing this issue...

@lesshonor
Copy link
Contributor

Since it's a long thread and this hasn't been mentioned in a while; might be worth trying CONFIG_ZMK_BLE_EXPERIMENTAL_FEATURES=y if you're having issues.

@BambooRaptor
Copy link

Since it's a long thread and this hasn't been mentioned in a while; might be worth trying CONFIG_ZMK_BLE_EXPERIMENTAL_FEATURES=y if you're having issues.

It worked! Thank you!!

@MatchstickWorks
Copy link

Since it's a long thread and this hasn't been mentioned in a while; might be worth trying CONFIG_ZMK_BLE_EXPERIMENTAL_FEATURES=y if you're having issues.

I tried this on my setup and it's not working. I believe I'm at the latest ZMK build (unsure how to check that against my config). I'm not using an intel driver for bluetooth, either. So I'm feeling a little stuck.

Works on my android phone, and my wife's macbook, but not her work Intel Windows PC ("Try connecting your device again"), nor my own AMD W10 PC, or my work Intel W10 PC.

Any additional thoughts?

@rayanpiro
Copy link

Since it's a long thread and this hasn't been mentioned in a while; might be worth trying CONFIG_ZMK_BLE_EXPERIMENTAL_FEATURES=y if you're having issues.

Working for me too with Zephyr 3.5.0 and Corne keyboard with NRF52840 and USB 5.3 dongle on Win11.

@MatchstickWorks
Copy link

Since it's a long thread and this hasn't been mentioned in a while; might be worth trying CONFIG_ZMK_BLE_EXPERIMENTAL_FEATURES=y if you're having issues.

I tried this on my setup and it's not working. I believe I'm at the latest ZMK build (unsure how to check that against my config). I'm not using an intel driver for bluetooth, either. So I'm feeling a little stuck.

Works on my android phone, and my wife's macbook, but not her work Intel Windows PC ("Try connecting your device again"), nor my own AMD W10 PC, or my work Intel W10 PC.

Any additional thoughts?

Solution I had was that one of the dongles I was using was below BT4.2, so it was never going to connect. The other is that my small macropad wasn't set up to clear profiles and I didn't understand that it didn't clear profiles when you flash the firmware. So I added a setup to be able to switch and clear profiles on the board itself.

@FearlessSpiff
Copy link

FearlessSpiff commented Oct 11, 2024

So cool. CONFIG_ZMK_BLE_EXPERIMENTAL_FEATURES=y also worked for me. Was a bit surprised, that I had to enter a PIN on the keyboard, but it worked!

@alexsohn1126
Copy link

Since it's a long thread and this hasn't been mentioned in a while; might be worth trying CONFIG_ZMK_BLE_EXPERIMENTAL_FEATURES=y if you're having issues.

I have one PC that I dual-boot Windows and Linux on, and could not have 2 different profiles working for 2 different OS, but this fixed it. Awesome job!

@FearlessSpiff
Copy link

First for me too. But now it stopped working. I went back for other things but nothing works. I read the dual boot part of the wiki https://zmk.dev/docs/troubleshooting/connection-issues#issues-with-dual-boot-setups but I don't understand it. Is it even not possible to pair on two different profiles with the same nice nano?

lejouson added a commit to lejouson/zmk-config that referenced this issue Oct 26, 2024
Try to solve the problem of connection with several Windows devices by following the recommendation given in zmkfirmware/zmk#805 (comment).
lejouson added a commit to lejouson/zmk-config that referenced this issue Oct 26, 2024
Try to remedy the connection problem with several Windows machines by following the recommendation given in zmkfirmware/zmk#805 (comment)
lejouson added a commit to lejouson/zmk-config that referenced this issue Oct 26, 2024
Try to remedy the connection problem with several Windows machines by following the recommendation given in zmkfirmware/zmk#805 (comment)
@lesshonor
Copy link
Contributor

lesshonor commented Oct 26, 2024

Is it even not possible to pair [a dual-boot OS] on two different profiles with the same nice nano?

Dual-booting is an unrelated issue; see #2026 (macOS users can try #549)

But the short answer is no, and the long answer is not unless you are able to follow the instructions in the Arch wiki (linked from the ZMK docs) or similar (linked in this comment or found elsewhere on the internet) to use the same pairing key across both operating systems. And you should use the same profile for that.

You could set up a dongle to avoid taking these extra steps, but that too is outside the scope of this issue.

@FearlessSpiff
Copy link

Ok. Then I'm going to sync the keys. I thought I had this running like that a few years ago.

@FearlessSpiff
Copy link

So it's not even that hard to do. Just synced my dual boot devices (Keyboard and Mouse) with the script linked in the arch wiki: https://github.com/nbanks/bluetooth-dualboot

The ZMK NiceNano was easy, as I could just copy paste the keys from the script output. For my Logitech Mouse I had do copy more things and most importantly rename the folder as the MAC address on Windows was another one than on Linux.

@SamBobBarnes
Copy link

SamBobBarnes commented Jan 6, 2025

Since it's a long thread and this hasn't been mentioned in a while; might be worth trying CONFIG_ZMK_BLE_EXPERIMENTAL_FEATURES=y if you're having issues.

This worked form me! Windows 11, modified corne, nice!nano copeis, tplink bluetooth dongle.

@haywirephoenix
Copy link

I'm still having this issue with latest zmk. If I pair to windows, then android on profile 2, I can no longer connect back to windows without flashing a settings reset and reflash firmware.

I have tried adding all of the following to the conf:

CONFIG_ZMK_BLE_EXPERIMENTAL_FEATURES=y
CONFIG_ZMK_BLE_PASSKEY_ENTRY=y
CONFIG_ZMK_KSCAN_DEBOUNCE_PRESS_MS=0
CONFIG_ZMK_KSCAN_DEBOUNCE_RELEASE_MS=5
CONFIG_BT_CTLR_PHY_2M=n
CONFIG_BT_CTLR_TX_PWR_PLUS_8=y


nice!nanos v1
RZ616 Bluetooth Adapter
Windows 11 23H2

@MatchstickWorks
Copy link

I'm still having this issue with latest zmk. If I pair to windows, then android on profile 2, I can no longer connect back to windows without flashing a settings reset and reflash firmware.

I have tried adding all of the following to the conf:

CONFIG_ZMK_BLE_EXPERIMENTAL_FEATURES=y CONFIG_ZMK_BLE_PASSKEY_ENTRY=y CONFIG_ZMK_KSCAN_DEBOUNCE_PRESS_MS=0 CONFIG_ZMK_KSCAN_DEBOUNCE_RELEASE_MS=5 CONFIG_BT_CTLR_PHY_2M=n CONFIG_BT_CTLR_TX_PWR_PLUS_8=y

nice!nanos v1 RZ616 Bluetooth Adapter Windows 11 23H2

Do you have a key to reset a BT profile?

@haywirephoenix
Copy link

Do you have a key to reset a BT profile?

I have BT_CLR key, which I try on both halves aswell as switching back and forth with the BT_SEL keys. I could add a BT_DISC key? Since I've disabled "Allow Winedoze to put the adaptor to sleep" I can get it to respond again after hitting BT_SEL on the same profile again. It seems to work until the nanos have sat for a while, (I don't know if they have a sleep state?)

@MatchstickWorks
Copy link

Do you have a key to reset a BT profile?

I have BT_CLR key, which I try on both halves aswell as switching back and forth with the BT_SEL keys. I could add a BT_DISC key? Since I've disabled "Allow Winedoze to put the adaptor to sleep" I can get it to respond again after hitting BT_SEL on the same profile again. It seems to work until the nanos have sat for a while, (I don't know if they have a sleep state?)

Hm, I have been fine with BT_CLR, as I was having a similar issue. Afraid I'm not much help beyond that.

@haywirephoenix
Copy link

I'm still having this issue with latest zmk. If I pair to windows, then android on profile 2, I can no longer connect back to windows without flashing a settings reset and reflash firmware.

I have tried adding all of the following to the conf:

CONFIG_ZMK_BLE_EXPERIMENTAL_FEATURES=y
CONFIG_ZMK_BLE_PASSKEY_ENTRY=y
CONFIG_ZMK_KSCAN_DEBOUNCE_PRESS_MS=0
CONFIG_ZMK_KSCAN_DEBOUNCE_RELEASE_MS=5
CONFIG_BT_CTLR_PHY_2M=n
CONFIG_BT_CTLR_TX_PWR_PLUS_8=y

nice!nanos v1 RZ616 Bluetooth Adapter Windows 11 23H2

After multiple firmware reflashes and settings resets I will note that the issue is currently resolved in my case when using the aforementioned config. Perhaps it wasn't fully flashing.

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

No branches or pull requests