summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorhans@localhost.localdomain <hans@localhost.localdomain>2009-05-16 12:57:18 +0200
committerhans@localhost.localdomain <hans@localhost.localdomain>2009-05-16 12:57:18 +0200
commit89b93efcabe5cc48d405d26843b53d288286752b (patch)
treee5ad1c8ddc7d34b84e20ad6e6b8352ef2893a6fc
parent53d7375e8b366a0639000eb0377a93fc20ee563b (diff)
downloadmediapointer-dvb-s2-89b93efcabe5cc48d405d26843b53d288286752b.tar.gz
mediapointer-dvb-s2-89b93efcabe5cc48d405d26843b53d288286752b.tar.bz2
libv4l: Support V4L2_CTRL_FLAG_NEXT_CTRL for fake controls
From: Adam Baker <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 Priority: normal Signed-off-by: Adam Baker <linux@baker-net.org.uk> Signed-off-by: Hans de Goede <hdegoede@redhat.com>
-rw-r--r--v4l2-apps/libv4l/libv4lconvert/control/libv4lcontrol.c19
1 files changed, 18 insertions, 1 deletions
diff --git a/v4l2-apps/libv4l/libv4lconvert/control/libv4lcontrol.c b/v4l2-apps/libv4l/libv4lconvert/control/libv4lcontrol.c
index 93c08c0c2..63de07bf1 100644
--- a/v4l2-apps/libv4l/libv4lconvert/control/libv4lcontrol.c
+++ b/v4l2-apps/libv4l/libv4lconvert/control/libv4lcontrol.c
@@ -292,7 +292,10 @@ int v4lcontrol_vidioc_queryctrl(struct v4lcontrol_data *data, void *arg)
{
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) {
@@ -300,7 +303,21 @@ int v4lcontrol_vidioc_queryctrl(struct v4lcontrol_data *data, void *arg)
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)