From patchwork Sun Mar 27 07:11:48 2011 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Jean-Francois Moine X-Patchwork-Id: 6222 Return-path: Envelope-to: mchehab@pedra Delivery-date: Sun, 27 Mar 2011 09:02:49 -0300 Received: from mchehab by pedra with local (Exim 4.72) (envelope-from ) id 1Q3ogD-0008Go-CO for mchehab@pedra; Sun, 27 Mar 2011 09:02:49 -0300 Received: from casper.infradead.org [85.118.1.10] by pedra with IMAP (fetchmail-6.3.17) for (single-drop); Sun, 27 Mar 2011 09:02:49 -0300 (BRT) Received: from vger.kernel.org ([209.132.180.67]) by casper.infradead.org with esmtp (Exim 4.72 #1 (Red Hat Linux)) id 1Q3k8A-0001kw-DN; Sun, 27 Mar 2011 07:11:22 +0000 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751730Ab1C0HLT (ORCPT + 1 other); Sun, 27 Mar 2011 03:11:19 -0400 Received: from smtp5-g21.free.fr ([212.27.42.5]:34716 "EHLO smtp5-g21.free.fr" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751653Ab1C0HLT convert rfc822-to-8bit (ORCPT ); Sun, 27 Mar 2011 03:11:19 -0400 Received: from tele (unknown [82.245.201.222]) by smtp5-g21.free.fr (Postfix) with ESMTP id E03F6D4801F for ; Sun, 27 Mar 2011 09:11:12 +0200 (CEST) Date: Sun, 27 Mar 2011 09:11:48 +0200 From: Jean-Francois Moine To: linux-media@vger.kernel.org Subject: [PATCH] pwc: Handle V4L2_CTRL_FLAG_NEXT_CTRL in queryctrl Message-ID: <20110327091148.63f5309a@tele> X-Mailer: Claws Mail 3.7.8 (GTK+ 2.24.3; x86_64-pc-linux-gnu) Mime-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-media@vger.kernel.org Sender: Signed-off-by: Jean-François Moine --- drivers/media/video/pwc/pwc-v4l.c | 23 +++++++++++++++++++++-- 1 files changed, 21 insertions(+), 2 deletions(-) diff --git a/drivers/media/video/pwc/pwc-v4l.c b/drivers/media/video/pwc/pwc-v4l.c index aa87e46..f85c512 100644 --- a/drivers/media/video/pwc/pwc-v4l.c +++ b/drivers/media/video/pwc/pwc-v4l.c @@ -379,8 +379,27 @@ static int pwc_s_input(struct file *file, void *fh, unsigned int i) static int pwc_queryctrl(struct file *file, void *fh, struct v4l2_queryctrl *c) { - int i; - + int i, idx; + u32 id; + + id = c->id; + if (id & V4L2_CTRL_FLAG_NEXT_CTRL) { + id &= V4L2_CTRL_ID_MASK; + id++; + idx = -1; + for (i = 0; i < ARRAY_SIZE(pwc_controls); i++) { + if (pwc_controls[i].id < id) + continue; + if (idx >= 0 + && pwc_controls[i].id > pwc_controls[idx].id) + continue; + idx = i; + } + if (idx < 0) + return -EINVAL; + memcpy(c, &pwc_controls[idx], sizeof pwc_controls[0]); + return 0; + } for (i = 0; i < sizeof(pwc_controls) / sizeof(struct v4l2_queryctrl); i++) { if (pwc_controls[i].id == c->id) { PWC_DEBUG_IOCTL("ioctl(VIDIOC_QUERYCTRL) found\n");