diff options
author | Mike Lockwood <lockwood@android.com> | 2010-02-13 16:37:16 -0500 |
---|---|---|
committer | Colin Cross <ccross@android.com> | 2010-09-29 17:49:28 -0700 |
commit | 875ca0193640da1eaf12a8626100f9dfce843ce9 (patch) | |
tree | f82ed1ca2aba4429bad5c20a0d79df8637fb73a5 | |
parent | 07daf775451f2866662361a30de20c525a7697bf (diff) |
USB: gadget: android: Fix special case for RNDIS ethernet function
Only set device descriptor bDeviceClass field to USB_CLASS_COMM when
the RNDIS function is actually enabled.
Signed-off-by: Mike Lockwood <lockwood@android.com>
-rw-r--r-- | drivers/usb/gadget/android.c | 19 |
1 files changed, 12 insertions, 7 deletions
diff --git a/drivers/usb/gadget/android.c b/drivers/usb/gadget/android.c index 73fc4b465ef5..77ff19eebbfa 100644 --- a/drivers/usb/gadget/android.c +++ b/drivers/usb/gadget/android.c @@ -100,14 +100,7 @@ static struct usb_device_descriptor device_desc = { .bLength = sizeof(device_desc), .bDescriptorType = USB_DT_DEVICE, .bcdUSB = __constant_cpu_to_le16(0x0200), -#ifdef CONFIG_USB_ANDROID_RNDIS - /* we need to specify the class in the device descriptor - * if we are using RNDIS. - */ - .bDeviceClass = USB_CLASS_COMM, -#else .bDeviceClass = USB_CLASS_PER_INTERFACE, -#endif .idVendor = __constant_cpu_to_le16(VENDOR_ID), .idProduct = __constant_cpu_to_le16(PRODUCT_ID), .bcdDevice = __constant_cpu_to_le16(0xffff), @@ -337,6 +330,18 @@ void android_enable_function(struct usb_function *f, int enable) if (dev->cdev) dev->cdev->desc.idProduct = device_desc.idProduct; +#ifdef CONFIG_USB_ANDROID_RNDIS + /* We need to specify the COMM class in the device descriptor + * if we are using RNDIS. + */ + if (!strcmp(f->name, "rndis")) { + if (enable) + dev->cdev->desc.bDeviceClass = USB_CLASS_COMM; + else + dev->cdev->desc.bDeviceClass = USB_CLASS_PER_INTERFACE; + } +#endif + /* force reenumeration */ if (dev->cdev && dev->cdev->gadget && dev->cdev->gadget->speed != USB_SPEED_UNKNOWN) { |