diff --git a/arch/arm/src/lpc17xx/lpc17_usbhost.c b/arch/arm/src/lpc17xx/lpc17_usbhost.c index eaee5a53d1..7546fea889 100644 --- a/arch/arm/src/lpc17xx/lpc17_usbhost.c +++ b/arch/arm/src/lpc17xx/lpc17_usbhost.c @@ -2059,9 +2059,15 @@ static int lpc17_epalloc(struct usbhost_driver_s *drvr, (uint32_t)(epdesc->addr) << ED_CONTROL_EN_SHIFT | (uint32_t)(epdesc->mxpacketsize) << ED_CONTROL_MPS_SHIFT; - /* Get the direction of the endpoint */ + /* Get the direction of the endpoint. For control endpoints, the + * direction is in the TD. + */ - if (epdesc->in) + if (epdesc->xfrtype == USB_EP_ATTR_XFER_CONTROL) + { + ed->hw.ctrl |= ED_CONTROL_D_TD1; + } + else if (epdesc->in) { ed->hw.ctrl |= ED_CONTROL_D_IN; } diff --git a/drivers/usbhost/usbhost_hub.c b/drivers/usbhost/usbhost_hub.c index 07fcf7ccff..fd4cdcffc0 100644 --- a/drivers/usbhost/usbhost_hub.c +++ b/drivers/usbhost/usbhost_hub.c @@ -799,16 +799,16 @@ static void usbhost_hub_event(FAR void *arg) connection = status & USBHUB_PORT_STAT_CONNECTION; } - if ((change & USBHUB_PORT_STAT_CCONNECTION) != 0) - { - ctrlreq->type = USBHUB_REQ_TYPE_PORT; - ctrlreq->req = USBHUB_REQ_CLEARFEATURE; - usbhost_putle16(ctrlreq->value, USBHUB_PORT_FEAT_CCONNECTION); - usbhost_putle16(ctrlreq->index, port); - usbhost_putle16(ctrlreq->len, 0); + if ((change & USBHUB_PORT_STAT_CCONNECTION) != 0) + { + ctrlreq->type = USBHUB_REQ_TYPE_PORT; + ctrlreq->req = USBHUB_REQ_CLEARFEATURE; + usbhost_putle16(ctrlreq->value, USBHUB_PORT_FEAT_CCONNECTION); + usbhost_putle16(ctrlreq->index, port); + usbhost_putle16(ctrlreq->len, 0); - (void)DRVR_CTRLOUT(hport->drvr, hport->ep0, ctrlreq, NULL); - } + (void)DRVR_CTRLOUT(hport->drvr, hport->ep0, ctrlreq, NULL); + } debouncetime += 25; up_mdelay(25);