# Assign /dev/video0

**URL:** <https://forums.developer.nvidia.com/t/assign-dev-video0/156780>\
**Category:** Jetson TX2\
**Tags:** camera\
**Created:** [October 10, 2020, 6:50pm UTC](https://forums.developer.nvidia.com/t/assign-dev-video0/156780 "2020-10-10T18:50:57Z")\
**Posts on this page:** 14\
**Page:** 1

<div class="post-metadata">

**Author:** ![khaledm.gamal95](https://developer.download.nvidia.com/images/forums/profile-default-devtalk-84.png) [@khaledm.gamal95](https://forums.developer.nvidia.com/u/khaledm.gamal95)\
**Post date:** [October 10, 2020, 6:50pm UTC](https://forums.developer.nvidia.com/t/assign-dev-video0/156780/1 "2020-10-10T18:50:57Z")

</div>

I have Jetson TX2 kit .how can i assign /dev/video0 to my webcam which is assigned to /dev/video1 ?

---

<div class="post-metadata">

**Author:** ![khaledm.gamal95](https://developer.download.nvidia.com/images/forums/profile-default-devtalk-84.png) [@khaledm.gamal95](https://forums.developer.nvidia.com/u/khaledm.gamal95)\
**Post date:** [October 11, 2020, 5:13pm UTC](https://forums.developer.nvidia.com/t/assign-dev-video0/156780/2 "2020-10-11T17:13:08Z")

</div>

how can i write udev rule for the usb camera to assign it to specific /dev/video  
i tried this method in this link [https://www.linuxquestions.org/questions/linux-hardware-18/how-can-i-assign-a-webcam-to-a-specific-dev-video-669507/](https://www.linuxquestions.org/questions/linux-hardware-18/how-can-i-assign-a-webcam-to-a-specific-dev-video-669507/) but it does not work

---

<div class="post-metadata">

**Author:** ![ShaneCCC](https://sea2.discourse-cdn.com/nvidia/user_avatar/forums.developer.nvidia.com/shaneccc/32/14043_2.png) [@ShaneCCC](https://forums.developer.nvidia.com/u/ShaneCCC)\
**Post date:** [October 12, 2020, 3:38am UTC](https://forums.developer.nvidia.com/t/assign-dev-video0/156780/4 "2020-10-12T03:38:04Z")

</div>

Why do you need for it? You may need to check which device have allocate the video0 to disable it to have webcam assigned to video0.

---

<div class="post-metadata">

**Author:** ![khaledm.gamal95](https://developer.download.nvidia.com/images/forums/profile-default-devtalk-84.png) [@khaledm.gamal95](https://forums.developer.nvidia.com/u/khaledm.gamal95)\
**Post date:** [October 12, 2020, 9:40pm UTC](https://forums.developer.nvidia.com/t/assign-dev-video0/156780/5 "2020-10-12T21:40:19Z")

</div>

Thank you for your response .I need that because i use application that uses specific /dev/video\* for example /dev/video1 so every time i boot the jetson ,the jetson assigns the usb camera to different /dev/video\* every time that makes the application does not work so i want to assign specific /dev/video\* to the usb camera

---

<div class="post-metadata">

**Author:** ![ShaneCCC](https://sea2.discourse-cdn.com/nvidia/user_avatar/forums.developer.nvidia.com/shaneccc/32/14043_2.png) [@ShaneCCC](https://forums.developer.nvidia.com/u/ShaneCCC)\
**Post date:** [October 13, 2020, 2:21am UTC](https://forums.developer.nvidia.com/t/assign-dev-video0/156780/6 "2020-10-13T02:21:44Z")

</div>

You can use v4l2 API or v4l2-ctl to query the video to check the vendor for your case.

---

<div class="post-metadata">

**Author:** ![khaledm.gamal95](https://developer.download.nvidia.com/images/forums/profile-default-devtalk-84.png) [@khaledm.gamal95](https://forums.developer.nvidia.com/u/khaledm.gamal95)\
**Post date:** [October 14, 2020, 4:37pm UTC](https://forums.developer.nvidia.com/t/assign-dev-video0/156780/7 "2020-10-14T16:37:09Z")

</div>

that what i did

> nvidia@jetson:~$ lsusb  
> Bus 002 Device 001: ID 1d6b:0003 Linux Foundation 3.0 root hub  
> Bus 001 Device 011: ID 1a2c:2d23 China Resource Semico Co., Ltd  
> Bus 001 Device 012: ID 1e4e:0103 Cubeternet  
> Bus 001 Device 003: ID 0000:3825  
> Bus 001 Device 002: ID 214b:7250  
> Bus 001 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub

> nvidia@jetson:~$ nano /etc/udev/rules.d/83-name-video-devices.rules

I put this udev rule in this file:

> KERNEL=="video[0-9]\*, SUBSYSTEM==“video4linux”, SUBSYSTEMS==“usb”, ATTRS{idVendor}==“1e4e”, ATTRS{idProduct}==“0103”, NAME=“video1”

i got ATTRS{idVendor}==“1e4e”, ATTRS{idProduct}==“0103” from lsusb command because Cubeternet is the name of the usb camera but this does not work so could you please tell me the udev rule for doing that

---

<div class="post-metadata">

**Author:** ![ShaneCCC](https://sea2.discourse-cdn.com/nvidia/user_avatar/forums.developer.nvidia.com/shaneccc/32/14043_2.png) [@ShaneCCC](https://forums.developer.nvidia.com/u/ShaneCCC)\
**Post date:** [October 14, 2020, 6:17pm UTC](https://forums.developer.nvidia.com/t/assign-dev-video0/156780/8 "2020-10-14T18:17:45Z")

</div>

I don’t think the udev rule can apply to the uvc driver due to the uvc driver register video node allocate from the first free number.

What I suggest is to use v4l2 API to query every videoX to get the vendor information then your APP can open the right video node depend on it.

---

<div class="post-metadata">

**Author:** ![khaledm.gamal95](https://developer.download.nvidia.com/images/forums/profile-default-devtalk-84.png) [@khaledm.gamal95](https://forums.developer.nvidia.com/u/khaledm.gamal95)\
**Post date:** [October 14, 2020, 6:39pm UTC](https://forums.developer.nvidia.com/t/assign-dev-video0/156780/9 "2020-10-14T18:39:50Z")

</div>

Could you please show me the steps of doing that or refer me to link

---

<div class="post-metadata">

**Author:** ![ShaneCCC](https://sea2.discourse-cdn.com/nvidia/user_avatar/forums.developer.nvidia.com/shaneccc/32/14043_2.png) [@ShaneCCC](https://forums.developer.nvidia.com/u/ShaneCCC)\
**Post date:** [October 15, 2020, 3:09am UTC](https://forums.developer.nvidia.com/t/assign-dev-video0/156780/10 "2020-10-15T03:09:17Z")

</div>

Using tools maybe python script to issue v4l2-ctl like below then parser the output to check the “Bus info” or "Card type to recognize your webcam. The pass the video node number to you APP.

```auto
nvidia@nvidia-desktop:~$ v4l2-ctl -d /dev/video0 -D
Driver Info (not using libv4l2):
        Driver name : tegra-video
        Card type : vi-output, ov5693 30-0036
        Bus info : platform:15700000.vi:0
        Driver version: 4.9.140
        Capabilities : 0x84200001
                Video Capture
                Streaming
                Extended Pix Format
                Device Capabilities
        Device Caps : 0x04200001
                Video Capture
                Streaming
                Extended Pix Format

```

---

<div class="post-metadata">

**Author:** ![khaledm.gamal95](https://developer.download.nvidia.com/images/forums/profile-default-devtalk-84.png) [@khaledm.gamal95](https://forums.developer.nvidia.com/u/khaledm.gamal95)\
**Post date:** [October 19, 2020, 11:48am UTC](https://forums.developer.nvidia.com/t/assign-dev-video0/156780/11 "2020-10-19T11:48:50Z")

</div>

Thanks for your reply that is what i get when i run this command tor video0 and video1 .video1 is jetson camera ,video0 is usb camera

> nvidia@jetson:~$ v4l2-ctl -d /dev/video0 -D  
> Driver Info (not using libv4l2):  
> Driver name : uvcvideo  
> Card type : USB2.0 Camera  
> Bus info : usb-3530000.xhci-2.1  
> Driver version: 4.9.140  
> Capabilities : 0x84200001  
> Video Capture  
> Streaming  
> Extended Pix Format  
> Device Capabilities  
> Device Caps : 0x04200001  
> Video Capture  
> Streaming  
> Extended Pix Format

> nvidia@jetson:~$ v4l2-ctl -d /dev/video1 -D  
> Driver Info (not using libv4l2):  
> Driver name : tegra-video  
> Card type : vi-output, ov5693 2-0036  
> Bus info : platform:15700000.vi:2  
> Driver version: 4.9.140  
> Capabilities : 0x84200001  
> Video Capture  
> Streaming  
> Extended Pix Format  
> Device Capabilities  
> Device Caps : 0x04200001  
> Video Capture  
> Streaming  
> Extended Pix Format

so now how can i assign video1 for the usb camera and video0 for jetson built-in camera

---

<div class="post-metadata">

**Author:** ![ShaneCCC](https://sea2.discourse-cdn.com/nvidia/user_avatar/forums.developer.nvidia.com/shaneccc/32/14043_2.png) [@ShaneCCC](https://forums.developer.nvidia.com/u/ShaneCCC)\
**Post date:** [October 19, 2020, 12:17pm UTC](https://forums.developer.nvidia.com/t/assign-dev-video0/156780/12 "2020-10-19T12:17:01Z")

</div>

You can plug in the USB camera after booting to system, then it will be the video1.

---

<div class="post-metadata">

**Author:** ![khaledm.gamal95](https://developer.download.nvidia.com/images/forums/profile-default-devtalk-84.png) [@khaledm.gamal95](https://forums.developer.nvidia.com/u/khaledm.gamal95)\
**Post date:** [October 19, 2020, 12:22pm UTC](https://forums.developer.nvidia.com/t/assign-dev-video0/156780/13 "2020-10-19T12:22:48Z")

</div>

yes i do this now but is their anyway to assign video1 to usb camera in booting

---

<div class="post-metadata">

**Author:** ![ShaneCCC](https://sea2.discourse-cdn.com/nvidia/user_avatar/forums.developer.nvidia.com/shaneccc/32/14043_2.png) [@ShaneCCC](https://forums.developer.nvidia.com/u/ShaneCCC)\
**Post date:** [October 19, 2020, 12:38pm UTC](https://forums.developer.nvidia.com/t/assign-dev-video0/156780/14 "2020-10-19T12:38:10Z")

</div>

You can modify the video\_register\_device() in the tegra\_vi\_graph\_notify\_complete() to assign 1 for CSI camera.

---

<div class="post-metadata">

**Author:** ![khaledm.gamal95](https://developer.download.nvidia.com/images/forums/profile-default-devtalk-84.png) [@khaledm.gamal95](https://forums.developer.nvidia.com/u/khaledm.gamal95)\
**Post date:** [October 19, 2020, 12:45pm UTC](https://forums.developer.nvidia.com/t/assign-dev-video0/156780/15 "2020-10-19T12:45:12Z")

</div>

could you please show me the steps of assigning CSI camera to video0 and usb camera to video1
