svn commit: r201296 - stable/8/sys/dev/usb/input

Andrew Thompson thompsa at FreeBSD.org
Thu Dec 31 00:04:49 UTC 2009


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:


More information about the svn-src-stable mailing list