summaryrefslogtreecommitdiff
path: root/drivers/usb/gadget/android.c
diff options
context:
space:
mode:
authorMike Lockwood <lockwood@android.com>2011-02-02 11:52:56 -0500
committerDan Willemsen <dwillemsen@nvidia.com>2011-11-30 21:38:41 -0800
commita43630051fb522449c5e75bcbd65ed0e3764b6f3 (patch)
treed0cc7742971cc998e627b7b6b9f345034548a674 /drivers/usb/gadget/android.c
parent964ac836c93ec1ee10c22131fd095f89d694e724 (diff)
USB: gadget: f_accessory: New gadget driver for android USB accesories
Signed-off-by: Mike Lockwood <lockwood@android.com> USB: gadget: f_accessory: Misc improvements and cleanup: - Add URI string - Replace type string with a description string - Add a control call to retrieve accessory protocol version (currently 1) - Driver read() and write() calls now fail after USB disconnect until driver file is closed and reopened. - Misc cleanup work Signed-off-by: Mike Lockwood <lockwood@android.com> USB: gadget: f_accessory: Clear accessory strings when USB is disconnected Signed-off-by: Mike Lockwood <lockwood@android.com> USB: gadget: f_accessory: Clear previous strings on ACCESSORY_GET_PROTOCOL Clearing strings on disconnect does not work since we may receive a disconnect on some devices when transitioning into accessory mode. We require an accessory to send ACCESSORY_GET_PROTOCOL before sending any strings, so any strings from a previous session will be cleared. Signed-off-by: Mike Lockwood <lockwood@android.com> USB: gadget: f_accessory: Clear disconnected flag when driver file is opened Fixes a race condition that can occur when entering accessory mode. Signed-off-by: Mike Lockwood <lockwood@android.com> USB: gadget: f_accessory: Add string for accessory's unique serial number Signed-off-by: Mike Lockwood <lockwood@android.com> USB: gadget: f_accessory: Set bNumEndpoints to correct value of 2 Change-Id: I24f4e36f196d45436e0573301500c3b93215953d Signed-off-by: Mike Lockwood <lockwood@android.com>
Diffstat (limited to 'drivers/usb/gadget/android.c')
-rw-r--r--drivers/usb/gadget/android.c13
1 files changed, 13 insertions, 0 deletions
diff --git a/drivers/usb/gadget/android.c b/drivers/usb/gadget/android.c
index eb6af6d538d6..2ebc8183fd52 100644
--- a/drivers/usb/gadget/android.c
+++ b/drivers/usb/gadget/android.c
@@ -430,6 +430,19 @@ void android_enable_function(struct usb_function *f, int enable)
}
}
#endif
+#ifdef CONFIG_USB_ANDROID_ACCESSORY
+ if (!strcmp(f->name, "accessory") && enable) {
+ struct usb_function *func;
+
+ /* disable everything else (and keep adb for now) */
+ list_for_each_entry(func, &android_config_driver.functions, list) {
+ if (strcmp(func->name, "accessory")
+ && strcmp(func->name, "adb")) {
+ usb_function_set_enabled(func, 0);
+ }
+ }
+ }
+#endif
update_dev_desc(dev);