diff --git a/ChangeLog b/ChangeLog index 7426dbf545..ed94972acd 100644 --- a/ChangeLog +++ b/ChangeLog @@ -7196,3 +7196,5 @@ keyboard and mouse classes if so configured. From Leo (2014-4-17). * include/nuttx/usb/usbhost: Fix some USB HID-related conditional compilation. From Leo (2014-4-17). + * drivers/usbhost/usbhost_hidmouse.c: Don't include NAKs from the device + in the error count. From Leo (2014-4-17). diff --git a/drivers/usbhost/usbhost_hidmouse.c b/drivers/usbhost/usbhost_hidmouse.c index 0fa49c50bf..5a9cff0a7a 100644 --- a/drivers/usbhost/usbhost_hidmouse.c +++ b/drivers/usbhost/usbhost_hidmouse.c @@ -1083,14 +1083,22 @@ static int usbhost_mouse_poll(int argc, char *argv[]) if (ret != OK) { - nerrors++; - udbg("ERROR: DRVR_TRANSFER returned: %d/%d\n", - ret, nerrors); + /* If DRVR_TRANSFER() returns EAGAIN, that simply means that + * the devices was not ready and has NAK'ed the transfer. That + * no be treated as an error (unless it persists for a long + * time). + */ - if (nerrors > 200) + udbg("ERROR: DRVR_TRANSFER returned: %d/%d\n", ret, nerrors); + if (ret != -EAGAIN) { - udbg("Too many errors... aborting: %d\n", nerrors); - break; + nerrors++; + + if (nerrors > 200) + { + udbg("Too many errors... aborting: %d\n", nerrors); + break; + } } } diff --git a/include/nuttx/usb/usbhost.h b/include/nuttx/usb/usbhost.h index 8c4b678288..d96a55d9a8 100644 --- a/include/nuttx/usb/usbhost.h +++ b/include/nuttx/usb/usbhost.h @@ -1,7 +1,7 @@ /************************************************************************************ * include/nuttx/usb/usbhost.h * - * Copyright (C) 2010-2013 Gregory Nutt. All rights reserved. + * Copyright (C) 2010-2014 Gregory Nutt. All rights reserved. * Author: Gregory Nutt * * References: