mirror of
git://projects.qi-hardware.com/ben-wpan.git
synced 2024-11-22 14:10:37 +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"
|
||||
|
||||
|
||||
#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)
|
||||
|
Loading…
Reference in New Issue
Block a user