Index: uhidev.c =================================================================== RCS file: /cvsroot/src/sys/dev/usb/uhidev.c,v retrieving revision 1.56 diff -u -p -u -r1.56 uhidev.c --- uhidev.c 10 Jun 2012 06:15:54 -0000 1.56 +++ uhidev.c 25 Sep 2013 16:04:06 -0000 @@ -670,22 +670,6 @@ uhidev_set_report(struct uhidev *scd, in return retstat; } -void -uhidev_set_report_async(struct uhidev *scd, int type, void *data, int len) -{ - /* XXX */ - char buf[100]; - if (scd->sc_report_id) { - buf[0] = scd->sc_report_id; - memcpy(buf+1, data, len); - len++; - data = buf; - } - - usbd_set_report_async(scd->sc_parent->sc_iface, type, - scd->sc_report_id, data, len); -} - usbd_status uhidev_get_report(struct uhidev *scd, int type, void *data, int len) { Index: uhidev.h =================================================================== RCS file: /cvsroot/src/sys/dev/usb/uhidev.h,v retrieving revision 1.13 diff -u -p -u -r1.13 uhidev.h --- uhidev.h 10 Jun 2012 06:15:54 -0000 1.13 +++ uhidev.h 25 Sep 2013 16:04:06 -0000 @@ -79,7 +79,6 @@ struct uhidev_attach_arg { void uhidev_get_report_desc(struct uhidev_softc *, void **, int *); int uhidev_open(struct uhidev *); void uhidev_close(struct uhidev *); -usbd_status uhidev_set_report(struct uhidev *scd, int type, void *data,int len); -void uhidev_set_report_async(struct uhidev *scd, int type, void *data, int len); -usbd_status uhidev_get_report(struct uhidev *scd, int type, void *data,int len); +usbd_status uhidev_set_report(struct uhidev *, int, void *, int); +usbd_status uhidev_get_report(struct uhidev *, int, void *, int); usbd_status uhidev_write(struct uhidev_softc *, void *, int); Index: ukbd.c =================================================================== RCS file: /cvsroot/src/sys/dev/usb/ukbd.c,v retrieving revision 1.128 diff -u -p -u -r1.128 ukbd.c --- ukbd.c 15 Sep 2013 15:44:53 -0000 1.128 +++ ukbd.c 25 Sep 2013 16:04:06 -0000 @@ -271,6 +271,7 @@ struct ukbd_softc { struct hid_location sc_scroloc; struct hid_location sc_compose; int sc_leds; + struct usb_task sc_ledtask; device_t sc_wskbddev; #if defined(WSDISPLAY_COMPAT_RAWKBD) @@ -341,6 +342,7 @@ Static void ukbd_delayed_decode(void *ad Static int ukbd_enable(void *, int); Static void ukbd_set_leds(void *, int); +Static void ukbd_set_leds_task(void *); Static int ukbd_ioctl(void *, u_long, void *, int, struct lwp *); #if defined(WSDISPLAY_COMPAT_RAWKBD) && defined(UKBD_REPEAT) @@ -476,6 +478,9 @@ ukbd_attach(device_t parent, device_t se callout_init(&sc->sc_delay, 0); + usb_init_task(&sc->sc_ledtask, ukbd_set_leds_task, sc, + USB_TASKQ_MPSAFE); + /* Flash the leds; no real purpose, just shows we're alive. */ ukbd_set_leds(sc, WSKBD_LED_SCROLL | WSKBD_LED_NUM | WSKBD_LED_CAPS | WSKBD_LED_COMPOSE); @@ -884,7 +889,7 @@ void ukbd_set_leds(void *v, int leds) { struct ukbd_softc *sc = v; - u_int8_t res; + usbd_device_handle udev = sc->sc_hdev.sc_parent->sc_udev; DPRINTF(("ukbd_set_leds: sc=%p leds=%d, sc_leds=%d\n", sc, leds, sc->sc_leds)); @@ -894,8 +899,18 @@ ukbd_set_leds(void *v, int leds) if (sc->sc_leds == leds) return; + sc->sc_leds = leds; - res = 0; + usb_add_task(udev, &sc->sc_ledtask, USB_TASKQ_DRIVER); +} + +void +ukbd_set_leds_task(void *v) +{ + struct ukbd_softc *sc = v; + int leds = sc->sc_leds; + uint8_t res = 0; + /* XXX not really right */ if ((leds & WSKBD_LED_COMPOSE) && sc->sc_compose.size == 1) res |= 1 << sc->sc_compose.pos; @@ -905,7 +920,8 @@ ukbd_set_leds(void *v, int leds) res |= 1 << sc->sc_numloc.pos; if ((leds & WSKBD_LED_CAPS) && sc->sc_capsloc.size == 1) res |= 1 << sc->sc_capsloc.pos; - uhidev_set_report_async(&sc->sc_hdev, UHID_OUTPUT_REPORT, &res, 1); + + uhidev_set_report(&sc->sc_hdev, UHID_OUTPUT_REPORT, &res, 1); } #if defined(WSDISPLAY_COMPAT_RAWKBD) && defined(UKBD_REPEAT) Index: usb_subr.c =================================================================== RCS file: /cvsroot/src/sys/dev/usb/usb_subr.c,v retrieving revision 1.193 diff -u -p -u -r1.193 usb_subr.c --- usb_subr.c 14 Sep 2013 00:40:31 -0000 1.193 +++ usb_subr.c 25 Sep 2013 16:04:13 -0000 @@ -770,7 +770,7 @@ usbd_setup_pipe_flags(usbd_device_handle free(p, M_USB); return (err); } - usb_init_task(&p->async_task, usbd_clear_endpoint_stall_async_cb, p, + usb_init_task(&p->async_task, usbd_clear_endpoint_stall_task, p, USB_TASKQ_MPSAFE); *pipe = p; return (USBD_NORMAL_COMPLETION); Index: usbdi.c =================================================================== RCS file: /cvsroot/src/sys/dev/usb/usbdi.c,v retrieving revision 1.155 diff -u -p -u -r1.155 usbdi.c --- usbdi.c 22 Aug 2013 20:00:43 -0000 1.155 +++ usbdi.c 25 Sep 2013 16:04:15 -0000 @@ -608,7 +611,7 @@ XXX should we do this? } void -usbd_clear_endpoint_stall_async_cb(void *arg) +usbd_clear_endpoint_stall_task(void *arg) { usbd_pipe_handle pipe = arg; usbd_device_handle dev = pipe->device; @@ -621,7 +624,7 @@ usbd_clear_endpoint_stall_async_cb(void USETW(req.wValue, UF_ENDPOINT_HALT); USETW(req.wIndex, pipe->endpoint->edesc->bEndpointAddress); USETW(req.wLength, 0); - (void)usbd_do_request_async(dev, &req, 0); + (void)usbd_do_request(dev, &req, 0); } void @@ -1085,49 +1083,6 @@ usbd_do_request_flags_pipe(usbd_device_h return (err); } -void -usbd_do_request_async_cb(usbd_xfer_handle xfer, - usbd_private_handle priv, usbd_status status) -{ -#if defined(USB_DEBUG) || defined(DIAGNOSTIC) - if (xfer->actlen > xfer->length) { - DPRINTF(("usbd_do_request: overrun addr=%d type=0x%02x req=0x" - "%02x val=%d index=%d rlen=%d length=%d actlen=%d\n", - xfer->pipe->device->address, - xfer->request.bmRequestType, - xfer->request.bRequest, UGETW(xfer->request.wValue), - UGETW(xfer->request.wIndex), - UGETW(xfer->request.wLength), - xfer->length, xfer->actlen)); - } -#endif - usbd_free_xfer(xfer); -} - -/* - * Execute a request without waiting for completion. - * Can be used from interrupt context. - */ -usbd_status -usbd_do_request_async(usbd_device_handle dev, usb_device_request_t *req, - void *data) -{ - usbd_xfer_handle xfer; - usbd_status err; - - xfer = usbd_alloc_xfer(dev); - if (xfer == NULL) - return (USBD_NOMEM); - usbd_setup_default_xfer(xfer, dev, 0, USBD_DEFAULT_TIMEOUT, req, - data, UGETW(req->wLength), 0, usbd_do_request_async_cb); - err = usbd_transfer(xfer); - if (err != USBD_IN_PROGRESS) { - usbd_free_xfer(xfer); - return (err); - } - return (USBD_NORMAL_COMPLETION); -} - const struct usbd_quirks * usbd_get_quirks(usbd_device_handle dev) { Index: usbdi.h =================================================================== RCS file: /cvsroot/src/sys/dev/usb/usbdi.h,v retrieving revision 1.88 diff -u -p -u -r1.88 usbdi.h --- usbdi.h 7 Sep 2013 16:47:23 -0000 1.88 +++ usbdi.h 25 Sep 2013 16:04:15 -0000 @@ -190,7 +190,7 @@ void usb_desc_iter_init(usbd_device_hand const usb_descriptor_t *usb_desc_iter_next(usbd_desc_iter_t *); /* Used to clear endpoint stalls from the softint */ -void usbd_clear_endpoint_stall_async_cb(void *); +void usbd_clear_endpoint_stall_task(void *); /* * The usb_task structs form a queue of things to run in the USB event Index: usbdi_util.c =================================================================== RCS file: /cvsroot/src/sys/dev/usb/usbdi_util.c,v retrieving revision 1.61 diff -u -p -u -r1.61 usbdi_util.c --- usbdi_util.c 30 Aug 2013 12:59:19 -0000 1.61 +++ usbdi_util.c 25 Sep 2013 16:04:15 -0000 @@ -273,26 +273,6 @@ usbd_set_report(usbd_interface_handle if } usbd_status -usbd_set_report_async(usbd_interface_handle iface, int type, int id, void *data, - int len) -{ - usb_interface_descriptor_t *ifd = usbd_get_interface_descriptor(iface); - usbd_device_handle dev; - usb_device_request_t req; - - DPRINTFN(4, ("usbd_set_report_async: len=%d\n", len)); - if (ifd == NULL) - return (USBD_IOERROR); - usbd_interface2device_handle(iface, &dev); - req.bmRequestType = UT_WRITE_CLASS_INTERFACE; - req.bRequest = UR_SET_REPORT; - USETW2(req.wValue, type, id); - USETW(req.wIndex, ifd->bInterfaceNumber); - USETW(req.wLength, len); - return (usbd_do_request_async(dev, &req, data)); -} - -usbd_status usbd_get_report(usbd_interface_handle iface, int type, int id, void *data, int len) { Index: usbdi_util.h =================================================================== RCS file: /cvsroot/src/sys/dev/usb/usbdi_util.h,v retrieving revision 1.44 diff -u -p -u -r1.44 usbdi_util.h --- usbdi_util.h 10 Jun 2012 06:15:55 -0000 1.44 +++ usbdi_util.h 25 Sep 2013 16:04:15 -0000 @@ -58,8 +58,6 @@ usbd_status usbd_get_report_descriptor(u usb_hid_descriptor_t *usbd_get_hid_descriptor(usbd_interface_handle ifc); usbd_status usbd_set_report(usbd_interface_handle iface, int type, int id, void *data,int len); -usbd_status usbd_set_report_async(usbd_interface_handle iface, int type, - int id, void *data, int len); usbd_status usbd_get_report(usbd_interface_handle iface, int type, int id, void *data, int len); usbd_status usbd_set_idle(usbd_interface_handle iface, int duration,int id);