Hi Ronald,

I would do this.

struct v4l2_queryctrl c;

for (c.index = V4L2_CID_BASE; c.index < V4L2_CID_LASTP1; c.index++) {
  if (ioctl (fd, VIDIOC_QUERYCTRL, &c) == 0) {
    if (c.flags & V4L2_CTRL_FLAG_DISABLED)
      continue;
    printf ("Control %s supported\n", c.name);
  } else if (errno != EINVAL) {
    perror ("VIDIOC_QUERYCTRL");
    exit (EXIT_FAILURE);
  }
}

for (c.index = V4L2_CID_PRIVATE_BASE;; c.index++) {
  if (ioctl (fd, VIDIOC_QUERYCTRL, &c) == 0) {
    if (c.flags & V4L2_CTRL_FLAG_DISABLED)
      continue;
    printf ("Control %s supported\n", c.name);
  } else {
    if (errno == EINVAL) 
      break;
    perror ("VIDIOC_QUERYCTRL");
    exit (EXIT_FAILURE);
  }
}

The idea of V4L2_CTRL_FLAG_DISABLED in the old api was exactly that
drivers will not support all predefined controls and may disable some
only after probing the hardware. IMO returning EINVAL would suffice. The
other flag V4L2_CTRL_FLAG_GRABBED is the equivalent of EBUSY when
attempting to change the control, i.e. a GUI can render the control in a
disabled state. It's never been used AFAIK.

Michael



--
video4linux-list mailing list
Unsubscribe mailto:video4linux-list-request@;redhat.com?subject=unsubscribe
https://listman.redhat.com/mailman/listinfo/video4linux-list

Reply via email to