diff options
author | Mike Lockwood <lockwood@android.com> | 2011-02-02 11:52:56 -0500 |
---|---|---|
committer | Benoit Goby <benoit@android.com> | 2011-06-17 16:02:31 -0700 |
commit | 9902e0b5c53bba7469e7163e539fa696f09e35cc (patch) | |
tree | 82d118d4b32eabcac59506453ce22a542af071d7 /drivers/usb/gadget/android.c | |
parent | 0d9f3c2791c1e19796d3a41d8ec45093583817e7 (diff) | |
download | kernel_samsung_tuna-9902e0b5c53bba7469e7163e539fa696f09e35cc.zip kernel_samsung_tuna-9902e0b5c53bba7469e7163e539fa696f09e35cc.tar.gz kernel_samsung_tuna-9902e0b5c53bba7469e7163e539fa696f09e35cc.tar.bz2 |
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.c | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/drivers/usb/gadget/android.c b/drivers/usb/gadget/android.c index eb6af6d..2ebc818 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); |