From cb20c55231b9c6c7bc0a2f22a35460a31f7a77db Mon Sep 17 00:00:00 2001 From: Werner Almesberger Date: Mon, 20 Jun 2011 22:56:59 -0300 Subject: [PATCH] tools/lib/misctxrx.c (wait_for_interrupt): don't fragment timeouts usb_bulk_read may lose data when timing out. We therefore try to minimize the number of times we time out. --- tools/lib/misctxrx.c | 10 ++-------- 1 file changed, 2 insertions(+), 8 deletions(-) diff --git a/tools/lib/misctxrx.c b/tools/lib/misctxrx.c index 5dbf996..786f038 100644 --- a/tools/lib/misctxrx.c +++ b/tools/lib/misctxrx.c @@ -24,9 +24,6 @@ #include "misctxrx.h" -#define MAX_WAIT_MS 100 /* make sure we respond to ^C */ - - /* ----- Interrupts -------------------------------------------------------- */ @@ -68,15 +65,12 @@ uint8_t wait_for_interrupt(struct atrf_dsc *dsc, uint8_t wait_for, while (!sigint && !timedout) { if (timeout_ms) { ms = timeout_left_ms(&to); - if (ms > 0) { - if (ms > MAX_WAIT_MS) - ms = MAX_WAIT_MS; - } else { + if (ms <= 0) { timedout = 1; ms = 1; } } else { - ms = MAX_WAIT_MS; + ms = 0; } irq = atrf_interrupt_wait(dsc, ms); if (irq)