summaryrefslogtreecommitdiff
path: root/tmk_core/protocol/chibios
diff options
context:
space:
mode:
authorQMK Bot <hello@qmk.fm>2021-10-23 04:04:47 +0000
committerQMK Bot <hello@qmk.fm>2021-10-23 04:04:47 +0000
commit3b04425f1abe61d773b34285ff8093496c7243cb (patch)
tree4210b2cf06c3635e786336e2a7bf65cb43b8d3e5 /tmk_core/protocol/chibios
parent203b87a7d550c5ec48e6017519e09bb7f23482a3 (diff)
parent1953a968c51630cc2badfade9ee54f59c878b422 (diff)
Merge remote-tracking branch 'origin/master' into develop
Diffstat (limited to 'tmk_core/protocol/chibios')
-rw-r--r--tmk_core/protocol/chibios/usb_main.c11
1 files changed, 11 insertions, 0 deletions
diff --git a/tmk_core/protocol/chibios/usb_main.c b/tmk_core/protocol/chibios/usb_main.c
index 9b139b3992..3b16a0ff7b 100644
--- a/tmk_core/protocol/chibios/usb_main.c
+++ b/tmk_core/protocol/chibios/usb_main.c
@@ -934,6 +934,17 @@ static void send_extra(uint8_t report_id, uint16_t data) {
return;
}
+ if (usbGetTransmitStatusI(&USB_DRIVER, SHARED_IN_EPNUM)) {
+ /* Need to either suspend, or loop and call unlock/lock during
+ * every iteration - otherwise the system will remain locked,
+ * no interrupts served, so USB not going through as well.
+ * Note: for suspend, need USB_USE_WAIT == TRUE in halconf.h */
+ if (osalThreadSuspendTimeoutS(&(&USB_DRIVER)->epc[SHARED_IN_EPNUM]->in_state->thread, TIME_MS2I(10)) == MSG_TIMEOUT) {
+ osalSysUnlock();
+ return;
+ }
+ }
+
static report_extra_t report;
report = (report_extra_t){.report_id = report_id, .usage = data};