From: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
To: Sakari Ailus <sakari.ailus@iki.fi>
Cc: linux-media@vger.kernel.org
Subject: Re: [yavta PATCH 1/3] Support integer menus.
Date: Fri, 13 Apr 2012 21:47:14 +0200 [thread overview]
Message-ID: <2967674.Tm7K8VO7YX@avalon> (raw)
In-Reply-To: <1334220095-1698-1-git-send-email-sakari.ailus@iki.fi>
Hi Sakari,
Thanks for the patch.
The code looks fine, but unfortunately breaks compilation when using kernel
headers < v3.5 (which is a pretty common case as of today ;-)).
V4L2_CTRL_TYPE_INTEGER_MENU is an enumerated value, not a pre-processor
#define, so it's difficult to test for it using conditional compilation.
Maybe including a copy of videodev2.h in the yavta repository is the best
option ?
On Thursday 12 April 2012 11:41:33 Sakari Ailus wrote:
> Signed-off-by: Sakari Ailus <sakari.ailus@iki.fi>
> ---
> yavta.c | 18 +++++++++++-------
> 1 files changed, 11 insertions(+), 7 deletions(-)
>
> diff --git a/yavta.c b/yavta.c
> index 72679c2..8db6e1e 100644
> --- a/yavta.c
> +++ b/yavta.c
> @@ -564,19 +564,22 @@ static int video_enable(struct device *dev, int
> enable) return 0;
> }
>
> -static void video_query_menu(struct device *dev, unsigned int id,
> - unsigned int min, unsigned int max)
> +static void video_query_menu(struct device *dev, struct v4l2_queryctrl
> *query) {
> struct v4l2_querymenu menu;
> int ret;
>
> - for (menu.index = min; menu.index <= max; menu.index++) {
> - menu.id = id;
> + for (menu.index = query->minimum; menu.index <= query->maximum;
> + menu.index++) {
> + menu.id = query->id;
> ret = ioctl(dev->fd, VIDIOC_QUERYMENU, &menu);
> if (ret < 0)
> continue;
>
> - printf(" %u: %.32s\n", menu.index, menu.name);
> + if (query->type == V4L2_CTRL_TYPE_MENU)
> + printf(" %u: %.32s\n", menu.index, menu.name);
> + else
> + printf(" %u: %lld\n", menu.index, menu.value);
> };
> }
>
> @@ -621,8 +624,9 @@ static void video_list_controls(struct device *dev)
> query.id, query.name, query.minimum, query.maximum,
> query.step, query.default_value, value);
>
> - if (query.type == V4L2_CTRL_TYPE_MENU)
> - video_query_menu(dev, query.id, query.minimum, query.maximum);
> + if (query.type == V4L2_CTRL_TYPE_MENU ||
> + query.type == V4L2_CTRL_TYPE_INTEGER_MENU)
> + video_query_menu(dev, &query);
>
> nctrls++;
> }
--
Regards,
Laurent Pinchart
next prev parent reply other threads:[~2012-04-13 19:47 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-04-12 8:41 [yavta PATCH 1/3] Support integer menus Sakari Ailus
2012-04-12 8:41 ` [yavta PATCH 2/3] Support extended controls, including 64-bit integers Sakari Ailus
2012-04-12 8:41 ` [yavta PATCH 3/3] Support additional dpcm compressed bayer formats Sakari Ailus
2012-04-13 19:17 ` Laurent Pinchart
2012-04-13 20:14 ` Sakari Ailus
2012-04-13 19:47 ` Laurent Pinchart [this message]
2012-04-13 19:57 ` [yavta PATCH 1/3] Support integer menus Rémi Denis-Courmont
2012-04-13 20:13 ` Sakari Ailus
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=2967674.Tm7K8VO7YX@avalon \
--to=laurent.pinchart@ideasonboard.com \
--cc=linux-media@vger.kernel.org \
--cc=sakari.ailus@iki.fi \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).