How to set TX2 otg usb as device mode?

As I know, TX2 OTG usb is default used as host mode.

How to set TX2 OTG USB as device mode and enable Android Gadget? I want connect the TX2 to HOST PC through usb cable. PC is the host and TX2 is the device.

There were significant changes going from the 3.x kernel to the 4.x kernel, I am unsure about OTG going to device mode on a TX2. The kernel docs themselves are here (it’s the “gadget” interface):
https://www.kernel.org/doc/htmldocs/gadget/index.html

Does anyone know what kernel config differences are needed for OTG to go into device mode on R27.1? Or which “/sys” files have access to this once the kernel config is valid?

Hello linuxdev, thanks for your answer.

I find something about TX1_USB_as_device as below:https://devtalk.nvidia.com/default/topic/952472/jetson-tx1/jtx1_usb_as-device/post/4937794/#4937794

Unfortunately, the patch for TX1 can’t work with TX2.

So, does anyone know how to config TX2 otg usb as device mode?

Since the move from the 3.x kernel to 4.x kernel the “/sys” files for OTG will have changed…hopefully someone will know what changes are needed for the TX2 since TX1 “/sys” info won’t apply.

We are working on a solution for kernel 4.4. Keep you posted.

Hi shupeng,

The device mode will work in next release.
Please wait for our announcement.

Got it. Many thanks, carolyuu.

Hi Carolyuu, would you please tell me about the time for next release?

Hi everybody,
is there any list of USB gadget device classes that will be supported on TX2 - USB OTG?
E.g.: GadgetFS / mass storage gadget / serial / CDC ethernet and so on…

Kind regards,
Jan

The gadget framework is not specific to a Jetson…anything gadget supports can be emulated, but it is intended that someone author code to go with the framework. Mostly the framework is not intended as a standalone piece of software (it seems bulk storage though doesn’t require much…other standard interface USB devices might require much more intervention and customization).

Hi linuxdev,
thanks for the comment. I don’t have a deep knowledge of the Gadget API. But know that different devices offer different functionality. I have played recently with Intel Joule (with its unfortunate end) and that device supported MTP, serial and CDC Ethernet functionality via OTG port.
Reading the previous comments about the OTG device mode being functional in next release I was hoping to get some more information about what functionality I can expect from TX2.

Kind regards,
Jan

Mostly customization specific to Jetson involve putting the port into device mode. After that one has to program a device to implement what the port does. Within USB standards are some definitions of what has to be implemented on certain generic classes of devices. Generic classes include things like human interface devices (HID, implies keyboards, mice, so on), bulk storage (things like USB external hard drives), video (the UVC or USB Video Class…cameras), so on. You have to read the USB standards to know what those classes are…anything within those classes as a host can use them without custom driver installs. Should you want your device mode to behave as one of those modes, then any computer can just plug the Jetson in and it’ll just work…but turning it into a device (other than reaching device mode) will almost always be custom regardless of whether the user of the device considers it generic or not.

The USB generic class standards define an interface of how to query and control common devices. The actual implementation is left up to the device author. The gadget interface is just a template of the generic interface classes…no implementation exists for the most part. Simpler devices may not take much work due to the amount of template help of gadget…I’m thinking mainly of bulk storage. You must know what classes the device implements and how to fulfill the interface requirements.

I do not know the details of the Intel Joule, but many USB devices actually have multiple devices in a single piece of hardware. If you connect the device to a Linux computer and use verbose output from “sudo lsusb -vvv” it will give information about what device or devices are provided by the Joule, and whether they are generic interfaces or custom. You can use the ID field of a plain “lsusb” to select just the one USB port (e.g., “sudo lsusb -d 0955:7c18 -vvv” is verbose description of a tx2 in recovery mode) so you don’t get spammed by output from every USB device on the system.

Once you know each class supported by that hardware you’ll have to compare docs from the kernel on the gadget interface for that specific class to know what has to be implemented. Jetson itself won’t be any different than a desktop PC.

Hello,Carolyuu. Jetpack3.1 has released, can the device mode work in this release?

Hi shupeng,

Sorry for inconvenience.
Please run attached “configfs_msc_l4t.sh” script, device mode works on R28.1.
configfs_msc_l4t.7z (510 Bytes)

Hi Carolyuu

Got it. Many thanks.

Great news :)
Thank you carolyuu

Hello,Carolyuu.

Thanks very much. I can enable f_cam now.

Hi shupeng, we have the script to demonstrate TX2 as device mode. For usb f_acm function, we don’t have expertise and wish other users can share experience.

Hi DaneLLL,
use below script,
https://devtalk.nvidia.com/default/topic/1014096/jetson-tx2/how-to-set-tx2-otg-usb-as-device-mode-/post/5192587/#5192587

For USB2 device mode is work.
I also test USB3 device mode but it just have USB2 performance,
and I am getting the
“USB 3.0 This device can perform faster. This USB Mass Storage Device can transfer information faster if you connect it to a Super-Speed USB 3.0 port” message.

Did this demo not include USB3 device mode performance?

Best regards,