Module Name:    src
Committed By:   jakllsch
Date:           Wed Dec 30 23:42:22 UTC 2009

Modified Files:
        src/sys/dev/usb: uhidev.c

Log Message:
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.


To generate a diff of this commit:
cvs rdiff -u -r1.45 -r1.46 src/sys/dev/usb/uhidev.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/sys/dev/usb/uhidev.c
diff -u src/sys/dev/usb/uhidev.c:1.45 src/sys/dev/usb/uhidev.c:1.46
--- src/sys/dev/usb/uhidev.c:1.45	Thu Nov 12 19:58:27 2009
+++ src/sys/dev/usb/uhidev.c	Wed Dec 30 23:42:22 2009
@@ -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

Reply via email to