V4L2常用调试命令

这篇文章简单记录一下RK平台基于V4L2框架camera调试过程中常用的一些命令:

(1)查看拓扑结构:查看media0的pipeline

media-ctl -p -d /dev/media0

(2)抓数据流命令:

对video0节点,设置格式为NV12,分辨率为1920x1080,不裁剪,4个buf轮转,--verbose的作用是刷出帧率。

v4l2-ctl --verbose -d /dev/video0 --set-fmt-video=width=1920,height=1080,pixelformat='NV12' --stream-mmap=4 --set-selection=target=crop, flags=0,top=0,left=0,width=1920,height=1080

(3)抓图命令:

类似上面的,将图像保存到文件,加了--stream-poll的参数,如果抓不到数据会返回错误

v4l2-ctl -d /dev/video0 --set-fmt-video=width=1920,height=1080,pixelformat='NV12' --stream-mmap=3 --stream-skip=4 --stream-to=/data/1920x1080_nv12.yuv --stream-count=5 --stream-poll

(4)设置节点格式:

参考如下,设置ISP的rkisp1-isp-subdev节点的分辨率和图像格式、裁减信息等

media-ctl -d /dev/media0 --set-v4l2 '"rkisp1-isp-subdev":0[fmt:UYVY2X8/1920x1080]'
media-ctl -d /dev/media0 --set-v4l2 '"rkisp1-isp-subdev":0[crop:(0,0)/1920x1080]'
media-ctl -d /dev/media0 --set-v4l2 '"rkisp1-isp-subdev":2[fmt:UYVY2X8/1920x1080]'
media-ctl -d /dev/media0 --set-v4l2 '"rkisp1-isp-subdev":2[crop:(0,0)/1920x1080]'

(5)配置数据链路

将节点m01_f_ov13855 7-0010的pad0和rockchip-csi2-dphy1的pad0连接

media-ctl -d /dev/media1 -l '"m01_f_ov13855 7-0010":0->"rockchip-csi2-dphy1":0[1]'

(6)设置曝光增益:

v4l2-ctl -d /dev/v4l-subdev2 --set-ctrl 'exposure=1216,analogue_gain=10'

(7)查看节点具体信息

v4l2-ctl -d /dev/video0 -D 
v4l2-ctl -d /dev/video11 --all

(8)获取格式:会调用驱动的G_FMT

v4l2-ctl -d /dev/video0 --get-fmt-video
v4l2-ctl -d /dev/v4l-subdev2 --get-subdev-fmt

(9)获取帧率

v4l2-ctl -d /dev/v4l-subdev2 --get-subdev-fps

(10)查看节点支持的分辨率和格式

v4l2-ctl -d /dev/video0 --list-formats-ext

(11)查询事件变化:

例如查询分辨率变化事件和5V 的拔插事件,wait-for是等待一次时间,poll-for一直等待事件

v4l2-ctl -d /dev/v4l-subdev2 --wait-for-event=source_change=0
v4l2-ctl -d /dev/v4l-subdev2 --poll-for-event=source_change=0
v4l2-ctl -d /dev/v4l-subdev2 --wait-for-event=ctrl=power_present
v4l2-ctl -d /dev/v4l-subdev2 --poll-for-event=ctrl=power_present

(12)移动马达动作

v4l2-ctl -d /dev/v4l-subdev3 --set-ctrl 'focus_absolute=64'

猜你喜欢

转载自blog.csdn.net/qq_34341546/article/details/129015346