Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit e6b5a58c authored by Vijayavardhan Vennapusa's avatar Vijayavardhan Vennapusa Committed by Gerrit - the friendly Code Review server
Browse files

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: default avatarVijayavardhan Vennapusa <vvreddy@codeaurora.org>
Signed-off-by: default avatarChandana Kishori Chiluveru <cchiluve@codeaurora.org>
parent 3162449f
Loading
Loading
Loading
Loading
+6 −0
Original line number Diff line number Diff line
@@ -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);