When Jetson connects to a PC,Can L4T-readme disk Can be modified Or Customed folder use Or add disk size?

As a share space use ? Not use filesystem.img as a disk?



How to use ?

Hi diyize99,

Are you using the devkit or custom board for Orin NX?
What’s your Jetpack version in use?

Sorry that I’m not clear about your requirement.
Do you mean that you want to disable the USB device mode?

Some background you might be interested in, although it won’t be anything specific…

USB is not a generic bidirectional pipe. It requires a host for control and a device to be controlled. Many of those devices are standardized due to simplification of unifying the driver for such devices. An example is that every keyboard and every mouse could have been designed by each company, and each one would require a custom driver download. Or…the manufacturers could get together, decide that certain “classes” of devices would be built with a standardized interface, called a “human interface device” (“HID”), and only one generic driver would be required.

One of the standard devices is mass storage. For example, an SD card partition with a FAT32 filesystem. Certain storage devices use the generic driver. Most cell phones have a USB connection where they can become a device (a mass storage device) to the PC one plugs it in to. Then the PC can treat the memory covered by the driver as an SD card partition. I will emphasize that this is a behavior programmed by the cell phone manufacturer, and this is NOT “what USB is supposed to do”. It is an optional programmed behavior.

The more interesting device is that of a generic USB network router. The RNDIS on the Jetson, upon using the correct USB plug, and connecting it to the desktop PC, provides a wired ethernet connection from PC to Jetson. The part of the Linux kernel which “emulates” that function is a framework known as the "gadget API".

It just so happens that some of this USB gadget interface is exposed with examples of the things one can do with the device mode connector. Mass storage is just one of them, and it is presented as an example. This has been inherited from cases many years ago and simply has not been removed or changed. The README is for documentation purposes. There is code under “/opt” (in the form of human readable bash scripts and some documentation) producing that virtual partition. This is device mode, but this is not recovery mode. Recovery mode is a 100% custom USB device, and there is no such mass storage in recovery mode. Jetson recovery does not emulate block storage.

Within the mass storage of the Gadget framework one can make entire filesystems available. One can also make subdirectories available. If that content is formatted as ext4, then everything Linux could read it, but nothing Windows could read it. It just so happens that there is a small file which is loopback mounted and pretending to be a FAT32 partition. This loopback mounted file is what the code in “/opt” is exporting.

Certainly you could edit this and export more or different content. However, one reason why the entire filesystem is not exported is security. Are you going to give anyone plugging your Jetson into a PC permission to reformat? To delete files critical to the o/s? To read your personal home directory files? To add content to your personal home directory? Do you care that Windows can’t read the ext4? Do you care that the password file can be overwritten or modified? This is why any actual use is usually of another partition and not the device as a whole.

The read-only loopback mounted file could easily be made read-write with a few tweaks. That file could be enlarged as well. This wouldn’t be a risk, or at least mostly not a risk. Someone could still fill up the filesystem and create a denial of service. You could put limits on the file size (in fact it would be difficult to create a loopback file capable of growing), but it is an example to think about.

I have solved it today,I created a new img file,mount to /dev/loop0,edit nv-l4t-usb-device-mode-config.sh. But transmission speed is so slowed only 10M/s . How to increase USB transmission speed.That is RNDIS’s speed.

Jetpack Version 5.1.2
Device Jetson Orin NX 8GB

Please file another topic for USB speed issue.
You may run lsusb -t to check the speed for that interface.

1 Like

When you do file under a new topic, with the cable plugged in to a host PC, run the command “lsusb -tv” from the host PC. Include the output (at least the part showing the Jetson as a device all the way back to the root HUB handling it on the host) of the “lsusb -tv”.

1 Like

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.