mirror of
git://projects.qi-hardware.com/ben-wpan.git
synced 2024-11-29 10:48:28 +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:
parent
b2c7727c57
commit
cb20c55231
@ -24,9 +24,6 @@
|
|||||||
#include "misctxrx.h"
|
#include "misctxrx.h"
|
||||||
|
|
||||||
|
|
||||||
#define MAX_WAIT_MS 100 /* make sure we respond to ^C */
|
|
||||||
|
|
||||||
|
|
||||||
/* ----- Interrupts -------------------------------------------------------- */
|
/* ----- Interrupts -------------------------------------------------------- */
|
||||||
|
|
||||||
|
|
||||||
@ -68,15 +65,12 @@ uint8_t wait_for_interrupt(struct atrf_dsc *dsc, uint8_t wait_for,
|
|||||||
while (!sigint && !timedout) {
|
while (!sigint && !timedout) {
|
||||||
if (timeout_ms) {
|
if (timeout_ms) {
|
||||||
ms = timeout_left_ms(&to);
|
ms = timeout_left_ms(&to);
|
||||||
if (ms > 0) {
|
if (ms <= 0) {
|
||||||
if (ms > MAX_WAIT_MS)
|
|
||||||
ms = MAX_WAIT_MS;
|
|
||||||
} else {
|
|
||||||
timedout = 1;
|
timedout = 1;
|
||||||
ms = 1;
|
ms = 1;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
ms = MAX_WAIT_MS;
|
ms = 0;
|
||||||
}
|
}
|
||||||
irq = atrf_interrupt_wait(dsc, ms);
|
irq = atrf_interrupt_wait(dsc, ms);
|
||||||
if (irq)
|
if (irq)
|
||||||
|
Loading…
Reference in New Issue
Block a user