From 15ab35d9b82590e49937457efd2654adb2dd8b65 Mon Sep 17 00:00:00 2001 From: Sebastien COUDREAU Date: Thu, 8 Dec 2022 11:18:28 +0100 Subject: [PATCH 1/2] usbtmc: correct packet size bug Code was only reading the first 64 bytes of a 512 bytes packet. --- src/class/usbtmc/usbtmc_device.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/class/usbtmc/usbtmc_device.c b/src/class/usbtmc/usbtmc_device.c index 0f6d3f60d8..0b7c28b6ee 100644 --- a/src/class/usbtmc/usbtmc_device.c +++ b/src/class/usbtmc/usbtmc_device.c @@ -364,7 +364,7 @@ bool tud_usbtmc_start_bus_read() default: TU_VERIFY(false); } - TU_VERIFY(usbd_edpt_xfer(usbtmc_state.rhport, usbtmc_state.ep_bulk_out, usbtmc_state.ep_bulk_out_buf, 64)); + TU_VERIFY(usbd_edpt_xfer(usbtmc_state.rhport, usbtmc_state.ep_bulk_out, usbtmc_state.ep_bulk_out_buf, usbtmc_state.ep_bulk_out_wMaxPacketSize)); return true; } From 007ed1f0fe84c13567c7a4ccda79d71a05d79aec Mon Sep 17 00:00:00 2001 From: scoudreau <95369154+scoudreau@users.noreply.github.com> Date: Thu, 8 Dec 2022 14:50:34 +0100 Subject: [PATCH 2/2] Added missing typecast to pass build checks --- src/class/usbtmc/usbtmc_device.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/class/usbtmc/usbtmc_device.c b/src/class/usbtmc/usbtmc_device.c index 0b7c28b6ee..122b3f3cfb 100644 --- a/src/class/usbtmc/usbtmc_device.c +++ b/src/class/usbtmc/usbtmc_device.c @@ -364,7 +364,7 @@ bool tud_usbtmc_start_bus_read() default: TU_VERIFY(false); } - TU_VERIFY(usbd_edpt_xfer(usbtmc_state.rhport, usbtmc_state.ep_bulk_out, usbtmc_state.ep_bulk_out_buf, usbtmc_state.ep_bulk_out_wMaxPacketSize)); + TU_VERIFY(usbd_edpt_xfer(usbtmc_state.rhport, usbtmc_state.ep_bulk_out, usbtmc_state.ep_bulk_out_buf, (uint16_t)usbtmc_state.ep_bulk_out_wMaxPacketSize)); return true; }