USB: composite: Send stall when no config is active

Whenever composition switch happens, android driver stops data transfers &
removes configuation before disabling pullup. Due to this, there is small
window during which pullup is active and device ends up sending device
descriptor with zero confiurations in certain scenarios of Host PC reboot.
Hence fix the issue by stalling control endpoint in this scenario.

Change-Id: I3d3c0321d9311617c6ee492c55809f36de6ae412
Signed-off-by: Vijayavardhan Vennapusa <vvreddy@codeaurora.org>
Signed-off-by: Chandana Kishori Chiluveru <cchiluve@codeaurora.org>
This commit is contained in:
Vijayavardhan Vennapusa 2016-04-26 17:38:10 +05:30 committed by Gerrit - the friendly Code Review server
parent 3162449f7d
commit e6b5a58c7d

View file

@ -1631,6 +1631,12 @@ composite_setup(struct usb_gadget *gadget, const struct usb_ctrlrequest *ctrl)
case USB_DT_DEVICE:
cdev->desc.bNumConfigurations =
count_configs(cdev, USB_DT_DEVICE);
if (cdev->desc.bNumConfigurations == 0) {
pr_err("%s:config is not active. send stall\n",
__func__);
break;
}
cdev->desc.bMaxPacketSize0 =
cdev->gadget->ep0->maxpacket;
cdev->desc.bcdUSB = cpu_to_le16(0x0200);