diff options
author | Dasky <32983009+daskygit@users.noreply.github.com> | 2021-10-23 05:04:15 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-10-23 15:04:15 +1100 |
commit | 1953a968c51630cc2badfade9ee54f59c878b422 (patch) | |
tree | 25a1ef005a0ce145214d528f63290906424275be /tmk_core | |
parent | 1e13d07cac92946262be2a8e6e1d497b6e3a6f1c (diff) | |
download | qmk_firmware-1953a968c51630cc2badfade9ee54f59c878b422.tar.gz qmk_firmware-1953a968c51630cc2badfade9ee54f59c878b422.zip |
Check usb transmit status in send_extra() (#14643)
Diffstat (limited to 'tmk_core')
-rw-r--r-- | tmk_core/protocol/chibios/usb_main.c | 11 |
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 cc282e6a9..04049c1a9 100644 --- a/tmk_core/protocol/chibios/usb_main.c +++ b/tmk_core/protocol/chibios/usb_main.c | |||
@@ -921,6 +921,17 @@ static void send_extra(uint8_t report_id, uint16_t data) { | |||
921 | return; | 921 | return; |
922 | } | 922 | } |
923 | 923 | ||
924 | if (usbGetTransmitStatusI(&USB_DRIVER, SHARED_IN_EPNUM)) { | ||
925 | /* Need to either suspend, or loop and call unlock/lock during | ||
926 | * every iteration - otherwise the system will remain locked, | ||
927 | * no interrupts served, so USB not going through as well. | ||
928 | * Note: for suspend, need USB_USE_WAIT == TRUE in halconf.h */ | ||
929 | if (osalThreadSuspendTimeoutS(&(&USB_DRIVER)->epc[SHARED_IN_EPNUM]->in_state->thread, TIME_MS2I(10)) == MSG_TIMEOUT) { | ||
930 | osalSysUnlock(); | ||
931 | return; | ||
932 | } | ||
933 | } | ||
934 | |||
924 | static report_extra_t report; | 935 | static report_extra_t report; |
925 | report = (report_extra_t){.report_id = report_id, .usage = data}; | 936 | report = (report_extra_t){.report_id = report_id, .usage = data}; |
926 | 937 | ||