From 6d6f4f61d6a5afaebc21276bbaba10ebd3f5fcdc Mon Sep 17 00:00:00 2001 From: lyz Date: Wed, 24 Apr 2013 17:56:24 +0800 Subject: [PATCH] usb: fix bug: no response to zero length out control request --- drivers/usb/dwc_otg/dwc_otg_pcd.c | 8 +++++++- drivers/usb/dwc_otg/dwc_otg_pcd_intr.c | 6 +++++- 2 files changed, 12 insertions(+), 2 deletions(-) diff --git a/drivers/usb/dwc_otg/dwc_otg_pcd.c b/drivers/usb/dwc_otg/dwc_otg_pcd.c index 06b00d9c4344..ba9516bc9c0e 100755 --- a/drivers/usb/dwc_otg/dwc_otg_pcd.c +++ b/drivers/usb/dwc_otg/dwc_otg_pcd.c @@ -662,7 +662,13 @@ static int dwc_otg_pcd_ep_queue(struct usb_ep *_ep, pcd->ep0state = EP0_STATUS; } break; - + + case EP0_STATUS: + DWC_DEBUGPL(DBG_PCD, + "%s ep0: EP0_IN_STATUS_PHASE\n", + __func__); + break; + default: DWC_DEBUGPL(DBG_ANY, "ep0: odd state %d\n", pcd->ep0state); diff --git a/drivers/usb/dwc_otg/dwc_otg_pcd_intr.c b/drivers/usb/dwc_otg/dwc_otg_pcd_intr.c index 5e1a7ccf4e6a..7f207908d145 100755 --- a/drivers/usb/dwc_otg/dwc_otg_pcd_intr.c +++ b/drivers/usb/dwc_otg/dwc_otg_pcd_intr.c @@ -1486,7 +1486,11 @@ static inline void pcd_setup( dwc_otg_pcd_t *_pcd ) ep0->dwc_ep.is_in = 0; _pcd->ep0state = EP0_OUT_DATA_PHASE; } - + if (ctrl.wLength == 0) + { + ep0->dwc_ep.is_in = 1; + _pcd->ep0state = EP0_STATUS; + } if ((ctrl.bRequestType & USB_TYPE_MASK) != USB_TYPE_STANDARD) { /* handle non-standard (class/vendor) requests in the gadget driver */ -- 2.34.1