From patchwork Thu Oct 29 10:10:30 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ricardo Ribalda Delgado X-Patchwork-Id: 7518001 Return-Path: X-Original-To: patchwork-linux-media@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork1.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork1.web.kernel.org (Postfix) with ESMTP id 6DA2C9F37F for ; Thu, 29 Oct 2015 10:11:51 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id A9947209DC for ; Thu, 29 Oct 2015 10:11:50 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 950AD2068D for ; Thu, 29 Oct 2015 10:11:49 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1756857AbbJ2KLe (ORCPT ); Thu, 29 Oct 2015 06:11:34 -0400 Received: from mail-lf0-f43.google.com ([209.85.215.43]:33883 "EHLO mail-lf0-f43.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1756342AbbJ2KKn (ORCPT ); Thu, 29 Oct 2015 06:10:43 -0400 Received: by lfaz124 with SMTP id z124so16304552lfa.1; Thu, 29 Oct 2015 03:10:41 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=b0mKAxqNj2yF9XvE+HWYUMEaAKIHtXa0qlmr/1sXP5o=; b=YeI0w5ni5MsCEpgGnhjiynPB4loRVTBEh3iSEwUTeGHkmjtj05pYK5CyYB9Bfm7qp9 hTcPi1wrHgtRUEMsy9ggjkD0710JoUaRW2977KxwQfzwqMZT0AamTjb5K7pTt3J4+MwS zkLepiRGYB+ZSkvGny8vVFLAjFNpLdozxA4VuU6SUaYqjo8ryxGXzUXVitpQPiERo2BT ko25CC2JK/X90Wv7YQ5afSPURtHtSmCeg/kUUmTy9Sa4JcgpMNljM84sNjphej2jFT+L L0f/UpbBzd7mkKumeDQWaq0FZo6aMyFgP6rQJ17nSvb9DzukuAJBdojZxHGotkrVy5ay gaPw== X-Received: by 10.25.40.65 with SMTP id o62mr311369lfo.115.1446113441678; Thu, 29 Oct 2015 03:10:41 -0700 (PDT) Received: from neopili.qtec.com (cpe.xe-3-0-1-778.vbrnqe10.dk.customer.tdc.net. [80.197.57.18]) by smtp.gmail.com with ESMTPSA id r77sm164022lfr.30.2015.10.29.03.10.40 (version=TLSv1.2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Thu, 29 Oct 2015 03:10:40 -0700 (PDT) From: Ricardo Ribalda Delgado To: Mauro Carvalho Chehab , Mike Isely , Laurent Pinchart , Hans Verkuil , Steven Toth , Sakari Ailus , Vincent Palatin , linux-media@vger.kernel.org, linux-kernel@vger.kernel.org Cc: Ricardo Ribalda Delgado Subject: [PATCH v2 4/6] usb/uvc: Support for V4L2_CTRL_WHICH_DEF_VAL Date: Thu, 29 Oct 2015 11:10:30 +0100 Message-Id: <1446113432-27390-5-git-send-email-ricardo.ribalda@gmail.com> X-Mailer: git-send-email 2.6.1 In-Reply-To: <1446113432-27390-1-git-send-email-ricardo.ribalda@gmail.com> References: <1446113432-27390-1-git-send-email-ricardo.ribalda@gmail.com> Sender: linux-media-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-media@vger.kernel.org X-Spam-Status: No, score=-6.8 required=5.0 tests=BAYES_00, DKIM_ADSP_CUSTOM_MED, DKIM_SIGNED, FREEMAIL_FROM, RCVD_IN_DNSWL_HI, RP_MATCHES_RCVD, T_DKIM_INVALID, UNPARSEABLE_RELAY autolearn=unavailable version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP This driver does not use the control infrastructure. Add support for the new field which on structure v4l2_ext_controls Signed-off-by: Ricardo Ribalda Delgado Acked-by: Laurent Pinchart --- drivers/media/usb/uvc/uvc_v4l2.c | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/drivers/media/usb/uvc/uvc_v4l2.c b/drivers/media/usb/uvc/uvc_v4l2.c index 2764f43607c1..d7723ce772b3 100644 --- a/drivers/media/usb/uvc/uvc_v4l2.c +++ b/drivers/media/usb/uvc/uvc_v4l2.c @@ -983,6 +983,22 @@ static int uvc_ioctl_g_ext_ctrls(struct file *file, void *fh, unsigned int i; int ret; + if (ctrls->which == V4L2_CTRL_WHICH_DEF_VAL) { + for (i = 0; i < ctrls->count; ++ctrl, ++i) { + struct v4l2_queryctrl qc = { .id = ctrl->id }; + + ret = uvc_query_v4l2_ctrl(chain, &qc); + if (ret < 0) { + ctrls->error_idx = i; + return ret; + } + + ctrl->value = qc.default_value; + } + + return 0; + } + ret = uvc_ctrl_begin(chain); if (ret < 0) return ret; @@ -1010,6 +1026,10 @@ static int uvc_ioctl_s_try_ext_ctrls(struct uvc_fh *handle, unsigned int i; int ret; + /* Default value cannot be changed */ + if (ctrls->which == V4L2_CTRL_WHICH_DEF_VAL) + return -EINVAL; + ret = uvc_ctrl_begin(chain); if (ret < 0) return ret;