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

tools/lib/misctxrx.c (wait_for_interrupt): enforce a minimum timeout of 10 ms

Seems that just one millisecond isn't enough to get a byte from
the USB device, even if the byte is already waiting in the endpoint
FIFO there.
This commit is contained in:
Werner Almesberger 2011-06-23 13:17:31 -03:00
parent 8a2d80a93c
commit d8363d853c

View File

@ -24,6 +24,9 @@
#include "misctxrx.h"
#define MIN_TIMEOUT_MS 10
/* ----- Interrupts -------------------------------------------------------- */
@ -59,8 +62,11 @@ uint8_t wait_for_interrupt(struct atrf_dsc *dsc, uint8_t wait_for,
sigint = 0;
old_sig = signal(SIGINT, die);
if (timeout_ms)
if (timeout_ms) {
if (timeout_ms < MIN_TIMEOUT_MS)
timeout_ms = MIN_TIMEOUT_MS;
timeout_start(&to, timeout_ms);
}
while (!sigint && !timedout) {
while (!sigint && !timedout) {
if (timeout_ms) {