V4l2 can't work with V4L_MEMORY_USERPTR in l4t-32.4.4

my custom camera work well with V4L2_MEMORY_MMAP option.
it was checked like this:

$ v4l2-ctl --set-fmt-video=width=1280,height=720,pixelformat=UYVY --stream-mmap --stream-count=1 -d /dev/video0 --verbose

i want to set option V4L_MEMORY_USERPTR, i had try with --stream-user, but it was fail like this

$ v4l2-ctl --set-fmt-video=width=1280,height=720,pixelformat=UYVY --stream-user --stream-count=1 -d /dev/video0 --verbose
Format Video Capture:
	Width/Height      : 1280/720
	Pixel Format      : 'UYVY'
	Field             : None
	Bytes per Line    : 2560
	Size Image        : 1843200
	Colorspace        : sRGB
	Transfer Function : Default (maps to sRGB)
	YCbCr/HSV Encoding: Default (maps to ITU-R 601)
	Quantization      : Default (maps to Limited Range)
	Flags             : 
VIDIOC_QBUF: failed: Invalid argument

i found older thread, and updated v4l2-ctl to newest, tried again, but I got same result.

are there any check points using v4l2-ctl with V4L_MEMORY_USERPTR option?

Does it CSI YUV camera?

yes. and connection has MAXIM ser/des. driver made by following Xavier camera driver guide.
i changed full result text of v4l2-ctl

Have a try this binary. mv v4l2-ctl-t186.txt v4l2-ctl-t186
sudo chmod +x v4l2-ctl-186

v4l2-ctl-t186.txt (311.7 KB)

it’s work!

Q1 how can i build this binary by myself?

Q2 actually, i was trying ioctl in c++ code:

auto buf = v4l2_buffer{};
buf.memory = V4L2_MEMORY_USERPTR;
buf.index = buffer.index;
buf.m.userptr = (unsigned long)buffer.start;
buf.length = (unsigned int)buffer.length;
if (-1 == ioctl(fd_, VIDIOC_QBUF, &buf)) {
	"Buffer failure on capture start: %s (%s)", strerror(errno),
	return false;

it was failed, i was trying check with v4l2-ctl util.
but, i think there are some different way to use V4L2_MEMORY_USERPTR.
i checked Multimedia example source code, i can’t found example using V4L2_MEMORY_USERPTR.
where can i get some example for using V4L2_MEMORY_USERPTR option?

Have a check the …/jetson_multimedia_api/samples/v4l2cuda/capture.cpp

thank you ShaneCCC
I will check the example.
and i tried use v4l2-ctl newest version repo from here: GitHub - gjasny/v4l-utils
but it did not works.
where did you get src code of your v4l2-ctl-t186 binary ?

It’s internal source can’t public to you, sorry.