From d1c15375e7ffae0e0e64d05298cc2e29c3c4c8ac Mon Sep 17 00:00:00 2001 From: Alexey Korobko <32317929+akorobko@users.noreply.github.com> Date: Mon, 17 Jun 2024 20:30:31 -0700 Subject: [PATCH] Wake up on keyboard events --- src/keyboard.c | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/src/keyboard.c b/src/keyboard.c index 47def28..032abfa 100644 --- a/src/keyboard.c +++ b/src/keyboard.c @@ -150,8 +150,13 @@ void process_kbd_queue_task(device_t *state) { if (!queue_try_peek(&state->kbd_queue, &report)) return; - /* ... try sending it to the host, if it's successful */ - bool succeeded = tud_hid_keyboard_report(REPORT_ID_KEYBOARD, report.modifier, report.keycode); + bool succeeded = false; + + if (tud_suspended()) + succeeded = tud_remote_wakeup(); + else + /* ... try sending it to the host, if it's successful */ + succeeded = tud_hid_keyboard_report(REPORT_ID_KEYBOARD, report.modifier, report.keycode); /* ... then we can remove it from the queue. Race conditions shouldn't happen [tm] */ if (succeeded)