[PATCH 1/3] usb: chipidea: udc: add OTG status request handling.

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Peripheral answers OTG status selector request from host according to
host request flag of gadget, this flag may be set by application via
kernel interface.

Signed-off-by: Li Jun <b47624@xxxxxxxxxxxxx>
---
 drivers/usb/chipidea/udc.c |   12 ++++++++++--
 1 file changed, 10 insertions(+), 2 deletions(-)

diff --git a/drivers/usb/chipidea/udc.c b/drivers/usb/chipidea/udc.c
index d683968..b4ee07f 100644
--- a/drivers/usb/chipidea/udc.c
+++ b/drivers/usb/chipidea/udc.c
@@ -823,8 +823,16 @@ __acquires(hwep->lock)
 	}
 
 	if ((setup->bRequestType & USB_RECIP_MASK) == USB_RECIP_DEVICE) {
-		/* Assume that device is bus powered for now. */
-		*(u16 *)req->buf = ci->remote_wakeup << 1;
+		if ((setup->wIndex == OTG_STS_SELECTOR) &&
+				(gadget_is_otg(&ci->gadget))) {
+			if (ci->gadget.host_request_flag)
+				*(u16 *)req->buf = HOST_REQUEST_FLAG;
+			else
+				*(u16 *)req->buf = 0;
+		} else {
+			/* Assume that device is bus powered for now. */
+			*(u16 *)req->buf = ci->remote_wakeup << 1;
+		}
 		retval = 0;
 	} else if ((setup->bRequestType & USB_RECIP_MASK) \
 		   == USB_RECIP_ENDPOINT) {
-- 
1.7.9.5

--
To unsubscribe from this list: send the line "unsubscribe linux-usb" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html




[Index of Archives]     [Linux Media]     [Linux Input]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]     [Old Linux USB Devel Archive]

  Powered by Linux