Dynamic change of video device nodes on db820-4.14-kernel

Hi all,
when i query available video device nodes with “v4l2-ctl --list-devices” then some times it is showing encoder and some times it using decoder as shown below

This is happening on reflashing the bootimage.

root@linaro-alip:~# v4l2-ctl --list-devices
Qualcomm Venus video decoder (platform:qcom-venus):
/dev/video0
/dev/video1

root@linaro-alip:~# v4l2-ctl --list-devices
Qualcomm Venus video encoder (platform:qcom-venus):
/dev/video0
/dev/video1

As i’m working on venus decoder driver this is making me annoyed since i’m concerned only with decoder.since the video device node sometimes representing encoder, the decoder ioctls calls are not happening thus it forcing me to reflash the bootimage again and again till i can see the decoders device node.

anyone knows,what might be the reason for this?

Regards,
Laxman

One node (/dev/videoX) is the encoder, the other one is the decoder. But the index is not fixed. You can use v4l2-ctl -D -d /dev/videoX on each device to find which one is the decoder.

Hi Loic,
Thanks very much Loic for the clarification.

is it possible to make fixed index for decode (as i hard coded to /dev/video0 in userspace code ) since i need to recompile the code everytime by verifying the device nodes.

Thanks.

I would suggest to create a new udev rule, e.g. create /etc/udev/rules.d/42-video.rules with the following content:

SUBSYSTEM=="video4linux", ATTR{name}=="qcom-venus-decoder", GROUP="video", SYMLINK+="decoder"

After a reboot, a /dev/decoder symlink will be automatically created, pointing to the decoder device. You can then use /dev/decoder unconditionally from your script/app.

Note that I created the rules based on device identifiers:

udevadm info -a -p $(udevadm info -q path -n /dev/video0)

Hi Loic,
Thanks a lot. It got worked.