This is an automated email from Gerrit. Tim Newsome ([email protected]) just uploaded a new patch set to Gerrit, which you can find at http://openocd.zylin.com/4767
-- gerrit commit 13f1a34234bc6da1aea2500fcc6e5c61340cb25c Author: Tim Newsome <[email protected]> Date: Wed Nov 14 11:55:09 2018 -0800 Add wall clock timeout to mpsse_flush() I think that libusb_handle_events_timeout_completed is supposed to make progress or time out, but sometimes we hit a case where it makes no progress, and mpsse_flush() loops forever. This wall clock timeout kicks it out of that loop. OpenOCD appears to die afterwards, but that's still an improvement. Change-Id: I7eb66f43462298e263a48048aa0c8769095661eb Signed-off-by: Tim Newsome <[email protected]> diff --git a/src/jtag/drivers/mpsse.c b/src/jtag/drivers/mpsse.c index 8924892..43e924e 100644 --- a/src/jtag/drivers/mpsse.c +++ b/src/jtag/drivers/mpsse.c @@ -22,6 +22,7 @@ #include "mpsse.h" #include "helper/log.h" +#include "helper/time_support.h" #include <libusb.h> /* Compatibility define for older libusb-1.0 */ @@ -892,6 +893,7 @@ int mpsse_flush(struct mpsse_ctx *ctx) } /* Polling loop, more or less taken from libftdi */ + int64_t start = timeval_ms(); while (!write_result.done || !read_result.done) { struct timeval timeout_usb; @@ -914,6 +916,11 @@ int mpsse_flush(struct mpsse_ctx *ctx) break; } } + + if (timeval_ms() - start > 2000) { + LOG_ERROR("Timed out handling USB events in mpsse_flush()."); + break; + } } error_check: -- _______________________________________________ OpenOCD-devel mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/openocd-devel
