PERFORCE change 170990 for review

Hans Petter Selasky hselasky at FreeBSD.org
Tue Nov 24 17:38:17 UTC 2009


http://p4web.freebsd.org/chv.cgi?CH=170990

Change 170990 by hselasky at hselasky_laptop001 on 2009/11/24 17:37:41

	
	USB input:
		- HID improvement
		- fix issue reported by "Daichi GOTO"
		- patch by HPS

Affected files ...

.. //depot/projects/usb/src/sys/dev/usb/input/uhid.c#16 edit

Differences ...

==== //depot/projects/usb/src/sys/dev/usb/input/uhid.c#16 (text+ko) ====

@@ -173,12 +173,21 @@
 		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 p4-projects mailing list