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
This commit is contained in:
John Drogo 2022-09-11 00:05:15 -07:00 committed by Pete Johanson
parent 41bfc56e13
commit 6124d254f9

View file

@ -33,6 +33,7 @@ enum zmk_usb_conn_state zmk_usb_get_conn_state() {
switch (usb_status) { switch (usb_status) {
case USB_DC_SUSPEND: case USB_DC_SUSPEND:
case USB_DC_CONFIGURED: case USB_DC_CONFIGURED:
case USB_DC_RESUME:
return ZMK_USB_CONN_HID; return ZMK_USB_CONN_HID;
case USB_DC_DISCONNECTED: case USB_DC_DISCONNECTED: