From: Adam Baker <linux@baker-net.org.uk>
To: video4linux-list@redhat.com
Cc: Hans de Goede <hdegoede@redhat.com>,
SPCA50x Linux Device Driver Development
<spca50x-devs@lists.sourceforge.net>,
Linux Media Mailing List <linux-media@vger.kernel.org>
Subject: [PATCH][libv4l] Support V4L2_CTRL_FLAG_NEXT_CTRL for fake controls
Date: Sat, 18 Apr 2009 23:45:48 +0100 [thread overview]
Message-ID: <200904182345.48441.linux@baker-net.org.uk> (raw)
In-Reply-To: <200904182044.06879.linux@baker-net.org.uk>
The "fake" controls added by libv4l to provide whitebalance on some cameras do
not respect the V4L2_CTRL_FLAG_NEXT_CTRL and hence don't appear on control
programs that try to use that flag if there are any driver controls that do
support the flag. Add support for V4L2_CTRL_FLAG_NEXT_CTRL
Signed-off-by: Adam Baker <linux@baker-net.org.uk>
---
This isn't extensively tested but v4l2ucp (and my version does use the flag) now
lists both fake and original control for a camera with both and adds the fake controls
for a camera with none.
---
--- libv4l-0.5.97/libv4lconvert/control/libv4lcontrol.c 2009-04-14 09:17:02.000000000 +0100
+++ new/libv4lconvert/control/libv4lcontrol.c 2009-04-18 23:36:28.000000000 +0100
@@ -280,7 +280,10 @@
{
int i;
struct v4l2_queryctrl *ctrl = arg;
+ int retval;
+ __u32 orig_id=ctrl->id;
+ /* if we have an exact match return it */
for (i = 0; i < V4LCONTROL_COUNT; i++)
if ((data->controls & (1 << i)) &&
ctrl->id == fake_controls[i].id) {
@@ -288,7 +291,21 @@
return 0;
}
- return syscall(SYS_ioctl, data->fd, VIDIOC_QUERYCTRL, arg);
+ /* find out what the kernel driver would respond. */
+ retval = syscall(SYS_ioctl, data->fd, VIDIOC_QUERYCTRL, arg);
+
+ /* if any of our controls have an id > orig_id but less than
+ ctrl->id then return that control instead. */
+ if (orig_id & V4L2_CTRL_FLAG_NEXT_CTRL)
+ for (i = 0; i < V4LCONTROL_COUNT; i++)
+ if ((data->controls & (1 << i)) &&
+ (fake_controls[i].id > (orig_id & ~V4L2_CTRL_FLAG_NEXT_CTRL)) &&
+ (fake_controls[i].id <= ctrl->id)) {
+ memcpy(ctrl, &fake_controls[i], sizeof(struct v4l2_queryctrl));
+ retval = 0;
+ }
+
+ return retval;
}
int v4lcontrol_vidioc_g_ctrl(struct v4lcontrol_data *data, void *arg)
next prev parent reply other threads:[~2009-04-18 22:45 UTC|newest]
Thread overview: 23+ messages / expand[flat|nested] mbox.gz Atom feed top
2009-04-15 12:36 libv4l release: 0.5.97: the whitebalance release! Hans de Goede
2009-04-15 22:26 ` Adam Baker
2009-04-15 23:02 ` Hans de Goede
2009-04-16 20:46 ` Adam Baker
2009-04-17 8:54 ` Hans de Goede
2009-04-17 19:27 ` Erik Andrén
2009-04-18 11:29 ` Hans de Goede
2009-04-18 14:40 ` Erik Andrén
2009-04-19 7:45 ` Hans de Goede
2009-04-19 19:20 ` Erik Andrén
2009-04-19 19:49 ` Hans de Goede
2009-04-20 4:43 ` Erik Andrén
2009-04-20 7:43 ` Hans de Goede
2009-04-20 7:54 ` Erik Andrén
2009-04-18 19:44 ` Adam Baker
2009-04-18 22:45 ` Adam Baker [this message]
2009-05-17 13:49 ` [PATCH][libv4l] Support V4L2_CTRL_FLAG_NEXT_CTRL for fake controls Hans de Goede
2009-04-17 22:13 ` libv4l release: 0.5.97: the whitebalance release! Adam Baker
2009-04-18 11:27 ` Hans de Goede
2009-04-16 6:16 ` Gilles Gigan
2009-04-16 9:25 ` Hans de Goede
2009-04-16 9:38 ` Gilles Gigan
2009-04-17 19:31 ` Erik Andrén
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=200904182345.48441.linux@baker-net.org.uk \
--to=linux@baker-net.org.uk \
--cc=hdegoede@redhat.com \
--cc=linux-media@vger.kernel.org \
--cc=spca50x-devs@lists.sourceforge.net \
--cc=video4linux-list@redhat.com \
/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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.