Date:2011-06-21 03:58:46 (8 years 5 months ago)
Author:Werner Almesberger
Commit:f8f2f890d9cc1c81996fb83f7c131b0e1b78e262
Message:tools/lib/atusb-common.c (atusb_interrupt_wait): don't try to pull more irqs

ausb_bulk_read may lose data when timing out. We therefore try to
minimize the number of times we time out. Reading until no more
interrupts arrive may have looked like a good idea, but it just
causes trouble for now.
Files: tools/lib/atusb-common.c (1 diff)

Change Details

tools/lib/atusb-common.c
213213    if (irq)
214214        timeout_ms = 1;
215215
216    while (1) {
217        res = usb_bulk_read(dsc->dev, 1,
218            (char *) &buf, sizeof(buf), timeout_ms);
219        if (res == -ETIMEDOUT)
220            break;
216    res = usb_bulk_read(dsc->dev, 1,
217        (char *) &buf, sizeof(buf), timeout_ms);
218    if (res != -ETIMEDOUT) {
221219        if (res < 0) {
222220            fprintf(stderr, "usb_bulk_read: %d\n", res);
223221            dsc->error = 1;
224222            return 0; /* handle this via atrf_error */
225223        }
226        timeout_ms = 1;
227224        for (i = 0; i != res; i++)
228225            irq |= buf[i];
229226    }

Archive Download the corresponding diff file



interactive