From 6124d254f94ab6c115172311e0878a159b8ddcaa Mon Sep 17 00:00:00 2001 From: John Drogo Date: Sun, 11 Sep 2022 00:05:15 -0700 Subject: [PATCH 1/2] fix(usb): add USB_DC_RESUME to supported states All credit for this one goes to @xudongzheng (thanks for helping debug this!). Should fix the issue where keyboards go unresponsive after their host machine wakes from sleep due to the USB driver entering an error state. I was able to both reliably reproduce the issue before the patch goes in and confirmed it no longer occurs post patch. The `USB_DC_RESUME` state indicates the host event has resumed the connection. Adding it to the list of valid connection states to prevent the error when waking from sleep. Zephyr API Link: https://docs.zephyrproject.org/apidoc/latest/group____usb__device__controller__api.html#gac09e3e0af1a2b41a5bfbad91f900baf7 fixes #1372 --- app/src/usb.c | 1 + 1 file changed, 1 insertion(+) diff --git a/app/src/usb.c b/app/src/usb.c index 5f170ee6..aa2d3e75 100644 --- a/app/src/usb.c +++ b/app/src/usb.c @@ -33,6 +33,7 @@ enum zmk_usb_conn_state zmk_usb_get_conn_state() { switch (usb_status) { case USB_DC_SUSPEND: case USB_DC_CONFIGURED: + case USB_DC_RESUME: return ZMK_USB_CONN_HID; case USB_DC_DISCONNECTED: From 3f28a55452eb34d02876e0c98bdc4be9e00936c3 Mon Sep 17 00:00:00 2001 From: Robert U <978080+urob@users.noreply.github.com> Date: Sun, 11 Sep 2022 21:06:04 -0400 Subject: [PATCH 2/2] fix(docs): Fix ambiguous tap-preferred desc. --- docs/docs/behaviors/hold-tap.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/docs/behaviors/hold-tap.md b/docs/docs/behaviors/hold-tap.md index 528b9aec..667e5df8 100644 --- a/docs/docs/behaviors/hold-tap.md +++ b/docs/docs/behaviors/hold-tap.md @@ -28,7 +28,7 @@ We call this the 'hold-preferred' flavor of hold-taps. While this flavor may wor - The 'hold-preferred' flavor triggers the hold behavior when the `tapping-term-ms` has expired or another key is pressed. - The 'balanced' flavor will trigger the hold behavior when the `tapping-term-ms` has expired or another key is pressed and released. -- The 'tap-preferred' flavor triggers the hold behavior when the `tapping-term-ms` has expired. It triggers the tap behavior when another key is pressed. +- The 'tap-preferred' flavor triggers the hold behavior when the `tapping-term-ms` has expired. Pressing another key within `tapping-term-ms` does not affect the decision. - The 'tap-unless-interrupted' flavor triggers a hold behavior only when another key is pressed before `tapping-term-ms` has expired. It triggers the tap behavior in all other situations. When the hold-tap key is released and the hold behavior has not been triggered, the tap behavior will trigger.