diff --git a/app/include/dt-bindings/zmk/keys.h b/app/include/dt-bindings/zmk/keys.h index a3b22297..5f59055e 100644 --- a/app/include/dt-bindings/zmk/keys.h +++ b/app/include/dt-bindings/zmk/keys.h @@ -3,7 +3,6 @@ * * SPDX-License-Identifier: MIT */ - #pragma once #define USAGE_KEYPAD 0x07 @@ -144,11 +143,24 @@ #define M_VOLU 0xE9 #define M_VOLD 0xEA -#define MOD_LCTL (1 << 0x00) -#define MOD_LSFT (1 << 0x01) -#define MOD_LALT (1 << 0x02) -#define MOD_LGUI (1 << 0x03) -#define MOD_RCTL (1 << 0x04) -#define MOD_RSFT (1 << 0x05) -#define MOD_RALT (1 << 0x06) -#define MOD_RGUI (1 << 0x07) \ No newline at end of file +#define MOD_LCTL 0x01 +#define MOD_LSFT 0x02 +#define MOD_LALT 0x04 +#define MOD_LGUI 0x08 +#define MOD_RCTL 0x10 +#define MOD_RSFT 0x20 +#define MOD_RALT 0x40 +#define MOD_RGUI 0x80 + +#define SELECT_MODS(keycode) (keycode >> 24) +#define STRIP_MODS(keycode) (keycode & ~(0xFF << 24)) +#define APPLY_MODS(mods, keycode) (mods << 24 | keycode) + +#define LC(keycode) APPLY_MODS(MOD_LCTL, keycode) +#define LS(keycode) APPLY_MODS(MOD_LSFT, keycode) +#define LA(keycode) APPLY_MODS(MOD_LALT, keycode) +#define LG(keycode) APPLY_MODS(MOD_LGUI, keycode) +#define RC(keycode) APPLY_MODS(MOD_RCTL, keycode) +#define RS(keycode) APPLY_MODS(MOD_RSFT, keycode) +#define RA(keycode) APPLY_MODS(MOD_RALT, keycode) +#define RG(keycode) APPLY_MODS(MOD_RGUI, keycode) diff --git a/app/include/zmk/events/keycode-state-changed.h b/app/include/zmk/events/keycode-state-changed.h index 1e2c24e8..493f075b 100644 --- a/app/include/zmk/events/keycode-state-changed.h +++ b/app/include/zmk/events/keycode-state-changed.h @@ -7,22 +7,24 @@ #pragma once #include +#include #include struct keycode_state_changed { struct zmk_event_header header; u8_t usage_page; u32_t keycode; + u8_t implicit_modifiers; bool state; }; ZMK_EVENT_DECLARE(keycode_state_changed); -inline struct keycode_state_changed *create_keycode_state_changed(u8_t usage_page, u32_t keycode, - bool state) { +static inline struct keycode_state_changed *create_keycode_state_changed(u8_t usage_page, u32_t keycode, bool state) { struct keycode_state_changed *ev = new_keycode_state_changed(); ev->usage_page = usage_page; - ev->keycode = keycode; + ev->keycode = STRIP_MODS(keycode); + ev->implicit_modifiers = SELECT_MODS(keycode); ev->state = state; return ev; -} \ No newline at end of file +} diff --git a/app/include/zmk/hid.h b/app/include/zmk/hid.h index fd09a6f4..2426c2db 100644 --- a/app/include/zmk/hid.h +++ b/app/include/zmk/hid.h @@ -164,8 +164,8 @@ struct zmk_hid_consumer_report { int zmk_hid_register_mod(zmk_mod modifier); int zmk_hid_unregister_mod(zmk_mod modifier); -int zmk_hid_register_mods(zmk_mod_flags modifiers); -int zmk_hid_unregister_mods(zmk_mod_flags modifiers); +int zmk_hid_implicit_modifiers_press(zmk_mod_flags implicit_modifiers); +int zmk_hid_implicit_modifiers_release(); int zmk_hid_keypad_press(zmk_key key); int zmk_hid_keypad_release(zmk_key key); void zmk_hid_keypad_clear(); diff --git a/app/src/behaviors/behavior_hold_tap.c b/app/src/behaviors/behavior_hold_tap.c index 8b3620ef..ac91e7de 100644 --- a/app/src/behaviors/behavior_hold_tap.c +++ b/app/src/behaviors/behavior_hold_tap.c @@ -8,6 +8,7 @@ #include #include +#include #include #include #include @@ -16,7 +17,6 @@ #include #include #include -#include #include LOG_MODULE_DECLARE(zmk, CONFIG_ZMK_LOG_LEVEL); @@ -427,7 +427,7 @@ static int position_state_changed_listener(const struct zmk_event_header *eh) { return ZMK_EV_EVENT_CAPTURED; } -static bool is_mod(struct keycode_state_changed *ev) { +static inline bool only_mods(struct keycode_state_changed *ev) { return ev->usage_page == USAGE_KEYPAD && ev->keycode >= LCTL && ev->keycode <= RGUI; } @@ -440,7 +440,7 @@ static int keycode_state_changed_listener(const struct zmk_event_header *eh) { return 0; } - if (!is_mod(ev)) { + if (!only_mods(ev)) { // LOG_DBG("0x%02X bubble (not a mod)", ev->keycode); return 0; } diff --git a/app/src/hid.c b/app/src/hid.c index 216cec7a..001d7d31 100644 --- a/app/src/hid.c +++ b/app/src/hid.c @@ -8,29 +8,44 @@ LOG_MODULE_DECLARE(zmk, CONFIG_ZMK_LOG_LEVEL); #include +#include static struct zmk_hid_keypad_report kp_report = { .report_id = 1, .body = {.modifiers = 0, ._reserved = 0, .keys = {0}}}; static struct zmk_hid_consumer_report consumer_report = {.report_id = 2, .body = {.keys = {0}}}; -#define _TOGGLE_MOD(mod, state) \ - if (modifier > MOD_RGUI) { \ - return -EINVAL; \ - } \ - WRITE_BIT(kp_report.body.modifiers, mod, state); \ - return 0; +// Keep track of how often a modifier was pressed. +// Only release the modifier if the count is 0. +static int explicit_modifier_counts[8] = {0, 0, 0, 0, 0, 0, 0, 0}; +static zmk_mod_flags explicit_modifiers = 0; -int zmk_hid_register_mod(zmk_mod modifier) { _TOGGLE_MOD(modifier, true); } -int zmk_hid_unregister_mod(zmk_mod modifier) { _TOGGLE_MOD(modifier, false); } +#define SET_MODIFIERS(mods) \ + { \ + kp_report.body.modifiers = mods; \ + LOG_DBG("Modifiers set to 0x%02X", kp_report.body.modifiers); \ + } -int zmk_hid_register_mods(zmk_mod_flags modifiers) { - kp_report.body.modifiers |= modifiers; +int zmk_hid_register_mod(zmk_mod modifier) { + explicit_modifier_counts[modifier]++; + LOG_DBG("Modifier %d count %d", modifier, explicit_modifier_counts[modifier]); + WRITE_BIT(explicit_modifiers, modifier, true); + SET_MODIFIERS(explicit_modifiers); return 0; } -int zmk_hid_unregister_mods(zmk_mod_flags modifiers) { - kp_report.body.modifiers &= ~modifiers; +int zmk_hid_unregister_mod(zmk_mod modifier) { + if (explicit_modifier_counts[modifier] <= 0) { + LOG_ERR("Tried to unregister modifier %d too often", modifier); + return -EINVAL; + } + explicit_modifier_counts[modifier]--; + LOG_DBG("Modifier %d count: %d", modifier, explicit_modifier_counts[modifier]); + if (explicit_modifier_counts[modifier] == 0) { + LOG_DBG("Modifier %d released", modifier); + WRITE_BIT(explicit_modifiers, modifier, false); + } + SET_MODIFIERS(explicit_modifiers); return 0; } @@ -52,6 +67,16 @@ int zmk_hid_unregister_mods(zmk_mod_flags modifiers) { break; \ } +int zmk_hid_implicit_modifiers_press(zmk_mod_flags implicit_modifiers) { + SET_MODIFIERS(explicit_modifiers | implicit_modifiers); + return 0; +} + +int zmk_hid_implicit_modifiers_release() { + SET_MODIFIERS(explicit_modifiers); + return 0; +} + int zmk_hid_keypad_press(zmk_key code) { if (code >= LCTL && code <= RGUI) { return zmk_hid_register_mod(code - LCTL); diff --git a/app/src/hid_listener.c b/app/src/hid_listener.c index 4467e6d4..32e9d97b 100644 --- a/app/src/hid_listener.c +++ b/app/src/hid_listener.c @@ -15,10 +15,11 @@ LOG_MODULE_DECLARE(zmk, CONFIG_ZMK_LOG_LEVEL); #include #include -static int hid_listener_keycode_pressed(u8_t usage_page, u32_t keycode) { +static int hid_listener_keycode_pressed(u8_t usage_page, u32_t keycode, + zmk_mod_flags implicit_modifiers) { int err; - LOG_DBG("usage_page 0x%02X keycode 0x%02X", usage_page, keycode); - + LOG_DBG("usage_page 0x%02X keycode 0x%02X mods 0x%02X", usage_page, keycode, + implicit_modifiers); switch (usage_page) { case USAGE_KEYPAD: err = zmk_hid_keypad_press(keycode); @@ -35,14 +36,15 @@ static int hid_listener_keycode_pressed(u8_t usage_page, u32_t keycode) { } break; } - + zmk_hid_implicit_modifiers_press(implicit_modifiers); return zmk_endpoints_send_report(usage_page); } -static int hid_listener_keycode_released(u8_t usage_page, u32_t keycode) { +static int hid_listener_keycode_released(u8_t usage_page, u32_t keycode, + zmk_mod_flags implicit_modifiers) { int err; - LOG_DBG("usage_page 0x%02X keycode 0x%02X", usage_page, keycode); - + LOG_DBG("usage_page 0x%02X keycode 0x%02X mods 0x%02X", usage_page, keycode, + implicit_modifiers); switch (usage_page) { case USAGE_KEYPAD: err = zmk_hid_keypad_release(keycode); @@ -57,44 +59,27 @@ static int hid_listener_keycode_released(u8_t usage_page, u32_t keycode) { LOG_ERR("Unable to release keycode"); return err; } - break; } + // There is a minor issue with this code. + // If LC(A) is pressed, then LS(B), then LC(A) is released, the shift for B will be released + // prematurely. This causes if LS(B) to repeat like Bbbbbbbb when pressed for a long time. + // Solving this would require keeping track of which key's implicit modifiers are currently + // active and only releasing modifiers at that time. + zmk_hid_implicit_modifiers_release(); return zmk_endpoints_send_report(usage_page); } -static int hid_listener_modifiers_pressed(zmk_mod_flags modifiers) { - LOG_DBG("modifiers %d", modifiers); - - zmk_hid_register_mods(modifiers); - return zmk_endpoints_send_report(USAGE_KEYPAD); -} - -static int hid_listener_modifiers_released(zmk_mod_flags modifiers) { - LOG_DBG("modifiers %d", modifiers); - - zmk_hid_unregister_mods(modifiers); - return zmk_endpoints_send_report(USAGE_KEYPAD); -} - int hid_listener(const struct zmk_event_header *eh) { if (is_keycode_state_changed(eh)) { const struct keycode_state_changed *ev = cast_keycode_state_changed(eh); if (ev->state) { - hid_listener_keycode_pressed(ev->usage_page, ev->keycode); + hid_listener_keycode_pressed(ev->usage_page, ev->keycode, ev->implicit_modifiers); } else { - hid_listener_keycode_released(ev->usage_page, ev->keycode); - } - } else if (is_modifiers_state_changed(eh)) { - const struct modifiers_state_changed *ev = cast_modifiers_state_changed(eh); - if (ev->state) { - hid_listener_modifiers_pressed(ev->modifiers); - } else { - hid_listener_modifiers_released(ev->modifiers); + hid_listener_keycode_released(ev->usage_page, ev->keycode, ev->implicit_modifiers); } } return 0; } ZMK_LISTENER(hid_listener, hid_listener); -ZMK_SUBSCRIPTION(hid_listener, keycode_state_changed); -ZMK_SUBSCRIPTION(hid_listener, modifiers_state_changed); \ No newline at end of file +ZMK_SUBSCRIPTION(hid_listener, keycode_state_changed); \ No newline at end of file diff --git a/app/src/keymap.c b/app/src/keymap.c index 74fe60db..1d289e51 100644 --- a/app/src/keymap.c +++ b/app/src/keymap.c @@ -11,7 +11,6 @@ LOG_MODULE_DECLARE(zmk, CONFIG_ZMK_LOG_LEVEL); #include #include #include -#include #include #include diff --git a/app/tests/hold-tap/balanced/1-dn-up/keycode_events.snapshot b/app/tests/hold-tap/balanced/1-dn-up/keycode_events.snapshot index 5f6a2668..c088e5e6 100644 --- a/app/tests/hold-tap/balanced/1-dn-up/keycode_events.snapshot +++ b/app/tests/hold-tap/balanced/1-dn-up/keycode_events.snapshot @@ -1,5 +1,5 @@ ht_binding_pressed: 0 new undecided hold_tap ht_decide: 0 decided tap (balanced event 0) -kp_pressed: usage_page 0x07 keycode 0x09 -kp_released: usage_page 0x07 keycode 0x09 +kp_pressed: usage_page 0x07 keycode 0x09 mods 0x00 +kp_released: usage_page 0x07 keycode 0x09 mods 0x00 ht_binding_released: 0 cleaning up hold-tap diff --git a/app/tests/hold-tap/balanced/2-dn-timer-up/keycode_events.snapshot b/app/tests/hold-tap/balanced/2-dn-timer-up/keycode_events.snapshot index ddda1ae4..a8b5d1fe 100644 --- a/app/tests/hold-tap/balanced/2-dn-timer-up/keycode_events.snapshot +++ b/app/tests/hold-tap/balanced/2-dn-timer-up/keycode_events.snapshot @@ -1,5 +1,5 @@ ht_binding_pressed: 0 new undecided hold_tap ht_decide: 0 decided hold (balanced event 3) -kp_pressed: usage_page 0x07 keycode 0xe1 -kp_released: usage_page 0x07 keycode 0xe1 +kp_pressed: usage_page 0x07 keycode 0xe1 mods 0x00 +kp_released: usage_page 0x07 keycode 0xe1 mods 0x00 ht_binding_released: 0 cleaning up hold-tap diff --git a/app/tests/hold-tap/balanced/3a-moddn-dn-modup-up/keycode_events.snapshot b/app/tests/hold-tap/balanced/3a-moddn-dn-modup-up/keycode_events.snapshot index a4351030..ca458c7b 100644 --- a/app/tests/hold-tap/balanced/3a-moddn-dn-modup-up/keycode_events.snapshot +++ b/app/tests/hold-tap/balanced/3a-moddn-dn-modup-up/keycode_events.snapshot @@ -1,7 +1,7 @@ -kp_pressed: usage_page 0x07 keycode 0xe4 +kp_pressed: usage_page 0x07 keycode 0xe4 mods 0x00 ht_binding_pressed: 0 new undecided hold_tap ht_decide: 0 decided tap (balanced event 0) -kp_pressed: usage_page 0x07 keycode 0x09 -kp_released: usage_page 0x07 keycode 0xe4 -kp_released: usage_page 0x07 keycode 0x09 +kp_pressed: usage_page 0x07 keycode 0x09 mods 0x00 +kp_released: usage_page 0x07 keycode 0xe4 mods 0x00 +kp_released: usage_page 0x07 keycode 0x09 mods 0x00 ht_binding_released: 0 cleaning up hold-tap diff --git a/app/tests/hold-tap/balanced/3b-moddn-dn-modup-timer-up/keycode_events.snapshot b/app/tests/hold-tap/balanced/3b-moddn-dn-modup-timer-up/keycode_events.snapshot index c0da94fd..ef4dfa5f 100644 --- a/app/tests/hold-tap/balanced/3b-moddn-dn-modup-timer-up/keycode_events.snapshot +++ b/app/tests/hold-tap/balanced/3b-moddn-dn-modup-timer-up/keycode_events.snapshot @@ -1,7 +1,7 @@ -kp_pressed: usage_page 0x07 keycode 0xe4 +kp_pressed: usage_page 0x07 keycode 0xe4 mods 0x00 ht_binding_pressed: 0 new undecided hold_tap ht_decide: 0 decided hold (balanced event 3) -kp_pressed: usage_page 0x07 keycode 0xe1 -kp_released: usage_page 0x07 keycode 0xe4 -kp_released: usage_page 0x07 keycode 0xe1 +kp_pressed: usage_page 0x07 keycode 0xe1 mods 0x00 +kp_released: usage_page 0x07 keycode 0xe4 mods 0x00 +kp_released: usage_page 0x07 keycode 0xe1 mods 0x00 ht_binding_released: 0 cleaning up hold-tap diff --git a/app/tests/hold-tap/balanced/3c-kcdn-dn-kcup-up/keycode_events.snapshot b/app/tests/hold-tap/balanced/3c-kcdn-dn-kcup-up/keycode_events.snapshot index ce6e7b7c..70a3353d 100644 --- a/app/tests/hold-tap/balanced/3c-kcdn-dn-kcup-up/keycode_events.snapshot +++ b/app/tests/hold-tap/balanced/3c-kcdn-dn-kcup-up/keycode_events.snapshot @@ -1,7 +1,7 @@ -kp_pressed: usage_page 0x07 keycode 0x07 +kp_pressed: usage_page 0x07 keycode 0x07 mods 0x00 ht_binding_pressed: 0 new undecided hold_tap -kp_released: usage_page 0x07 keycode 0x07 +kp_released: usage_page 0x07 keycode 0x07 mods 0x00 ht_decide: 0 decided tap (balanced event 0) -kp_pressed: usage_page 0x07 keycode 0x09 -kp_released: usage_page 0x07 keycode 0x09 +kp_pressed: usage_page 0x07 keycode 0x09 mods 0x00 +kp_released: usage_page 0x07 keycode 0x09 mods 0x00 ht_binding_released: 0 cleaning up hold-tap diff --git a/app/tests/hold-tap/balanced/3d-kcdn-dn-kcup-timer-up/keycode_events.snapshot b/app/tests/hold-tap/balanced/3d-kcdn-dn-kcup-timer-up/keycode_events.snapshot index 1ec384a6..121f0071 100644 --- a/app/tests/hold-tap/balanced/3d-kcdn-dn-kcup-timer-up/keycode_events.snapshot +++ b/app/tests/hold-tap/balanced/3d-kcdn-dn-kcup-timer-up/keycode_events.snapshot @@ -1,7 +1,7 @@ -kp_pressed: usage_page 0x07 keycode 0x07 +kp_pressed: usage_page 0x07 keycode 0x07 mods 0x00 ht_binding_pressed: 0 new undecided hold_tap -kp_released: usage_page 0x07 keycode 0x07 +kp_released: usage_page 0x07 keycode 0x07 mods 0x00 ht_decide: 0 decided hold (balanced event 3) -kp_pressed: usage_page 0x07 keycode 0xe1 -kp_released: usage_page 0x07 keycode 0xe1 +kp_pressed: usage_page 0x07 keycode 0xe1 mods 0x00 +kp_released: usage_page 0x07 keycode 0xe1 mods 0x00 ht_binding_released: 0 cleaning up hold-tap diff --git a/app/tests/hold-tap/balanced/4a-dn-htdn-timer-htup-up/keycode_events.snapshot b/app/tests/hold-tap/balanced/4a-dn-htdn-timer-htup-up/keycode_events.snapshot index 8a1980b8..ae9dcc96 100644 --- a/app/tests/hold-tap/balanced/4a-dn-htdn-timer-htup-up/keycode_events.snapshot +++ b/app/tests/hold-tap/balanced/4a-dn-htdn-timer-htup-up/keycode_events.snapshot @@ -1,10 +1,10 @@ ht_binding_pressed: 0 new undecided hold_tap ht_decide: 0 decided hold (balanced event 3) -kp_pressed: usage_page 0x07 keycode 0xe1 +kp_pressed: usage_page 0x07 keycode 0xe1 mods 0x00 ht_binding_pressed: 1 new undecided hold_tap ht_decide: 1 decided tap (balanced event 0) -kp_pressed: usage_page 0x07 keycode 0x0d -kp_released: usage_page 0x07 keycode 0x0d +kp_pressed: usage_page 0x07 keycode 0x0d mods 0x00 +kp_released: usage_page 0x07 keycode 0x0d mods 0x00 ht_binding_released: 1 cleaning up hold-tap -kp_released: usage_page 0x07 keycode 0xe1 +kp_released: usage_page 0x07 keycode 0xe1 mods 0x00 ht_binding_released: 0 cleaning up hold-tap diff --git a/app/tests/hold-tap/balanced/4a-dn-kcdn-timer-kcup-up/keycode_events.snapshot b/app/tests/hold-tap/balanced/4a-dn-kcdn-timer-kcup-up/keycode_events.snapshot index b89b21dc..c1e03ad2 100644 --- a/app/tests/hold-tap/balanced/4a-dn-kcdn-timer-kcup-up/keycode_events.snapshot +++ b/app/tests/hold-tap/balanced/4a-dn-kcdn-timer-kcup-up/keycode_events.snapshot @@ -1,7 +1,7 @@ ht_binding_pressed: 0 new undecided hold_tap ht_decide: 0 decided hold (balanced event 3) -kp_pressed: usage_page 0x07 keycode 0xe1 -kp_pressed: usage_page 0x07 keycode 0x07 -kp_released: usage_page 0x07 keycode 0x07 -kp_released: usage_page 0x07 keycode 0xe1 +kp_pressed: usage_page 0x07 keycode 0xe1 mods 0x00 +kp_pressed: usage_page 0x07 keycode 0x07 mods 0x00 +kp_released: usage_page 0x07 keycode 0x07 mods 0x00 +kp_released: usage_page 0x07 keycode 0xe1 mods 0x00 ht_binding_released: 0 cleaning up hold-tap diff --git a/app/tests/hold-tap/balanced/4b-dn-kcdn-kcup-timer-up/keycode_events.snapshot b/app/tests/hold-tap/balanced/4b-dn-kcdn-kcup-timer-up/keycode_events.snapshot index 798e2eed..95330e69 100644 --- a/app/tests/hold-tap/balanced/4b-dn-kcdn-kcup-timer-up/keycode_events.snapshot +++ b/app/tests/hold-tap/balanced/4b-dn-kcdn-kcup-timer-up/keycode_events.snapshot @@ -1,7 +1,7 @@ ht_binding_pressed: 0 new undecided hold_tap ht_decide: 0 decided hold (balanced event 2) -kp_pressed: usage_page 0x07 keycode 0xe1 -kp_pressed: usage_page 0x07 keycode 0x07 -kp_released: usage_page 0x07 keycode 0x07 -kp_released: usage_page 0x07 keycode 0xe1 +kp_pressed: usage_page 0x07 keycode 0xe1 mods 0x00 +kp_pressed: usage_page 0x07 keycode 0x07 mods 0x00 +kp_released: usage_page 0x07 keycode 0x07 mods 0x00 +kp_released: usage_page 0x07 keycode 0xe1 mods 0x00 ht_binding_released: 0 cleaning up hold-tap diff --git a/app/tests/hold-tap/balanced/4c-dn-kcdn-kcup-up/keycode_events.snapshot b/app/tests/hold-tap/balanced/4c-dn-kcdn-kcup-up/keycode_events.snapshot index 798e2eed..95330e69 100644 --- a/app/tests/hold-tap/balanced/4c-dn-kcdn-kcup-up/keycode_events.snapshot +++ b/app/tests/hold-tap/balanced/4c-dn-kcdn-kcup-up/keycode_events.snapshot @@ -1,7 +1,7 @@ ht_binding_pressed: 0 new undecided hold_tap ht_decide: 0 decided hold (balanced event 2) -kp_pressed: usage_page 0x07 keycode 0xe1 -kp_pressed: usage_page 0x07 keycode 0x07 -kp_released: usage_page 0x07 keycode 0x07 -kp_released: usage_page 0x07 keycode 0xe1 +kp_pressed: usage_page 0x07 keycode 0xe1 mods 0x00 +kp_pressed: usage_page 0x07 keycode 0x07 mods 0x00 +kp_released: usage_page 0x07 keycode 0x07 mods 0x00 +kp_released: usage_page 0x07 keycode 0xe1 mods 0x00 ht_binding_released: 0 cleaning up hold-tap diff --git a/app/tests/hold-tap/balanced/4d-dn-kcdn-timer-up-kcup/keycode_events.snapshot b/app/tests/hold-tap/balanced/4d-dn-kcdn-timer-up-kcup/keycode_events.snapshot index 5c9f4e33..63219ee0 100644 --- a/app/tests/hold-tap/balanced/4d-dn-kcdn-timer-up-kcup/keycode_events.snapshot +++ b/app/tests/hold-tap/balanced/4d-dn-kcdn-timer-up-kcup/keycode_events.snapshot @@ -1,7 +1,7 @@ ht_binding_pressed: 0 new undecided hold_tap ht_decide: 0 decided tap (balanced event 0) -kp_pressed: usage_page 0x07 keycode 0x09 -kp_pressed: usage_page 0x07 keycode 0x07 -kp_released: usage_page 0x07 keycode 0x09 +kp_pressed: usage_page 0x07 keycode 0x09 mods 0x00 +kp_pressed: usage_page 0x07 keycode 0x07 mods 0x00 +kp_released: usage_page 0x07 keycode 0x09 mods 0x00 ht_binding_released: 0 cleaning up hold-tap -kp_released: usage_page 0x07 keycode 0x07 +kp_released: usage_page 0x07 keycode 0x07 mods 0x00 diff --git a/app/tests/hold-tap/balanced/many-nested/keycode_events.snapshot b/app/tests/hold-tap/balanced/many-nested/keycode_events.snapshot index 806896fb..dda02ddf 100644 --- a/app/tests/hold-tap/balanced/many-nested/keycode_events.snapshot +++ b/app/tests/hold-tap/balanced/many-nested/keycode_events.snapshot @@ -1,20 +1,20 @@ ht_binding_pressed: 0 new undecided hold_tap ht_decide: 0 decided hold (balanced event 3) -kp_pressed: usage_page 0x07 keycode 0xe1 +kp_pressed: usage_page 0x07 keycode 0xe1 mods 0x00 ht_binding_pressed: 1 new undecided hold_tap ht_decide: 1 decided hold (balanced event 3) -kp_pressed: usage_page 0x07 keycode 0xe0 +kp_pressed: usage_page 0x07 keycode 0xe0 mods 0x00 ht_binding_pressed: 2 new undecided hold_tap ht_binding_released: 0 cleaning up hold-tap ht_decide: 2 decided hold (balanced event 3) -kp_pressed: usage_page 0x07 keycode 0xe3 +kp_pressed: usage_page 0x07 keycode 0xe3 mods 0x00 ht_binding_pressed: 3 new undecided hold_tap ht_binding_released: 1 cleaning up hold-tap ht_decide: 3 decided hold (balanced event 3) -kp_pressed: usage_page 0x07 keycode 0xe2 -kp_released: usage_page 0x07 keycode 0xe1 -kp_released: usage_page 0x07 keycode 0xe0 -kp_released: usage_page 0x07 keycode 0xe3 +kp_pressed: usage_page 0x07 keycode 0xe2 mods 0x00 +kp_released: usage_page 0x07 keycode 0xe1 mods 0x00 +kp_released: usage_page 0x07 keycode 0xe0 mods 0x00 +kp_released: usage_page 0x07 keycode 0xe3 mods 0x00 ht_binding_released: 2 cleaning up hold-tap -kp_released: usage_page 0x07 keycode 0xe2 +kp_released: usage_page 0x07 keycode 0xe2 mods 0x00 ht_binding_released: 3 cleaning up hold-tap diff --git a/app/tests/hold-tap/hold-preferred/1-dn-up/keycode_events.snapshot b/app/tests/hold-tap/hold-preferred/1-dn-up/keycode_events.snapshot index cf787d8d..2eb64758 100644 --- a/app/tests/hold-tap/hold-preferred/1-dn-up/keycode_events.snapshot +++ b/app/tests/hold-tap/hold-preferred/1-dn-up/keycode_events.snapshot @@ -1,5 +1,5 @@ ht_binding_pressed: 0 new undecided hold_tap ht_decide: 0 decided tap (hold-preferred event 0) -kp_pressed: usage_page 0x07 keycode 0x09 -kp_released: usage_page 0x07 keycode 0x09 +kp_pressed: usage_page 0x07 keycode 0x09 mods 0x00 +kp_released: usage_page 0x07 keycode 0x09 mods 0x00 ht_binding_released: 0 cleaning up hold-tap diff --git a/app/tests/hold-tap/hold-preferred/2-dn-timer-up/keycode_events.snapshot b/app/tests/hold-tap/hold-preferred/2-dn-timer-up/keycode_events.snapshot index 03329d53..86517aa3 100644 --- a/app/tests/hold-tap/hold-preferred/2-dn-timer-up/keycode_events.snapshot +++ b/app/tests/hold-tap/hold-preferred/2-dn-timer-up/keycode_events.snapshot @@ -1,5 +1,5 @@ ht_binding_pressed: 0 new undecided hold_tap ht_decide: 0 decided hold (hold-preferred event 3) -kp_pressed: usage_page 0x07 keycode 0xe1 -kp_released: usage_page 0x07 keycode 0xe1 +kp_pressed: usage_page 0x07 keycode 0xe1 mods 0x00 +kp_released: usage_page 0x07 keycode 0xe1 mods 0x00 ht_binding_released: 0 cleaning up hold-tap diff --git a/app/tests/hold-tap/hold-preferred/3a-moddn-dn-modup-up/keycode_events.snapshot b/app/tests/hold-tap/hold-preferred/3a-moddn-dn-modup-up/keycode_events.snapshot index adf4fe23..b7434c65 100644 --- a/app/tests/hold-tap/hold-preferred/3a-moddn-dn-modup-up/keycode_events.snapshot +++ b/app/tests/hold-tap/hold-preferred/3a-moddn-dn-modup-up/keycode_events.snapshot @@ -1,7 +1,7 @@ -kp_pressed: usage_page 0x07 keycode 0xe4 +kp_pressed: usage_page 0x07 keycode 0xe4 mods 0x00 ht_binding_pressed: 0 new undecided hold_tap ht_decide: 0 decided tap (hold-preferred event 0) -kp_pressed: usage_page 0x07 keycode 0x09 -kp_released: usage_page 0x07 keycode 0xe4 -kp_released: usage_page 0x07 keycode 0x09 +kp_pressed: usage_page 0x07 keycode 0x09 mods 0x00 +kp_released: usage_page 0x07 keycode 0xe4 mods 0x00 +kp_released: usage_page 0x07 keycode 0x09 mods 0x00 ht_binding_released: 0 cleaning up hold-tap diff --git a/app/tests/hold-tap/hold-preferred/3b-moddn-dn-modup-timer-up/keycode_events.snapshot b/app/tests/hold-tap/hold-preferred/3b-moddn-dn-modup-timer-up/keycode_events.snapshot index 69b64a96..ffb6aadd 100644 --- a/app/tests/hold-tap/hold-preferred/3b-moddn-dn-modup-timer-up/keycode_events.snapshot +++ b/app/tests/hold-tap/hold-preferred/3b-moddn-dn-modup-timer-up/keycode_events.snapshot @@ -1,7 +1,7 @@ -kp_pressed: usage_page 0x07 keycode 0xe4 +kp_pressed: usage_page 0x07 keycode 0xe4 mods 0x00 ht_binding_pressed: 0 new undecided hold_tap ht_decide: 0 decided hold (hold-preferred event 3) -kp_pressed: usage_page 0x07 keycode 0xe1 -kp_released: usage_page 0x07 keycode 0xe4 -kp_released: usage_page 0x07 keycode 0xe1 +kp_pressed: usage_page 0x07 keycode 0xe1 mods 0x00 +kp_released: usage_page 0x07 keycode 0xe4 mods 0x00 +kp_released: usage_page 0x07 keycode 0xe1 mods 0x00 ht_binding_released: 0 cleaning up hold-tap diff --git a/app/tests/hold-tap/hold-preferred/3c-kcdn-dn-kcup-up/keycode_events.snapshot b/app/tests/hold-tap/hold-preferred/3c-kcdn-dn-kcup-up/keycode_events.snapshot index b06a1d76..1254fedd 100644 --- a/app/tests/hold-tap/hold-preferred/3c-kcdn-dn-kcup-up/keycode_events.snapshot +++ b/app/tests/hold-tap/hold-preferred/3c-kcdn-dn-kcup-up/keycode_events.snapshot @@ -1,7 +1,7 @@ -kp_pressed: usage_page 0x07 keycode 0x07 +kp_pressed: usage_page 0x07 keycode 0x07 mods 0x00 ht_binding_pressed: 0 new undecided hold_tap -kp_released: usage_page 0x07 keycode 0x07 +kp_released: usage_page 0x07 keycode 0x07 mods 0x00 ht_decide: 0 decided tap (hold-preferred event 0) -kp_pressed: usage_page 0x07 keycode 0x09 -kp_released: usage_page 0x07 keycode 0x09 +kp_pressed: usage_page 0x07 keycode 0x09 mods 0x00 +kp_released: usage_page 0x07 keycode 0x09 mods 0x00 ht_binding_released: 0 cleaning up hold-tap diff --git a/app/tests/hold-tap/hold-preferred/3d-kcdn-dn-kcup-timer-up/keycode_events.snapshot b/app/tests/hold-tap/hold-preferred/3d-kcdn-dn-kcup-timer-up/keycode_events.snapshot index bf31955b..ba7b48b3 100644 --- a/app/tests/hold-tap/hold-preferred/3d-kcdn-dn-kcup-timer-up/keycode_events.snapshot +++ b/app/tests/hold-tap/hold-preferred/3d-kcdn-dn-kcup-timer-up/keycode_events.snapshot @@ -1,7 +1,7 @@ -kp_pressed: usage_page 0x07 keycode 0x07 +kp_pressed: usage_page 0x07 keycode 0x07 mods 0x00 ht_binding_pressed: 0 new undecided hold_tap -kp_released: usage_page 0x07 keycode 0x07 +kp_released: usage_page 0x07 keycode 0x07 mods 0x00 ht_decide: 0 decided hold (hold-preferred event 3) -kp_pressed: usage_page 0x07 keycode 0xe1 -kp_released: usage_page 0x07 keycode 0xe1 +kp_pressed: usage_page 0x07 keycode 0xe1 mods 0x00 +kp_released: usage_page 0x07 keycode 0xe1 mods 0x00 ht_binding_released: 0 cleaning up hold-tap diff --git a/app/tests/hold-tap/hold-preferred/4a-dn-htdn-timer-htup-up/keycode_events.snapshot b/app/tests/hold-tap/hold-preferred/4a-dn-htdn-timer-htup-up/keycode_events.snapshot index 3ed7de0d..c8acfc17 100644 --- a/app/tests/hold-tap/hold-preferred/4a-dn-htdn-timer-htup-up/keycode_events.snapshot +++ b/app/tests/hold-tap/hold-preferred/4a-dn-htdn-timer-htup-up/keycode_events.snapshot @@ -1,10 +1,10 @@ ht_binding_pressed: 0 new undecided hold_tap ht_decide: 0 decided hold (hold-preferred event 1) -kp_pressed: usage_page 0x07 keycode 0xe1 +kp_pressed: usage_page 0x07 keycode 0xe1 mods 0x00 ht_binding_pressed: 1 new undecided hold_tap ht_decide: 1 decided tap (hold-preferred event 0) -kp_pressed: usage_page 0x07 keycode 0x0d -kp_released: usage_page 0x07 keycode 0x0d +kp_pressed: usage_page 0x07 keycode 0x0d mods 0x00 +kp_released: usage_page 0x07 keycode 0x0d mods 0x00 ht_binding_released: 1 cleaning up hold-tap -kp_released: usage_page 0x07 keycode 0xe1 +kp_released: usage_page 0x07 keycode 0xe1 mods 0x00 ht_binding_released: 0 cleaning up hold-tap diff --git a/app/tests/hold-tap/hold-preferred/4a-dn-kcdn-timer-kcup-up/keycode_events.snapshot b/app/tests/hold-tap/hold-preferred/4a-dn-kcdn-timer-kcup-up/keycode_events.snapshot index e0b57fd4..97cd07bf 100644 --- a/app/tests/hold-tap/hold-preferred/4a-dn-kcdn-timer-kcup-up/keycode_events.snapshot +++ b/app/tests/hold-tap/hold-preferred/4a-dn-kcdn-timer-kcup-up/keycode_events.snapshot @@ -1,7 +1,7 @@ ht_binding_pressed: 0 new undecided hold_tap ht_decide: 0 decided hold (hold-preferred event 1) -kp_pressed: usage_page 0x07 keycode 0xe1 -kp_pressed: usage_page 0x07 keycode 0x07 -kp_released: usage_page 0x07 keycode 0x07 -kp_released: usage_page 0x07 keycode 0xe1 +kp_pressed: usage_page 0x07 keycode 0xe1 mods 0x00 +kp_pressed: usage_page 0x07 keycode 0x07 mods 0x00 +kp_released: usage_page 0x07 keycode 0x07 mods 0x00 +kp_released: usage_page 0x07 keycode 0xe1 mods 0x00 ht_binding_released: 0 cleaning up hold-tap diff --git a/app/tests/hold-tap/hold-preferred/4b-dn-kcdn-kcup-timer-up/keycode_events.snapshot b/app/tests/hold-tap/hold-preferred/4b-dn-kcdn-kcup-timer-up/keycode_events.snapshot index e0b57fd4..97cd07bf 100644 --- a/app/tests/hold-tap/hold-preferred/4b-dn-kcdn-kcup-timer-up/keycode_events.snapshot +++ b/app/tests/hold-tap/hold-preferred/4b-dn-kcdn-kcup-timer-up/keycode_events.snapshot @@ -1,7 +1,7 @@ ht_binding_pressed: 0 new undecided hold_tap ht_decide: 0 decided hold (hold-preferred event 1) -kp_pressed: usage_page 0x07 keycode 0xe1 -kp_pressed: usage_page 0x07 keycode 0x07 -kp_released: usage_page 0x07 keycode 0x07 -kp_released: usage_page 0x07 keycode 0xe1 +kp_pressed: usage_page 0x07 keycode 0xe1 mods 0x00 +kp_pressed: usage_page 0x07 keycode 0x07 mods 0x00 +kp_released: usage_page 0x07 keycode 0x07 mods 0x00 +kp_released: usage_page 0x07 keycode 0xe1 mods 0x00 ht_binding_released: 0 cleaning up hold-tap diff --git a/app/tests/hold-tap/hold-preferred/4c-dn-kcdn-kcup-up/keycode_events.snapshot b/app/tests/hold-tap/hold-preferred/4c-dn-kcdn-kcup-up/keycode_events.snapshot index e0b57fd4..97cd07bf 100644 --- a/app/tests/hold-tap/hold-preferred/4c-dn-kcdn-kcup-up/keycode_events.snapshot +++ b/app/tests/hold-tap/hold-preferred/4c-dn-kcdn-kcup-up/keycode_events.snapshot @@ -1,7 +1,7 @@ ht_binding_pressed: 0 new undecided hold_tap ht_decide: 0 decided hold (hold-preferred event 1) -kp_pressed: usage_page 0x07 keycode 0xe1 -kp_pressed: usage_page 0x07 keycode 0x07 -kp_released: usage_page 0x07 keycode 0x07 -kp_released: usage_page 0x07 keycode 0xe1 +kp_pressed: usage_page 0x07 keycode 0xe1 mods 0x00 +kp_pressed: usage_page 0x07 keycode 0x07 mods 0x00 +kp_released: usage_page 0x07 keycode 0x07 mods 0x00 +kp_released: usage_page 0x07 keycode 0xe1 mods 0x00 ht_binding_released: 0 cleaning up hold-tap diff --git a/app/tests/hold-tap/hold-preferred/4d-dn-kcdn-timer-up-kcup/keycode_events.snapshot b/app/tests/hold-tap/hold-preferred/4d-dn-kcdn-timer-up-kcup/keycode_events.snapshot index cac579d2..2a21d929 100644 --- a/app/tests/hold-tap/hold-preferred/4d-dn-kcdn-timer-up-kcup/keycode_events.snapshot +++ b/app/tests/hold-tap/hold-preferred/4d-dn-kcdn-timer-up-kcup/keycode_events.snapshot @@ -1,7 +1,7 @@ ht_binding_pressed: 0 new undecided hold_tap ht_decide: 0 decided hold (hold-preferred event 1) -kp_pressed: usage_page 0x07 keycode 0xe1 -kp_pressed: usage_page 0x07 keycode 0x07 -kp_released: usage_page 0x07 keycode 0xe1 +kp_pressed: usage_page 0x07 keycode 0xe1 mods 0x00 +kp_pressed: usage_page 0x07 keycode 0x07 mods 0x00 +kp_released: usage_page 0x07 keycode 0xe1 mods 0x00 ht_binding_released: 0 cleaning up hold-tap -kp_released: usage_page 0x07 keycode 0x07 +kp_released: usage_page 0x07 keycode 0x07 mods 0x00 diff --git a/app/tests/hold-tap/tap-preferred/1-dn-up/keycode_events.snapshot b/app/tests/hold-tap/tap-preferred/1-dn-up/keycode_events.snapshot index 2a250fb8..57e4fcd7 100644 --- a/app/tests/hold-tap/tap-preferred/1-dn-up/keycode_events.snapshot +++ b/app/tests/hold-tap/tap-preferred/1-dn-up/keycode_events.snapshot @@ -1,5 +1,5 @@ ht_binding_pressed: 0 new undecided hold_tap ht_decide: 0 decided tap (tap-preferred event 0) -kp_pressed: usage_page 0x07 keycode 0x09 -kp_released: usage_page 0x07 keycode 0x09 +kp_pressed: usage_page 0x07 keycode 0x09 mods 0x00 +kp_released: usage_page 0x07 keycode 0x09 mods 0x00 ht_binding_released: 0 cleaning up hold-tap diff --git a/app/tests/hold-tap/tap-preferred/2-dn-timer-up/keycode_events.snapshot b/app/tests/hold-tap/tap-preferred/2-dn-timer-up/keycode_events.snapshot index 4f1ee635..71ba8da4 100644 --- a/app/tests/hold-tap/tap-preferred/2-dn-timer-up/keycode_events.snapshot +++ b/app/tests/hold-tap/tap-preferred/2-dn-timer-up/keycode_events.snapshot @@ -1,5 +1,5 @@ ht_binding_pressed: 0 new undecided hold_tap ht_decide: 0 decided hold (tap-preferred event 3) -kp_pressed: usage_page 0x07 keycode 0xe1 -kp_released: usage_page 0x07 keycode 0xe1 +kp_pressed: usage_page 0x07 keycode 0xe1 mods 0x00 +kp_released: usage_page 0x07 keycode 0xe1 mods 0x00 ht_binding_released: 0 cleaning up hold-tap diff --git a/app/tests/hold-tap/tap-preferred/3a-moddn-dn-modup-up/keycode_events.snapshot b/app/tests/hold-tap/tap-preferred/3a-moddn-dn-modup-up/keycode_events.snapshot index 87d1406a..0bc731f0 100644 --- a/app/tests/hold-tap/tap-preferred/3a-moddn-dn-modup-up/keycode_events.snapshot +++ b/app/tests/hold-tap/tap-preferred/3a-moddn-dn-modup-up/keycode_events.snapshot @@ -1,7 +1,7 @@ -kp_pressed: usage_page 0x07 keycode 0xe4 +kp_pressed: usage_page 0x07 keycode 0xe4 mods 0x00 ht_binding_pressed: 0 new undecided hold_tap ht_decide: 0 decided tap (tap-preferred event 0) -kp_pressed: usage_page 0x07 keycode 0x09 -kp_released: usage_page 0x07 keycode 0xe4 -kp_released: usage_page 0x07 keycode 0x09 +kp_pressed: usage_page 0x07 keycode 0x09 mods 0x00 +kp_released: usage_page 0x07 keycode 0xe4 mods 0x00 +kp_released: usage_page 0x07 keycode 0x09 mods 0x00 ht_binding_released: 0 cleaning up hold-tap diff --git a/app/tests/hold-tap/tap-preferred/3b-moddn-dn-modup-timer-up/keycode_events.snapshot b/app/tests/hold-tap/tap-preferred/3b-moddn-dn-modup-timer-up/keycode_events.snapshot index 7455d2a3..6a3398f4 100644 --- a/app/tests/hold-tap/tap-preferred/3b-moddn-dn-modup-timer-up/keycode_events.snapshot +++ b/app/tests/hold-tap/tap-preferred/3b-moddn-dn-modup-timer-up/keycode_events.snapshot @@ -1,7 +1,7 @@ -kp_pressed: usage_page 0x07 keycode 0xe4 +kp_pressed: usage_page 0x07 keycode 0xe4 mods 0x00 ht_binding_pressed: 0 new undecided hold_tap ht_decide: 0 decided hold (tap-preferred event 3) -kp_pressed: usage_page 0x07 keycode 0xe1 -kp_released: usage_page 0x07 keycode 0xe4 -kp_released: usage_page 0x07 keycode 0xe1 +kp_pressed: usage_page 0x07 keycode 0xe1 mods 0x00 +kp_released: usage_page 0x07 keycode 0xe4 mods 0x00 +kp_released: usage_page 0x07 keycode 0xe1 mods 0x00 ht_binding_released: 0 cleaning up hold-tap diff --git a/app/tests/hold-tap/tap-preferred/3c-kcdn-dn-kcup-up/keycode_events.snapshot b/app/tests/hold-tap/tap-preferred/3c-kcdn-dn-kcup-up/keycode_events.snapshot index 3d7eaf1a..e518582c 100644 --- a/app/tests/hold-tap/tap-preferred/3c-kcdn-dn-kcup-up/keycode_events.snapshot +++ b/app/tests/hold-tap/tap-preferred/3c-kcdn-dn-kcup-up/keycode_events.snapshot @@ -1,7 +1,7 @@ -kp_pressed: usage_page 0x07 keycode 0x07 +kp_pressed: usage_page 0x07 keycode 0x07 mods 0x00 ht_binding_pressed: 0 new undecided hold_tap -kp_released: usage_page 0x07 keycode 0x07 +kp_released: usage_page 0x07 keycode 0x07 mods 0x00 ht_decide: 0 decided tap (tap-preferred event 0) -kp_pressed: usage_page 0x07 keycode 0x09 -kp_released: usage_page 0x07 keycode 0x09 +kp_pressed: usage_page 0x07 keycode 0x09 mods 0x00 +kp_released: usage_page 0x07 keycode 0x09 mods 0x00 ht_binding_released: 0 cleaning up hold-tap diff --git a/app/tests/hold-tap/tap-preferred/3d-kcdn-dn-kcup-timer-up/keycode_events.snapshot b/app/tests/hold-tap/tap-preferred/3d-kcdn-dn-kcup-timer-up/keycode_events.snapshot index 059d99c5..b3b06730 100644 --- a/app/tests/hold-tap/tap-preferred/3d-kcdn-dn-kcup-timer-up/keycode_events.snapshot +++ b/app/tests/hold-tap/tap-preferred/3d-kcdn-dn-kcup-timer-up/keycode_events.snapshot @@ -1,7 +1,7 @@ -kp_pressed: usage_page 0x07 keycode 0x07 +kp_pressed: usage_page 0x07 keycode 0x07 mods 0x00 ht_binding_pressed: 0 new undecided hold_tap -kp_released: usage_page 0x07 keycode 0x07 +kp_released: usage_page 0x07 keycode 0x07 mods 0x00 ht_decide: 0 decided hold (tap-preferred event 3) -kp_pressed: usage_page 0x07 keycode 0xe1 -kp_released: usage_page 0x07 keycode 0xe1 +kp_pressed: usage_page 0x07 keycode 0xe1 mods 0x00 +kp_released: usage_page 0x07 keycode 0xe1 mods 0x00 ht_binding_released: 0 cleaning up hold-tap diff --git a/app/tests/hold-tap/tap-preferred/4a-dn-htdn-timer-htup-up/keycode_events.snapshot b/app/tests/hold-tap/tap-preferred/4a-dn-htdn-timer-htup-up/keycode_events.snapshot index a8cf4907..7f454210 100644 --- a/app/tests/hold-tap/tap-preferred/4a-dn-htdn-timer-htup-up/keycode_events.snapshot +++ b/app/tests/hold-tap/tap-preferred/4a-dn-htdn-timer-htup-up/keycode_events.snapshot @@ -1,10 +1,10 @@ ht_binding_pressed: 0 new undecided hold_tap ht_decide: 0 decided hold (tap-preferred event 3) -kp_pressed: usage_page 0x07 keycode 0xe1 +kp_pressed: usage_page 0x07 keycode 0xe1 mods 0x00 ht_binding_pressed: 1 new undecided hold_tap ht_decide: 1 decided tap (tap-preferred event 0) -kp_pressed: usage_page 0x07 keycode 0x0d -kp_released: usage_page 0x07 keycode 0x0d +kp_pressed: usage_page 0x07 keycode 0x0d mods 0x00 +kp_released: usage_page 0x07 keycode 0x0d mods 0x00 ht_binding_released: 1 cleaning up hold-tap -kp_released: usage_page 0x07 keycode 0xe1 +kp_released: usage_page 0x07 keycode 0xe1 mods 0x00 ht_binding_released: 0 cleaning up hold-tap diff --git a/app/tests/hold-tap/tap-preferred/4a-dn-kcdn-timer-kcup-up/keycode_events.snapshot b/app/tests/hold-tap/tap-preferred/4a-dn-kcdn-timer-kcup-up/keycode_events.snapshot index 92a3569a..ade0d3ea 100644 --- a/app/tests/hold-tap/tap-preferred/4a-dn-kcdn-timer-kcup-up/keycode_events.snapshot +++ b/app/tests/hold-tap/tap-preferred/4a-dn-kcdn-timer-kcup-up/keycode_events.snapshot @@ -1,7 +1,7 @@ ht_binding_pressed: 0 new undecided hold_tap ht_decide: 0 decided hold (tap-preferred event 3) -kp_pressed: usage_page 0x07 keycode 0xe1 -kp_pressed: usage_page 0x07 keycode 0x07 -kp_released: usage_page 0x07 keycode 0x07 -kp_released: usage_page 0x07 keycode 0xe1 +kp_pressed: usage_page 0x07 keycode 0xe1 mods 0x00 +kp_pressed: usage_page 0x07 keycode 0x07 mods 0x00 +kp_released: usage_page 0x07 keycode 0x07 mods 0x00 +kp_released: usage_page 0x07 keycode 0xe1 mods 0x00 ht_binding_released: 0 cleaning up hold-tap diff --git a/app/tests/hold-tap/tap-preferred/4b-dn-kcdn-kcup-timer-up/keycode_events.snapshot b/app/tests/hold-tap/tap-preferred/4b-dn-kcdn-kcup-timer-up/keycode_events.snapshot index 92a3569a..ade0d3ea 100644 --- a/app/tests/hold-tap/tap-preferred/4b-dn-kcdn-kcup-timer-up/keycode_events.snapshot +++ b/app/tests/hold-tap/tap-preferred/4b-dn-kcdn-kcup-timer-up/keycode_events.snapshot @@ -1,7 +1,7 @@ ht_binding_pressed: 0 new undecided hold_tap ht_decide: 0 decided hold (tap-preferred event 3) -kp_pressed: usage_page 0x07 keycode 0xe1 -kp_pressed: usage_page 0x07 keycode 0x07 -kp_released: usage_page 0x07 keycode 0x07 -kp_released: usage_page 0x07 keycode 0xe1 +kp_pressed: usage_page 0x07 keycode 0xe1 mods 0x00 +kp_pressed: usage_page 0x07 keycode 0x07 mods 0x00 +kp_released: usage_page 0x07 keycode 0x07 mods 0x00 +kp_released: usage_page 0x07 keycode 0xe1 mods 0x00 ht_binding_released: 0 cleaning up hold-tap diff --git a/app/tests/hold-tap/tap-preferred/4c-dn-kcdn-kcup-up/keycode_events.snapshot b/app/tests/hold-tap/tap-preferred/4c-dn-kcdn-kcup-up/keycode_events.snapshot index bc8aa8e3..418312c3 100644 --- a/app/tests/hold-tap/tap-preferred/4c-dn-kcdn-kcup-up/keycode_events.snapshot +++ b/app/tests/hold-tap/tap-preferred/4c-dn-kcdn-kcup-up/keycode_events.snapshot @@ -1,7 +1,7 @@ ht_binding_pressed: 0 new undecided hold_tap ht_decide: 0 decided tap (tap-preferred event 0) -kp_pressed: usage_page 0x07 keycode 0x09 -kp_pressed: usage_page 0x07 keycode 0x07 -kp_released: usage_page 0x07 keycode 0x07 -kp_released: usage_page 0x07 keycode 0x09 +kp_pressed: usage_page 0x07 keycode 0x09 mods 0x00 +kp_pressed: usage_page 0x07 keycode 0x07 mods 0x00 +kp_released: usage_page 0x07 keycode 0x07 mods 0x00 +kp_released: usage_page 0x07 keycode 0x09 mods 0x00 ht_binding_released: 0 cleaning up hold-tap diff --git a/app/tests/hold-tap/tap-preferred/4d-dn-kcdn-timer-up-kcup/keycode_events.snapshot b/app/tests/hold-tap/tap-preferred/4d-dn-kcdn-timer-up-kcup/keycode_events.snapshot index b106f136..c0b4c0b7 100644 --- a/app/tests/hold-tap/tap-preferred/4d-dn-kcdn-timer-up-kcup/keycode_events.snapshot +++ b/app/tests/hold-tap/tap-preferred/4d-dn-kcdn-timer-up-kcup/keycode_events.snapshot @@ -1,7 +1,7 @@ ht_binding_pressed: 0 new undecided hold_tap ht_decide: 0 decided tap (tap-preferred event 0) -kp_pressed: usage_page 0x07 keycode 0x09 -kp_pressed: usage_page 0x07 keycode 0x07 -kp_released: usage_page 0x07 keycode 0x09 +kp_pressed: usage_page 0x07 keycode 0x09 mods 0x00 +kp_pressed: usage_page 0x07 keycode 0x07 mods 0x00 +kp_released: usage_page 0x07 keycode 0x09 mods 0x00 ht_binding_released: 0 cleaning up hold-tap -kp_released: usage_page 0x07 keycode 0x07 +kp_released: usage_page 0x07 keycode 0x07 mods 0x00 diff --git a/app/tests/keypress/behavior_keymap.dtsi b/app/tests/keypress/behavior_keymap.dtsi index 34c445cf..3a458092 100644 --- a/app/tests/keypress/behavior_keymap.dtsi +++ b/app/tests/keypress/behavior_keymap.dtsi @@ -9,20 +9,8 @@ default_layer { bindings = < - &kp B &mo 1 - &kp D &kp G>; - }; - - lower_layer { - bindings = < - &cp M_NEXT &trans - &kp L &kp J>; - }; - - raise_layer { - bindings = < - &kp W &kp U - &kp X &kp M>; + &kp B &none + &cp M_NEXT &none>; }; }; }; diff --git a/app/tests/keypress/cp-press-release/keycode_events.snapshot b/app/tests/keypress/cp-press-release/keycode_events.snapshot index f1ef0eda..95d24a49 100644 --- a/app/tests/keypress/cp-press-release/keycode_events.snapshot +++ b/app/tests/keypress/cp-press-release/keycode_events.snapshot @@ -1,2 +1,2 @@ -pressed: usage_page 0x0c keycode 0xb5 -released: usage_page 0x0c keycode 0xb5 +pressed: usage_page 0x0c keycode 0xb5 mods 0x00 +pressed: usage_page 0x0c keycode 0xb5 mods 0x00 diff --git a/app/tests/keypress/cp-press-release/native_posix.keymap b/app/tests/keypress/cp-press-release/native_posix.keymap index 0e86f935..bf93af7d 100644 --- a/app/tests/keypress/cp-press-release/native_posix.keymap +++ b/app/tests/keypress/cp-press-release/native_posix.keymap @@ -1,5 +1,5 @@ #include "../behavior_keymap.dtsi" &kscan { - events = ; + events = ; }; \ No newline at end of file diff --git a/app/tests/keypress/kp-press-release/keycode_events.snapshot b/app/tests/keypress/kp-press-release/keycode_events.snapshot index f1ef0eda..80cac202 100644 --- a/app/tests/keypress/kp-press-release/keycode_events.snapshot +++ b/app/tests/keypress/kp-press-release/keycode_events.snapshot @@ -1,2 +1,2 @@ -pressed: usage_page 0x0c keycode 0xb5 -released: usage_page 0x0c keycode 0xb5 +pressed: usage_page 0x07 keycode 0x05 mods 0x00 +released: usage_page 0x07 keycode 0x05 mods 0x00 diff --git a/app/tests/keypress/kp-press-release/native_posix.keymap b/app/tests/keypress/kp-press-release/native_posix.keymap index 7f736904..279b084d 100644 --- a/app/tests/keypress/kp-press-release/native_posix.keymap +++ b/app/tests/keypress/kp-press-release/native_posix.keymap @@ -1,8 +1,5 @@ -#include -#include -#include #include "../behavior_keymap.dtsi" &kscan { - events = ; + events = ; }; \ No newline at end of file diff --git a/app/tests/modifiers/explicit/kp-lctl-dn-lctl-dn-lctl-up-lctl-up/events.patterns b/app/tests/modifiers/explicit/kp-lctl-dn-lctl-dn-lctl-up-lctl-up/events.patterns new file mode 100644 index 00000000..cbf21aff --- /dev/null +++ b/app/tests/modifiers/explicit/kp-lctl-dn-lctl-dn-lctl-up-lctl-up/events.patterns @@ -0,0 +1,4 @@ +s/.*hid_listener_keycode_//p +s/.*hid_register_mod/reg/p +s/.*hid_unregister_mod/unreg/p +s/.*zmk_hid_.*Modifiers set to /mods: Modifiers set to /p \ No newline at end of file diff --git a/app/tests/modifiers/explicit/kp-lctl-dn-lctl-dn-lctl-up-lctl-up/keycode_events.snapshot b/app/tests/modifiers/explicit/kp-lctl-dn-lctl-dn-lctl-up-lctl-up/keycode_events.snapshot new file mode 100644 index 00000000..6218e650 --- /dev/null +++ b/app/tests/modifiers/explicit/kp-lctl-dn-lctl-dn-lctl-up-lctl-up/keycode_events.snapshot @@ -0,0 +1,17 @@ +pressed: usage_page 0x07 keycode 0xe0 mods 0x00 +reg: Modifier 0 count 1 +reg: Modifiers set to 0x01 +mods: Modifiers set to 0x01 +pressed: usage_page 0x07 keycode 0xe0 mods 0x00 +reg: Modifier 0 count 2 +reg: Modifiers set to 0x01 +mods: Modifiers set to 0x01 +released: usage_page 0x07 keycode 0xe0 mods 0x00 +unreg: Modifier 0 count: 1 +unreg: Modifiers set to 0x01 +mods: Modifiers set to 0x01 +released: usage_page 0x07 keycode 0xe0 mods 0x00 +unreg: Modifier 0 count: 0 +unreg: Modifier 0 released +unreg: Modifiers set to 0x00 +mods: Modifiers set to 0x00 diff --git a/app/tests/modifiers/explicit/kp-lctl-dn-lctl-dn-lctl-up-lctl-up/native_posix.keymap b/app/tests/modifiers/explicit/kp-lctl-dn-lctl-dn-lctl-up-lctl-up/native_posix.keymap new file mode 100644 index 00000000..61500946 --- /dev/null +++ b/app/tests/modifiers/explicit/kp-lctl-dn-lctl-dn-lctl-up-lctl-up/native_posix.keymap @@ -0,0 +1,27 @@ +#include +#include +#include + + +&kscan { + events = < + ZMK_MOCK_PRESS(0,0,10) + ZMK_MOCK_PRESS(0,1,10) + ZMK_MOCK_RELEASE(0,0,10) + ZMK_MOCK_RELEASE(0,1,10) + >; +}; + +/ { + keymap { + compatible = "zmk,keymap"; + label ="Default keymap"; + + default_layer { + bindings = < + &kp LCTL &kp LCTL + &kp LSFT &none + >; + }; + }; +}; diff --git a/app/tests/modifiers/explicit/kp-lctl-dn-lctl-up/events.patterns b/app/tests/modifiers/explicit/kp-lctl-dn-lctl-up/events.patterns new file mode 100644 index 00000000..cbf21aff --- /dev/null +++ b/app/tests/modifiers/explicit/kp-lctl-dn-lctl-up/events.patterns @@ -0,0 +1,4 @@ +s/.*hid_listener_keycode_//p +s/.*hid_register_mod/reg/p +s/.*hid_unregister_mod/unreg/p +s/.*zmk_hid_.*Modifiers set to /mods: Modifiers set to /p \ No newline at end of file diff --git a/app/tests/modifiers/explicit/kp-lctl-dn-lctl-up/keycode_events.snapshot b/app/tests/modifiers/explicit/kp-lctl-dn-lctl-up/keycode_events.snapshot new file mode 100644 index 00000000..42324284 --- /dev/null +++ b/app/tests/modifiers/explicit/kp-lctl-dn-lctl-up/keycode_events.snapshot @@ -0,0 +1,9 @@ +pressed: usage_page 0x07 keycode 0xe0 mods 0x00 +reg: Modifier 0 count 1 +reg: Modifiers set to 0x01 +mods: Modifiers set to 0x01 +released: usage_page 0x07 keycode 0xe0 mods 0x00 +unreg: Modifier 0 count: 0 +unreg: Modifier 0 released +unreg: Modifiers set to 0x00 +mods: Modifiers set to 0x00 diff --git a/app/tests/modifiers/explicit/kp-lctl-dn-lctl-up/native_posix.keymap b/app/tests/modifiers/explicit/kp-lctl-dn-lctl-up/native_posix.keymap new file mode 100644 index 00000000..3324584d --- /dev/null +++ b/app/tests/modifiers/explicit/kp-lctl-dn-lctl-up/native_posix.keymap @@ -0,0 +1,25 @@ +#include +#include +#include + + +&kscan { + events = < + ZMK_MOCK_PRESS(0,0,10) + ZMK_MOCK_RELEASE(0,0,10) + >; +}; + +/ { + keymap { + compatible = "zmk,keymap"; + label ="Default keymap"; + + default_layer { + bindings = < + &kp LCTL &kp LCTL + &kp LSFT &none + >; + }; + }; +}; diff --git a/app/tests/modifiers/explicit/kp-lctl-dn-lsft-dn-lctl-up-lsft-up/events.patterns b/app/tests/modifiers/explicit/kp-lctl-dn-lsft-dn-lctl-up-lsft-up/events.patterns new file mode 100644 index 00000000..cbf21aff --- /dev/null +++ b/app/tests/modifiers/explicit/kp-lctl-dn-lsft-dn-lctl-up-lsft-up/events.patterns @@ -0,0 +1,4 @@ +s/.*hid_listener_keycode_//p +s/.*hid_register_mod/reg/p +s/.*hid_unregister_mod/unreg/p +s/.*zmk_hid_.*Modifiers set to /mods: Modifiers set to /p \ No newline at end of file diff --git a/app/tests/modifiers/explicit/kp-lctl-dn-lsft-dn-lctl-up-lsft-up/keycode_events.snapshot b/app/tests/modifiers/explicit/kp-lctl-dn-lsft-dn-lctl-up-lsft-up/keycode_events.snapshot new file mode 100644 index 00000000..60d829a6 --- /dev/null +++ b/app/tests/modifiers/explicit/kp-lctl-dn-lsft-dn-lctl-up-lsft-up/keycode_events.snapshot @@ -0,0 +1,18 @@ +pressed: usage_page 0x07 keycode 0xe0 mods 0x00 +reg: Modifier 0 count 1 +reg: Modifiers set to 0x01 +mods: Modifiers set to 0x01 +pressed: usage_page 0x07 keycode 0xe1 mods 0x00 +reg: Modifier 1 count 1 +reg: Modifiers set to 0x03 +mods: Modifiers set to 0x03 +released: usage_page 0x07 keycode 0xe0 mods 0x00 +unreg: Modifier 0 count: 0 +unreg: Modifier 0 released +unreg: Modifiers set to 0x02 +mods: Modifiers set to 0x02 +released: usage_page 0x07 keycode 0xe1 mods 0x00 +unreg: Modifier 1 count: 0 +unreg: Modifier 1 released +unreg: Modifiers set to 0x00 +mods: Modifiers set to 0x00 diff --git a/app/tests/modifiers/explicit/kp-lctl-dn-lsft-dn-lctl-up-lsft-up/native_posix.keymap b/app/tests/modifiers/explicit/kp-lctl-dn-lsft-dn-lctl-up-lsft-up/native_posix.keymap new file mode 100644 index 00000000..b6f96311 --- /dev/null +++ b/app/tests/modifiers/explicit/kp-lctl-dn-lsft-dn-lctl-up-lsft-up/native_posix.keymap @@ -0,0 +1,27 @@ +#include +#include +#include + + +&kscan { + events = < + ZMK_MOCK_PRESS(0,0,10) + ZMK_MOCK_PRESS(1,0,10) + ZMK_MOCK_RELEASE(0,0,10) + ZMK_MOCK_RELEASE(1,0,10) + >; +}; + +/ { + keymap { + compatible = "zmk,keymap"; + label ="Default keymap"; + + default_layer { + bindings = < + &kp LCTL &kp LCTL + &kp LSFT &none + >; + }; + }; +}; diff --git a/app/tests/modifiers/explicit/kp-lctl-dn-lsft-dn-lsft-up-lctl-up/events.patterns b/app/tests/modifiers/explicit/kp-lctl-dn-lsft-dn-lsft-up-lctl-up/events.patterns new file mode 100644 index 00000000..cbf21aff --- /dev/null +++ b/app/tests/modifiers/explicit/kp-lctl-dn-lsft-dn-lsft-up-lctl-up/events.patterns @@ -0,0 +1,4 @@ +s/.*hid_listener_keycode_//p +s/.*hid_register_mod/reg/p +s/.*hid_unregister_mod/unreg/p +s/.*zmk_hid_.*Modifiers set to /mods: Modifiers set to /p \ No newline at end of file diff --git a/app/tests/modifiers/explicit/kp-lctl-dn-lsft-dn-lsft-up-lctl-up/keycode_events.snapshot b/app/tests/modifiers/explicit/kp-lctl-dn-lsft-dn-lsft-up-lctl-up/keycode_events.snapshot new file mode 100644 index 00000000..b4755e5b --- /dev/null +++ b/app/tests/modifiers/explicit/kp-lctl-dn-lsft-dn-lsft-up-lctl-up/keycode_events.snapshot @@ -0,0 +1,18 @@ +pressed: usage_page 0x07 keycode 0xe0 mods 0x00 +reg: Modifier 0 count 1 +reg: Modifiers set to 0x01 +mods: Modifiers set to 0x01 +pressed: usage_page 0x07 keycode 0xe1 mods 0x00 +reg: Modifier 1 count 1 +reg: Modifiers set to 0x03 +mods: Modifiers set to 0x03 +released: usage_page 0x07 keycode 0xe1 mods 0x00 +unreg: Modifier 1 count: 0 +unreg: Modifier 1 released +unreg: Modifiers set to 0x01 +mods: Modifiers set to 0x01 +released: usage_page 0x07 keycode 0xe0 mods 0x00 +unreg: Modifier 0 count: 0 +unreg: Modifier 0 released +unreg: Modifiers set to 0x00 +mods: Modifiers set to 0x00 diff --git a/app/tests/modifiers/explicit/kp-lctl-dn-lsft-dn-lsft-up-lctl-up/native_posix.keymap b/app/tests/modifiers/explicit/kp-lctl-dn-lsft-dn-lsft-up-lctl-up/native_posix.keymap new file mode 100644 index 00000000..3fedad25 --- /dev/null +++ b/app/tests/modifiers/explicit/kp-lctl-dn-lsft-dn-lsft-up-lctl-up/native_posix.keymap @@ -0,0 +1,28 @@ +#include +#include +#include + + +&kscan { + events = < + ZMK_MOCK_PRESS(0,0,10) + ZMK_MOCK_PRESS(1,0,10) + ZMK_MOCK_RELEASE(1,0,10) + ZMK_MOCK_RELEASE(0,0,10) + + >; +}; + +/ { + keymap { + compatible = "zmk,keymap"; + label ="Default keymap"; + + default_layer { + bindings = < + &kp LCTL &kp LCTL + &kp LSFT &none + >; + }; + }; +}; diff --git a/app/tests/modifiers/implicit/kp-mod1-dn-mod2-dn-mod1-up-mod2-up/events.patterns b/app/tests/modifiers/implicit/kp-mod1-dn-mod2-dn-mod1-up-mod2-up/events.patterns new file mode 100644 index 00000000..cbf21aff --- /dev/null +++ b/app/tests/modifiers/implicit/kp-mod1-dn-mod2-dn-mod1-up-mod2-up/events.patterns @@ -0,0 +1,4 @@ +s/.*hid_listener_keycode_//p +s/.*hid_register_mod/reg/p +s/.*hid_unregister_mod/unreg/p +s/.*zmk_hid_.*Modifiers set to /mods: Modifiers set to /p \ No newline at end of file diff --git a/app/tests/modifiers/implicit/kp-mod1-dn-mod2-dn-mod1-up-mod2-up/keycode_events.snapshot b/app/tests/modifiers/implicit/kp-mod1-dn-mod2-dn-mod1-up-mod2-up/keycode_events.snapshot new file mode 100644 index 00000000..61dd271b --- /dev/null +++ b/app/tests/modifiers/implicit/kp-mod1-dn-mod2-dn-mod1-up-mod2-up/keycode_events.snapshot @@ -0,0 +1,8 @@ +pressed: usage_page 0x07 keycode 0x05 mods 0x02 +mods: Modifiers set to 0x02 +pressed: usage_page 0x07 keycode 0x04 mods 0x01 +mods: Modifiers set to 0x01 +released: usage_page 0x07 keycode 0x05 mods 0x02 +mods: Modifiers set to 0x01 +released: usage_page 0x07 keycode 0x04 mods 0x01 +mods: Modifiers set to 0x00 diff --git a/app/tests/modifiers/implicit/kp-mod1-dn-mod2-dn-mod1-up-mod2-up/native_posix.keymap b/app/tests/modifiers/implicit/kp-mod1-dn-mod2-dn-mod1-up-mod2-up/native_posix.keymap new file mode 100644 index 00000000..c603c009 --- /dev/null +++ b/app/tests/modifiers/implicit/kp-mod1-dn-mod2-dn-mod1-up-mod2-up/native_posix.keymap @@ -0,0 +1,27 @@ +#include +#include +#include + + +&kscan { + events = < + ZMK_MOCK_PRESS(0,1,10) + ZMK_MOCK_PRESS(0,0,10) + ZMK_MOCK_RELEASE(0,1,10) + ZMK_MOCK_RELEASE(0,0,10) + >; +}; + +/ { + keymap { + compatible = "zmk,keymap"; + label ="Default keymap"; + + default_layer { + bindings = < + &kp LC(A) &kp LS(B) + &kp LCTL &none + >; + }; + }; +}; diff --git a/app/tests/modifiers/implicit/kp-mod1-dn-mod2-dn-mod1-up-mod2-up/pending b/app/tests/modifiers/implicit/kp-mod1-dn-mod2-dn-mod1-up-mod2-up/pending new file mode 100644 index 00000000..3f49005a --- /dev/null +++ b/app/tests/modifiers/implicit/kp-mod1-dn-mod2-dn-mod1-up-mod2-up/pending @@ -0,0 +1,9 @@ +This test fails because the hid_listener_keycode_released function +releases implicit modifiers always, even if they were not set by the +key that's going up. Also see the comment in that function: + + If LC(A) is pressed, then LS(B), then LC(A) is released, the shift for B will be released + prematurely. This causes if LS(B) to repeat like Bbbbbbbb when pressed for a long time. + Solving this would require keeping track of which key's implicit modifiers are currently + active and only releasing modifiers at that time. + diff --git a/app/tests/modifiers/implicit/kp-mod1-dn-mod2-dn-mod2-up-mod1-up/events.patterns b/app/tests/modifiers/implicit/kp-mod1-dn-mod2-dn-mod2-up-mod1-up/events.patterns new file mode 100644 index 00000000..cbf21aff --- /dev/null +++ b/app/tests/modifiers/implicit/kp-mod1-dn-mod2-dn-mod2-up-mod1-up/events.patterns @@ -0,0 +1,4 @@ +s/.*hid_listener_keycode_//p +s/.*hid_register_mod/reg/p +s/.*hid_unregister_mod/unreg/p +s/.*zmk_hid_.*Modifiers set to /mods: Modifiers set to /p \ No newline at end of file diff --git a/app/tests/modifiers/implicit/kp-mod1-dn-mod2-dn-mod2-up-mod1-up/keycode_events.snapshot b/app/tests/modifiers/implicit/kp-mod1-dn-mod2-dn-mod2-up-mod1-up/keycode_events.snapshot new file mode 100644 index 00000000..e8a231fe --- /dev/null +++ b/app/tests/modifiers/implicit/kp-mod1-dn-mod2-dn-mod2-up-mod1-up/keycode_events.snapshot @@ -0,0 +1,8 @@ +pressed: usage_page 0x07 keycode 0x04 mods 0x01 +mods: Modifiers set to 0x01 +pressed: usage_page 0x07 keycode 0x05 mods 0x02 +mods: Modifiers set to 0x02 +released: usage_page 0x07 keycode 0x05 mods 0x02 +mods: Modifiers set to 0x00 +released: usage_page 0x07 keycode 0x04 mods 0x01 +mods: Modifiers set to 0x00 diff --git a/app/tests/modifiers/implicit/kp-mod1-dn-mod2-dn-mod2-up-mod1-up/native_posix.keymap b/app/tests/modifiers/implicit/kp-mod1-dn-mod2-dn-mod2-up-mod1-up/native_posix.keymap new file mode 100644 index 00000000..109d60e5 --- /dev/null +++ b/app/tests/modifiers/implicit/kp-mod1-dn-mod2-dn-mod2-up-mod1-up/native_posix.keymap @@ -0,0 +1,27 @@ +#include +#include +#include + + +&kscan { + events = < + ZMK_MOCK_PRESS(0,0,10) + ZMK_MOCK_PRESS(0,1,10) + ZMK_MOCK_RELEASE(0,1,10) + ZMK_MOCK_RELEASE(0,0,10) + >; +}; + +/ { + keymap { + compatible = "zmk,keymap"; + label ="Default keymap"; + + default_layer { + bindings = < + &kp LC(A) &kp LS(B) + &none &none + >; + }; + }; +}; diff --git a/app/tests/modifiers/mixed/kp-lctl-dn-mod-dn-lctl-up-mod-up/events.patterns b/app/tests/modifiers/mixed/kp-lctl-dn-mod-dn-lctl-up-mod-up/events.patterns new file mode 100644 index 00000000..cbf21aff --- /dev/null +++ b/app/tests/modifiers/mixed/kp-lctl-dn-mod-dn-lctl-up-mod-up/events.patterns @@ -0,0 +1,4 @@ +s/.*hid_listener_keycode_//p +s/.*hid_register_mod/reg/p +s/.*hid_unregister_mod/unreg/p +s/.*zmk_hid_.*Modifiers set to /mods: Modifiers set to /p \ No newline at end of file diff --git a/app/tests/modifiers/mixed/kp-lctl-dn-mod-dn-lctl-up-mod-up/keycode_events.snapshot b/app/tests/modifiers/mixed/kp-lctl-dn-mod-dn-lctl-up-mod-up/keycode_events.snapshot new file mode 100644 index 00000000..40c5841e --- /dev/null +++ b/app/tests/modifiers/mixed/kp-lctl-dn-mod-dn-lctl-up-mod-up/keycode_events.snapshot @@ -0,0 +1,13 @@ +pressed: usage_page 0x07 keycode 0xe0 mods 0x00 +reg: Modifier 0 count 1 +reg: Modifiers set to 0x01 +mods: Modifiers set to 0x01 +pressed: usage_page 0x07 keycode 0x05 mods 0x02 +mods: Modifiers set to 0x03 +released: usage_page 0x07 keycode 0xe0 mods 0x00 +unreg: Modifier 0 count: 0 +unreg: Modifier 0 released +unreg: Modifiers set to 0x00 +mods: Modifiers set to 0x00 +released: usage_page 0x07 keycode 0x05 mods 0x02 +mods: Modifiers set to 0x00 diff --git a/app/tests/modifiers/mixed/kp-lctl-dn-mod-dn-lctl-up-mod-up/native_posix.keymap b/app/tests/modifiers/mixed/kp-lctl-dn-mod-dn-lctl-up-mod-up/native_posix.keymap new file mode 100644 index 00000000..d381e4bf --- /dev/null +++ b/app/tests/modifiers/mixed/kp-lctl-dn-mod-dn-lctl-up-mod-up/native_posix.keymap @@ -0,0 +1,27 @@ +#include +#include +#include + + +&kscan { + events = < + ZMK_MOCK_PRESS(1,0,10) + ZMK_MOCK_PRESS(0,1,10) + ZMK_MOCK_RELEASE(1,0,10) + ZMK_MOCK_RELEASE(0,1,10) + >; +}; + +/ { + keymap { + compatible = "zmk,keymap"; + label ="Default keymap"; + + default_layer { + bindings = < + &kp LC(A) &kp LS(B) + &kp LCTL &none + >; + }; + }; +}; diff --git a/app/tests/modifiers/mixed/kp-lctl-dn-mod-dn-mod-up-lctl-up/events.patterns b/app/tests/modifiers/mixed/kp-lctl-dn-mod-dn-mod-up-lctl-up/events.patterns new file mode 100644 index 00000000..cbf21aff --- /dev/null +++ b/app/tests/modifiers/mixed/kp-lctl-dn-mod-dn-mod-up-lctl-up/events.patterns @@ -0,0 +1,4 @@ +s/.*hid_listener_keycode_//p +s/.*hid_register_mod/reg/p +s/.*hid_unregister_mod/unreg/p +s/.*zmk_hid_.*Modifiers set to /mods: Modifiers set to /p \ No newline at end of file diff --git a/app/tests/modifiers/mixed/kp-lctl-dn-mod-dn-mod-up-lctl-up/keycode_events.snapshot b/app/tests/modifiers/mixed/kp-lctl-dn-mod-dn-mod-up-lctl-up/keycode_events.snapshot new file mode 100644 index 00000000..5df571be --- /dev/null +++ b/app/tests/modifiers/mixed/kp-lctl-dn-mod-dn-mod-up-lctl-up/keycode_events.snapshot @@ -0,0 +1,13 @@ +pressed: usage_page 0x07 keycode 0xe0 mods 0x00 +reg: Modifier 0 count 1 +reg: Modifiers set to 0x01 +mods: Modifiers set to 0x01 +pressed: usage_page 0x07 keycode 0x05 mods 0x02 +mods: Modifiers set to 0x03 +released: usage_page 0x07 keycode 0x05 mods 0x02 +mods: Modifiers set to 0x01 +released: usage_page 0x07 keycode 0xe0 mods 0x00 +unreg: Modifier 0 count: 0 +unreg: Modifier 0 released +unreg: Modifiers set to 0x00 +mods: Modifiers set to 0x00 diff --git a/app/tests/modifiers/mixed/kp-lctl-dn-mod-dn-mod-up-lctl-up/native_posix.keymap b/app/tests/modifiers/mixed/kp-lctl-dn-mod-dn-mod-up-lctl-up/native_posix.keymap new file mode 100644 index 00000000..b47b5f7e --- /dev/null +++ b/app/tests/modifiers/mixed/kp-lctl-dn-mod-dn-mod-up-lctl-up/native_posix.keymap @@ -0,0 +1,27 @@ +#include +#include +#include + + +&kscan { + events = < + ZMK_MOCK_PRESS(1,0,10) + ZMK_MOCK_PRESS(0,1,10) + ZMK_MOCK_RELEASE(0,1,10) + ZMK_MOCK_RELEASE(1,0,10) + >; +}; + +/ { + keymap { + compatible = "zmk,keymap"; + label ="Default keymap"; + + default_layer { + bindings = < + &kp LC(A) &kp LS(B) + &kp LCTL &none + >; + }; + }; +}; diff --git a/app/tests/momentary-layer/early-key-release/keycode_events.snapshot b/app/tests/momentary-layer/early-key-release/keycode_events.snapshot index 474eef7a..82ebc67c 100644 --- a/app/tests/momentary-layer/early-key-release/keycode_events.snapshot +++ b/app/tests/momentary-layer/early-key-release/keycode_events.snapshot @@ -1,4 +1,4 @@ -kp_pressed: usage_page 0x07 keycode 0x05 +kp_pressed: usage_page 0x07 keycode 0x05 mods 0x00 mo_pressed: position 1 layer 1 -kp_released: usage_page 0x07 keycode 0x05 +kp_released: usage_page 0x07 keycode 0x05 mods 0x00 mo_released: position 1 layer 1 diff --git a/app/tests/momentary-layer/normal/keycode_events.snapshot b/app/tests/momentary-layer/normal/keycode_events.snapshot index 9dc6101c..247128fe 100644 --- a/app/tests/momentary-layer/normal/keycode_events.snapshot +++ b/app/tests/momentary-layer/normal/keycode_events.snapshot @@ -1,4 +1,4 @@ mo_pressed: position 1 layer 1 -kp_pressed: usage_page 0x0c keycode 0xb5 -kp_released: usage_page 0x0c keycode 0xb5 +kp_pressed: usage_page 0x0c keycode 0xb5 mods 0x00 +kp_released: usage_page 0x0c keycode 0xb5 mods 0x00 mo_released: position 1 layer 1 diff --git a/app/tests/toggle-layer/early-key-release/keycode_events.snapshot b/app/tests/toggle-layer/early-key-release/keycode_events.snapshot index 3ac017c8..6b4d50bd 100644 --- a/app/tests/toggle-layer/early-key-release/keycode_events.snapshot +++ b/app/tests/toggle-layer/early-key-release/keycode_events.snapshot @@ -1,6 +1,6 @@ -kp_pressed: usage_page 0x07 keycode 0x05 +kp_pressed: usage_page 0x07 keycode 0x05 mods 0x00 tog_pressed: position 1 layer 1 -kp_released: usage_page 0x07 keycode 0x05 +kp_released: usage_page 0x07 keycode 0x05 mods 0x00 tog_released: position 1 layer 1 -kp_pressed: usage_page 0x0c keycode 0xb5 -kp_released: usage_page 0x0c keycode 0xb5 +kp_pressed: usage_page 0x0c keycode 0xb5 mods 0x00 +kp_released: usage_page 0x0c keycode 0xb5 mods 0x00 diff --git a/app/tests/toggle-layer/normal/keycode_events.snapshot b/app/tests/toggle-layer/normal/keycode_events.snapshot index 42174cc5..d03295ef 100644 --- a/app/tests/toggle-layer/normal/keycode_events.snapshot +++ b/app/tests/toggle-layer/normal/keycode_events.snapshot @@ -1,4 +1,4 @@ tog_pressed: position 1 layer 1 tog_released: position 1 layer 1 -kp_pressed: usage_page 0x0c keycode 0xb5 -kp_released: usage_page 0x0c keycode 0xb5 +kp_pressed: usage_page 0x0c keycode 0xb5 mods 0x00 +kp_released: usage_page 0x0c keycode 0xb5 mods 0x00 diff --git a/app/tests/transparent/layered/keycode_events.snapshot b/app/tests/transparent/layered/keycode_events.snapshot index d0bd2455..5e707b85 100644 --- a/app/tests/transparent/layered/keycode_events.snapshot +++ b/app/tests/transparent/layered/keycode_events.snapshot @@ -1,2 +1,2 @@ -kp_pressed: usage_page 0x07 keycode 0x04 -kp_released: usage_page 0x07 keycode 0x04 +kp_pressed: usage_page 0x07 keycode 0x04 mods 0x00 +kp_released: usage_page 0x07 keycode 0x04 mods 0x00 diff --git a/docs/docs/feature/keymaps.md b/docs/docs/feature/keymaps.md index 56fc2cc9..a322336c 100644 --- a/docs/docs/feature/keymaps.md +++ b/docs/docs/feature/keymaps.md @@ -68,7 +68,7 @@ In this case, the `A` is actually a define for the raw HID keycode, to make keym For example of a binding that uses two parameters, you can see how "mod-tap" (`mt`) is bound: ``` -&mt MOD_LSFT D +&mt LSFT D ``` Here, the first parameter is the set of modifiers that should be used for the "hold" behavior, and the second @@ -92,7 +92,7 @@ The top two lines of most keymaps should include: The first defines the nodes for all the available behaviors in ZMK, which will be referenced in the behavior bindings. This is how bindings like `&kp` can reference the key press behavior defined with an anchor name of `kp`. -The second include brings in the defines for all the keycodes (e.g. `A`, `NUM_1`, `M_PLAY`) and the modifiers (e.g. `MOD_LSFT`) used for various behavior bindings. +The second include brings in the defines for all the keycodes (e.g. `A`, `NUM_1`, `M_PLAY`) and the modifiers (e.g. `LSFT`) used for various behavior bindings. ### Root devicetree Node