Skip to content

Commit 4d107fe

Browse files
authored
Check for ongoing transfers on the OUT endpoint (#16974)
...when attempting to start a receiving USB transfer. Previously, we would check on the IN endpoint which is the transmitting part of the USB endpoint. This is wrong and lead to two USB transfers being started immediately after each other in case of e.g. RAW HID endpoints: 1. When finishing an OUT transfer the low level USB driver calls the out_cb callback, which in turn initiates another OUT transfer by calling qmkusbDataReceived. 2. When the raw hid receive channel runs empty inside the raw_hid task, another OUT transfer is started to potentially fill the channel again. This happens by calling ibnotify. Both events occur directly after each other, thus triggering the bug.
1 parent da63289 commit 4d107fe

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

tmk_core/protocol/chibios/usb_driver.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@ static bool qmkusb_start_receive(QMKUSBDriver *qmkusbp) {
6060
}
6161

6262
/* Checking if there is already a transaction ongoing on the endpoint.*/
63-
if (usbGetReceiveStatusI(qmkusbp->config->usbp, qmkusbp->config->bulk_in)) {
63+
if (usbGetReceiveStatusI(qmkusbp->config->usbp, qmkusbp->config->bulk_out)) {
6464
return true;
6565
}
6666

0 commit comments

Comments
 (0)