From patchwork Wed Sep 16 09:30:51 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: 7193251 Return-Path: X-Original-To: patchwork-linux-media@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork2.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork2.web.kernel.org (Postfix) with ESMTP id 85B60BEEC1 for ; Wed, 16 Sep 2015 09:31:02 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id B245A205D6 for ; Wed, 16 Sep 2015 09:31:01 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id BE57220592 for ; Wed, 16 Sep 2015 09:31:00 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753684AbbIPJa5 (ORCPT ); Wed, 16 Sep 2015 05:30:57 -0400 Received: from mail-la0-f51.google.com ([209.85.215.51]:32835 "EHLO mail-la0-f51.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753029AbbIPJaz (ORCPT ); Wed, 16 Sep 2015 05:30:55 -0400 Received: by lamp12 with SMTP id p12so123574480lam.0 for ; Wed, 16 Sep 2015 02:30:53 -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=6ne4B39U8HwdHgkN3IIf0ISnugauo1rHFxTI42cWQW0=; b=ldJVM6VKL2IkOK4A8EUJNIfFzkdhzpGEM4r+pAeMaCwswZj1fINCa7byfWynHY6PLU IA6F76p5EOnnywgX0f0+MGZGirghAKkfIgKT7Tbyy1lvzxA3RnwsmUmSeYZWmpnUZBDh NOQ3+X0PatEcrj/gQ7nc9VHVaYkB2JmRseYAIz10v+odKEvEnA4u6c1fIVclfNs41hvU oNzXkiwVTVuiVFsoqF77rrc//Z/UtwweZ+ayKu/RQADKDMzYJuV6qQNbgHxil73EOvAm mp7PPOPk9EcjYpqVWTZbcxaiDsjWHBPG67dAa7ThsUjwP/P3FWebqczvvgTwedq6Q1KX Gbzg== X-Received: by 10.152.3.233 with SMTP id f9mr23898577laf.14.1442395853807; Wed, 16 Sep 2015 02:30:53 -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 j1sm3932722lbc.15.2015.09.16.02.30.52 (version=TLSv1.2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Wed, 16 Sep 2015 02:30:53 -0700 (PDT) From: Ricardo Ribalda Delgado To: hverkuil@xs4all.nl, linux-media@vger.kernel.org Cc: Ricardo Ribalda Delgado Subject: [PATCH] v4l2-compliance: Basic support for array controls Date: Wed, 16 Sep 2015 11:30:51 +0200 Message-Id: <1442395851-6789-1-git-send-email-ricardo.ribalda@gmail.com> X-Mailer: git-send-email 2.5.1 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, T_DKIM_INVALID, T_RP_MATCHES_RCVD, 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 Without this patch: Control ioctls: test VIDIOC_QUERY_EXT_CTRL/QUERYMENU: OK test VIDIOC_QUERYCTRL: OK fail: v4l2-test-controls.cpp(411): g_ctrl returned an error (22) test VIDIOC_G/S_CTRL: FAIL fail: v4l2-test-controls.cpp(637): g_ext_ctrls returned an error (28) test VIDIOC_G/S/TRY_EXT_CTRLS: FAIL test VIDIOC_(UN)SUBSCRIBE_EVENT/DQEVENT: OK test VIDIOC_G/S_JPEGCOMP: OK (Not Supported) Standard Controls: 55 Private Controls: 0 Signed-off-by: Ricardo Ribalda Delgado --- utils/v4l2-compliance/v4l2-test-controls.cpp | 20 ++++++++++++++++++-- 1 file changed, 18 insertions(+), 2 deletions(-) diff --git a/utils/v4l2-compliance/v4l2-test-controls.cpp b/utils/v4l2-compliance/v4l2-test-controls.cpp index 526905eef183..eba32a9f7855 100644 --- a/utils/v4l2-compliance/v4l2-test-controls.cpp +++ b/utils/v4l2-compliance/v4l2-test-controls.cpp @@ -377,6 +377,9 @@ int testSimpleControls(struct node *node) for (iter = node->controls.begin(); iter != node->controls.end(); ++iter) { test_query_ext_ctrl &qctrl = iter->second; + if (qctrl.elems > 1) + continue; + info("checking control '%s' (0x%08x)\n", qctrl.name, qctrl.id); ctrl.id = qctrl.id; if (qctrl.type == V4L2_CTRL_TYPE_INTEGER64 || @@ -518,6 +521,10 @@ static int checkExtendedCtrl(struct v4l2_ext_control &ctrl, struct test_query_ex if (ctrl.id != qctrl.id) return fail("control id mismatch\n"); + + if (qctrl.elems > 1) + return 0; + switch (qctrl.type) { case V4L2_CTRL_TYPE_INTEGER: case V4L2_CTRL_TYPE_INTEGER64: @@ -620,7 +627,8 @@ int testExtendedControls(struct node *node) ctrl.id = qctrl.id; ctrl.value = qctrl.default_value; } else { - if (ret != ENOSPC && qctrl.type == V4L2_CTRL_TYPE_STRING) + if (ret != ENOSPC && + (qctrl.type == V4L2_CTRL_TYPE_STRING || qctrl.elems > 1 )) return fail("did not check against size\n"); if (ret == ENOSPC && qctrl.type == V4L2_CTRL_TYPE_STRING) { if (ctrls.error_idx != 0) @@ -629,6 +637,10 @@ int testExtendedControls(struct node *node) ctrl.size = qctrl.maximum + 1; ret = doioctl(node, VIDIOC_G_EXT_CTRLS, &ctrls); } + if (ret == ENOSPC && qctrl.elems > 1){ + ctrl.ptr = new char[ctrl.size]; + ret = doioctl(node, VIDIOC_G_EXT_CTRLS, &ctrls); + } if (ret == EIO) { warn("g_ext_ctrls returned EIO\n"); ret = 0; @@ -668,7 +680,7 @@ int testExtendedControls(struct node *node) if (checkExtendedCtrl(ctrl, qctrl)) return fail("s_ext_ctrls returned invalid control contents (%08x)\n", qctrl.id); } - if (qctrl.type == V4L2_CTRL_TYPE_STRING) + if (qctrl.type == V4L2_CTRL_TYPE_STRING || qctrl.elems > 1) delete [] ctrl.string; ctrl.string = NULL; } @@ -708,6 +720,10 @@ int testExtendedControls(struct node *node) ctrl.size = qctrl.maximum + 1; ctrl.string = new char[ctrl.size]; } + if (qctrl.elems > 1){ + ctrl.size = qctrl.elem_size * qctrl.elems; + ctrl.ptr = new char[ctrl.size]; + } ctrl.reserved2[0] = 0; if (!ctrl_class) ctrl_class = V4L2_CTRL_ID2CLASS(ctrl.id);