Skip to content

Commit a75834e

Browse files
committed
Do timeout when writing to CONSOLE EP queue.
Fixes TMK bug tmk#266.
1 parent 1104dc0 commit a75834e

File tree

1 file changed

+7
-4
lines changed

1 file changed

+7
-4
lines changed

tmk_core/protocol/chibios/usb_main.c

+7-4
Original file line numberDiff line numberDiff line change
@@ -1323,10 +1323,13 @@ int8_t sendchar(uint8_t c) {
13231323
return 0;
13241324
}
13251325
osalSysUnlock();
1326-
/* should get suspended and wait if the queue is full
1327-
* but it's not blocking even if noone is listening,
1328-
* because the USB packets are sent anyway */
1329-
return(chOQPut(&console_queue, c));
1326+
/* Timeout after 5us if the queue is full.
1327+
* Increase this timeout if too much stuff is getting
1328+
* dropped (i.e. the buffer is getting full too fast
1329+
* for USB/HIDRAW to dequeue). Another possibility
1330+
* for fixing this kind of thing is to increase
1331+
* CONSOLE_QUEUE_CAPACITY. */
1332+
return(chOQPutTimeout(&console_queue, c, US2ST(5)));
13301333
}
13311334

13321335
#else /* CONSOLE_ENABLE */

0 commit comments

Comments
 (0)