From: Hans Verkuil Date: Sat, 11 Sep 2010 14:38:51 +0000 (-0300) Subject: V4L/DVB: V4L Doc: correct the documentation for VIDIOC_QUERYMENU X-Git-Url: http://git.lede-project.org./?a=commitdiff_plain;h=6756207a71a0f976ab027186d0966a2162aaf922;p=openwrt%2Fstaging%2Fblogic.git V4L/DVB: V4L Doc: correct the documentation for VIDIOC_QUERYMENU The VIDIOC_QUERYMENU documentation was not correct. EINVAL can be returned if the driver does not support some of the menu items. I.e. in a list of MPEG bitrates a driver generally supports only a subset of these. This behavior has been in place for years, but was never properly documented. Signed-off-by: Hans Verkuil Signed-off-by: Mauro Carvalho Chehab --- diff --git a/Documentation/DocBook/v4l/controls.xml b/Documentation/DocBook/v4l/controls.xml index 68c83449d7c9..2fae3e87ce73 100644 --- a/Documentation/DocBook/v4l/controls.xml +++ b/Documentation/DocBook/v4l/controls.xml @@ -364,9 +364,6 @@ enumerate_menu (void) querymenu.index++) { if (0 == ioctl (fd, &VIDIOC-QUERYMENU;, &querymenu)) { printf (" %s\n", querymenu.name); - } else { - perror ("VIDIOC_QUERYMENU"); - exit (EXIT_FAILURE); } } } diff --git a/Documentation/DocBook/v4l/vidioc-queryctrl.xml b/Documentation/DocBook/v4l/vidioc-queryctrl.xml index 8e0e055ac934..0d5e8283cf32 100644 --- a/Documentation/DocBook/v4l/vidioc-queryctrl.xml +++ b/Documentation/DocBook/v4l/vidioc-queryctrl.xml @@ -103,8 +103,12 @@ structure. The driver fills the rest of the structure or returns an index is invalid. Menu items are enumerated by calling VIDIOC_QUERYMENU with successive index values from &v4l2-queryctrl; -minimum (0) to -maximum, inclusive. +minimum to +maximum, inclusive. Note that it is possible +for VIDIOC_QUERYMENU to return an &EINVAL; for some +indices between minimum and maximum. +In that case that particular menu item is not supported by this driver. Also note that +the minimum value is not necessarily 0. See also the examples in . @@ -139,7 +143,7 @@ string. This information is intended for the user. minimum Minimum value, inclusive. This field gives a lower bound for V4L2_CTRL_TYPE_INTEGER controls and the -lowest valid index (always 0) for V4L2_CTRL_TYPE_MENU controls. +lowest valid index for V4L2_CTRL_TYPE_MENU controls. For V4L2_CTRL_TYPE_STRING controls the minimum value gives the minimum length of the string. This length does not include the terminating zero. It may not be valid for any other type of control, including @@ -279,7 +283,7 @@ values which are actually different on the hardware. V4L2_CTRL_TYPE_MENU - 0 + ≥ 0 1 N-1 The control has a menu of N choices. The names of @@ -405,8 +409,10 @@ writing a value will cause the device to carry out a given action EINVAL The &v4l2-queryctrl; id -is invalid. The &v4l2-querymenu; id or -index is invalid. +is invalid. The &v4l2-querymenu; id is +invalid or index is out of range (less than +minimum or greater than maximum) +or this particular menu item is not supported by the driver.