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

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

View File

@ -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)