Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/sys/dev/usb The Dell DRAC5 gives us a zero-length report imm...



details:   https://anonhg.NetBSD.org/src/rev/ea2a5f930c03
branches:  trunk
changeset: 750421:ea2a5f930c03
user:      jakllsch <jakllsch%NetBSD.org@localhost>
date:      Wed Dec 30 23:42:22 2009 +0000

description:
The Dell DRAC5 gives us a zero-length report immediately following
a normal report.  Thus, ignore zero-length reports.  Move some related
report size insanity checking into the UHIDEV_DEBUG case.

Should fix PR/39911.

diffstat:

 sys/dev/usb/uhidev.c |  16 +++++++++++-----
 1 files changed, 11 insertions(+), 5 deletions(-)

diffs (37 lines):

diff -r e51392a7feba -r ea2a5f930c03 sys/dev/usb/uhidev.c
--- a/sys/dev/usb/uhidev.c      Wed Dec 30 23:31:56 2009 +0000
+++ b/sys/dev/usb/uhidev.c      Wed Dec 30 23:42:22 2009 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: uhidev.c,v 1.45 2009/11/12 19:58:27 dyoung Exp $       */
+/*     $NetBSD: uhidev.c,v 1.46 2009/12/30 23:42:22 jakllsch Exp $     */
 
 /*
  * Copyright (c) 2001 The NetBSD Foundation, Inc.
@@ -35,7 +35,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: uhidev.c,v 1.45 2009/11/12 19:58:27 dyoung Exp $");
+__KERNEL_RCSID(0, "$NetBSD: uhidev.c,v 1.46 2009/12/30 23:42:22 jakllsch Exp $");
 
 #include <sys/param.h>
 #include <sys/systm.h>
@@ -467,9 +467,15 @@
                    rep, scd, scd ? scd->sc_state : 0));
        if (!(scd->sc_state & UHIDEV_OPEN))
                return;
-       if (scd->sc_in_rep_size > cc) {
-               printf("%s: bad input length %d != %d\n",
-                      USBDEVNAME(sc->sc_dev), scd->sc_in_rep_size, cc);
+#ifdef UHIDEV_DEBUG
+       if (scd->sc_in_rep_size != cc) {
+               DPRINTF(("%s: expected %d bytes, got %d\n",
+                      USBDEVNAME(sc->sc_dev), scd->sc_in_rep_size, cc));
+       }
+#endif
+       if (cc == 0) {
+               DPRINTF(("%s: 0-length input ignored\n",
+                       USBDEVNAME(sc->sc_dev)));
                return;
        }
 #if NRND > 0



Home | Main Index | Thread Index | Old Index