[U-Boot] [UBOOT RFC PATCH 07/13] usb: gadget: g_dnl: Explicitly set the max packet size in descriptor

Kishon Vijay Abraham I kishon at ti.com
Mon Aug 18 16:28:29 CEST 2014


Explicity set the max packet size in the device descriptor to 0x40
as specified in the device class specification for device firmware upgrade.
Also changed debug to printf to explicitly notify the user if the
device has been enumerated.

Signed-off-by: Kishon Vijay Abraham I <kishon at ti.com>
---
 drivers/usb/gadget/composite.c | 3 +--
 drivers/usb/gadget/g_dnl.c     | 1 +
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/usb/gadget/composite.c b/drivers/usb/gadget/composite.c
index 7bd2562..60ca9a5 100644
--- a/drivers/usb/gadget/composite.c
+++ b/drivers/usb/gadget/composite.c
@@ -331,7 +331,7 @@ static int set_config(struct usb_composite_dev *cdev,
 	} else
 		result = 0;
 
-	debug("%s: %s speed config #%d: %s\n", __func__,
+	printf("%s: %s speed config #%d: %s\n", __func__,
 	     ({ char *speed;
 		     switch (gadget->speed) {
 		     case USB_SPEED_LOW:
@@ -987,7 +987,6 @@ static int composite_bind(struct usb_gadget *gadget)
 
 	memcpy(&cdev->desc, composite->dev,
 	       sizeof(struct usb_device_descriptor));
-	cdev->desc.bMaxPacketSize0 = gadget->ep0->maxpacket;
 
 	debug("%s: ready\n", composite->name);
 	return 0;
diff --git a/drivers/usb/gadget/g_dnl.c b/drivers/usb/gadget/g_dnl.c
index 25611ac..8128b86 100644
--- a/drivers/usb/gadget/g_dnl.c
+++ b/drivers/usb/gadget/g_dnl.c
@@ -59,6 +59,7 @@ static struct usb_device_descriptor device_desc = {
 	.bcdUSB = __constant_cpu_to_le16(0x0200),
 	.bDeviceClass = USB_CLASS_COMM,
 	.bDeviceSubClass = 0x02, /*0x02:CDC-modem , 0x00:CDC-serial*/
+	.bMaxPacketSize0 = 0x40,
 
 	.idVendor = __constant_cpu_to_le16(CONFIG_G_DNL_VENDOR_NUM),
 	.idProduct = __constant_cpu_to_le16(CONFIG_G_DNL_PRODUCT_NUM),
-- 
1.9.1



More information about the U-Boot mailing list