USB PTP Gadget function on Jetson boards

Dear NVidia Team,

Seeing that CONFIG_USB_CONFIGFS_F_PTP=y in tegra_defconfig, I would like if it is possible to convert the Jetson boards to an USB PTP Gadget, please ? By PTP, I mean Picture Transfer Protocol.

Thanks in advance and best regards,
K.

Hi,
For information, do you use Jetpack 4 or Jetpack 5?

Dear @DaneLLL,

Currently, we are using jetpack-4.5.1.

Thanks in advance,
K

Hi again,

From RidgeRun Wiki, I understand how to setup a gadget (USB Ethernet, UVC, Mass Storage) for Jetson using configFS :
https://developer.ridgerun.com/wiki/index.php/How_to_create_USB_Ethernet_gadget_for_Jetson_through_configfs

However, I have difficulty to create the instance of PTP function as I have not known what would be the correct PTP function name in the following syntax :

mkdir functions/<name>.<instance name>

where is mass_storage for Mass Storage Gadget (with usb_f_mass_storage driver) or hid for Human Interface Device (keyboard) or ecm for USB ethernet gadget or uvc for USB Video Class, …

Also, I found a “simple” implementation of ptp gadget function in below location : <public_sources_xavier_nx_tx2_jp4_5_1_r32_5_1>/Linux_for_Tegra/source/public/kernel_src/kernel/kernel-4.9/drivers/usb/gadget/function/f_ptp.c :

/*
 * 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");

I am not sure if above driver is enough for PTP function. And based on the Makefile in the same location :

usb_f_ptp-y                     := f_ptp.o
obj-$(CONFIG_USB_F_PTP)         += usb_f_ptp.o

should its driver be usb_f_ptp ?

Best Regards,
Khang

Hi,
We have checked with teams and confirmed PTP is not a supported gadget. This would need other users to share experience.

Thanks @DaneLLL ,

May I ask whether MTP is supported, please ?

Best Regards,
Khang

Hi,
MTP is not supported by upstream Linux kernel so we don’t support it as well.