Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. =================================================================== RCS file: /ftp/cvs/cvsroot/src/sys/dev/usb/uhidev.c,v rcsdiff: /ftp/cvs/cvsroot/src/sys/dev/usb/uhidev.c,v: warning: Unknown phrases like `commitid ...;' are present. retrieving revision 1.42.16.1 retrieving revision 1.43 diff -u -p -r1.42.16.1 -r1.43 --- src/sys/dev/usb/uhidev.c 2010/04/21 00:27:53 1.42.16.1 +++ src/sys/dev/usb/uhidev.c 2009/09/23 19:07:19 1.43 @@ -1,4 +1,4 @@ -/* $NetBSD: uhidev.c,v 1.42.16.1 2010/04/21 00:27:53 matt Exp $ */ +/* $NetBSD: uhidev.c,v 1.43 2009/09/23 19:07:19 plunky Exp $ */ /* * Copyright (c) 2001 The NetBSD Foundation, Inc. @@ -35,7 +35,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: uhidev.c,v 1.42.16.1 2010/04/21 00:27:53 matt Exp $"); +__KERNEL_RCSID(0, "$NetBSD: uhidev.c,v 1.43 2009/09/23 19:07:19 plunky Exp $"); #include #include @@ -105,7 +105,7 @@ USB_ATTACH(uhidev) struct uhidev_attach_arg uha; device_t dev; struct uhidev *csc; - int maxinpktsize, size, nrepid, repid, repsz; + int size, nrepid, repid, repsz; int *repsizes; int i; void *desc; @@ -117,10 +117,13 @@ USB_ATTACH(uhidev) sc->sc_dev = self; sc->sc_udev = uaa->device; sc->sc_iface = iface; + + aprint_naive("\n"); + aprint_normal("\n"); + id = usbd_get_interface_descriptor(iface); devinfop = usbd_devinfo_alloc(uaa->device, 0); - USB_ATTACH_SETUP; aprint_normal_dev(self, "%s, iclass %d/%d\n", devinfop, id->bInterfaceClass, id->bInterfaceSubClass); usbd_devinfo_free(devinfop); @@ -137,7 +140,6 @@ USB_ATTACH(uhidev) (void)usbd_set_protocol(iface, 1); #endif - maxinpktsize = 0; sc->sc_iep_addr = sc->sc_oep_addr = -1; for (i = 0; i < id->bNumEndpoints; i++) { ed = usbd_interface2endpoint_descriptor(iface, i); @@ -159,7 +161,6 @@ USB_ATTACH(uhidev) if (UE_GET_DIR(ed->bEndpointAddress) == UE_DIR_IN && (ed->bmAttributes & UE_XFERTYPE) == UE_INTERRUPT) { - maxinpktsize = UGETW(ed->wMaxPacketSize); sc->sc_iep_addr = ed->bEndpointAddress; } else if (UE_GET_DIR(ed->bEndpointAddress) == UE_DIR_OUT && (ed->bmAttributes & UE_XFERTYPE) == UE_INTERRUPT) { @@ -264,10 +265,8 @@ nomem: aprint_error_dev(self, "no memory\n"); USB_ATTACH_ERROR_RETURN; } - - /* Just request max packet size for the interrupt pipe */ - sc->sc_isize = maxinpktsize; sc->sc_nrepid = nrepid; + sc->sc_isize = 0; usbd_add_drv_event(USB_EVENT_DRIVER_ATTACH, sc->sc_udev, USBDEV(sc->sc_dev)); @@ -276,8 +275,12 @@ nomem: repsz = hid_report_size(desc, size, hid_input, repid); DPRINTF(("uhidev_match: repid=%d, repsz=%d\n", repid, repsz)); repsizes[repid] = repsz; + if (repsz > 0) { + if (repsz > sc->sc_isize) + sc->sc_isize = repsz; + } } - + sc->sc_isize += nrepid != 1; /* space for report ID */ DPRINTF(("uhidev_attach: isize=%d\n", sc->sc_isize)); uha.parent = sc; @@ -475,15 +478,9 @@ uhidev_intr(usbd_xfer_handle xfer, usbd_ rep, scd, scd ? scd->sc_state : 0)); if (!(scd->sc_state & UHIDEV_OPEN)) return; -#ifdef UHIDEV_DEBUG if (scd->sc_in_rep_size != cc) { - DPRINTF(("%s: expected %d bytes, got %d\n", - USBDEVNAME(sc->sc_dev), scd->sc_in_rep_size, cc)); - } -#endif - if (cc == 0) { - DPRINTF(("%s: 0-length input ignored\n", - USBDEVNAME(sc->sc_dev))); + printf("%s: bad input length %d != %d\n", + USBDEVNAME(sc->sc_dev), scd->sc_in_rep_size, cc); return; } #if NRND > 0