Hi Hans, On Mon, Feb 17, 2014 at 10:57:37AM +0100, Hans Verkuil wrote: ... > @@ -501,6 +511,32 @@ for (queryctrl.id = V4L2_CID_PRIVATE_BASE;; > </example> > > <example> > + <title>Enumerating all user controls (alternative)</title> > + <programlisting> > +memset(&queryctrl, 0, sizeof(queryctrl)); > + > +queryctrl.id = V4L2_CTRL_CLASS_USER | V4L2_CTRL_FLAG_NEXT_CTRL; > +while (0 == ioctl(fd, &VIDIOC-QUERYCTRL;, &queryctrl)) { > + if (V4L2_CTRL_ID2CLASS(queryctrl.id) != V4L2_CTRL_CLASS_USER) > + break; > + if (queryctrl.flags & V4L2_CTRL_FLAG_DISABLED) > + continue; > + > + printf("Control %s\n", queryctrl.name); > + > + if (queryctrl.type == V4L2_CTRL_TYPE_MENU) > + enumerate_menu(); > + > + queryctrl.id |= V4L2_CTRL_FLAG_NEXT_CTRL; > +} > +if (errno != EINVAL) { > + perror("VIDIOC_QUERYCTRL"); > + exit(EXIT_FAILURE); > +} This is wrong; errno is guaranteed to be valid only if there's been an error. -- Kind regards, Sakari Ailus e-mail: sakari.ailus@xxxxxx XMPP: sailus@xxxxxxxxxxxxxx -- To unsubscribe from this list: send the line "unsubscribe linux-media" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html