I try to write the program (without using gStreamer), which would create images from the video camera with the required characteristics. Also I faced an unclear problem...
Here piece of the source text of a plug-in of imxv4l2src (v4l2src.c file of a line 167-182)
fd_v4l = open(v4l2src->devicename, O_RDWR, 0); if (fd_v4l < 0) {
GST_ERROR_OBJECT(v4l2src, "Unable to open %s", v4l2src->devicename);
return -1;
}
if (ioctl (fd_v4l, VIDIOC_QUERYCAP, &cap) < 0) {
GST_ERROR_OBJECT(v4l2src, "VIDIOC_QUERYCAP failed: %s", ыtrerror(errno));
goto fail;
}
if (!(cap.capabilities & V4L2_CAP_VIDEO_CAPTURE)) {
GST_ERROR_OBJECT(v4l2src, "%s is no video capture device", v4l2src->devicename);
goto fail;
}
The sense of these lines is absolutely obvious - we open the device and we check that it is capable to video capture. If isn't present - we leave.
I began development of the program with testing of capabilities of the device (The same!). Here piece of my text:
fd = open("/dev/video0", O_RDWR);
if (fd < 0) {
syslog(LOG_ERR,"Open file '%s' error: %m", "/dev/video0");
exit(EXIT_FAILURE);
}
if (ioctl (fd, VIDIOC_QUERYCAP, &cap) < 0) {
printf("VIDIOC_QUERYCAP failed: %s", strerror(errno));
exit(EXIT_FAILURE);
}
print_cap(&cap);
The print_cap() function prints capabilities of the device. And here what it prints:
# ./test
------------------------------------------------
struct v4l2_capability cap;
------------------------------------------------
cap->driver : 'mxc_v4l2'
cap->card : ''
cap->bus_info : ''
cap->version : 267
cap->device_caps: 00000000
I don't understand why the field cap.device_caps empty?!
Why the plug-in of gStreamer sees a possibility of capture, and my test doesn't?
It doesn't depend on whether it is launched at this moment of gStreamer.
I assume that additional initialization of the driver somewhere becomes.
You couldn't clear a situation?
Hello,
Please try to perform tests, described in section 9.6 (Unit Test)
of i.MX_Linux_Reference_Manual.pdf.
Test codes sources can be found at
www.nxp.com/lgfiles/NMG/MAD/YOCTO/imx-test-5.4.tar.gz
What Linux BSP is applied in the case ? Is Device Tree configuration (if used) correct regarding cam driver(s)?
Have a great day,
Yuri
-----------------------------------------------------------------------------------------------------------------------
Note: If this post answers your question, please click the Correct Answer button. Thank you!
-----------------------------------------------------------------------------------------------------------------------
Please try to perform tests, described in section 9.6 (Unit Test)
Test ID: FSL-UT-V4L2-capture-0010
# mxc_v4l2_capture.out -w 352 -h 288 -r 0 -c 50 -fr 30
test.yuv
in_width = 176, in_height = 144
out_width = 176, out_height = 144
top = 0, left = 0
sensor chip is ov5640_mipi_camera
sensor supported frame size:
640x480
320x240
720x480
720x576
1280x720
1920x1080
2592x1944
176x144
1024x768
sensor frame format: UYVY
sensor frame format: UYVY
sensor frame format: UYVY
sensor frame format: UYVY
sensor frame format: UYVY
sensor frame format: UYVY
sensor frame format: UYVY
sensor frame format: UYVY
sensor frame format: UYVY
set dest crop failed
get format failed
Size of file test.yuv is zero.
Test ID: FSL-UT-V4L2-capture-0020
# mxc_v4l2_still.out -w 640 -h 480 -f YUV422P
Width = 640
ot@var Height = 480mnt/unit_tests/mxc_v4l2_capture.out -w 640 -h 480
-f YUV422
Image size = 614400
Pixel format = 422P
ERROR: v4l2 capture: mxc_v4l_read timeout counter 0
imx-ipuv3 2400000.ipu: Not a CSI channel
v4l2 read error.
Test codes sources can be found at
I didn't build these tests as in source texts of programs isn't present the linux/mxcfb.h and linux/mxc_v4l2.h files.
What Linux BSP is applied in the case ? Is Device Tree configuration (if used) correct regarding cam driver(s)?
VAR-MX6 Custom Board Rev 1.3
VAR-SOM-SOLO VSM-SOLO-001-3
# uname -a
Linux var-som-mx6 3.14.38-6QP+g8740b9f #1 SMP PREEMPT Mon Mar 21
17:42:40 NOVT 2016 armv7l GNU/Linux
I assume that the problem consists in use of the mxc_v4l2.h file. In my program I use the v4l2.h file.