1
0
mirror of git://projects.qi-hardware.com/ben-wpan.git synced 2024-11-25 21:00:37 +02:00

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.
This commit is contained in:
Werner Almesberger 2011-06-20 22:58:46 -03:00
parent cb20c55231
commit f8f2f890d9

View File

@ -213,17 +213,14 @@ int atusb_interrupt_wait(void *handle, int timeout_ms)
if (irq)
timeout_ms = 1;
while (1) {
res = usb_bulk_read(dsc->dev, 1,
(char *) &buf, sizeof(buf), timeout_ms);
if (res == -ETIMEDOUT)
break;
if (res != -ETIMEDOUT) {
if (res < 0) {
fprintf(stderr, "usb_bulk_read: %d\n", res);
dsc->error = 1;
return 0; /* handle this via atrf_error */
}
timeout_ms = 1;
for (i = 0; i != res; i++)
irq |= buf[i];
}