svn commit: r200304 - head/sys/dev/usb/input
Andrew Thompson
thompsa at FreeBSD.org
Wed Dec 9 12:15:05 PST 2009
Author: thompsa
Date: Wed Dec 9 20:15:05 2009
New Revision: 200304
URL: http://svn.freebsd.org/changeset/base/200304
Log:
If the ID byte is non zero then we allow descriptors having multiple sizes.
Submitted by: HPS
Reported by: daichi
Modified:
head/sys/dev/usb/input/uhid.c
Modified: head/sys/dev/usb/input/uhid.c
==============================================================================
--- head/sys/dev/usb/input/uhid.c Wed Dec 9 20:05:37 2009 (r200303)
+++ head/sys/dev/usb/input/uhid.c Wed Dec 9 20:15:05 2009 (r200304)
@@ -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-head
mailing list