summaryrefslogtreecommitdiff
path: root/tmk_core
diff options
context:
space:
mode:
authorSascha <suschi@ist-einmalig.de>2022-04-10 00:27:02 +0200
committerGitHub <noreply@github.com>2022-04-10 00:27:02 +0200
commitbf67abb046846e95137052b30d6aee458ad7c1f9 (patch)
treedb53e1c6273a030b3ea4c5186783d41311da2fab /tmk_core
parent4ce02032081dfe66e5fc7b8267a2fe924987e508 (diff)
downloadqmk_firmware-bf67abb046846e95137052b30d6aee458ad7c1f9.tar.gz
qmk_firmware-bf67abb046846e95137052b30d6aee458ad7c1f9.zip
Fixed usb read loops not reading until timeout (#16827)
* the size variable was redeclared (hiding the variable of the outside scope) and therefore the while check was always false, so the compiler just removed the do while loop, but it would be better to read all data and only exit the task, after this is done
Diffstat (limited to 'tmk_core')
-rw-r--r--tmk_core/protocol/chibios/usb_main.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/tmk_core/protocol/chibios/usb_main.c b/tmk_core/protocol/chibios/usb_main.c
index d9aa351ecb..bd8af6d194 100644
--- a/tmk_core/protocol/chibios/usb_main.c
+++ b/tmk_core/protocol/chibios/usb_main.c
@@ -1074,7 +1074,7 @@ void console_task(void) {
uint8_t buffer[CONSOLE_EPSIZE];
size_t size = 0;
do {
- size_t size = chnReadTimeout(&drivers.console_driver.driver, buffer, sizeof(buffer), TIME_IMMEDIATE);
+ size = chnReadTimeout(&drivers.console_driver.driver, buffer, sizeof(buffer), TIME_IMMEDIATE);
if (size > 0) {
console_receive(buffer, size);
}
@@ -1102,7 +1102,7 @@ void raw_hid_task(void) {
uint8_t buffer[RAW_EPSIZE];
size_t size = 0;
do {
- size_t size = chnReadTimeout(&drivers.raw_driver.driver, buffer, sizeof(buffer), TIME_IMMEDIATE);
+ size = chnReadTimeout(&drivers.raw_driver.driver, buffer, sizeof(buffer), TIME_IMMEDIATE);
if (size > 0) {
raw_hid_receive(buffer, size);
}
@@ -1125,7 +1125,7 @@ void midi_ep_task(void) {
uint8_t buffer[MIDI_STREAM_EPSIZE];
size_t size = 0;
do {
- size_t size = chnReadTimeout(&drivers.midi_driver.driver, buffer, sizeof(buffer), TIME_IMMEDIATE);
+ size = chnReadTimeout(&drivers.midi_driver.driver, buffer, sizeof(buffer), TIME_IMMEDIATE);
if (size > 0) {
MIDI_EventPacket_t event;
recv_midi_packet(&event);