Browse Source

Merge remote-tracking branch 'origin/develop' into xap

QMK Bot 3 years ago
parent
commit
8c4ff20201
1 changed files with 15 additions and 5 deletions
  1. 15 5
      tmk_core/protocol/chibios/usb_main.c

+ 15 - 5
tmk_core/protocol/chibios/usb_main.c

@@ -124,6 +124,16 @@ static const USBDescriptor *usb_get_descriptor_cb(USBDriver *usbp, uint8_t dtype
         return &desc;
 }
 
+/*
+ * USB notification callback that does nothing.  Needed to work around bugs in
+ * some USB LLDs that fail to resume the waiting thread when the notification
+ * callback pointer is NULL.
+ */
+static void dummy_usb_cb(USBDriver *usbp, usbep_t ep) {
+    (void)usbp;
+    (void)ep;
+}
+
 #ifndef KEYBOARD_SHARED_EP
 /* keyboard endpoint state structure */
 static USBInEndpointState kbd_ep_state;
@@ -131,7 +141,7 @@ static USBInEndpointState kbd_ep_state;
 static const USBEndpointConfig kbd_ep_config = {
     USB_EP_MODE_TYPE_INTR,  /* Interrupt EP */
     NULL,                   /* SETUP packet notification callback */
-    NULL,                   /* IN notification callback */
+    dummy_usb_cb,           /* IN notification callback */
     NULL,                   /* OUT notification callback */
     KEYBOARD_EPSIZE,        /* IN maximum packet size */
     0,                      /* OUT maximum packet size */
@@ -149,7 +159,7 @@ static USBInEndpointState mouse_ep_state;
 static const USBEndpointConfig mouse_ep_config = {
     USB_EP_MODE_TYPE_INTR,  /* Interrupt EP */
     NULL,                   /* SETUP packet notification callback */
-    NULL,                   /* IN notification callback */
+    dummy_usb_cb,           /* IN notification callback */
     NULL,                   /* OUT notification callback */
     MOUSE_EPSIZE,           /* IN maximum packet size */
     0,                      /* OUT maximum packet size */
@@ -167,7 +177,7 @@ static USBInEndpointState shared_ep_state;
 static const USBEndpointConfig shared_ep_config = {
     USB_EP_MODE_TYPE_INTR,  /* Interrupt EP */
     NULL,                   /* SETUP packet notification callback */
-    NULL,                   /* IN notification callback */
+    dummy_usb_cb,           /* IN notification callback */
     NULL,                   /* OUT notification callback */
     SHARED_EPSIZE,          /* IN maximum packet size */
     0,                      /* OUT maximum packet size */
@@ -185,7 +195,7 @@ static USBInEndpointState joystick_ep_state;
 static const USBEndpointConfig joystick_ep_config = {
     USB_EP_MODE_TYPE_INTR,  /* Interrupt EP */
     NULL,                   /* SETUP packet notification callback */
-    NULL,                   /* IN notification callback */
+    dummy_usb_cb,           /* IN notification callback */
     NULL,                   /* OUT notification callback */
     JOYSTICK_EPSIZE,        /* IN maximum packet size */
     0,                      /* OUT maximum packet size */
@@ -203,7 +213,7 @@ static USBInEndpointState digitizer_ep_state;
 static const USBEndpointConfig digitizer_ep_config = {
     USB_EP_MODE_TYPE_INTR,  /* Interrupt EP */
     NULL,                   /* SETUP packet notification callback */
-    NULL,                   /* IN notification callback */
+    dummy_usb_cb,           /* IN notification callback */
     NULL,                   /* OUT notification callback */
     DIGITIZER_EPSIZE,       /* IN maximum packet size */
     0,                      /* OUT maximum packet size */