Skip to content

Commit

Permalink
fix(bt): Passkey entry pairing fixes.
Browse files Browse the repository at this point in the history
* Don't propogate any key press events while in the
  middle of passkey entry, avoid funky state on hosts.
* Handle passkey on release, not press, to ensure key *releases*
  are not accidentally sent, especially the Enter release
  at the very end of passkey entry, which can trigger
  cancel in the dialog if the keyboard is connected
  via USB to the same host.
  • Loading branch information
petejohanson committed Dec 1, 2023
1 parent 69f7bfb commit 1f9e353
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions app/src/ble.c
Original file line number Diff line number Diff line change
Expand Up @@ -696,9 +696,9 @@ static int zmk_ble_handle_key_user(struct zmk_keycode_state_changed *event) {
return ZMK_EV_EVENT_BUBBLE;
}

if (!event->state) {
LOG_DBG("Key released, ignoring");
return ZMK_EV_EVENT_BUBBLE;
if (event->state) {
LOG_DBG("Key press, ignoring");
return ZMK_EV_EVENT_HANDLED;
}

if (key == HID_USAGE_KEY_KEYBOARD_ESCAPE) {
Expand Down Expand Up @@ -728,7 +728,7 @@ static int zmk_ble_handle_key_user(struct zmk_keycode_state_changed *event) {
zmk_ble_numeric_usage_to_value(key, HID_USAGE_KEY_KEYPAD_1_AND_END,
HID_USAGE_KEY_KEYPAD_0_AND_INSERT, &val))) {
LOG_DBG("Key not a number, ignoring");
return ZMK_EV_EVENT_BUBBLE;
return ZMK_EV_EVENT_HANDLED;
}

if (ring_buf_space_get(&passkey_entries) <= 0) {
Expand Down

0 comments on commit 1f9e353

Please sign in to comment.