Skip to content

Instantly share code, notes, and snippets.

@dannas
Last active February 26, 2020 08:27
Show Gist options
  • Save dannas/4154286ac063de18ec00e2b51336112c to your computer and use it in GitHub Desktop.
Save dannas/4154286ac063de18ec00e2b51336112c to your computer and use it in GitHub Desktop.

Enabling debug output for v4l2 drivers

To change your current console loglevel to debug

echo 8 > /proc/sys/kernel/printk

First, you can enable v4l2 core debug logs. Check what driver is associated with which device file:

ls /dev/video/by-name/ -l
lrwxrwxrwx    1 root     root            12 Jan  1 03:00 coda -> ../../video2
lrwxrwxrwx    1 root     root            12 Jan  1 03:00 imx-ipuv3-scale -> ../../video0
lrwxrwxrwx    1 root     root            12 Jan  1 03:00 vout -> ../../video1

So, enable debug logging for coda by writing to the corresponding video2 file in /sys:

echo 3 > /sys/class/video4linux/video2/debug

More details: https://www.kernel.org/doc/Documentation/video4linux/v4l2-framework.txt

If the tested driver uses the v4l2_mem2mem framework you can get M2M logs with:

echo Y > /sys/module/v4l2_mem2mem/parameters/debug

Get also internal vb2 logs with:

echo 3 > /sys/module/videobuf2_core/parameters/debug

And optionally more logs using the dynamic debug feature: (https://www.kernel.org/doc/Documentation/dynamic-debug-howto.txt). Example:

echo "module my_driver +p" > /sys/kernel/debug/dynamic_debug/control
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment