summaryrefslogtreecommitdiff
path: root/drivers/usb/gadget/android.c
diff options
context:
space:
mode:
authorMike Lockwood <lockwood@android.com>2011-06-01 22:17:36 -0400
committerDan Willemsen <dwillemsen@nvidia.com>2011-11-30 21:38:42 -0800
commit665b56b827822677080da0ab65bbb9ef3fdf56af (patch)
treed1da577ee397efb5a3aa84e9fe3a1ba2c391fde3 /drivers/usb/gadget/android.c
parent64e69d682bbb8c8745bacb937a4bc15345a1b209 (diff)
USB: gadget: f_mtp: Add PTP variant of MTP USB function
This is the same as MTP but with PTP interface descriptor. Also removed obsolete ioctl for switching between MTP and PTP mode 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, 26 insertions, 1 deletions
diff --git a/drivers/usb/gadget/android.c b/drivers/usb/gadget/android.c
index 377df5b4d52e..ebe67666b20e 100644
--- a/drivers/usb/gadget/android.c
+++ b/drivers/usb/gadget/android.c
@@ -294,7 +294,23 @@ static void mtp_function_cleanup(struct android_usb_function *f)
static int mtp_function_bind_config(struct android_usb_function *f, struct usb_configuration *c)
{
- return mtp_bind_config(c);
+ return mtp_bind_config(c, false);
+}
+
+static int ptp_function_init(struct android_usb_function *f, struct usb_composite_dev *cdev)
+{
+ /* nothing to do - initialization is handled by mtp_function_init */
+ return 0;
+}
+
+static void ptp_function_cleanup(struct android_usb_function *f)
+{
+ /* nothing to do - cleanup is handled by mtp_function_cleanup */
+}
+
+static int ptp_function_bind_config(struct android_usb_function *f, struct usb_configuration *c)
+{
+ return mtp_bind_config(c, true);
}
static int mtp_function_ctrlrequest(struct android_usb_function *f,
@@ -312,6 +328,14 @@ static struct android_usb_function mtp_function = {
.ctrlrequest = mtp_function_ctrlrequest,
};
+/* PTP function is same as MTP with slightly different interface descriptor */
+static struct android_usb_function ptp_function = {
+ .name = "ptp",
+ .init = ptp_function_init,
+ .cleanup = ptp_function_cleanup,
+ .bind_config = ptp_function_bind_config,
+};
+
struct rndis_function_config {
u8 ethaddr[ETH_ALEN];
@@ -623,6 +647,7 @@ static struct android_usb_function *supported_functions[] = {
&adb_function,
&acm_function,
&mtp_function,
+ &ptp_function,
&rndis_function,
&mass_storage_function,
&accessory_function,