Skip to content

Commit

Permalink
Do timeout when writing to CONSOLE EP queue.
Browse files Browse the repository at this point in the history
Fixes TMK bug tmk#266.
  • Loading branch information
flabbergast committed Dec 18, 2015
1 parent 6f1e974 commit 0223e7a
Showing 1 changed file with 7 additions and 4 deletions.
11 changes: 7 additions & 4 deletions protocol/chibios/usb_main.c
Original file line number Diff line number Diff line change
Expand Up @@ -1323,10 +1323,13 @@ int8_t sendchar(uint8_t c) {
return 0;
}
osalSysUnlock();
/* should get suspended and wait if the queue is full
* but it's not blocking even if noone is listening,
* because the USB packets are sent anyway */
return(chOQPut(&console_queue, c));
/* Timeout after 5us if the queue is full.
* Increase this timeout if too much stuff is getting
* dropped (i.e. the buffer is getting full too fast
* for USB/HIDRAW to dequeue). Another possibility
* for fixing this kind of thing is to increase
* CONSOLE_QUEUE_CAPACITY. */
return(chOQPutTimeout(&console_queue, c, US2ST(5)));
}

#else /* CONSOLE_ENABLE */
Expand Down

0 comments on commit 0223e7a

Please sign in to comment.