Usb 3.0 port problem for dev/video

While connect zed or etc camera to TX2’s usb3.0 port
And while check with vtl2
Sometimes it shows /dev/video0 for external camera

And sometimes it shows /dev/video1 i guess this is normal

And sometimes /dev/video2

Hi,
If you have multiple devices connected, the order of enumerating the cameras decides the index in /dev/videoX. Looks like you have three cameras. Are the camera all USB cameras? Or there are Bayer sensors or YUV sensors?

There is one camera that connected to tx2 and tx2’s own camera

Hi,
If the USB camera is connected and the we boot the device, it is /dev/video0 and the default camera is /dev/video1. If only the default camera is connected in booting, the default camera is /dev/video0. Your observation is normal.

Then what should i do. How can i solve this problem.
When i run the code it doesnt work

Even it gives video2

Hi,
Please look at:
https://docs.huihoo.com/linux/kernel/2.6.26/videobook/re01.html

By default nr=-1 in v4l2 drivers. You can modify driver to hard code the device number.

how could i modify that, can you help me?
i’m beginner for linux and jetson,

i saw a python code that shows

import re
import subprocess
device_re = re.compile(b"Bus\s+(?P<bus>\d+)\s+Device\s+(?P<device>\d+).+ID\s(?P<id>\w+:\w+)\s(?P<tag>.+)$", re.I)
df = subprocess.check_output("lsusb")
devices = []
for i in df.split(b'\n'):
    if i:
        info = device_re.match(i)
        if info:
            dinfo = info.groupdict()
            dinfo['device'] = '/dev/bus/usb/%s/%s' % (dinfo.pop('bus'), dinfo.pop('device'))
            devices.append(dinfo)
            
print(devices,"\n\n")

how to check /dev/video0 or etc. and assign to
VideoCapture("/dev/video and VariableName)

Hi,
You need to make modification in driver, rebuild/replace kernel image. Please refer to Kernel Customization in developer guide:
https://docs.nvidia.com/jetson/l4t/index.html#page/Tegra%2520Linux%2520Driver%2520Package%2520Development%2520Guide%2Fkernel_custom.html%23

thank you