diff options
author | thompsa <thompsa@FreeBSD.org> | 2009-12-09 20:15:05 +0000 |
---|---|---|
committer | thompsa <thompsa@FreeBSD.org> | 2009-12-09 20:15:05 +0000 |
commit | bba590a37220e1469f91ec5b72bc4a382cfdec75 (patch) | |
tree | 96d9cb5d8a0540b3a622f9d4566533522575bc54 | |
parent | 29d5f23adb43ba91d4560776bd04e3bb3b0e3f6d (diff) | |
download | FreeBSD-src-bba590a37220e1469f91ec5b72bc4a382cfdec75.zip FreeBSD-src-bba590a37220e1469f91ec5b72bc4a382cfdec75.tar.gz |
If the ID byte is non zero then we allow descriptors having multiple sizes.
Submitted by: HPS
Reported by: daichi
-rw-r--r-- | sys/dev/usb/input/uhid.c | 15 |
1 files changed, 12 insertions, 3 deletions
diff --git a/sys/dev/usb/input/uhid.c b/sys/dev/usb/input/uhid.c index 63972e4..be356a5 100644 --- a/sys/dev/usb/input/uhid.c +++ b/sys/dev/usb/input/uhid.c @@ -173,12 +173,21 @@ uhid_intr_callback(struct usb_xfer *xfer, usb_error_t error) 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: |