Skip to content

Commit

Permalink
USB: gadget: f_accessory: New gadget driver for android USB accesories
Browse files Browse the repository at this point in the history
Signed-off-by: Mike Lockwood <lockwood@android.com>
  • Loading branch information
mikeandroid authored and Dima Zavin committed Mar 29, 2011
1 parent ead002d commit 5d9d862
Show file tree
Hide file tree
Showing 5 changed files with 868 additions and 0 deletions.
7 changes: 7 additions & 0 deletions drivers/usb/gadget/Kconfig
Original file line number Diff line number Diff line change
Expand Up @@ -884,6 +884,13 @@ config USB_ANDROID_RNDIS_WCEIS
If you enable this option, the device is no longer CDC ethernet
compatible.


config USB_ANDROID_ACCESSORY
boolean "Android USB accessory function"
depends on USB_ANDROID
help
Provides Android USB Accessory support for android gadget driver.

config USB_CDC_COMPOSITE
tristate "CDC Composite Device (Ethernet and ACM)"
depends on NET
Expand Down
1 change: 1 addition & 0 deletions drivers/usb/gadget/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -69,4 +69,5 @@ obj-$(CONFIG_USB_ANDROID_ADB) += f_adb.o
obj-$(CONFIG_USB_ANDROID_MASS_STORAGE) += f_mass_storage.o
obj-$(CONFIG_USB_ANDROID_MTP) += f_mtp.o
obj-$(CONFIG_USB_ANDROID_RNDIS) += f_rndis.o u_ether.o
obj-$(CONFIG_USB_ANDROID_ACCESSORY) += f_accessory.o

13 changes: 13 additions & 0 deletions drivers/usb/gadget/android.c
Original file line number Diff line number Diff line change
Expand Up @@ -404,6 +404,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

device_desc.idVendor = __constant_cpu_to_le16(get_vendor_id(dev));
device_desc.idProduct = __constant_cpu_to_le16(get_product_id(dev));
Expand Down
Loading

0 comments on commit 5d9d862

Please sign in to comment.