summaryrefslogtreecommitdiff
path: root/drivers/usb/gadget/android.c
diff options
context:
space:
mode:
authorMike Lockwood <lockwood@android.com>2010-02-24 10:20:59 -0500
committerColin Cross <ccross@android.com>2011-06-14 09:09:05 -0700
commit352208629f9af9e79c48214ef355ad7d0056da12 (patch)
tree949f1d73058736a1435669fc1e62a08345e1679e /drivers/usb/gadget/android.c
parenta83f187e9f34cd91d05b0c3016f6afb9c91ae916 (diff)
USB: gadget: android: Disable UMS when RNDIS ethernet is active.
Signed-off-by: Mike Lockwood <lockwood@android.com>
Diffstat (limited to 'drivers/usb/gadget/android.c')
-rw-r--r--drivers/usb/gadget/android.c27
1 files changed, 20 insertions, 7 deletions
diff --git a/drivers/usb/gadget/android.c b/drivers/usb/gadget/android.c
index e1ea22fe0e6..70e48ac3e2a 100644
--- a/drivers/usb/gadget/android.c
+++ b/drivers/usb/gadget/android.c
@@ -325,16 +325,14 @@ void android_enable_function(struct usb_function *f, int enable)
if (!!f->hidden != disable) {
f->hidden = disable;
- product_id = get_product_id(dev);
- device_desc.idProduct = __constant_cpu_to_le16(product_id);
- 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")) {
+ struct usb_function *func;
+
+ /* We need to specify the COMM class in the device descriptor
+ * if we are using RNDIS.
+ */
if (enable)
#ifdef CONFIG_USB_ANDROID_RNDIS_WCEIS
dev->cdev->desc.bDeviceClass = USB_CLASS_WIRELESS_CONTROLLER;
@@ -343,9 +341,24 @@ void android_enable_function(struct usb_function *f, int enable)
#endif
else
dev->cdev->desc.bDeviceClass = USB_CLASS_PER_INTERFACE;
+
+ /* Windows does not support other interfaces when RNDIS is enabled,
+ * so we disable UMS when RNDIS is on.
+ */
+ list_for_each_entry(func, &android_config_driver.functions, list) {
+ if (!strcmp(func->name, "usb_mass_storage")) {
+ func->hidden = enable;
+ break;
+ }
+ }
}
#endif
+ product_id = get_product_id(dev);
+ device_desc.idProduct = __constant_cpu_to_le16(product_id);
+ if (dev->cdev)
+ dev->cdev->desc.idProduct = device_desc.idProduct;
+
/* force reenumeration */
if (dev->cdev && dev->cdev->gadget &&
dev->cdev->gadget->speed != USB_SPEED_UNKNOWN) {