Date: Wed, 9 Dec 2009 20:15:05 +0000 (UTC) From: Andrew Thompson <thompsa@FreeBSD.org> To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r200304 - head/sys/dev/usb/input Message-ID: <200912092015.nB9KF59X035803@svn.freebsd.org>
next in thread | raw e-mail | index | archive | help
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:
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200912092015.nB9KF59X035803>