-
-
Notifications
You must be signed in to change notification settings - Fork 42.1k
Description
Describe the Bug
I've mapped media keys in a momentarily activated layer. When I press mod down - key down - key up - mod up
(seq1) everything works as expected. The issue happens only when the sequence of last two is switched (mod down - key down - mod up - key up
(seq2)). After pressing keys in sequence 2 I observe incredible annoying behavior: my OS cannot interpret normal keys key ups anymore, but according to debug output QMK send them properly. When I press any further key OS starts to repeat it indefinitely.
I wasn't able to find any similar requests at github and started logging commands issues to the driver (see attached logs).
The only noticed difference is the order of host_consumer_send
and keyboard_report
.
They are inverted as in clear_keyboard_but_mods_and_keys
clearing of keys and mods precede clearing of special special hid codes. I don't fully understand why it leads to such fatal consequences, but switching order of these commands helps me.
Additional Context
actions log for seq1
---- action_exec: start -----
EVENT: 0900d(33303)
ACTION: ACT_LAYER_TAP[1:F1] layer_state: 00000000(0) default_layer_state: 00000000(0)
layer_state: 00000000(0) to 00000002(1)
keyboard_report: 01 00 00 00 00 00 00 00 00
processed: 0900d(33303):0
---- action_exec: start -----
EVENT: 0101d(34317)
ACTION: ACT_USAGE[4:CD] layer_state: 00000002(1) default_layer_state: 00000000(0)
host_consumer_send: 205
processed: 0101d(34317):0
---- action_exec: start -----
EVENT: 0900u(35697)
ensure_modifiers: desired: 0, active: 0
ACTION: ACT_LAYER_TAP[1:F1] layer_state: 00000002(1) default_layer_state: 00000000(0)
layer_state: 00000002(1) to 00000000(0)
keyboard_report: 01 00 00 00 00 00 00 00 00
host_consumer_send: 0
processed: 0900u(35697):0
---- action_exec: start -----
EVENT: 0101u(36473)
ACTION: ACT_USAGE[4:CD] layer_state: 00000000(0) default_layer_state: 00000000(0)
processed: 0101u(36473):0
actions log for seq1
---- action_exec: start -----
EVENT: 0900d(64619)
ACTION: ACT_LAYER_TAP[1:F1] layer_state: 00000000(0) default_layer_state: 00000000(0)
layer_state: 00000000(0) to 00000002(1)
keyboard_report: 01 00 00 00 00 00 00 00 00
processed: 0900d(64619):0
---- action_exec: start -----
EVENT: 0101d(343)
ACTION: ACT_USAGE[4:CD] layer_state: 00000002(1) default_layer_state: 00000000(0)
host_consumer_send: 205
processed: 0101d(343):0
---- action_exec: start -----
EVENT: 0101u(1883)
ACTION: ACT_USAGE[4:CD] layer_state: 00000002(1) default_layer_state: 00000000(0)
host_consumer_send: 0
processed: 0101u(1883):0
---- action_exec: start -----
EVENT: 0900u(2915)
ensure_modifiers: desired: 0, active: 0
ACTION: ACT_LAYER_TAP[1:F1] layer_state: 00000002(1) default_layer_state: 00000000(0)
layer_state: 00000002(1) to 00000000(0)
keyboard_report: 01 00 00 00 00 00 00 00 00
processed: 0900u(2915):0
proposed patch
diff --git a/tmk_core/common/action.c b/tmk_core/common/action.c
index 77da0139f..c6f3ffd7b 100644
--- a/tmk_core/common/action.c
+++ b/tmk_core/common/action.c
@@ -1017,6 +1017,10 @@ void clear_keyboard_but_mods(void) {
* FIXME: Needs documentation.
*/
void clear_keyboard_but_mods_and_keys() {
+#ifdef EXTRAKEY_ENABLE
+ host_system_send(0);
+ host_consumer_send(0);
+#endif
clear_weak_mods();
clear_macro_mods();
send_keyboard_report();
@@ -1024,10 +1028,6 @@ void clear_keyboard_but_mods_and_keys() {
mousekey_clear();
mousekey_send();
#endif
-#ifdef EXTRAKEY_ENABLE
- host_system_send(0);
- host_consumer_send(0);
-#endif
}
/** \brief Utilities for actions. (FIXME: Needs better description)