From e912a69766bf9e9d1f4390ca65cefebaf3a30175 Mon Sep 17 00:00:00 2001 From: David Lechner Date: Fri, 8 Aug 2025 21:03:26 -0500 Subject: [PATCH] pbio/drv/usb: extend USB transmit timeout Extend the USB transmit timeout from 5 ms to 50 ms. We are getting spurious unsubscribes due to the timeout while still being connected, so 5 ms is not long enough. Let's increase by 1 order of magnitude and see how it goes. --- lib/pbio/drv/usb/usb_ev3.c | 2 +- lib/pbio/drv/usb/usb_stm32.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/pbio/drv/usb/usb_ev3.c b/lib/pbio/drv/usb/usb_ev3.c index 9fcb0897b..d1fa96585 100644 --- a/lib/pbio/drv/usb/usb_ev3.c +++ b/lib/pbio/drv/usb/usb_ev3.c @@ -984,7 +984,7 @@ static pbio_error_t pbdrv_usb_ev3_process_thread(pbio_os_state_t *state, void *c prev_status_flags = ~0; } } else if (!was_transmitting && is_transmitting) { - pbio_os_timer_set(&tx_timeout_timer, 5); + pbio_os_timer_set(&tx_timeout_timer, 50); } was_transmitting = is_transmitting; diff --git a/lib/pbio/drv/usb/usb_stm32.c b/lib/pbio/drv/usb/usb_stm32.c index d97707abf..3ef7c494b 100644 --- a/lib/pbio/drv/usb/usb_stm32.c +++ b/lib/pbio/drv/usb/usb_stm32.c @@ -515,7 +515,7 @@ PROCESS_THREAD(pbdrv_usb_process, ev, data) { if (transmitting) { // If the FIFO isn't emptied quickly, then there probably isn't an // app anymore. This timer is used to detect such a condition. - etimer_set(&transmit_timer, 5); + etimer_set(&transmit_timer, 50); } }