From patchwork Thu Jul 16 08:56:43 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: 6805151 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 B81649F380 for ; Thu, 16 Jul 2015 08:56:57 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id E3001206D4 for ; Thu, 16 Jul 2015 08:56:56 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 0407C20641 for ; Thu, 16 Jul 2015 08:56:56 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754267AbbGPI4w (ORCPT ); Thu, 16 Jul 2015 04:56:52 -0400 Received: from mail-la0-f51.google.com ([209.85.215.51]:36206 "EHLO mail-la0-f51.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754919AbbGPI4s (ORCPT ); Thu, 16 Jul 2015 04:56:48 -0400 Received: by lagw2 with SMTP id w2so39446729lag.3 for ; Thu, 16 Jul 2015 01:56:47 -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; bh=96fZCgzGJ60fcG+VHmfi53XI+wEImFI48JtH1Ci7mOU=; b=OF5FvpIvKohPL9JAlwlR2Q37H1/wuy3DTb9pnXmoNB6BRAZMnkuySmJa7x7+iwjFwL O/JmaAE70rmiWt9bsbGKUkpA5tukUujgAJdAeZzy3QmI26eXcmIrqm1l6MRaIivtLkR9 CZJQUPOxvN4h0A+OZc9hnzfgkszt0+Av+GlmZWJq1DU2brTbaRiaO2ehacujb5aCgeyy p4k+DskLNXank3gf08V14EiRYizHBCLtGGZbAgiSTxNRvLngWZWLiNA9/5Bf/Q3elbzM 6KrBM1+peYTcgc7YM3KwiABd8S/dw32ng/ua++35NugwBECr9mSxxqsvZvkVHF+YTW+j 8SXg== X-Received: by 10.112.78.105 with SMTP id a9mr8347231lbx.70.1437037006949; Thu, 16 Jul 2015 01:56:46 -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 ay10sm1852712lbc.29.2015.07.16.01.56.45 (version=TLSv1.2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Thu, 16 Jul 2015 01:56:45 -0700 (PDT) From: Ricardo Ribalda Delgado To: Hans Verkuil , Sakari Ailus , Laurent Pinchart , Mauro Carvalho Chehab , Guennadi Liakhovetski , linux-media@vger.kernel.org Cc: Ricardo Ribalda Delgado Subject: [RFC v4 04/19] media/usb/uvc: Implement vivioc_g_def_ext_ctrls Date: Thu, 16 Jul 2015 10:56:43 +0200 Message-Id: <1437037003-6113-1-git-send-email-ricardo.ribalda@gmail.com> X-Mailer: git-send-email 2.1.4 Sender: linux-media-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-media@vger.kernel.org X-Spam-Status: No, score=-8.1 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 Callback needed by ioctl VIDIOC_G_DEF_EXT_CTRLS as this driver does not use the controller framework. Signed-off-by: Ricardo Ribalda Delgado Acked-by: Laurent Pinchart --- Changelog v4: Comments by Laurent Pinchart Remove unneeded uvc_ctrl_begin() drivers/media/usb/uvc/uvc_v4l2.c | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+) diff --git a/drivers/media/usb/uvc/uvc_v4l2.c b/drivers/media/usb/uvc/uvc_v4l2.c index 2764f43607c1..7ec7d45b24ed 100644 --- a/drivers/media/usb/uvc/uvc_v4l2.c +++ b/drivers/media/usb/uvc/uvc_v4l2.c @@ -1001,6 +1001,31 @@ static int uvc_ioctl_g_ext_ctrls(struct file *file, void *fh, return uvc_ctrl_rollback(handle); } +static int uvc_ioctl_g_def_ext_ctrls(struct file *file, void *fh, + struct v4l2_ext_controls *ctrls) +{ + struct uvc_fh *handle = fh; + struct uvc_video_chain *chain = handle->chain; + struct v4l2_ext_control *ctrl = ctrls->controls; + unsigned int i; + int ret; + struct v4l2_queryctrl qc; + + for (i = 0; i < ctrls->count; ++ctrl, ++i) { + 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; + } + + ctrls->error_idx = 0; + + return 0; +} + static int uvc_ioctl_s_try_ext_ctrls(struct uvc_fh *handle, struct v4l2_ext_controls *ctrls, bool commit) @@ -1500,6 +1525,7 @@ const struct v4l2_ioctl_ops uvc_ioctl_ops = { .vidioc_g_ctrl = uvc_ioctl_g_ctrl, .vidioc_s_ctrl = uvc_ioctl_s_ctrl, .vidioc_g_ext_ctrls = uvc_ioctl_g_ext_ctrls, + .vidioc_g_def_ext_ctrls = uvc_ioctl_g_def_ext_ctrls, .vidioc_s_ext_ctrls = uvc_ioctl_s_ext_ctrls, .vidioc_try_ext_ctrls = uvc_ioctl_try_ext_ctrls, .vidioc_querymenu = uvc_ioctl_querymenu,