diff options
author | Gregory Nutt <gnutt@nuttx.org> | 2014-04-17 11:47:00 -0600 |
---|---|---|
committer | Gregory Nutt <gnutt@nuttx.org> | 2014-04-17 11:47:00 -0600 |
commit | 1ab1f3da2b44e0528b87000b23da329aec0a522e (patch) | |
tree | d8f265f9baaca641163d6d943d7b49b2961bf658 | |
parent | fbbdc2c1b7f118f592b3c8ffa0832a965685acb5 (diff) | |
download | nuttx-1ab1f3da2b44e0528b87000b23da329aec0a522e.tar.gz nuttx-1ab1f3da2b44e0528b87000b23da329aec0a522e.tar.bz2 nuttx-1ab1f3da2b44e0528b87000b23da329aec0a522e.zip |
HID mouse: Don't include NAKs in error count. From Leo
-rw-r--r-- | nuttx/ChangeLog | 2 | ||||
-rw-r--r-- | nuttx/drivers/usbhost/usbhost_hidmouse.c | 20 | ||||
-rw-r--r-- | nuttx/include/nuttx/usb/usbhost.h | 2 |
3 files changed, 17 insertions, 7 deletions
diff --git a/nuttx/ChangeLog b/nuttx/ChangeLog index 7426dbf54..ed94972ac 100644 --- a/nuttx/ChangeLog +++ b/nuttx/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/nuttx/drivers/usbhost/usbhost_hidmouse.c b/nuttx/drivers/usbhost/usbhost_hidmouse.c index 0fa49c50b..5a9cff0a7 100644 --- a/nuttx/drivers/usbhost/usbhost_hidmouse.c +++ b/nuttx/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/nuttx/include/nuttx/usb/usbhost.h b/nuttx/include/nuttx/usb/usbhost.h index 8c4b67828..d96a55d9a 100644 --- a/nuttx/include/nuttx/usb/usbhost.h +++ b/nuttx/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 <gnutt@nuttx.org> * * References: |