From: Hans Verkuil <hansverk@cisco.com>
To: Prabhakar Lad <prabhakar.lad@ti.com>
Cc: Laurent Pinchart <laurent.pinchart@ideasonboard.com>,
LMML <linux-media@vger.kernel.org>,
dlos <davinci-linux-open-source@linux.davincidsp.com>,
linux-kernel@vger.kernel.org,
Manjunath Hadli <manjunath.hadli@ti.com>,
linux-doc@vger.kernel.org, Hans Verkuil <hans.verkuil@cisco.com>,
"Sakari Ailus" <sakari.ailus@iki.fi>,
Sylwester Nawrocki <s.nawrocki@samsung.com>,
Mauro Carvalho Chehab <mchehab@infradead.org>,
Hans de Goede <hdegoede@redhat.com>,
Kyungmin Park <kyungmin.park@samsung.com>,
"Guennadi Liakhovetski" <g.liakhovetski@gmx.de>,
Rob Landley <rob@landley.net>
Subject: Re: [PATCH v3] media: v4l2-ctrl: add a helper function to modify the menu
Date: Thu, 13 Sep 2012 13:53:34 +0200 [thread overview]
Message-ID: <201209131353.34497.hansverk@cisco.com> (raw)
In-Reply-To: <5051C6E8.8030109@ti.com>
On Thu 13 September 2012 13:43:36 Prabhakar Lad wrote:
> Hi Laurent,
>
> Thanks for the review.
>
> On Thursday 13 September 2012 06:45 AM, Laurent Pinchart wrote:
> > Hi Prabhakar,
> >
> > Thanks for the patch.
> >
> > On Tuesday 11 September 2012 19:53:38 Prabhakar Lad wrote:
> >> From: Lad, Prabhakar <prabhakar.lad@ti.com>
> >>
> >> Add a helper function to modify the menu, max and default value
> >> to set.
> >>
> >> Signed-off-by: Lad, Prabhakar <prabhakar.lad@ti.com>
> >> Signed-off-by: Manjunath Hadli <manjunath.hadli@ti.com>
> >> Cc: Hans Verkuil <hans.verkuil@cisco.com>
> >> Cc: Sakari Ailus <sakari.ailus@iki.fi>
> >> Cc: Sylwester Nawrocki <s.nawrocki@samsung.com>
> >> Cc: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
> >> Cc: Mauro Carvalho Chehab <mchehab@infradead.org>
> >> Cc: Hans de Goede <hdegoede@redhat.com>
> >> Cc: Kyungmin Park <kyungmin.park@samsung.com>
> >> Cc: Guennadi Liakhovetski <g.liakhovetski@gmx.de>
> >> Cc: Rob Landley <rob@landley.net>
> >> ---
> >> Changes for v3:
> >> 1: Fixed style/grammer issues as pointed by Hans.
> >> Thanks Hans for providing the description.
> >>
> >> Changes for v2:
> >> 1: Fixed review comments from Hans, to have return type as
> >> void, add WARN_ON() for fail conditions, allow this fucntion
> >> to modify the menu of custom controls.
> >>
> >> Documentation/video4linux/v4l2-controls.txt | 29 ++++++++++++++++++++++++
> >> drivers/media/v4l2-core/v4l2-ctrls.c | 17 +++++++++++++++
> >> include/media/v4l2-ctrls.h | 11 ++++++++++
> >> 3 files changed, 57 insertions(+), 0 deletions(-)
> >>
> >> diff --git a/Documentation/video4linux/v4l2-controls.txt
> >> b/Documentation/video4linux/v4l2-controls.txt index 43da22b..01d0a82 100644
> >> --- a/Documentation/video4linux/v4l2-controls.txt
> >> +++ b/Documentation/video4linux/v4l2-controls.txt
> >> @@ -367,6 +367,35 @@ it to 0 means that all menu items are supported.
> >> You set this mask either through the v4l2_ctrl_config struct for a custom
> >> control, or by calling v4l2_ctrl_new_std_menu().
> >>
> >> +There are situations where menu items may be device specific. In such cases
> >> the
> >> +framework provides a helper function to change the menu:
> >> +
> >> +void v4l2_ctrl_modify_menu(struct v4l2_ctrl *ctrl, const char * const
> >> *qmenu,
> >> + s32 max, u32 menu_skip_mask, s32 def);
> >
> > Sorry if this is a stupid question, but wouldn't it be better to add a
> > function to create a custom menu instead of modifying it afterwards ?
> >
> Create a custom menu? eventually everything boils down to modifying the
> menu itself.
Laurent, the reason we went for modifying a standard control is that that
ensures that the control name and type is all standardized. The only thing
that can be changed later is the menu contents.
Regards,
Hans
>
> Regards,
> --Prabhakar Lad
>
> >> +
> >> +A good example is the test pattern control for capture/display/sensors
> >> devices
> >> +that have the capability to generate test patterns. These test patterns are
> >> +hardware specific, so the contents of the menu will vary from device to
> >> device.
> >> +
> >> +This helper function is used to modify the menu, max, mask and the default
> >> +value of the control.
> >> +
> >> +Example:
> >> +
> >> + static const char * const test_pattern[] = {
> >> + "Disabled",
> >> + "Vertical Bars",
> >> + "Solid Black",
> >> + "Solid White",
> >> + NULL,
> >> + };
> >> + struct v4l2_ctrl *test_pattern_ctrl =
> >> + v4l2_ctrl_new_std_menu(&foo->ctrl_handler, &foo_ctrl_ops,
> >> + V4L2_CID_TEST_PATTERN, V4L2_TEST_PATTERN_DISABLED, 0,
> >> + V4L2_TEST_PATTERN_DISABLED);
> >> +
> >> + v4l2_ctrl_modify_menu(test_pattern_ctrl, test_pattern, 3, 0,
> >> + V4L2_TEST_PATTERN_DISABLED);
> >>
> >> Custom Controls
> >> ===============
> >
>
>
prev parent reply other threads:[~2012-09-13 12:03 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-09-11 14:23 [PATCH v3] media: v4l2-ctrl: add a helper function to modify the menu Prabhakar Lad
2012-09-11 14:31 ` Hans Verkuil
2012-09-13 1:15 ` Laurent Pinchart
2012-09-13 11:43 ` Prabhakar Lad
2012-09-13 11:53 ` Hans Verkuil [this message]
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=201209131353.34497.hansverk@cisco.com \
--to=hansverk@cisco.com \
--cc=davinci-linux-open-source@linux.davincidsp.com \
--cc=g.liakhovetski@gmx.de \
--cc=hans.verkuil@cisco.com \
--cc=hdegoede@redhat.com \
--cc=kyungmin.park@samsung.com \
--cc=laurent.pinchart@ideasonboard.com \
--cc=linux-doc@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-media@vger.kernel.org \
--cc=manjunath.hadli@ti.com \
--cc=mchehab@infradead.org \
--cc=prabhakar.lad@ti.com \
--cc=rob@landley.net \
--cc=s.nawrocki@samsung.com \
--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).