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

Commit 53ff409a authored by Vijayavardhan Vennapusa's avatar Vijayavardhan Vennapusa Committed by Stephen Boyd
Browse files

USB: android: Add OTG descriptor to configuration



Include OTG descriptor in configuration when gadget is
capable of OTG. SRP and HNP capablities are exposed for now.
This patch will help to inform USB Host that our device
is OTG capable via configuration descriptor.

Change-Id: Idc72ee8168a478f0124c91b99d3123eab5e71adb
Signed-off-by: default avatarVijayavardhan Vennapusa <vvreddy@codeaurora.org>
parent b7e4e00f
Loading
Loading
Loading
Loading
+15 −0
Original line number Diff line number Diff line
@@ -148,6 +148,18 @@ static struct usb_device_descriptor device_desc = {
	.bNumConfigurations   = 1,
};

static struct usb_otg_descriptor otg_descriptor = {
	.bLength =		sizeof otg_descriptor,
	.bDescriptorType =	USB_DT_OTG,
	.bmAttributes =		USB_OTG_SRP | USB_OTG_HNP,
	.bcdOTG               = __constant_cpu_to_le16(0x0200),
};

static const struct usb_descriptor_header *otg_desc[] = {
	(struct usb_descriptor_header *) &otg_descriptor,
	NULL,
};

static struct usb_configuration android_config_driver = {
	.label		= "android",
	.unbind		= android_unbind_config,
@@ -1488,6 +1500,9 @@ static int android_bind(struct usb_composite_dev *cdev)
	strings_dev[STRING_SERIAL_IDX].id = id;
	device_desc.iSerialNumber = id;

	if (gadget_is_otg(cdev->gadget))
		android_config_driver.descriptors = otg_desc;

	dev->cdev = cdev;

	return 0;