Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit ff66f5ea authored by qctecmdr Service's avatar qctecmdr Service Committed by Gerrit - the friendly Code Review server
Browse files

Merge "usb: gadget: f_mtp: Add snapshot of USB MTP function driver"

parents 2835fc8b 5b577317
Loading
Loading
Loading
Loading
+27 −0
Original line number Diff line number Diff line
@@ -241,6 +241,12 @@ config USB_F_QDSS
config USB_F_GSI
	tristate

config USB_F_MTP
	tristate

config USB_F_PTP
	tristate

# this first set of drivers all depend on bulk-capable hardware.

config USB_CONFIGFS
@@ -588,6 +594,27 @@ config USB_CONFIGFS_F_GSI
	  related functionalities using GSI hardware accelerated data
	  path and control path.

config USB_CONFIGFS_F_MTP
	bool "MTP gadget"
	select USB_F_MTP
	depends on USB_CONFIGFS
	help
	  The Media Transfer Protocol (MTP) function mounts USB gadget
	  as a media device but unlike Mass Storage Gadget, MTP operates
	  at the file level. Thus exposing the relevant content but hiding
	  the system/restricted files.

config USB_CONFIGFS_F_PTP
	bool "PTP gadget"
	select USB_F_PTP
	depends on USB_CONFIGFS && USB_CONFIGFS_F_MTP
	help
	  The Picture Transfer Protocol (PTP) function driver is a wrapper
	  around MTP function driver. This function driver mounts USB gadget
	  as a media device but unlike Mass Storage Gadget, PTP operates
	  at the file level. Thus exposing the relevant content but hiding
	  the system/restricted files.

choice
	tristate "USB Gadget precomposed configurations"
	default USB_ETH
+4 −0
Original line number Diff line number Diff line
@@ -65,3 +65,7 @@ usb_f_qdss-y := f_qdss.o u_qdss.o
obj-$(CONFIG_USB_F_QDSS)	+= usb_f_qdss.o
usb_f_gsi-y			:= f_gsi.o
obj-$(CONFIG_USB_F_GSI)		+= usb_f_gsi.o
usb_f_mtp-y			:= f_mtp.o
obj-$(CONFIG_USB_F_MTP)		+= usb_f_mtp.o
usb_f_ptp-y			:= f_ptp.o
obj-$(CONFIG_USB_F_PTP)		+= usb_f_ptp.o
+1921 −0

File added.

Preview size limit exceeded, changes collapsed.

+18 −0
Original line number Diff line number Diff line
/*
 * Copyright (C) 2014 Google, Inc.
 * Author: Badhri Jagan Sridharan <badhri@android.com>
 *
 * This software is licensed under the terms of the GNU General Public
 * License version 2, as published by the Free Software Foundation, and
 * may be copied, distributed, and modified under those terms.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 *
 */

extern struct usb_function_instance *alloc_inst_mtp_ptp(bool mtp_config);
extern struct usb_function *function_alloc_mtp_ptp(
			struct usb_function_instance *fi, bool mtp_config);
+38 −0
Original line number Diff line number Diff line
/*
 * Gadget Function Driver for PTP
 *
 * Copyright (C) 2014 Google, Inc.
 * Author: Badhri Jagan Sridharan <badhri@android.com>
 *
 * This software is licensed under the terms of the GNU General Public
 * License version 2, as published by the Free Software Foundation, and
 * may be copied, distributed, and modified under those terms.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 *
 */

#include <linux/module.h>
#include <linux/types.h>

#include <linux/configfs.h>
#include <linux/usb/composite.h>

#include "f_mtp.h"

static struct usb_function_instance *ptp_alloc_inst(void)
{
	return alloc_inst_mtp_ptp(false);
}

static struct usb_function *ptp_alloc(struct usb_function_instance *fi)
{
	return function_alloc_mtp_ptp(fi, false);
}

DECLARE_USB_FUNCTION_INIT(ptp, ptp_alloc_inst, ptp_alloc);
MODULE_LICENSE("GPL");
MODULE_AUTHOR("Badhri Jagan Sridharan");
Loading