Hi all, I have issue with v4l2-ctl settings
Specs:
processor: IMX8MM,
kernel ver: 5.10.72 (hardknott yocto)
camera senso:r MIPI-CSI OS02G10
bus: V4L2_MBUS_CSI2_DPHY
format: RAW10 / BG10 (SBGGR10) /1920x1080
more details for RAW10 support for IMX8MM here: https://community.nxp.com/t5/i-MX-Graphics/gst-launch-1-0-returns-Internal-data-stream-error/m-p/157...
Issue:
Driver for OS02G10 has implemented V4L2 controls infrastructure similar to ov5640. It uses subdevice concept.
V4L2 can not handle implemented controls, example:
root@user:~# v4l2-ctl --verbose -L
VIDIOC_QUERYCAP: ok
root@user:~# v4l2-ctl --set-ctrl brightness=192
unknown control 'brightness'
It is a bit known issue, but hope someone will help me to find solution faster.
How to fix it?
root@user:~# v4l2-ctl --list-devices
i.MX6S_CSI (platform:32e20000.csi_bridge):
/dev/video0
vsi_v4l2dec (platform:vsi_v4l2dec):
/dev/video2
vsi_v4l2enc (platform:vsi_v4l2enc):
/dev/video1
All additional details here:
root@user:~# v4l2-compliance
v4l2-compliance SHA: not available
[ 334.897958] unknown pixelformat:'▒▒▒▒'
[ 334.902049] mx6s-csi 32e20000.csi_bridge: Fourcc format (0xffffffff) invalid.
[ 334.912066] unknown pixelformat:' '
[ 334.918660] mx6s-csi 32e20000.csi_bridge: Fourcc format (0x00000000) invalid.
Compliance test for mx6s-csi device /dev/video0:
Driver Info:
Driver name : mx6s-csi
Card type : i.MX6S_CSI
Bus info : platform:32e20000.csi_bridge
Driver version : 5.10.72
Capabilities : 0x84200001
Video Capture
Streaming
Extended Pix Format
Device Capabilities
Device Caps : 0x04200001
Video Capture
Streaming
Extended Pix Format
Required ioctls:
test VIDIOC_QUERYCAP: OK
Allow for multiple opens:
test second /dev/video0 open: OK
test VIDIOC_QUERYCAP: OK
fail: ../../../v4l-utils-1.20.0/utils/v4l2-compliance/v4l2-compliance.cpp(739): prio != match
test VIDIOC_G/S_PRIORITY: FAIL
test for unlimited opens: OK
test invalid ioctls: OK
Debug ioctls:
test VIDIOC_DBG_G/S_REGISTER: OK (Not Supported)
test VIDIOC_LOG_STATUS: OK (Not Supported)
Input ioctls:
test VIDIOC_G/S_TUNER/ENUM_FREQ_BANDS: OK (Not Supported)
test VIDIOC_G/S_FREQUENCY: OK (Not Supported)
test VIDIOC_S_HW_FREQ_SEEK: OK (Not Supported)
test VIDIOC_ENUMAUDIO: OK (Not Supported)
fail: ../../../v4l-utils-1.20.0/utils/v4l2-compliance/v4l2-test-input-output.cpp(385): std == 0
fail: ../../../v4l-utils-1.20.0/utils/v4l2-compliance/v4l2-test-input-output.cpp(455): invalid attributes for input 0
test VIDIOC_G/S/ENUMINPUT: FAIL
test VIDIOC_G/S_AUDIO: OK (Not Supported)
Inputs: 0 Audio Inputs: 0 Tuners: 0
Output ioctls:
test VIDIOC_G/S_MODULATOR: OK (Not Supported)
test VIDIOC_G/S_FREQUENCY: OK (Not Supported)
test VIDIOC_ENUMAUDOUT: OK (Not Supported)
test VIDIOC_G/S/ENUMOUTPUT: OK (Not Supported)
test VIDIOC_G/S_AUDOUT: OK (Not Supported)
Outputs: 0 Audio Outputs: 0 Modulators: 0
Input/Output configuration ioctls:
test VIDIOC_ENUM/G/S/QUERY_STD: OK (Not Supported)
test VIDIOC_ENUM/G/S/QUERY_DV_TIMINGS: OK (Not Supported)
test VIDIOC_DV_TIMINGS_CAP: OK (Not Supported)
test VIDIOC_G/S_EDID: OK (Not Supported)
Control ioctls:
test VIDIOC_QUERY_EXT_CTRL/QUERYMENU: OK (Not Supported)
test VIDIOC_QUERYCTRL: OK (Not Supported)
test VIDIOC_G/S_CTRL: OK (Not Supported)
test VIDIOC_G/S/TRY_EXT_CTRLS: OK (Not Supported)
test VIDIOC_(UN)SUBSCRIBE_EVENT/DQEVENT: OK (Not Supported)
test VIDIOC_G/S_JPEGCOMP: OK (Not Supported)
Standard Controls: 0 Private Controls: 0
Format ioctls:
fail: ../../../v4l-utils-1.20.0/utils/v4l2-compliance/v4l2-test-formats.cpp(312): Video Capture cap set, but no Video Capture formats defined
test VIDIOC_ENUM_FMT/FRAMESIZES/FRAMEINTERVALS: FAIL
fail: ../../../v4l-utils-1.20.0/utils/v4l2-compliance/v4l2-test-formats.cpp(1308): expected EINVAL, but got 19 when getting parms for buftype 1
test VIDIOC_G/S_PARM: FAIL
test VIDIOC_G_FBUF: OK (Not Supported)
fail: ../../../v4l-utils-1.20.0/utils/v4l2-compliance/v4l2-test-formats.cpp(441): fmt.type != type
test VIDIOC_G_FMT: FAIL
fail: ../../../v4l-utils-1.20.0/utils/v4l2-compliance/v4l2-test-formats.cpp(716): Video Capture is valid, but no TRY_FMT was implemented
test VIDIOC_TRY_FMT: FAIL
warn: ../../../v4l-utils-1.20.0/utils/v4l2-compliance/v4l2-test-formats.cpp(1099): S_FMT cannot handle an invalid pixelformat.
warn: ../../../v4l-utils-1.20.0/utils/v4l2-compliance/v4l2-test-formats.cpp(1100): This may or may not be a problem. For more information see:
warn: ../../../v4l-utils-1.20.0/utils/v4l2-compliance/v4l2-test-formats.cpp(1101): http://www.mail-archive.com/linux-media@vger.kernel.org/msg56550.html
fail: ../../../v4l-utils-1.20.0/utils/v4l2-compliance/v4l2-test-formats.cpp(1115): S_FMT cannot handle an invalid format
[ 335.268377] ------------[ cut here ]------------
[ 335.275401] WARNING: CPU: 0 PID: 739 at drivers/media/common/videobuf2/videobuf2-core.c:806 vb2_core_reqbufs+0x140/0x420
[ 335.286266] Modules linked in: fsl_jr_uio caam_jr caamkeyblob_desc caamhash_desc caamalg_desc crypto_engine rng_core authenc libdes crct10dif_ce secvio caam error
[ 335.286306] virtio_rpmsg_bus rpmsg_ns imx_rproc imx_rpmsg_tty fuse
[ 335.307098] CPU: 0 PID: 739 Comm: v4l2-compliance Not tainted 5.10.72-lts-5.10.y+ge4c14755b1cb #1
[ 335.315970] Hardware name: user i.MX8MM Base Board (DT)
[ 335.321199] pstate: 80000005 (Nzcv daif -PAN -UAO -TCO BTYPE=--)
[ 335.327209] pc : vb2_core_reqbufs+0x140/0x420
[ 335.331566] lr : vb2_core_reqbufs+0x108/0x420
[ 335.335921] sp : ffff80001c5e3b30
[ 335.339235] x29: ffff80001c5e3b30 x28: ffff800011339508
[ 335.344549] x27: 00000000c0145608 x26: ffff80001c5e3d68
[ 335.349866] x25: ffff80001c5e3d68 x24: ffff00000448c178
[ 335.355180] x23: 0000000000000001 x22: ffff80001c5e3d68
[ 335.360494] x21: ffff000008b00000 x20: 0000000000000000
[ 335.365808] x19: ffff00000448c110 x18: 0000000000000000
[ 335.371122] x17: 0000000000000000 x16: 0000000000000000
[ 335.376437] x15: 0000000000000000 x14: 0000000000000000
[ 335.381751] x13: 0000000000000000 x12: 0000000000000000
[ 335.387065] x11: 0000000000000000 x10: 0000000000000000
[ 335.392382] x9 : 0000000000000000 x8 : 0000ffff00000001
[ 335.397696] x7 : 0000000000000000 x6 : 0000000000000000
[ 335.403010] x5 : ffff000004187010 x4 : 0000000000000000
[ 335.408323] x3 : 0000000000000001 x2 : ffff80001c5e3b84
[ 335.413637] x1 : ffff80001c5e3b8c x0 : ffff80001c5e3b88
[ 335.418952] Call trace:
[ 335.421401] vb2_core_reqbufs+0x140/0x420
[ 335.425417] vb2_reqbufs+0x58/0x70
[ 335.428823] mx6s_vidioc_reqbufs+0x40/0x7c
[ 335.432921] v4l_reqbufs+0x4c/0x60
[ 335.436322] __video_do_ioctl+0x180/0x3e4
[ 335.440331] video_usercopy+0x1a0/0x450
[ 335.444167] video_ioctl2+0x18/0x24
[ 335.447659] v4l2_ioctl+0x44/0x64
[ 335.450978] __arm64_sys_ioctl+0xa8/0xf0
[ 335.454903] el0_svc_common.constprop.0+0x78/0x1c4
[ 335.459694] do_el0_svc+0x24/0x8c
[ 335.463011] el0_svc+0x14/0x20
[ 335.466067] el0_sync_handler+0x1a4/0x1b0
[ 335.470077] el0_sync+0x180/0x1c0
[ 335.473391] ---[ end trace 70273d2f610c9f9a ]---
test VIDIOC_S_FMT: FAIL
test VIDIOC_G_SLICED_VBI_CAP: OK (Not Supported)
fail: ../../../v4l-utils-1.20.0/utils/v4l2-compliance/v4l2-test-formats.cpp(1439): doioctl(node, VIDIOC_G_SELECTION, &sel) != EINVAL
test Cropping: FAIL
fail: ../../../v4l-utils-1.20.0/utils/v4l2-compliance/v4l2-test-formats.cpp(1439): doioctl(node, VIDIOC_G_SELECTION, &sel) != EINVAL
test Composing: FAIL
fail: ../../../v4l-utils-1.20.0/utils/v4l2-compliance/v4l2-test-formats.cpp(1712): doioctl(node, VIDIOC_S_FMT, &fmt)
fail: ../../../v4l-utils-1.20.0/utils/v4l2-compliance/v4l2-test-formats.cpp(1861): doioctl(node, VIDIOC_S_FMT, &fmt)
test Scaling: FAIL
Codec ioctls:
test VIDIOC_(TRY_)ENCODER_CMD: OK (Not Supported)
test VIDIOC_G_ENC_INDEX: OK (Not Supported)
test VIDIOC_(TRY_)DECODER_CMD: OK (Not Supported)
Buffer ioctls:
fail: ../../../v4l-utils-1.20.0/utils/v4l2-compliance/v4l2-test-buffers.cpp(612): q.reqbufs(node, 1)
test VIDIOC_REQBUFS/CREATE_BUFS/QUERYBUF: FAIL
fail: ../../../v4l-utils-1.20.0/utils/v4l2-compliance/v4l2-test-buffers.cpp(749): VIDIOC_EXPBUF is supported, but the V4L2_MEMORY_MMAP support is missing or malfunctioning.
fail: ../../../v4l-utils-1.20.0/utils/v4l2-compliance/v4l2-test-buffers.cpp(750): VIDIOC_EXPBUF is supported, but the V4L2_MEMORY_MMAP support is missing, probably due to earlier failing format tests.
test VIDIOC_EXPBUF: OK (Not Supported)
test Requests: OK (Not Supported)
Total for mx6s-csi device /dev/video0: 45, Succeeded: 34, Failed: 11, Warnings: 3
已解决! 转到解答。
v4l-ctl does not work because there is incomplete API, you need to add callback function.
You need to see the v4l-subdev0 in the /dev (if it is single subdevice there), it is camera sensor registered as sub-device.
Then it works:
v4l2-ctl --device=/dev/v4l-subdev0 --get-ctrl=exposure
v4l2-ctl -d /dev/v4l-subdev0 --set-ctrl exposure=512
v4l2-ctl --device=/dev/v4l-subdev0 --get-ctrl=analogue_gain
v4l2-ctl --device=/dev/v4l-subdev0 -L
Below you can see the patch file for this solution
v4l-ctl does not work because there is incomplete API, you need to add callback function.
You need to see the v4l-subdev0 in the /dev (if it is single subdevice there), it is camera sensor registered as sub-device.
Then it works:
v4l2-ctl --device=/dev/v4l-subdev0 --get-ctrl=exposure
v4l2-ctl -d /dev/v4l-subdev0 --set-ctrl exposure=512
v4l2-ctl --device=/dev/v4l-subdev0 --get-ctrl=analogue_gain
v4l2-ctl --device=/dev/v4l-subdev0 -L
Below you can see the patch file for this solution