On Wed, Mar 18, 2015 at 01:44:11PM +0800, Peter Chen wrote: > On Tue, Mar 17, 2015 at 10:37:49PM +0800, Li Jun wrote: > > If gadget with HNP polling support receives GetStatus request of otg status > > selector, it feedback to host with host request flag to indicate if it wants > > to take host role. > > > > Signed-off-by: Li Jun <jun.li@xxxxxxxxxxxxx> > > --- > > drivers/usb/gadget/composite.c | 25 +++++++++++++++++-------- > > 1 file changed, 17 insertions(+), 8 deletions(-) > > > > diff --git a/drivers/usb/gadget/composite.c b/drivers/usb/gadget/composite.c > > index 13adfd1..1f73bd9 100644 > > --- a/drivers/usb/gadget/composite.c > > +++ b/drivers/usb/gadget/composite.c > > @@ -1594,15 +1594,24 @@ composite_setup(struct usb_gadget *gadget, const struct usb_ctrlrequest *ctrl) > > *((u8 *)req->buf) = value; > > value = min(w_length, (u16) 1); > > break; > > - > > - /* > > - * USB 3.0 additions: > > - * Function driver should handle get_status request. If such cb > > - * wasn't supplied we respond with default value = 0 > > - * Note: function driver should supply such cb only for the first > > - * interface of the function > > - */ > > case USB_REQ_GET_STATUS: > > + if (gadget_is_otg(gadget) && gadget->hnp_polling_support && > > + (w_index == OTG_STS_SELECTOR)) { > > + if (ctrl->bRequestType != (USB_DIR_IN | > > + USB_RECIP_DEVICE)) > > Any cases the above conditions will be true? > No real defined case, this check just make sure the request type is correct as spec defined. Li Jun > > + goto unknown; > > + *((u8 *)req->buf) = gadget->host_request_flag; > > + value = 1; > > + break; > > + } > > + > > + /* > > + * USB 3.0 additions: > > + * Function driver should handle get_status request. If such cb > > + * wasn't supplied we respond with default value = 0 > > + * Note: function driver should supply such cb only for the > > + * first interface of the function > > + */ > > if (!gadget_is_superspeed(gadget)) > > goto unknown; > > if (ctrl->bRequestType != (USB_DIR_IN | USB_RECIP_INTERFACE)) > > -- > > 1.7.9.5 > > > > -- > > Best Regards, > Peter Chen -- 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