We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
2 parents 933cb87 + d6a1e27 commit 35eed36Copy full SHA for 35eed36
src/jtag/drivers/mpsse.c
@@ -22,6 +22,7 @@
22
23
#include "mpsse.h"
24
#include "helper/log.h"
25
+#include "helper/time_support.h"
26
#include <libusb.h>
27
28
/* Compatibility define for older libusb-1.0 */
@@ -892,6 +893,7 @@ int mpsse_flush(struct mpsse_ctx *ctx)
892
893
}
894
895
/* Polling loop, more or less taken from libftdi */
896
+ int64_t start = timeval_ms();
897
while (!write_result.done || !read_result.done) {
898
struct timeval timeout_usb;
899
@@ -914,6 +916,11 @@ int mpsse_flush(struct mpsse_ctx *ctx)
914
916
break;
915
917
918
919
+
920
+ if (timeval_ms() - start > 2000) {
921
+ LOG_ERROR("Timed out handling USB events in mpsse_flush().");
922
+ break;
923
+ }
924
925
926
error_check:
0 commit comments