Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 31 Dec 2009 00:04:49 +0000 (UTC)
From:      Andrew Thompson <thompsa@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org
Subject:   svn commit: r201296 - stable/8/sys/dev/usb/input
Message-ID:  <200912310004.nBV04n4W077971@svn.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: thompsa
Date: Thu Dec 31 00:04:48 2009
New Revision: 201296
URL: http://svn.freebsd.org/changeset/base/201296

Log:
  MFC r200304
  
   If the ID byte is non zero then we allow descriptors having multiple sizes.

Modified:
  stable/8/sys/dev/usb/input/uhid.c
Directory Properties:
  stable/8/sys/   (props changed)
  stable/8/sys/amd64/include/xen/   (props changed)
  stable/8/sys/cddl/contrib/opensolaris/   (props changed)
  stable/8/sys/contrib/dev/acpica/   (props changed)
  stable/8/sys/contrib/pf/   (props changed)
  stable/8/sys/dev/xen/xenpci/   (props changed)

Modified: stable/8/sys/dev/usb/input/uhid.c
==============================================================================
--- stable/8/sys/dev/usb/input/uhid.c	Thu Dec 31 00:04:05 2009	(r201295)
+++ stable/8/sys/dev/usb/input/uhid.c	Thu Dec 31 00:04:48 2009	(r201296)
@@ -173,12 +173,21 @@ uhid_intr_callback(struct usb_xfer *xfer
 		DPRINTF("transferred!\n");
 
 		pc = usbd_xfer_get_frame(xfer, 0);
-		if (actlen >= sc->sc_isize) {
+
+		/* 
+		 * If the ID byte is non zero we allow descriptors
+		 * having multiple sizes:
+		 */
+		if ((actlen >= sc->sc_isize) ||
+		    ((actlen > 0) && (sc->sc_iid != 0))) {
+			/* limit report length to the maximum */
+			if (actlen > sc->sc_isize)
+				actlen = sc->sc_isize;
 			usb_fifo_put_data(sc->sc_fifo.fp[USB_FIFO_RX], pc,
-			    0, sc->sc_isize, 1);
+			    0, actlen, 1);
 		} else {
 			/* ignore it */
-			DPRINTF("ignored short transfer, %d bytes\n", actlen);
+			DPRINTF("ignored transfer, %d bytes\n", actlen);
 		}
 
 	case USB_ST_SETUP:



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200912310004.nBV04n4W077971>