X-Git-Url: https://git.donarmstrong.com/?a=blobdiff_plain;f=tmk_core%2Fprotocol%2Fchibios%2Fusb_main.c;h=e79ff15e8909307a118c9dc319001a4f696eb4dd;hb=ade22f8e2c272044ea2f80ff6fe5ca9576858939;hp=cbe25719441da6f480a639e22a471353de984228;hpb=96cb9f4661faa80e795b1e6731b7a8e8a50bd0cb;p=qmk_firmware.git diff --git a/tmk_core/protocol/chibios/usb_main.c b/tmk_core/protocol/chibios/usb_main.c index cbe257194..e79ff15e8 100644 --- a/tmk_core/protocol/chibios/usb_main.c +++ b/tmk_core/protocol/chibios/usb_main.c @@ -717,12 +717,14 @@ void send_mouse(report_mouse_t *report) { } osalSysUnlock(); - /* TODO: LUFA manually waits for the endpoint to become ready - * for about 10ms for mouse, kbd, system; 1ms for nkro - * is this really needed? - */ - osalSysLock(); + if(usbGetTransmitStatusI(&USB_DRIVER, MOUSE_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 */ + osalThreadSuspendS(&(&USB_DRIVER)->epc[MOUSE_IN_EPNUM]->in_state->thread); + } usbStartTransmitI(&USB_DRIVER, MOUSE_IN_EPNUM, (uint8_t *)report, sizeof(report_mouse_t)); osalSysUnlock(); }