zmkfirmware / zmk

ZMK Firmware Repository
https://zmk.dev/
MIT License
2.82k stars 2.85k forks source link

Mac OS BLE stack is a trashcan: possible workarounds. #278

Open Na-Cly opened 4 years ago

Na-Cly commented 4 years ago

Pairing with Mac OS has been an overall negative experience that requires multiple resets of the keyboard and multiple resets of bluetooth settings on the mac, and when it does start working you've tried so many things you don't even remember how you got to where you are.

Here's behavior I've seen when pairing and unpairing from mac os:

  1. Initial connection looks like it establishes fine but no key presses are registered.
  2. Disconnecting the keyboard by clearing the bond causes issues reconnecting the keyboard to the mac.

Since the improved bluetooth profiles were released this has been significantly helped as now if the connection is established and working it will usually continue working and an occasional reset of central is required after a reboot.

There are ways to get it working with a couple of reboots but I wanted a method of restoring connectivity without rebooting. So far this is the method I've come up with:

  1. Clear bond on keyboard
  2. Remove device from mac from debug menu
  3. Reset bluetooth device from debug menu
  4. rm ~/Library/Preferences/ByHost/Bluetooth && sudo pkill blued

This has been the best to get the keyboard working again without rebooting.

Na-Cly commented 4 years ago

It should be noted this workaround didn’t work the last time I tried it, so it’s definitely not a fix every time.

pluskid commented 4 years ago
  1. Remove device from mac from debug menu

Where can I find the "debug menu"?

adamcstephens commented 4 years ago

Where can I find the "debug menu"?

Hold shift and option while clicking the bluetooth menu bar icon

image

j1n6 commented 4 years ago

another tip shared @petejohanson unknown

pluskid commented 4 years ago

mac-bluetooth

My Macbook constantly wake itself up from sleep, and the battery drains over night. I suspect it is waken up by battery report or some other notification but it wake up even when I switch the keyboard to a different ZMK BLE profile. Unchecking the checkbox that allows bluetooth to wake up computer solves the issue, but for some mysterious reason my MacOS automatically re-check that box for me from time to time.

petejohanson commented 4 years ago

@pluskid do you have ZMK deep sleep enabled? We're almost ready to enable it by default, but if you haven't turned it on, doing so might help, since once the keyboard sleeps it will stop sending battery notifications.

pluskid commented 4 years ago

@petejohanson Cool! I will test it tonight.

Update: it did not work. pmset -g log shows DarkWake to FullWake from Deep Idle [CDNVA] : due to HID Activity Using AC (Charge:100%). I was not able to see anything suspicious from USB logging (when the keyboard is connected to another computer). Currently the only workaround that works is unchecking 'Allow Bluethooth devices to wake this computer', and the main pain point is that that checkbox somehow get checked again automatically by some mysterious force.

pluskid commented 4 years ago

@petejohanson Enabling deep sleep did not work, but my guess is it has not really entered deep sleep stage yet. For my case, the laptop wakes up almost within 1 minute of being put to sleep, which is definitely before the deep sleep kicks in. Is there way to trigger the deep sleep manually using a key press? Or are we able to config the sleep timeout to be a very short one for debugging purpose?

carbncl commented 3 years ago

We've just merged the update to Zephyr 2.4.0, which brings some major BT stability improvements (macOS!)

Does this mean this issue is resolved?

Is Mac OS BLE really a trash can? ;p

j1n6 commented 3 years ago

I’m using it daily, still have drops occasionally.

Sent from my iPhone

On 14 Dec 2020, at 21:30, carbncl notifications@github.com wrote:

 We've just merged the update to Zephyr 2.4.0, which brings some major BT stability improvements (macOS!)

Does this mean this issue is resolved?

Is Mac OS BLE really a trash can? ;p

— You are receiving this because you commented. Reply to this email directly, view it on GitHub, or unsubscribe.

carbncl commented 3 years ago

Oh also, does this solve the constant wake from sleep of macOS?

j1n6 commented 3 years ago

Nope

Sent from my iPhone

On 14 Dec 2020, at 21:33, carbncl notifications@github.com wrote:

 Oh also, does this solve the constant wake from sleep of macOS?

— You are receiving this because you commented. Reply to this email directly, view it on GitHub, or unsubscribe.

petejohanson commented 3 years ago

Nope Sent from my iPhone On 14 Dec 2020, at 21:33, carbncl @.***> wrote:  Oh also, does this solve the constant wake from sleep of macOS? — You are receiving this because you commented. Reply to this email directly, view it on GitHub, or unsubscribe.

My suspicion is that the BAS notifications are causing the wake-up. We may need to enhance the BAS stuff to check for any subscriptions to the notification before sending; upstream Zephyr battery service may not do that, and so that may be causing issues.

j1n6 commented 3 years ago

I will recompile the firmware and confirm the new updates behaviours.

j1n6 commented 3 years ago

I have recompiled the firmware, it has been good for the last 20 hours. Before the Sleep function wasn't working, the new update seems to fix the sleep/wake functionality on the nice nano controller itself, I have not tested with sleeping interruption with Mac.

ericrlau commented 3 years ago

Anyone have some new tips on this?

My experience matches the original post, connection often appears ok on mac os and in logs over usb but when I disconnect USB there are no keypresses over BT. If I hit reset button on my board mac os quickly updates BT device status to "Not Connected" and it stays as "Not Connected" in BT devices list forever despite laptop and keyboard reboots.

I haven't had success with the 4 steps listed in the OP. I have gotten the board to pair/connect in the past through a whole bunch of trial and error but I can't figure out a reliable way to do it again after accidentally hitting bt clear the other day :man_facepalming: .

MvEerd commented 3 years ago

There are some additional plist files you can try deleting, see https://stackoverflow.com/a/20554393

Another option to try is blueutil --discoverable 1 a user recently said they may have fixed their issue with that, see #763

ericrlau commented 3 years ago

Thanks @MvEerd . I had tried the plist stuff with no luck in the past. I tried the blueutil command just now and I'm up and running. Not sure I understand "why" that worked but that's fine, ha.

Na-Cly commented 3 years ago

I've noticed a lot more ease after zephyr core upgrades. It usually feels like a crapshoot of what fixes it though.

jmding8 commented 3 years ago

Would it be possible to bring back bond-reset as a behavior, instead of as a flashable shield? I find that resetting the bond often fixes the issue. Being able to do this as a behavior would be much less hassle than flashing the reset shield

devBabinski commented 3 years ago

Nothing is working for me, I have a nice!nano and reviung41 with macOS

judahrand commented 3 years ago

Nothing works for me either on nice!60, MacOS 11.5.1

peauters commented 3 years ago

Do we know what the error code is from Zephyr?

jamesramsay commented 3 years ago

I am using an M1 MacBook Pro with a Sofle split keyboard (nice!nano on both halves) and see the errors below.

I have tried the reset, remove all Bluetooth devices, clear bond approach many times but never had success.

[00:00:33.100,616] <dbg> zmk.connected: Connected thread: 0x20002f88
[00:00:33.100,646] <dbg> zmk.connected: Connected a0:78:17:75:2e:f0 (public)
[00:00:33.100,646] <dbg> zmk.update_advertising: advertising from 0 to 2
[00:00:33.861,267] <inf> bas: BAS Notifications enabled
[00:00:34.011,352] <err> zmk: Security failed: a0:78:17:75:2e:f0 (public) level 1 err 4
[00:00:34.267,333] <err> zmk: Security failed: a0:78:17:75:2e:f0 (public) level 1 err 4
[00:00:38.344,512] <dbg> zmk.le_param_updated: a0:78:17:75:2e:f0 (public): interval 12 latency 30 timeout 400

@peauters is this the kind of information you were looking for? Let me know if I need to do more digging.

ryingg commented 3 years ago

After having the same issues with endless spinner connects on the following devices, I think I found a process that works for me on my Polarity Works BT60.

Screen Shot 2021-08-13 at 11 56 37 AM

Some of these steps might not be necessary, but it's what worked for me:

  1. Remove BT60 from every computer
  2. BT_CLR every profile
  3. Unplug power and battery from PCB
  4. Turn off every computer
  5. Wait at least 10 minutes
  6. Plug only battery in PCB
  7. Turn on first computer
  8. Select a profile
  9. Connect BT60 on first computer
  10. Repeat 7-9 for all computers
lyallcooper commented 3 years ago

What works for me literally just trying over and over again until it successfully pairs and works. As in 1) forget device from macOS menu 2) clear relevant profile on device 3) try to pair 4) go to step 1.

judahrand commented 3 years ago

Is there anything any of us can do to help debug what's causing the issues and help the ZMK maintainers fix this issue?

sorokinDev commented 3 years ago

There is definitely some problem with MacBooks on last MacOS version. I can't connect nrfmicro to my MacBook Air M1 with 11.2.1. But I can connect the same nrfmicro to my Hackintosh with same OS version and native bluetooth module.

I tried all the steps above. Also I tried updating MacBook to beta OS. Nothing helps. I paired them few times. But when I switch device on keyboard or wait for the sleep - connection breaks and I cannot reconnect or re-pair it anymore.

mkaryadi commented 3 years ago

I'm having issues as well with my Nice!Nanos on my Intel MBP (13-inch, 2019, Two Thunderbolt 3 ports).

I've tried clearing all the profiles, it's detecting the keyboard just fine, but after clicking connect it just spins and spins.

Curiously, it also had problems with my bootcamp partition and my phone.

DavidCarstens commented 3 years ago

After having the same issues with endless spinner connects on the following devices, I think I found a process that works for me on my Polarity Works BT60.

* Macbook Pro 15" Mid 2015 macOS 10.15.7

* Macbook Pro 15" 2019 macOS 10.15.7

* Macbook Air 13" M1 macOS 11.3
Screen Shot 2021-08-13 at 11 56 37 AM

Some of these steps might not be necessary, but it's what worked for me:

1. Remove BT60 from every computer

2. BT_CLR every profile

3. Unplug power and battery from PCB

4. Turn off every computer

5. Wait at least 10 minutes

6. Plug only battery in PCB

7. Turn on first computer

8. Select a profile

9. Connect BT60 on first computer

10. Repeat 7-9 for all computers

This seems promising but I -- the idiot that I am -- don't know how to switch between profiles on the BT60. Any chance you could help me out?

ryingg commented 3 years ago

@DavidCarstens If you haven't switched the BT profile before you probably don't need to reset them all, but this is the default BT60 keymap where you can toggle BT next and prev, which cycles through 1-5 looped.

bt60 keymap

sorokinDev commented 3 years ago

I have just tried Pete's PR and it really works on macbook m1!

mitchsw commented 3 years ago

I tried PR #946 on a Corne-ish Zen (nRF52840, zmk branch) on a 2020 MBP (Big Sur).

I have tried many resets/CLRs, but am failing to get the keyboard to connect. (It says Connected in BT prefs but is spinning.)

My Mac console logs are:

default 11:06:46.033437-0400    bluetoothd  ***** [handleATTErrorResponse].
error   11:06:46.033509-0400    bluetoothd  ***** [handleATTErrorResponse] - Insufficient Encryption.
default 11:06:46.033535-0400    bluetoothd  ***** [handleATTErrorResponse] - Link is not encrypted, perform pairing with MITM disbled.
default 11:06:46.033565-0400    bluetoothd  ***** [startLESecurityManagerPairingSecureConnection] Start secure pairing with mitm: 0, bonding: 1, sc: 1, keypress: 0, ct2: 0
default 11:06:46.033849-0400    bluetoothd  ***** [startLESecurityManagerPairingSecureConnection] - Master: _localAuthReq: 0x9, localInitiatorKeyDistribution: 0x3, localResponderKeyDistribution: 0x3
default 11:06:46.033874-0400    bluetoothd  ***** [pairingRequest] Send Pairing Request: auth 0x9
default 11:06:46.063355-0400    bluetoothd  ***** [l2capChannelData] - Received Pairing Failed.
error   11:06:46.063482-0400    bluetoothd  *****[handlePairingFailed] reason = 3.
error   11:06:46.063872-0400    bluetoothd  Unable to Subscribe to HID Report <GATTDescriptor:0x7fdb98372900 handle:0x0022 uuid:0x2902> - Destroying HID If Created
petejohanson commented 3 years ago

I tried PR #946 on a Corne-ish Zen (nRF52840, zmk branch) on a 2020 MBP (Big Sur).

I have tried many resets/CLRs, but am failing to get the keyboard to connect. (It says Connected in BT prefs but is spinning.)

My Mac console logs are:

default   11:06:46.033437-0400    bluetoothd  ***** [handleATTErrorResponse].
error 11:06:46.033509-0400    bluetoothd  ***** [handleATTErrorResponse] - Insufficient Encryption.
default   11:06:46.033535-0400    bluetoothd  ***** [handleATTErrorResponse] - Link is not encrypted, perform pairing with MITM disbled.
default   11:06:46.033565-0400    bluetoothd  ***** [startLESecurityManagerPairingSecureConnection] Start secure pairing with mitm: 0, bonding: 1, sc: 1, keypress: 0, ct2: 0
default   11:06:46.033849-0400    bluetoothd  ***** [startLESecurityManagerPairingSecureConnection] - Master: _localAuthReq: 0x9, localInitiatorKeyDistribution: 0x3, localResponderKeyDistribution: 0x3
default   11:06:46.033874-0400    bluetoothd  ***** [pairingRequest] Send Pairing Request: auth 0x9
default   11:06:46.063355-0400    bluetoothd  ***** [l2capChannelData] - Received Pairing Failed.
error 11:06:46.063482-0400    bluetoothd  *****[handlePairingFailed] reason = 3.
error 11:06:46.063872-0400    bluetoothd  Unable to Subscribe to HID Report <GATTDescriptor:0x7fdb98372900 handle:0x0022 uuid:0x2902> - Destroying HID If Created

Can you get the ZMK logs when this happens, as well?

mitchsw commented 3 years ago

Sure, thanks for taking a look Pete!

I turned MBP bluetooth on, and pushed Connect button:

[00:02:31.140,014] <dbg> zmk.split_central_connected: Connected: 88:66:5a:10:0a:cf (public)
[00:02:31.140,045] <dbg> zmk.split_central_process_connection: Current security for connection: 1
[00:02:31.141,571] <dbg> zmk.split_central_process_connection: New connection params: Interval: 12, Latency: 0, PHY: 1
[00:02:31.141,632] <dbg> zmk.connected: Connected thread: 0x20003530
[00:02:31.141,662] <dbg> zmk.connected: Connected 88:66:5a:10:0a:cf (public)
[00:02:31.141,662] <dbg> zmk.update_advertising: advertising from 0 to 2
[00:02:31.147,186] <inf> bas: BAS Notifications enabled
[00:02:31.704,559] <err> zmk: Security failed: 88:66:5a:10:0a:cf (public) level 1 err 4
[00:02:31.990,631] <err> zmk: Security failed: 88:66:5a:10:0a:cf (public) level 1 err 4
[00:02:32.215,911] <err> zmk: Security failed: 88:66:5a:10:0a:cf (public) level 1 err 4
[00:02:32.275,756] <err> zmk: Security failed: 88:66:5a:10:0a:cf (public) level 1 err 4
[00:02:32.335,601] <err> zmk: Security failed: 88:66:5a:10:0a:cf (public) level 1 err 4
[00:02:36.337,432] <dbg> zmk.le_param_updated: 88:66:5a:10:0a:cf (public): interval 12 latency 30 timeout 400

I then turned MBP bluetooth off:

[00:03:21.633,056] <inf> bas: BAS Notifications disabled
[00:03:21.636,077] <dbg> zmk.split_central_disconnected: Disconnected: 88:66:5a:10:0a:cf (public) (reason 19)
[00:03:21.636,169] <dbg> zmk.disconnected: Disconnected from 88:66:5a:10:0a:cf (public) (reason 0x13)
petejohanson commented 3 years ago

Sure, thanks for taking a look Pete!

I turned MBP bluetooth on, and pushed Connect button:

[00:02:31.140,014] <dbg> zmk.split_central_connected: Connected: 88:66:5a:10:0a:cf (public)
[00:02:31.140,045] <dbg> zmk.split_central_process_connection: Current security for connection: 1
[00:02:31.141,571] <dbg> zmk.split_central_process_connection: New connection params: Interval: 12, Latency: 0, PHY: 1
[00:02:31.141,632] <dbg> zmk.connected: Connected thread: 0x20003530
[00:02:31.141,662] <dbg> zmk.connected: Connected 88:66:5a:10:0a:cf (public)
[00:02:31.141,662] <dbg> zmk.update_advertising: advertising from 0 to 2
[00:02:31.147,186] <inf> bas: BAS Notifications enabled
[00:02:31.704,559] <err> zmk: Security failed: 88:66:5a:10:0a:cf (public) level 1 err 4
[00:02:31.990,631] <err> zmk: Security failed: 88:66:5a:10:0a:cf (public) level 1 err 4
[00:02:32.215,911] <err> zmk: Security failed: 88:66:5a:10:0a:cf (public) level 1 err 4
[00:02:32.275,756] <err> zmk: Security failed: 88:66:5a:10:0a:cf (public) level 1 err 4
[00:02:32.335,601] <err> zmk: Security failed: 88:66:5a:10:0a:cf (public) level 1 err 4
[00:02:36.337,432] <dbg> zmk.le_param_updated: 88:66:5a:10:0a:cf (public): interval 12 latency 30 timeout 400

I then turned MBP bluetooth off:

[00:03:21.633,056] <inf> bas: BAS Notifications disabled
[00:03:21.636,077] <dbg> zmk.split_central_disconnected: Disconnected: 88:66:5a:10:0a:cf (public) (reason 19)
[00:03:21.636,169] <dbg> zmk.disconnected: Disconnected from 88:66:5a:10:0a:cf (public) (reason 0x13)

Can you also post the logs from restart, and when selecting and clearing each of the BT profiles?

mitchsw commented 3 years ago

Here are the logs you asked for:

On restart

``` [tio 17:17:08] Disconnected [tio 17:17:15] Connected m fs_nvs: 8 Sectors of 4096 bytes [00:00:05.437,866] fs_nvs: alloc wra: 0, e28 [00:00:05.437,866] fs_nvs: data wra: 0, 2ec [00:00:05.439,727] bt_hci_core: No ID address. App must call settings_load() [00:00:05.439,849] zmk.ble_profiles_handle_set: Setting BLE value profiles/2 [00:00:05.439,941] zmk.ble_profiles_handle_set: Loaded 00:00:00:00:00:00 (public) address for profile 2 [00:00:05.440,612] zmk.ble_profiles_handle_set: Setting BLE value active_profile [00:00:05.441,253] zmk.ble_profiles_handle_set: Setting BLE value profiles/1 [00:00:05.441,497] zmk.ble_profiles_handle_set: Loaded f0:5c:77:dd:91:77 (public) address for profile 1 [00:00:05.442,565] zmk.ble_profiles_handle_set: Setting BLE value profiles/0 [00:00:05.442,840] zmk.ble_profiles_handle_set: Loaded 88:66:5a:10:0a:cf (public) address for profile 0 [00:00:05.444,152] zmk.ble_profiles_handle_set: Setting BLE value peripheral_address [00:00:05.456,298] zmk.zmk_ble_ready: ready? 0 [00:00:05.456,298] zmk.update_advertising: advertising from 0 to 2 [00:00:05.457,244] zmk.start_scan: Scanning successfully started [00:00:05.457,519] zmk.zmk_battery_init: --- initialization --- [00:00:05.457,519] zmk.zmk_battery_init: --- Device labelled 'BATTERY' found! --- [00:00:05.457,611] usb_cdc_acm: Device not configured or suspended, drop 1 bytes [00:00:05.458,435] usb_hid: Device connected [00:00:05.458,496] zmk.zmk_usb_get_conn_state: state: 2 [00:00:05.458,496] zmk.zmk_usb_get_conn_state: state: 2 [00:00:05.458,526] zmk.zmk_usb_get_conn_state: state: 2 [00:00:05.458,526] zmk.get_selected_endpoint: Only USB is ready. [00:00:05.458,557] zmk.zmk_endpoints_send_report: usage page 0x07 [00:00:05.458,557] zmk.zmk_endpoints_send_report: usage page 0x0c [00:00:05.458,587] zmk: Endpoint changed: 0 [00:00:05.458,648] zmk.zmk_battery_update: Setting BAS GATT battery level to 100% [00:00:05.458,679] zmk.zmk_battery_update: -----> battery State of Charge: 100% [00:00:05.458,709] zmk.destination_connection: Address pointer 0x200097ce [00:00:05.458,709] zmk: Not sending, no active address for current profile [00:00:05.458,740] zmk.destination_connection: Address pointer 0x200097ce [00:00:05.458,740] zmk: Not sending, no active address for current profile [00:00:05.459,655] zmk.zmk_battery_update: -----> battery State of Health: 90% [00:00:05.460,632] zmk.zmk_battery_update: -----> battery voltage: 4.216000V [00:00:05.461,517] zmk.zmk_battery_update: -----> battery Average Current: 0.0A [00:00:05.461,547] usb_cdc_acm: Device suspended [00:00:05.461,547] usb_hid: Device suspended [00:00:05.461,578] zmk.zmk_usb_get_conn_state: state: 5 [00:00:05.461,608] zmk.zmk_usb_get_conn_state: state: 5 [00:00:05.461,608] zmk.zmk_usb_get_conn_state: state: 5 [00:00:05.461,639] zmk.get_selected_endpoint: Only USB is ready. [00:00:05.462,524] zmk.zmk_battery_update: -----> battery Standby Current: 0.-5000A [00:00:05.463,409] zmk.zmk_battery_update: -----> battery Maximum Load Current: 0.-200000A [00:00:05.464,324] zmk.zmk_battery_update: -----> battery Full Charge Capacity: 0.175000mAh [00:00:05.465,179] zmk.zmk_battery_update: -----> battery Remaining Charge Capacity: 0.175000mAh [00:00:05.466,064] zmk.zmk_battery_update: -----> battery Nominal Available Capacity: 0.178000mAh [00:00:05.466,949] zmk.zmk_battery_update: -----> battery Full Available Capacity: 0.178000mAh [00:00:05.467,803] zmk.zmk_battery_update: -----> battery Average Power Usage: 0.0mW [00:00:05.468,688] zmk.zmk_battery_update: -----> battery Internal IC Temperature: 24.749994 C [00:00:05.468,719] zmk.zmk_usb_get_conn_state: state: 5 [00:00:05.475,494] lvgl: lv_init ready [00:00:05.475,891] lvgl: Object create ready [00:00:05.476,226] lvgl: Object create ready [00:00:05.476,562] lvgl: Object create ready [00:00:05.476,715] zmk.kscan_matrix_init_input_inst: Configured pin 19 on GPIO_0 for input [00:00:05.476,745] zmk.kscan_matrix_init_input_inst: Configured pin 4 on GPIO_0 for input [00:00:05.476,745] zmk.kscan_matrix_init_input_inst: Configured pin 31 on GPIO_0 for input [00:00:05.476,745] zmk.kscan_matrix_init_input_inst: Configured pin 30 on GPIO_0 for input [00:00:05.476,776] zmk.kscan_matrix_init_output_inst: Configured pin 21 on GPIO_0 for output [00:00:05.476,776] zmk.kscan_matrix_init_output_inst: Configured pin 23 on GPIO_0 for output [00:00:05.476,776] zmk.kscan_matrix_init_output_inst: Configured pin 12 on GPIO_0 for output [00:00:05.476,776] zmk.kscan_matrix_init_output_inst: Configured pin 9 on GPIO_1 for output [00:00:05.476,806] zmk.kscan_matrix_init_output_inst: Configured pin 7 on GPIO_0 for output [00:00:05.476,806] zmk.kscan_matrix_init_output_inst: Configured pin 5 on GPIO_0 for output [00:00:05.476,837] zmk: Welcome to ZMK! [00:00:05.476,928] zmk.zmk_display_init: [00:00:05.477,264] lvgl: Object create ready [00:00:05.477,996] lvgl: Object create ready [00:00:05.478,118] lvgl: image created [00:00:05.478,485] lvgl: lv_img_set_src: `LV_IMG_SRC_VA~ [00:00:05.479,278] lvgl: Object create ready [00:00:05.479,400] lvgl: image created [00:00:05.479,461] lvgl: lv_img_set_src: `LV_IMG_SRC_VA~ [00:00:05.479,705] zmk.update_state: Layer changed to 0 [00:00:05.480,224] lvgl: Object create ready [00:00:05.480,590] lvgl: label created [00:00:05.481,964] lvgl: Object create ready [00:00:05.482,086] lvgl: image created [00:00:05.482,177] lvgl: lv_img_set_src: `LV_IMG_SRC_VA~ [00:00:05.516,906] zmk.zmk_display_init: [00:00:05.530,090] zmk.split_central_device_found: [DEVICE]: 69:e4:73:f5:e8:14 (random), AD evt type 0, AD data len 30, RSSI -71 [00:00:05.530,090] zmk.split_central_eir_found: [AD]: 1 data_len 1 [00:00:05.530,090] zmk.split_central_eir_found: [AD]: 255 data_len 25 [00:00:05.544,403] zmk.split_central_device_found: [DEVICE]: 27:03:5b:16:36:b9 (random), AD evt type 3, AD data len 31, RSSI -75 [00:00:05.556,365] lvgl: image draw: cache miss, cached ~ [00:00:05.561,004] lvgl: image draw: cache miss, close a~ [00:00:05.567,657] lvgl: image draw: cache miss, close a~ [00:00:05.600,830] zmk.split_central_device_found: [DEVICE]: f0:72:ea:0b:fb:d1 (public), AD evt type 2, AD data len 28, RSSI -58 [00:00:05.607,574] zmk.split_central_device_found: [DEVICE]: 41:ce:d2:2a:b6:85 (random), AD evt type 0, AD data len 18, RSSI -74 [00:00:05.607,604] zmk.split_central_eir_found: [AD]: 1 data_len 1 [00:00:05.607,604] zmk.split_central_eir_found: [AD]: 10 data_len 1 [00:00:05.607,604] zmk.split_central_eir_found: [AD]: 255 data_len 10 [00:00:05.651,123] usb_cdc_acm: Device resumed [00:00:05.651,123] usb_cdc_acm: from suspend [00:00:05.651,123] usb_hid: Device resumed [00:00:05.651,123] usb_hid: from suspend [00:00:05.651,184] usb_hid: Device reset detected [00:00:05.651,184] zmk.zmk_usb_get_conn_state: state: 1 [00:00:05.651,214] zmk.zmk_usb_get_conn_state: state: 1 [00:00:05.651,245] zmk.zmk_usb_get_conn_state: state: 1 [00:00:05.651,275] zmk.get_selected_endpoint: No endpoints are ready. [00:00:05.651,275] zmk.zmk_endpoints_send_report: usage page 0x07 [00:00:05.651,275] zmk: FAILED TO SEND OVER USB: -19 [00:00:05.651,275] zmk.zmk_endpoints_send_report: usage page 0x0c [00:00:05.651,275] zmk: FAILED TO SEND OVER USB: -19 [00:00:05.651,306] zmk: Endpoint changed: 1 [00:00:05.720,428] usb_cdc_acm: Device configured [00:00:05.720,458] usb_hid: Device configured [00:00:05.720,489] zmk.zmk_usb_get_conn_state: state: 3 [00:00:05.720,520] zmk.zmk_usb_get_conn_state: state: 3 [00:00:05.720,550] zmk.zmk_usb_get_conn_state: state: 3 [00:00:05.720,550] zmk.get_selected_endpoint: Only USB is ready. [00:00:05.720,550] zmk.zmk_endpoints_send_report: usage page 0x07 [00:00:05.720,581] zmk.zmk_endpoints_send_report: usage page 0x0c [00:00:05.720,581] zmk: Endpoint changed: 0 [00:00:05.720,703] zmk.destination_connection: Address pointer 0x200097ce [00:00:05.720,703] zmk: Not sending, no active address for current profile [00:00:05.720,733] zmk.destination_connection: Address pointer 0x200097ce [00:00:05.720,733] zmk: Not sending, no active address for current profile [00:00:06.007,537] zmk.split_central_device_found: [DEVICE]: ef:40:3d:d9:0c:41 (random), AD evt type 0, AD data len 25, RSSI -83 [00:00:06.007,537] zmk.split_central_eir_found: [AD]: 1 data_len 1 [00:00:06.007,537] zmk.split_central_eir_found: [AD]: 2 data_len 2 [00:00:06.007,537] zmk.split_central_eir_found: [AD]: 7 data_len 16 [00:00:06.007,568] zmk.split_central_eir_found: Found the split service [00:00:06.111,602] zmk.split_central_connected: Connected: ef:40:3d:d9:0c:41 (random) [00:00:06.111,602] zmk.split_central_process_connection: Current security for connection: 1 [00:00:06.112,609] zmk.split_central_process_connection: New connection params: Interval: 6, Latency: 30, PHY: 1 [00:00:06.112,701] zmk.connected: Connected thread: 0x20003530 [00:00:06.112,701] zmk.connected: Connected ef:40:3d:d9:0c:41 (random) [00:00:06.112,731] zmk: Failed to update LE parameters (err 187) [00:00:06.112,731] zmk.update_advertising: advertising from 0 to 2 [00:00:06.112,731] zmk: Advertising failed to start (err -69) [00:00:06.376,037] zmk.security_changed: Security changed: ef:40:3d:d9:0c:41 (random) level 2 [00:00:06.391,632] zmk.split_central_discovery_func: [ATTRIBUTE] handle 42 [00:00:06.428,619] zmk.split_central_discovery_func: [ATTRIBUTE] handle 43 [00:00:06.443,511] zmk.split_central_discovery_func: [ATTRIBUTE] handle 45 [00:00:06.443,572] zmk.split_central_subscribe: [SUBSCRIBED] [00:00:09.563,629] lvgl: lv_img_set_src: `LV_IMG_SRC_VA~ [00:00:09.576,293] lvgl: image draw: cache miss, close a~ [00:00:47.578,155] zmk.split_central_disconnected: Disconnected: ef:40:3d:d9:0c:41 (random) (reason 8) [00:00:47.578,460] zmk.start_scan: Scanning successfully started [00:00:47.578,582] zmk.disconnected: Disconnected from ef:40:3d:d9:0c:41 (random) (reason 0x08) [00:00:47.665,191] zmk.split_central_device_found: [DEVICE]: 27:03:5b:16:36:b9 (random), AD evt type 3, AD data len 31, RSSI -76 [00:00:47.729,339] zmk.split_central_device_found: [DEVICE]: 41:ce:d2:2a:b6:85 (random), AD evt type 0, AD data len 18, RSSI -72 [00:00:47.729,370] zmk.split_central_eir_found: [AD]: 1 data_len 1 [00:00:47.729,370] zmk.split_central_eir_found: [AD]: 10 data_len 1 [00:00:47.729,370] zmk.split_central_eir_found: [AD]: 255 data_len 10 [00:00:47.844,604] zmk.split_central_device_found: [DEVICE]: 54:ce:e3:d6:19:86 (random), AD evt type 2, AD data len 28, RSSI -80 [00:00:47.942,016] zmk.split_central_device_found: [DEVICE]: cf:90:c4:b4:70:cd (random), AD evt type 0, AD data len 14, RSSI -82 [00:00:47.942,047] zmk.split_central_eir_found: [AD]: 1 data_len 1 [00:00:47.942,047] zmk.split_central_eir_found: [AD]: 2 data_len 2 [00:00:47.942,047] zmk.split_central_eir_found: [AD]: 9 data_len 5 [00:00:47.961,334] zmk.split_central_device_found: [DEVICE]: 69:e4:73:f5:e8:14 (random), AD evt type 0, AD data len 30, RSSI -68 [00:00:47.961,334] zmk.split_central_eir_found: [AD]: 1 data_len 1 [00:00:47.961,334] zmk.split_central_eir_found: [AD]: 255 data_len 25 [00:00:48.125,518] zmk.split_central_device_found: [DEVICE]: f0:72:ea:0b:fb:d1 (public), AD evt type 2, AD data len 28, RSSI -51 [00:00:48.481,018] zmk.split_central_device_found: [DEVICE]: 61:61:61:88:6f:a0 (random), AD evt type 2, AD data len 28, RSSI -85 [00:00:49.025,848] zmk.split_central_device_found: [DEVICE]: 63:16:38:20:74:6f (random), AD evt type 2, AD data len 28, RSSI -86 [00:00:49.156,158] zmk.split_central_device_found: [DEVICE]: e0:8c:5e:dc:a4:16 (random), AD evt type 0, AD data len 14, RSSI -63 [00:00:49.156,158] zmk.split_central_eir_found: [AD]: 1 data_len 1 [00:00:49.156,158] zmk.split_central_eir_found: [AD]: 2 data_len 2 [00:00:49.156,158] zmk.split_central_eir_found: [AD]: 9 data_len 5 ```

On BT_CLR

``` [00:04:22.182,891] zmk.update_state: Layer changed to 5 [00:04:24.045,532] zmk.kscan_matrix_read: Sending event at 1,0 state on [00:04:24.045,623] zmk.zmk_kscan_process_msgq: Row: 1, col: 0, position: 12, pressed: true [00:04:24.045,654] zmk.zmk_keymap_apply_position_state: layer: 5 position: 12, binding name: BLUETOOTH [00:04:24.045,684] zmk.zmk_ble_clear_bonds: [00:04:24.045,684] zmk.update_advertising: advertising from 0 to 2 [00:04:24.045,715] zmk: Advertising failed to start (err -69) [00:04:24.209,747] zmk.kscan_matrix_read: Sending event at 1,0 state off [00:04:24.209,808] zmk.zmk_kscan_process_msgq: Row: 1, col: 0, position: 12, pressed: false [00:04:24.209,838] zmk.zmk_keymap_apply_position_state: layer: 5 position: 12, binding name: BLUETOOTH [00:04:25.395,599] zmk.kscan_matrix_read: Sending event at 3,3 state off [00:04:25.395,690] zmk.zmk_kscan_process_msgq: Row: 3, col: 3, position: 36, pressed: false [00:04:25.395,721] zmk.zmk_keymap_apply_position_state: layer: 2 position: 36, binding name: MO [00:04:25.395,782] zmk.mo_keymap_binding_released: position 36 layer 5 [00:04:25.395,782] zmk.set_layer_state: layer_changed: layer 5 state 0 [00:04:25.395,812] zmk.update_state: Layer changed to 2 ```

On BT_SEL 2

``` [00:06:15.060,974] zmk.kscan_matrix_read: Sending event at 1,3 state on [00:06:15.061,035] zmk.zmk_kscan_process_msgq: Row: 1, col: 3, position: 15, pressed: true [00:06:15.061,065] zmk.zmk_keymap_apply_position_state: layer: 5 position: 15, binding name: BLUETOOTH [00:06:15.061,126] zmk.zmk_ble_prof_select: profile 2 [00:06:15.061,126] zmk.update_advertising: advertising from 0 to 2 [00:06:15.061,157] zmk: Advertising failed to start (err -69) [00:06:15.061,218] zmk.zmk_usb_get_conn_state: state: 3 [00:06:15.061,218] zmk.get_selected_endpoint: Only USB is ready. [00:06:15.061,309] lvgl: lv_img_set_src: `LV_IMG_SRC_VA~ [00:06:15.194,519] zmk.kscan_matrix_read: Sending event at 1,3 state off [00:06:15.194,580] zmk.zmk_kscan_process_msgq: Row: 1, col: 3, position: 15, pressed: false [00:06:15.194,641] zmk.zmk_keymap_apply_position_state: layer: 5 position: 15, binding name: BLUETOOTH [00:06:15.964,508] zmk.kscan_matrix_read: Sending event at 3,3 state off [00:06:15.964,569] zmk.zmk_kscan_process_msgq: Row: 3, col: 3, position: 36, pressed: false [00:06:15.964,599] zmk.zmk_keymap_apply_position_state: layer: 2 position: 36, binding name: MO [00:06:15.964,630] zmk.mo_keymap_binding_released: position 36 layer 5 [00:06:15.964,630] zmk.set_layer_state: layer_changed: layer 5 state 0 [00:06:15.964,660] zmk.update_state: Layer changed to 2 ```

On BT_CLR and BT_SEL n, I don't see anything interesting other than

<err> zmk: Advertising failed to start (err -69)

Thank you!

devjona commented 3 years ago

After having the same issues with endless spinner connects on the following devices, I think I found a process that works for me on my Polarity Works BT60.

* Macbook Pro 15" Mid 2015 macOS 10.15.7

* Macbook Pro 15" 2019 macOS 10.15.7

* Macbook Air 13" M1 macOS 11.3
Screen Shot 2021-08-13 at 11 56 37 AM

Some of these steps might not be necessary, but it's what worked for me:

1. Remove BT60 from every computer

2. BT_CLR every profile

3. Unplug power and battery from PCB

4. Turn off every computer

5. Wait at least 10 minutes

6. Plug only battery in PCB

7. Turn on first computer

8. Select a profile

9. Connect BT60 on first computer

10. Repeat 7-9 for all computers

Based on your advice, I tried a modification of this that worked for me today:

  1. Forget the keyboard on my work Macbook Pro
  2. On my keyboard, BT_SEL <#> and BT_CLR on every single profile (I have 0-3)
  3. Select the profile I wanted to use to pair with my work MBP (Which was BT_SEL 1 for me)
  4. I re-paired my keyboard and am using it to type this message. I'll report back if I have this issue again and if this fix is enough or if I just go lucky from unpairing/forgetting/re-trying a bunch of times.
devjona commented 3 years ago

After having the same issues with endless spinner connects on the following devices, I think I found a process that works for me on my Polarity Works BT60.

* Macbook Pro 15" Mid 2015 macOS 10.15.7

* Macbook Pro 15" 2019 macOS 10.15.7

* Macbook Air 13" M1 macOS 11.3
Screen Shot 2021-08-13 at 11 56 37 AM

Some of these steps might not be necessary, but it's what worked for me:

1. Remove BT60 from every computer

2. BT_CLR every profile

3. Unplug power and battery from PCB

4. Turn off every computer

5. Wait at least 10 minutes

6. Plug only battery in PCB

7. Turn on first computer

8. Select a profile

9. Connect BT60 on first computer

10. Repeat 7-9 for all computers

Based on your advice, I tried a modification of this that worked for me today:

1. Forget the keyboard on my work Macbook Pro

2. On my keyboard, `BT_SEL <#>` and `BT_CLR` on every single profile (I have 0-3)

3. Select the profile I wanted to use to pair with my work MBP (Which was `BT_SEL 1` for me)

4. I re-paired my keyboard and am using it to type this message. I'll report back if I have this issue again and if this fix is enough or if I just go lucky from unpairing/forgetting/re-trying a bunch of times.

Follow up: I lost connection as soon as I closed my laptop lid and went from home to a coffee shop. This was yesterday. For a few days, even with my MBP going to sleep, I had no issues with the connection.

I've tried the steps I mentioned and nothing works so far.

xjtian commented 3 years ago

Any updates here? This seems to semi-reliably happen after trying to reconnect to a Mac after either clearing the corresponding bluetooth bond or reflashing firmware onto the controllers. Removing the device in System Preferences -> Bluetooth before doing this doesn't seem to be a reliable preventative measure.

In all cases, the keyboard connects an iPhone just fine but continues to hang in the "Connected" state with a spinner in the bluetooth preferences on the Mac.

Anecdotally, resetting the controllers and clearing all the bluetooth bonds multiple times seems to be potentially correlated with resolving the connectivity issue.

samodostal commented 2 years ago

I have the same issue. Initially, the keyboard connected to my MacBook on the first try, but now I can't get it to connect even once. One difference is, that I don't see the loading indicator when trying to connect to it. The keyboard just moves to the "connected" section, and stays there for about 1 minute. I think that I'll be using the keyboard with a cable for now.

samodostal commented 2 years ago

This is the only thing that worked for me: (I tried all of the suggestions above) https://zmk.dev/docs/troubleshooting/#split-keyboard-halves-unable-to-pair

aWalrus commented 1 year ago

To add some tiny data points to this: I am experiencing this issue very regularly on my Intel MacBook Pro, but I haven't had it on my M1 Air or my Hackintosh so far. (crkbd with a nice!nano and a corne-ish zen)

webhostsg commented 1 year ago

To add some tiny data points to this: I am experiencing this issue very regularly on my Intel MacBook Pro, but I haven't had it on my M1 Air or my Hackintosh so far. (crkbd with a nice!nano and a corne-ish zen)

I'm having issues with my hackintosh, Ventura 13.2.1