From c11759bc795239c38c36ecd78d6408662aa77f54 Mon Sep 17 00:00:00 2001 From: Pete Johanson Date: Wed, 6 Jan 2021 00:15:48 -0500 Subject: [PATCH] fix(hid): Clear all matching usages, not just first. * If various events get dropped, we can end up with duplicate codes in our report, so tweak to ensure we look for all matches and clear them when we have a keycode released. --- app/src/hid.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/app/src/hid.c b/app/src/hid.c index 37378b45..b9ddfc52 100644 --- a/app/src/hid.c +++ b/app/src/hid.c @@ -55,7 +55,9 @@ int zmk_hid_unregister_mod(zmk_mod_t modifier) { continue; \ } \ keyboard_report.body.keys[idx] = val; \ - break; \ + if (val) { \ + break; \ + } \ } #define TOGGLE_CONSUMER(match, val) \ @@ -64,7 +66,9 @@ int zmk_hid_unregister_mod(zmk_mod_t modifier) { continue; \ } \ consumer_report.body.keys[idx] = val; \ - break; \ + if (val) { \ + break; \ + } \ } int zmk_hid_implicit_modifiers_press(zmk_mod_flags_t implicit_modifiers) {