From 7a0a30f62665ba85fa6e74ec3d9541bcafec34ad Mon Sep 17 00:00:00 2001 From: Daniel Beer Date: Wed, 7 Sep 2011 08:18:00 +1200 Subject: [PATCH] usb_bulk_read: may return 0 on timeout. Pointed out by Jasper Lievisse Adriaanse . --- olimex.c | 2 +- rf2500.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/olimex.c b/olimex.c index acf63d7..46b4da4 100644 --- a/olimex.c +++ b/olimex.c @@ -272,7 +272,7 @@ transport_t olimex_open(const char *devpath, const char *requested_serial) /* Flush out lingering data */ while (usb_bulk_read(tr->handle, tr->in_ep, buf, sizeof(buf), - 100) >= 0); + 100) > 0); return (transport_t)tr; } diff --git a/rf2500.c b/rf2500.c index c3772e3..05007e4 100644 --- a/rf2500.c +++ b/rf2500.c @@ -231,7 +231,7 @@ transport_t rf2500_open(const char *devpath, const char *requested_serial) #ifndef __APPLE__ while (usb_bulk_read(tr->handle, USB_FET_IN_EP, buf, sizeof(buf), - 100) >= 0); + 100) > 0); #endif return (transport_t)tr;