add udev rules for 2 Kameras on imx8mp ISP0 and ISP1

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

add udev rules for 2 Kameras on imx8mp ISP0 and ISP1

Jump to solution
563 Views
malik_cisse
Senior Contributor I

Hello,

I have two camera-sensors on imx8mp ISP0 and ISP1 on two CSI ports

ls /dev 

video1 (ISP0)

video2 (ISP1)

I cannot distinguish between those two. therefor I would like to add a udev rule to create fixed symbolic links.
Any idea how to do that?
Thank you,

Labels (1)
0 Kudos
Reply
1 Solution
433 Views
malik_cisse
Senior Contributor I

Hi Bio_TICFSL

Thank you for the feedback, but to be honest that did not help me at all.
Here is how I finally solved the problem.
Problem description again:

The two  cameras appear as /dev/video1 and /dev/video2. Additionally ISI-CSI1 capture appears on /dev/video0.

As we cannot clearly identify which camera is mapped on CSI0 and CSI1, we need Udev Rules to set permanent links.

For example:
$ls /dev

video-isi-csi1 -> video0
video-isp-csi1 -> video1
video-isp-csi2 -> video2

To do this I added  /lib/udev/rules.d/my_new.rules with this content:

CSI1 ISI Video Device
ACTION=="add", \

                SUBSYSTEM=="video4linux", \

                ATTR{name}=="mxc_isi.0.capture",  \

                DRIVERS=="mxc-md", \

                SYMLINK+="video-isi-csi1"



CSI2 ISI Video Device
ACTION=="add", \

                SUBSYSTEM=="video4linux", \

                ATTR{name}=="mxc_isi.1.capture", \

                DRIVERS=="mxc-md", \

                SYMLINK+="video-isi-csi2"



CSI1 ISP Video Device
ACTION=="add", \

                SUBSYSTEM=="video4linux", \

                ATTR{name}=="viv_v4l20", \

                DRIVERS=="vvcam-video", \

                SYMLINK+="video-isp-csi1"



CSI2 ISP Video Device
ACTION=="add", \

                SUBSYSTEM=="video4linux", \

                ATTR{name}=="viv_v4l21", \

                DRIVERS=="vvcam-video", \

                SYMLINK+="video-isp-csi2"


Attribute "ATTR" of the node as well as parent nodes can be read using following commands:
udevadm info -a /dev/video0

udevadm info -a /dev/video1

udevadm info -a /dev/video2

Here is the output:

Udevadm info starts with the device specified by the devpath and then
walks up the chain of parent devices. It prints for every device
found, all possible attributes in the udev rules key format.
A rule to match, can be composed by the attributes of the device
and the attributes from one single parent device.

  looking at device '/devices/platform/vvcam-video.0/video4linux/video1':
    KERNEL=="video1"
    SUBSYSTEM=="video4linux"
    DRIVER==""
    ATTR{dev_debug}=="0"
    ATTR{index}=="0"
    ATTR{name}=="viv_v4l20"
    ATTR{power/control}=="auto"
    ATTR{power/runtime_active_time}=="0"
    ATTR{power/runtime_status}=="unsupported"
    ATTR{power/runtime_suspended_time}=="0"

  looking at parent device '/devices/platform/vvcam-video.0':
    KERNELS=="vvcam-video.0"
    SUBSYSTEMS=="platform"
    DRIVERS=="vvcam-video"
    ATTRS{driver_override}=="(null)"
    ATTRS{power/control}=="auto"
    ATTRS{power/runtime_active_time}=="0"
    ATTRS{power/runtime_status}=="unsupported"
    ATTRS{power/runtime_suspended_time}=="0"

  looking at parent device '/devices/platform':
    KERNELS=="platform"
    SUBSYSTEMS==""
    DRIVERS==""
    ATTRS{power/control}=="auto"
    ATTRS{power/runtime_active_time}=="0"
    ATTRS{power/runtime_status}=="unsupported"
    ATTRS{power/runtime_suspended_time}=="0"

 

Similar info can be gathered via (not 100% sure how to evaluate this though):
media-ctl --device /dev/media1 --print-topology

 

View solution in original post

0 Kudos
Reply
2 Replies
434 Views
malik_cisse
Senior Contributor I

Hi Bio_TICFSL

Thank you for the feedback, but to be honest that did not help me at all.
Here is how I finally solved the problem.
Problem description again:

The two  cameras appear as /dev/video1 and /dev/video2. Additionally ISI-CSI1 capture appears on /dev/video0.

As we cannot clearly identify which camera is mapped on CSI0 and CSI1, we need Udev Rules to set permanent links.

For example:
$ls /dev

video-isi-csi1 -> video0
video-isp-csi1 -> video1
video-isp-csi2 -> video2

To do this I added  /lib/udev/rules.d/my_new.rules with this content:

CSI1 ISI Video Device
ACTION=="add", \

                SUBSYSTEM=="video4linux", \

                ATTR{name}=="mxc_isi.0.capture",  \

                DRIVERS=="mxc-md", \

                SYMLINK+="video-isi-csi1"



CSI2 ISI Video Device
ACTION=="add", \

                SUBSYSTEM=="video4linux", \

                ATTR{name}=="mxc_isi.1.capture", \

                DRIVERS=="mxc-md", \

                SYMLINK+="video-isi-csi2"



CSI1 ISP Video Device
ACTION=="add", \

                SUBSYSTEM=="video4linux", \

                ATTR{name}=="viv_v4l20", \

                DRIVERS=="vvcam-video", \

                SYMLINK+="video-isp-csi1"



CSI2 ISP Video Device
ACTION=="add", \

                SUBSYSTEM=="video4linux", \

                ATTR{name}=="viv_v4l21", \

                DRIVERS=="vvcam-video", \

                SYMLINK+="video-isp-csi2"


Attribute "ATTR" of the node as well as parent nodes can be read using following commands:
udevadm info -a /dev/video0

udevadm info -a /dev/video1

udevadm info -a /dev/video2

Here is the output:

Udevadm info starts with the device specified by the devpath and then
walks up the chain of parent devices. It prints for every device
found, all possible attributes in the udev rules key format.
A rule to match, can be composed by the attributes of the device
and the attributes from one single parent device.

  looking at device '/devices/platform/vvcam-video.0/video4linux/video1':
    KERNEL=="video1"
    SUBSYSTEM=="video4linux"
    DRIVER==""
    ATTR{dev_debug}=="0"
    ATTR{index}=="0"
    ATTR{name}=="viv_v4l20"
    ATTR{power/control}=="auto"
    ATTR{power/runtime_active_time}=="0"
    ATTR{power/runtime_status}=="unsupported"
    ATTR{power/runtime_suspended_time}=="0"

  looking at parent device '/devices/platform/vvcam-video.0':
    KERNELS=="vvcam-video.0"
    SUBSYSTEMS=="platform"
    DRIVERS=="vvcam-video"
    ATTRS{driver_override}=="(null)"
    ATTRS{power/control}=="auto"
    ATTRS{power/runtime_active_time}=="0"
    ATTRS{power/runtime_status}=="unsupported"
    ATTRS{power/runtime_suspended_time}=="0"

  looking at parent device '/devices/platform':
    KERNELS=="platform"
    SUBSYSTEMS==""
    DRIVERS==""
    ATTRS{power/control}=="auto"
    ATTRS{power/runtime_active_time}=="0"
    ATTRS{power/runtime_status}=="unsupported"
    ATTRS{power/runtime_suspended_time}=="0"

 

Similar info can be gathered via (not 100% sure how to evaluate this though):
media-ctl --device /dev/media1 --print-topology

 

0 Kudos
Reply
508 Views
Bio_TICFSL
NXP TechSupport
NXP TechSupport

Hello,

Make sure that you have the cameras running and you can access to it before making a udev rule, then for making a udev visuallize which devices identification

su -c 'dmesg | tail | fgrep -i sd*'

 The udevadm info process reports on a device (specified by the device path), then "walks" up the chain of parent devices.

Open a file called 80-local.rules in /etc/udev/rules.d and enter this code:

SUBSYSTEM=="you dvice", ACTION=="add", RUN+="/usr/local/bin/yourscritps.sh"

Regards