USB Device port configuration

As we know any USB device connected to USB Host port of SOM are visible in lsusb command device list.
When we connect our SOM to another Host (Windows or Linux Laptop) through USB Device port its been detected as USB Mass storage device, CDC device and COM port device. Host can even able to access Storage Memory (L4T storage) of SOM.
Is there any way where some USB devices (USB camera,Pendrive,MIC) is connected to Host port of SOM and they are detect by Host when SOM is connected through Device Port ? Whether Host can able to access it?
If you have any reference please let me know.

Some background to help…

One end of the USB connection is always one and only one of “device” or “host”. A type-C connection actually has extra wiring, and so although it appears to be either, it isn’t really…it is just splitting up wiring. The Jetsons (such as the Nano) which you are seeing with this feature are using the micro-OTG port. That port accepts either a type-A connector (making the Nano a host, e.g., the port can have a keyboard plugged in) or a type-B connector (making it a device, e.g., pretending to be mass storage or a virtual network device). The ID pin on the connector knows which type was inserted, and the Nano uses that ID to switch modes (and you are talking about device mode). An actual type-A socket cannot function as a device, and an actual type-B socket cannot function as a host.

If this were the most trivial case, then you’d have to write a driver for the device you are talking about creating. However, this is something of a “standardized” setup since USB has several “standard” USB device APIs. A custom device (such as a recovery mode Jetson) would still need a custom driver to create a device mode, and that custom device would require a custom driver on the host side as well (this is why the flashing software which actually performs the device mode flash is called the “driver package”…it understands the custom device the Jetson becomes in recovery mode).

Devices which follow a standard API (e.g., a mouse or keyboard, or a video device with no custom features) can use the standard driver which every host has. Linux provides a framework to fill in details such that you don’t have to build the entire driver. The driver just reads your details and then runs the standard API. So it is not just setting up device mode (which is the starting prerequisite), it is also setting up the USB details of that device type. The framework for this is called the “gadget” API.

This might also require something like RTSP for web streaming, but I’m not the one to ask about that. Someone here can probably give you information on RTSP streaming (which might be a better way of working with this, although it is networking and not just a USB device).

For the Jetson’s virtual USB network device and mass storage, you can look at the files in:

Those are human readable scripts, and are setting up those device modes via the gadget interface (and putting that setup into a systemd service, which is something else you’d probably want to do). The “nv-l4t-usb-device-mode.service” is what Linux uses for automatic service setup. The scripts with “stop” or “start” in their names are just utilities to stop or start (either manually or via systemd using them).

Note that those scripts are for more than one device, and that several devices can share the same USB cable.

You might find these commands interesting:

  • systemctl list-units | grep 'nv-l4t'
  • systemctl status nv-l4t-usb-device-mode.service
    (you might see messages about the service as a whole, or about subcomponents of the service)
  • systemctl stop nv-l4t-usb-device-mode.service
  • systemctl start nv-l4t-usb-device-mode.service

There is such thing as USB/IP maybe is what you’re looking for.

Hello All,
First of all thanks a lot for reply.
Thanks a lot for sharing details,
but sorry it seems like I have not explained my requirement in detail.
I am neither trying to make USB OTG port nor USB/IP.
Let me explain in detail what I want to do.
Please check below given block diagram,
As we know SOM had three USB ports out of that one is device and other two are host.
Device ports is used to communicate with Host in headless mode.
Host ports are used for peripherals to connect.
When we won’t connect any usb device to SOM we get following USB details.

When we connect any USB camera or mic to host port of som we get following details

Here we get list of all USB devices which are connected to host port of SOM.
Now when I connect SOM to Host(laptop/desktop) I got following details

Host recognized it as Mass storage device and CDC device.
I want to make modification such a way that devices connected to host port of SOM should be recognized by Host and they should be listed out in Host usb device list along with mass storage device and CDC device.
Also Host can able to access them.
I am looking in GADGET configuration, I am working on that but there also I had one doubt that when we configure SOM in some Gadget format ( camera or mic) then when we connect USB device port of SOM to Host ,SOM is recognize as that particular device (Gadget) , but I think SOM at a time configured as single Gadget only (either mic or camera) .
Let me go through in detail and I will update you on that.
If you have any reference on this then please share that.

Is it correct that you want all camera/audio/control which the Jetson sees to be passed through to the host PC as if the Jetson is a camera/audio device with control abilities? If so, then what I first mentioned is in fact what you need (so long as none of it needs to be in isochronous mode at the Jetson’s type-B socket).

Note that each sub-device (microphone, camera, control) will need its own driver. The gadget interface works for each provided that they are “standard” USB class devices. The cameras use “uvcvideo”, so they qualify. Similar for the microphone or other audio with the “snd-usb-audio”. Maybe for the “usbhid” device. Each device would require a different gadget setup.

An alternative is to create an RTSP stream, and turn that stream into a USB device, although it would be a network device (containing a stream from the microphone and camera). I don’t know enough details about that to give RTSP advise though.

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