fix(usb): Correctly detect USB connection status.
* Fix detection of USB power vs. configuration, to ensure endpoint selection works properly with power-only USB attached.
This commit is contained in:
parent
db43757461
commit
d7bd81e5c4
1 changed files with 5 additions and 5 deletions
|
@ -31,16 +31,16 @@ enum usb_dc_status_code zmk_usb_get_status() { return usb_status; }
|
|||
enum zmk_usb_conn_state zmk_usb_get_conn_state() {
|
||||
LOG_DBG("state: %d", usb_status);
|
||||
switch (usb_status) {
|
||||
case USB_DC_SUSPEND:
|
||||
case USB_DC_CONFIGURED:
|
||||
return ZMK_USB_CONN_HID;
|
||||
|
||||
case USB_DC_DISCONNECTED:
|
||||
case USB_DC_UNKNOWN:
|
||||
return ZMK_USB_CONN_NONE;
|
||||
|
||||
case USB_DC_ERROR:
|
||||
case USB_DC_RESET:
|
||||
return ZMK_USB_CONN_POWERED;
|
||||
|
||||
default:
|
||||
return ZMK_USB_CONN_HID;
|
||||
return ZMK_USB_CONN_POWERED;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue