From 26dcc19b186a85f6ee8d1d94bb672e34865f56e9 Mon Sep 17 00:00:00 2001 From: Sean Cross Date: Fri, 29 Nov 2019 18:14:23 +0800 Subject: [PATCH] valentyusb: eptri: don't double-advance read buffer Due to an error, we were double-advancing the FIFO buffer. The end result was that the second half of most reads were getting ignored. This wasn't found during earlier testing because only 64-byte buffers were tested. This corrects this error by avoiding double-advancing the buffer. Signed-off-by: Sean Cross --- src/portable/valentyusb/eptri/dcd_eptri.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/portable/valentyusb/eptri/dcd_eptri.c b/src/portable/valentyusb/eptri/dcd_eptri.c index e555fb0b1..67e0c59aa 100644 --- a/src/portable/valentyusb/eptri/dcd_eptri.c +++ b/src/portable/valentyusb/eptri/dcd_eptri.c @@ -226,7 +226,7 @@ static void process_rx(void) { test_buffer[total_read] = c; #endif total_read++; - if ((rx_buffer_offset[rx_ep] + current_offset) < rx_buffer_max[rx_ep]) { + if (current_offset < rx_buffer_max[rx_ep]) { #if LOG_USB usb_log[usb_log_offset].data[usb_log[usb_log_offset].size++] = c; #endif