[PATCH v4 4/5] usb: legacy/multi add supports OTG 2.0

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

 



add supports OTG 2.0 for multi.c

Signed-off-by: Macpaul Lin <macpaul@xxxxxxxxx>
---
changes for v2:
  - no change
changes for v3:
  - multi.c: migrate global static const OTG descriptor with runtime retrived
    capability information by calling usb_gadget_customize_otg_desc().
changes for v4:
 - fix description of each git commits.

 drivers/usb/gadget/legacy/multi.c | 24 ++++++++----------------
 1 file changed, 8 insertions(+), 16 deletions(-)

diff --git a/drivers/usb/gadget/legacy/multi.c b/drivers/usb/gadget/legacy/multi.c
index 39d27bb..01bfe42 100644
--- a/drivers/usb/gadget/legacy/multi.c
+++ b/drivers/usb/gadget/legacy/multi.c
@@ -78,22 +78,6 @@ static struct usb_device_descriptor device_desc = {
 	.idProduct =		cpu_to_le16(MULTI_PRODUCT_NUM),
 };
 
-
-static const struct usb_descriptor_header *otg_desc[] = {
-	(struct usb_descriptor_header *) &(struct usb_otg_descriptor){
-		.bLength =		sizeof(struct usb_otg_descriptor),
-		.bDescriptorType =	USB_DT_OTG,
-
-		/*
-		 * REVISIT SRP-only hardware is possible, although
-		 * it would not be called "OTG" ...
-		 */
-		.bmAttributes =		USB_OTG_SRP | USB_OTG_HNP,
-	},
-	NULL,
-};
-
-
 enum {
 	MULTI_STRING_RNDIS_CONFIG_IDX = USB_GADGET_FIRST_AVAIL_IDX,
 	MULTI_STRING_CDC_CONFIG_IDX,
@@ -152,9 +136,13 @@ static struct usb_function *f_msg_rndis;
 static __init int rndis_do_config(struct usb_configuration *c)
 {
 	struct fsg_opts *fsg_opts;
+	static const struct usb_descriptor_header *otg_desc[2];
 	int ret;
 
 	if (gadget_is_otg(c->cdev->gadget)) {
+		otg_desc[0] = (struct usb_descriptor_header *)
+				usb_gadget_customize_otg_desc(c->cdev->gadget);
+		otg_desc[1] = NULL;
 		c->descriptors = otg_desc;
 		c->bmAttributes |= USB_CONFIG_ATT_WAKEUP;
 	}
@@ -240,9 +228,13 @@ static struct usb_function *f_msg_multi;
 static __init int cdc_do_config(struct usb_configuration *c)
 {
 	struct fsg_opts *fsg_opts;
+	static const struct usb_descriptor_header *otg_desc[2];
 	int ret;
 
 	if (gadget_is_otg(c->cdev->gadget)) {
+		otg_desc[0] = (struct usb_descriptor_header *)
+				usb_gadget_customize_otg_desc(c->cdev->gadget);
+		otg_desc[1] = NULL;
 		c->descriptors = otg_desc;
 		c->bmAttributes |= USB_CONFIG_ATT_WAKEUP;
 	}
-- 
1.8.3.2

--
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