AnsweredAssumed Answered

The v4l2 driver returns an incorrect field device_caps

Question asked by Sergey Larionov on May 29, 2017
Latest reply on May 31, 2017 by Sergey Larionov

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?

Outcomes