1
0

Fix drop key stroke

Keyboard report should be checked if its transfer finishs successfully.
Otherwise key stroke can be missing when other key event occurs
before the last report transfer is done.

Boot protocol 10ms interval probably causes this problem in case
it receives key events in a row within the period. NKRO protocol
suffers less or nothing due to its interval 1ms.
This commit is contained in:
Jun Wako 2015-10-17 15:28:21 +09:00
parent dcac43fa51
commit 8bcddd24f7

View File

@ -1121,19 +1121,24 @@ void send_keyboard(report_keyboard_t *report) {
} }
osalSysUnlock(); osalSysUnlock();
bool ret;
#ifdef NKRO_ENABLE #ifdef NKRO_ENABLE
if(keyboard_nkro) { /* NKRO protocol */ if(keyboard_nkro) { /* NKRO protocol */
usbPrepareTransmit(&USB_DRIVER, NKRO_ENDPOINT, (uint8_t *)report, sizeof(report_keyboard_t)); usbPrepareTransmit(&USB_DRIVER, NKRO_ENDPOINT, (uint8_t *)report, sizeof(report_keyboard_t));
do {
osalSysLock(); osalSysLock();
usbStartTransmitI(&USB_DRIVER, NKRO_ENDPOINT); ret = usbStartTransmitI(&USB_DRIVER, NKRO_ENDPOINT);
osalSysUnlock(); osalSysUnlock();
} while (ret);
} else } else
#endif /* NKRO_ENABLE */ #endif /* NKRO_ENABLE */
{ /* boot protocol */ { /* boot protocol */
usbPrepareTransmit(&USB_DRIVER, KBD_ENDPOINT, (uint8_t *)report, KBD_EPSIZE); usbPrepareTransmit(&USB_DRIVER, KBD_ENDPOINT, (uint8_t *)report, KBD_EPSIZE);
do {
osalSysLock(); osalSysLock();
usbStartTransmitI(&USB_DRIVER, KBD_ENDPOINT); ret = usbStartTransmitI(&USB_DRIVER, KBD_ENDPOINT);
osalSysUnlock(); osalSysUnlock();
} while (ret);
} }
keyboard_report_sent = *report; keyboard_report_sent = *report;
} }