diff options
| author | Stefan Kerkmann | 2025-11-11 13:35:03 +0100 |
|---|---|---|
| committer | GitHub | 2025-11-11 13:35:03 +0100 |
| commit | c68e4dec10db07f16f6d2b5dd883bbcfc09cde25 (patch) | |
| tree | 4b4a59b1f30a476c012466629bcbe21f1b756405 /quantum | |
| parent | 1ddcf57382f94548aba23871c57c7ce835f203b9 (diff) | |
[Core] suspend: suppress wake up keypress (#23389)
* suspend: suppress wake up keypress
Waking the host from suspend is done by pressing any key on the
keyboard, the regular key codes assigned to the keys are not important
and must not be sent - otherwise they usually end up in password prompts
as ghost characters that have to be deleted again. This commit adds
suppression for all keys pressed at the time of wake up. Once a key is
released it functions as a regular key again.
Signed-off-by: Stefan Kerkmann <karlk90@pm.me>
* suspend: update wake up matrix after wake up delay
If USB_SUSPEND_WAKEUP_DELAY is set, the keyboard sleeps during wake up -
which can be up to multiple seconds. To handle key presses and releases
in that time frame we have to handle the following cases:
1. Key not pressed before suspend, and not pressed after wakeup → do
nothing (normal case).
2. Key not pressed before suspend, but pressed after wakeup → set the
wakeup_matrix bit to 1 (so that the press and release events would be
suppressed).
3. Key pressed before suspend, but not pressed after wakeup → do nothing
(the release event will be generated on the first matrix_task() call
after the wakeup).
4. Key pressed before suspend, and still pressed after wakeup → do
nothing (the release event will be generated some time later).
Signed-off-by: Stefan Kerkmann <karlk90@pm.me>
Co-authored-by: Sergey Vlasov <sigprof@gmail.com>
* keyboards: anavi: macropad8: disable snake and rgb_test effects
...to shrink the binary size.
Diffstat (limited to 'quantum')
| -rw-r--r-- | quantum/keyboard.c | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/quantum/keyboard.c b/quantum/keyboard.c index ce8c8efa68..e0c9373165 100644 --- a/quantum/keyboard.c +++ b/quantum/keyboard.c @@ -33,6 +33,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>. #include "sendchar.h" #include "eeconfig.h" #include "action_layer.h" +#include "suspend.h" #ifdef BOOTMAGIC_ENABLE # include "bootmagic.h" #endif @@ -563,6 +564,7 @@ void switch_events(uint8_t row, uint8_t col, bool pressed) { #if defined(RGB_MATRIX_ENABLE) rgb_matrix_handle_key_event(row, col, pressed); #endif + wakeup_matrix_handle_key_event(row, col, pressed); } /** @@ -578,6 +580,8 @@ static inline void generate_tick_event(void) { } } +matrix_row_t matrix_previous[MATRIX_ROWS]; + /** * @brief This task scans the keyboards matrix and processes any key presses * that occur. @@ -591,8 +595,6 @@ static bool matrix_task(void) { return false; } - static matrix_row_t matrix_previous[MATRIX_ROWS]; - matrix_scan(); bool matrix_changed = false; for (uint8_t row = 0; row < MATRIX_ROWS && !matrix_changed; row++) { @@ -626,7 +628,7 @@ static bool matrix_task(void) { if (row_changes & col_mask) { const bool key_pressed = current_row & col_mask; - if (process_keypress) { + if (process_keypress && !keypress_is_wakeup_key(row, col)) { action_exec(MAKE_KEYEVENT(row, col, key_pressed)); } |