Check if there is an actual camera connected

before i start accessing a /dev/video3 device, i would like to check if there is an actual camera connected to it. How do i do this .
For USB cameras this is easy, as if the camera is disconnected it won’t have a device
for cameras connected to an analog->MIPI capture boards it is a bit more difficult as there are always 4 devices /dev/video…/dev/video3 … however not all (or none for that matter) may have an analog camera attached to it.

does anyone have a tip on what to check ?

nvidia@localhost:~$ v4l2-ctl --list-devices
vi-output, tp2850 0-0001 (platform:15700000.vi:0):
/dev/video0
vi-output, tp2850 0-0002 (platform:15700000.vi:2):
/dev/video1
vi-output, tp2850 1-0003 (platform:15700000.vi:3):
/dev/video2
vi-output, tp2850 1-0004 (platform:15700000.vi:4):
/dev/video3

also always shows 4 devices… no matter what is actually connected

hello tomschuring,

may I know what’s your device register process, did you disable plugin-manger and Using the Main Platform Device Tree File?

how about checking the kernel logs during kernel initial stage. you may looking for 54080000.vi.
for example,
it shows IMX219 camera sensor has actually register to 7-0010.

$ dmesg | grep 54080000.vi
[    0.464245] iommu: Adding device 54080000.vi to group 11
[    5.152109] vi 54080000.vi: vi_probe: ++
[    5.154775] vi 54080000.vi: initialized
[    5.156791] vi 54080000.vi: subdev nvcsi--2 bound
[    5.156804] vi 54080000.vi: subdev imx219 7-0010 bound
[    5.157528] vi 54080000.vi: subdev nvcsi--1 bound

Hello @JerryChang

to be honest , i don’t know. The card image was given to me. I’ll ask them.

I can check the logs for events, I was hoping there was a more direct way to figure this out via v4l or some sort of MIPI tool ? or even checking the /sys/ tree ? Maybe what i’m hoping is not what is available.

the quickest way is checking sys nodes.
do there video nodes created under /dev/video*?

yes, there are nodes under /dev/video* but unfortunately they are also there if there is no analog camera connected to the mipi (digitisation card)

for example, i know there is no camera on /dev/video3 :

nvidia@localhost:/sys/devices/13e10000.host1x/15700000.vi/video4linux$ ll
total 0
drwxr-xr-x 14 root root 0 Oct 22 06:09 ./
drwxr-xr-x  8 root root 0 Oct 22 07:03 ../
drwxr-xr-x  3 root root 0 Oct 22 07:03 v4l-subdev0/
drwxr-xr-x  3 root root 0 Oct 22 07:03 v4l-subdev1/
drwxr-xr-x  3 root root 0 Oct 22 07:03 v4l-subdev2/
drwxr-xr-x  3 root root 0 Oct 22 07:03 v4l-subdev3/
drwxr-xr-x  3 root root 0 Oct 22 07:03 v4l-subdev4/
drwxr-xr-x  3 root root 0 Oct 22 07:03 v4l-subdev5/
drwxr-xr-x  3 root root 0 Oct 22 07:03 v4l-subdev6/
drwxr-xr-x  3 root root 0 Oct 22 07:03 v4l-subdev7/
drwxr-xr-x  3 root root 0 Oct 22 07:03 video0/
drwxr-xr-x  3 root root 0 Oct 22 07:03 video1/
drwxr-xr-x  3 root root 0 Oct 22 06:09 video2/
drwxr-xr-x  3 root root 0 Oct 22 07:03 video3/
nvidia@localhost:/sys/devices/13e10000.host1x/15700000.vi/video4linux$ cd video3
nvidia@localhost:/sys/devices/13e10000.host1x/15700000.vi/video4linux/video3$ ll
total 0
drwxr-xr-x  3 root root    0 Oct 22 07:03 ./
drwxr-xr-x 14 root root    0 Oct 22 06:09 ../
-r--r--r--  1 root root 4096 Oct 22 07:04 dev
-rw-r--r--  1 root root 4096 Oct 22 07:04 dev_debug
lrwxrwxrwx  1 root root    0 Oct 22 07:04 device -> ../../../15700000.vi/
-r--r--r--  1 root root 4096 Oct 22 07:04 index
-r--r--r--  1 root root 4096 Oct 22 07:04 name
drwxr-xr-x  2 root root    0 Oct 22 07:04 power/
lrwxrwxrwx  1 root root    0 Oct 22 07:04 subsystem -> ../../../../../class/video4linux/
-rw-r--r--  1 root root 4096 Oct 22 07:04 uevent
nvidia@localhost:/sys/devices/13e10000.host1x/15700000.vi/video4linux/video3$ 
nvidia@localhost:/sys/devices/13e10000.host1x/15700000.vi/video4linux/video3$ ls /dev/video3
/dev/video3
nvidia@localhost:/sys/devices/13e10000.host1x/15700000.vi/video4linux/video3$

There is no update from you for a period, assuming this is not an issue any more.
Hence we are closing this topic. If need further support, please open a new one.
Thanks

hello tomschuring,

could you please share the details of digitisation card,
should we expect those video nodes were removed if the board disconnected.

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