From patchwork Thu Mar 11 22:19:41 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ricardo Ribalda X-Patchwork-Id: 399140 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-19.0 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_CR_TRAILER, INCLUDES_PATCH, MAILING_LIST_MULTI, SPF_HELO_NONE, SPF_PASS, URIBL_BLOCKED, USER_AGENT_GIT autolearn=unavailable autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 44211C4332B for ; Thu, 11 Mar 2021 22:20:31 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 1BC7D64F91 for ; Thu, 11 Mar 2021 22:20:31 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229756AbhCKWT5 (ORCPT ); Thu, 11 Mar 2021 17:19:57 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:48070 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229585AbhCKWT4 (ORCPT ); Thu, 11 Mar 2021 17:19:56 -0500 Received: from mail-ej1-x634.google.com (mail-ej1-x634.google.com [IPv6:2a00:1450:4864:20::634]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 14A75C061574 for ; Thu, 11 Mar 2021 14:19:56 -0800 (PST) Received: by mail-ej1-x634.google.com with SMTP id lr13so49516501ejb.8 for ; Thu, 11 Mar 2021 14:19:55 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=Q1DGKsTr9REpSe+LIHgT2CR/kX2zCTaPdy5dQ7gbqsY=; b=VyGTzG3UDxX2AVr/ENSs72dd1Xpbh/janpCSJN1eZp+E6uer3fLRgARDoZJ+5ZwiYv vzqBpH6PYgtZ7YSKTsxEnxQqpOeF6dwNDSqN2NsmcIxPK8e1RUSMGEGp+8XjtF+WRRHn uzHw65F1WA9YUAsU1WevX+GWCDlLrUChJmIsk= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=Q1DGKsTr9REpSe+LIHgT2CR/kX2zCTaPdy5dQ7gbqsY=; b=dR3CsqFi21cNHoFAMaf47wXpCr1qC01acHbRBt/QJaRulSxR+t3OjST9RBDCKy/oW9 Qj9Bd9Y+jr1/Mv/SGilW3n+f6xINWGo8wGmUbw9pxoB7BNO5xO0WkHxzOxkwEztnqzwb RjnXd/uPx4DiAai89Y6BPXVWChTH3MXO/209L8oUZrrXn0nK5VtBOCTb9k/F6mmw25TF ptco0JmM8ynFFmYcQB6ggAe4SZtbcblweoI1Cbj+SIyFrOZh27Lbo9wjY1tm8mNNaHCj krEP0FaRgjlaUS1+UCMvJqjFk0K5GtFZKJSkgNBDkHzh2qAhqUHfh1Yfw2+qii/Lq8ss IMqg== X-Gm-Message-State: AOAM532GbWpAEpl8Lssfi9oYIuM915+46heXExX+R7hbFDZdTPGyvo8r nbmLAF3RISGVSzHtK9GOmidqZQ== X-Google-Smtp-Source: ABdhPJwqUWbm4aX6+ZLzkvDNfelWe4g7YJZNCrItVs9vWeFw0IfFuqck7yySaJCTWIHYnSY0SgokJw== X-Received: by 2002:a17:906:ad85:: with SMTP id la5mr5256074ejb.37.1615501194661; Thu, 11 Mar 2021 14:19:54 -0800 (PST) Received: from alco.lan ([80.71.134.83]) by smtp.gmail.com with ESMTPSA id b18sm1942174ejb.77.2021.03.11.14.19.54 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 11 Mar 2021 14:19:54 -0800 (PST) From: Ricardo Ribalda To: Laurent Pinchart , Mauro Carvalho Chehab , Tomasz Figa , linux-media@vger.kernel.org, linux-kernel@vger.kernel.org, senozhatsky@chromium.org, Hans Verkuil Cc: Ricardo Ribalda , stable@vger.kernel.org, Hans Verkuil Subject: [PATCH v2 1/6] media: v4l2-ioctl: Fix check_ext_ctrls Date: Thu, 11 Mar 2021 23:19:41 +0100 Message-Id: <20210311221946.1319924-2-ribalda@chromium.org> X-Mailer: git-send-email 2.31.0.rc2.261.g7f71774620-goog In-Reply-To: <20210311221946.1319924-1-ribalda@chromium.org> References: <20210311221946.1319924-1-ribalda@chromium.org> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-media@vger.kernel.org Drivers that do not use the ctrl-framework use this function instead. - Return error when handling of REQUEST_VAL. - Do not check for multiple classes when getting the DEF_VAL. Fixes v4l2-compliance: Control ioctls (Input 0): fail: v4l2-test-controls.cpp(813): doioctl(node, VIDIOC_G_EXT_CTRLS, &ctrls) test VIDIOC_G/S/TRY_EXT_CTRLS: FAIL Cc: stable@vger.kernel.org Fixes: 6fa6f831f095 ("media: v4l2-ctrls: add core request support") Suggested-by: Hans Verkuil Signed-off-by: Ricardo Ribalda --- drivers/media/v4l2-core/v4l2-ioctl.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/drivers/media/v4l2-core/v4l2-ioctl.c b/drivers/media/v4l2-core/v4l2-ioctl.c index 31d1342e61e8..6f6b310e2802 100644 --- a/drivers/media/v4l2-core/v4l2-ioctl.c +++ b/drivers/media/v4l2-core/v4l2-ioctl.c @@ -924,8 +924,10 @@ static int check_ext_ctrls(struct v4l2_ext_controls *c, int allow_priv) */ if (!allow_priv && c->which == V4L2_CID_PRIVATE_BASE) return 0; - if (!c->which) + if (!c->which || c->which == V4L2_CTRL_WHICH_DEF_VAL) return 1; + if (c->which == V4L2_CTRL_WHICH_REQUEST_VAL) + return 0; /* Check that all controls are from the same control class. */ for (i = 0; i < c->count; i++) { if (V4L2_CTRL_ID2WHICH(c->controls[i].id) != c->which) { From patchwork Thu Mar 11 22:19:42 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ricardo Ribalda X-Patchwork-Id: 399139 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-19.0 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_CR_TRAILER, INCLUDES_PATCH, MAILING_LIST_MULTI, SPF_HELO_NONE, SPF_PASS, URIBL_BLOCKED, USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 9D6C8C4332D for ; Thu, 11 Mar 2021 22:20:31 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 6AD7364F87 for ; Thu, 11 Mar 2021 22:20:31 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229562AbhCKWUA (ORCPT ); Thu, 11 Mar 2021 17:20:00 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:48074 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229603AbhCKWT4 (ORCPT ); Thu, 11 Mar 2021 17:19:56 -0500 Received: from mail-ej1-x62f.google.com (mail-ej1-x62f.google.com [IPv6:2a00:1450:4864:20::62f]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 7A916C061760 for ; Thu, 11 Mar 2021 14:19:56 -0800 (PST) Received: by mail-ej1-x62f.google.com with SMTP id p8so49444557ejb.10 for ; Thu, 11 Mar 2021 14:19:56 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=10MlvnXrSl2evQH/VtUcd9w3QNfmLZ9OCqGKMYnt5M4=; b=RJDNlG3GzE2aljBqBJeS+Z1Lrs8Jcw72AMQ9eXgOBpQo677bmIpOi8n9IJBLxdtTDo IQn5U8a+dzFSVqhYc9t0jtlSlMe/J7wOTFsuGoMUPQoYtgdP3jR3UaqGe4BRredSeo/o T9OacY5nQN9+5HFaV9Jp7Nen5lLCY7V6k5yGQ= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=10MlvnXrSl2evQH/VtUcd9w3QNfmLZ9OCqGKMYnt5M4=; b=Oe2GsrQXSIewfHl9ZEWo+Xjxj+bccT3o+FI/WhxEIbaJ87mK3qdI4L4YCQi5C/r1bH HI4zRIjMTyIomxFxpvLD8jyEeXnIvrlxfl25/ihGkmjdChFgPXdVhxsvrwSUNr67PiY/ CsaTTH5ik5baJ4mlu0+aEWApmk84sEX0ZtfJ014l0SjCwB9BT1+4HXIm1DN1gk7yxLv+ JjSEFhNrl9vbsEKnJgtklyvRd4LrglkvbC4n7X1XMKr1vAbeIYFpfwJI9tFQjme8lsR3 DR737EKmx/72+FrP2+WBxy8pAEGlAS/Fuj2PRzUQ77zbxs26pbRfmOT/36A/l0ifXSOM e+HA== X-Gm-Message-State: AOAM532f5K0+CG8AUTp42CZddwLXdOm8syqyvwR8KaSHQwZZgunjLnqe 1igu4zNW67VSTQWXSWb1B+tyvA== X-Google-Smtp-Source: ABdhPJzlO3cv/CgU9XyWHNrGFN0G1RTDoTlqyzZAepHdlQQG/vSs+D7JrLmuSczOTfr/dWe8GyOopA== X-Received: by 2002:a17:906:f88a:: with SMTP id lg10mr5341798ejb.39.1615501195274; Thu, 11 Mar 2021 14:19:55 -0800 (PST) Received: from alco.lan ([80.71.134.83]) by smtp.gmail.com with ESMTPSA id b18sm1942174ejb.77.2021.03.11.14.19.54 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 11 Mar 2021 14:19:55 -0800 (PST) From: Ricardo Ribalda To: Laurent Pinchart , Mauro Carvalho Chehab , Tomasz Figa , linux-media@vger.kernel.org, linux-kernel@vger.kernel.org, senozhatsky@chromium.org, Hans Verkuil Cc: Ricardo Ribalda Subject: [PATCH v2 2/6] media: uvcvideo: Set capability in s_param Date: Thu, 11 Mar 2021 23:19:42 +0100 Message-Id: <20210311221946.1319924-3-ribalda@chromium.org> X-Mailer: git-send-email 2.31.0.rc2.261.g7f71774620-goog In-Reply-To: <20210311221946.1319924-1-ribalda@chromium.org> References: <20210311221946.1319924-1-ribalda@chromium.org> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-media@vger.kernel.org Fixes v4l2-compliance: Format ioctls (Input 0): warn: v4l2-test-formats.cpp(1339): S_PARM is supported but doesn't report V4L2_CAP_TIMEPERFRAME fail: v4l2-test-formats.cpp(1241): node->has_frmintervals && !cap->capability Reviewed-by: Laurent Pinchart Signed-off-by: Ricardo Ribalda Reviewed-by: Hans Verkuil --- drivers/media/usb/uvc/uvc_v4l2.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/drivers/media/usb/uvc/uvc_v4l2.c b/drivers/media/usb/uvc/uvc_v4l2.c index 252136cc885c..157310c0ca87 100644 --- a/drivers/media/usb/uvc/uvc_v4l2.c +++ b/drivers/media/usb/uvc/uvc_v4l2.c @@ -472,10 +472,13 @@ static int uvc_v4l2_set_streamparm(struct uvc_streaming *stream, uvc_simplify_fraction(&timeperframe.numerator, &timeperframe.denominator, 8, 333); - if (parm->type == V4L2_BUF_TYPE_VIDEO_CAPTURE) + if (parm->type == V4L2_BUF_TYPE_VIDEO_CAPTURE) { parm->parm.capture.timeperframe = timeperframe; - else + parm->parm.capture.capability = V4L2_CAP_TIMEPERFRAME; + } else { parm->parm.output.timeperframe = timeperframe; + parm->parm.output.capability = V4L2_CAP_TIMEPERFRAME; + } return 0; } From patchwork Thu Mar 11 22:19:43 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ricardo Ribalda X-Patchwork-Id: 397936 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-19.0 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_CR_TRAILER, INCLUDES_PATCH, MAILING_LIST_MULTI, SPF_HELO_NONE, SPF_PASS, URIBL_BLOCKED, USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 6F341C4332E for ; Thu, 11 Mar 2021 22:20:31 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 45E5E64FA7 for ; Thu, 11 Mar 2021 22:20:31 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230231AbhCKWT7 (ORCPT ); Thu, 11 Mar 2021 17:19:59 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:48080 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229674AbhCKWT5 (ORCPT ); Thu, 11 Mar 2021 17:19:57 -0500 Received: from mail-ej1-x629.google.com (mail-ej1-x629.google.com [IPv6:2a00:1450:4864:20::629]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 16638C061760 for ; Thu, 11 Mar 2021 14:19:57 -0800 (PST) Received: by mail-ej1-x629.google.com with SMTP id lr13so49516589ejb.8 for ; Thu, 11 Mar 2021 14:19:57 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=9MAhQGcdWHGej8nvNouxnVkw1hFpTssfKidukRMSibE=; b=oda80GXNQDxBorQrdX7puxCFtDzT+2HbYVzvq/Rln5noc56PiiN85bZ2vdOBp2rVOu KnkV4ii0dS5kMzUSzgAv0albtlu7MC2EwwI5n8shkCumQy2WQlFbaprRzosNr+XFeP66 PD1nDdsONibLTXEN9VXlCs+D33BYF4rM9O1lE= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=9MAhQGcdWHGej8nvNouxnVkw1hFpTssfKidukRMSibE=; b=lXK0gRo1C1JrotfzlhvBezm9wZK17r3lWHESq/j0wn6L0e2IkWGDTsArAcj0QfAX59 3AXcUyJLy0ccWXuEZkE1GUNCwsetOv8NjyH/AuOjQ5CoW56cdxA1oCUoEI5lI48s7d/K kf/D5+/AB4paQ1yoYwWt0JL9VaT63DjnJUUXNjVySRyvICBIyZOT2XTS3foimBlwU5Je oCXKrzUi0TEszMR0zpDtLtqFbD7tEo6m/fAWyZjPqpV/XUjbF7PCiWXuyVrKJVph9AzO aT/9KVdOLJ/Ms2qTux/6djrZpvY/NNkuan4vJ0ay23MuIqckwGu1JXH/E6YWjbAa7Erg UZqw== X-Gm-Message-State: AOAM530Qyb6YJFgcKMfGL82G9a/w+ZwFWer4LpWnPkcbhj82T+BN/snp SHbduEz+VJ6wDxQCz42s4+gaLw== X-Google-Smtp-Source: ABdhPJzAg/r21Oua221yFsmPRiRa9eRsaUiCuQRlIHfqjZQkF2fHas4zcRZjM7Q0skFvgZe3WuuF1A== X-Received: by 2002:a17:906:c1ca:: with SMTP id bw10mr5324161ejb.510.1615501195833; Thu, 11 Mar 2021 14:19:55 -0800 (PST) Received: from alco.lan ([80.71.134.83]) by smtp.gmail.com with ESMTPSA id b18sm1942174ejb.77.2021.03.11.14.19.55 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 11 Mar 2021 14:19:55 -0800 (PST) From: Ricardo Ribalda To: Laurent Pinchart , Mauro Carvalho Chehab , Tomasz Figa , linux-media@vger.kernel.org, linux-kernel@vger.kernel.org, senozhatsky@chromium.org, Hans Verkuil Cc: Ricardo Ribalda Subject: [PATCH v2 3/6] media: uvcvideo: Return -EIO for control errors Date: Thu, 11 Mar 2021 23:19:43 +0100 Message-Id: <20210311221946.1319924-4-ribalda@chromium.org> X-Mailer: git-send-email 2.31.0.rc2.261.g7f71774620-goog In-Reply-To: <20210311221946.1319924-1-ribalda@chromium.org> References: <20210311221946.1319924-1-ribalda@chromium.org> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-media@vger.kernel.org The device is doing something unspected with the control. Either because the protocol is not properly implemented or there has been a HW error. Fixes v4l2-compliance: Control ioctls (Input 0): fail: v4l2-test-controls.cpp(448): s_ctrl returned an error (22) test VIDIOC_G/S_CTRL: FAIL fail: v4l2-test-controls.cpp(698): s_ext_ctrls returned an error (22) test VIDIOC_G/S/TRY_EXT_CTRLS: FAIL Signed-off-by: Ricardo Ribalda Reviewed-by: Hans Verkuil --- drivers/media/usb/uvc/uvc_video.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/drivers/media/usb/uvc/uvc_video.c b/drivers/media/usb/uvc/uvc_video.c index f2f565281e63..25fd8aa23529 100644 --- a/drivers/media/usb/uvc/uvc_video.c +++ b/drivers/media/usb/uvc/uvc_video.c @@ -112,6 +112,11 @@ int uvc_query_ctrl(struct uvc_device *dev, u8 query, u8 unit, case 5: /* Invalid unit */ case 6: /* Invalid control */ case 7: /* Invalid Request */ + /* + * The firmware has not properly implemented + * the control or there has been a HW error. + */ + return -EIO; case 8: /* Invalid value within range */ return -EINVAL; default: /* reserved or unknown */ From patchwork Thu Mar 11 22:19:44 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ricardo Ribalda X-Patchwork-Id: 399137 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-19.0 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_CR_TRAILER, INCLUDES_PATCH, MAILING_LIST_MULTI, SPF_HELO_NONE, SPF_PASS, USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id B099EC4332B for ; Thu, 11 Mar 2021 22:21:03 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 7B32664F8F for ; Thu, 11 Mar 2021 22:21:03 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231151AbhCKWUc (ORCPT ); Thu, 11 Mar 2021 17:20:32 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:48088 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229526AbhCKWT6 (ORCPT ); Thu, 11 Mar 2021 17:19:58 -0500 Received: from mail-ej1-x62a.google.com (mail-ej1-x62a.google.com [IPv6:2a00:1450:4864:20::62a]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 938BCC061574 for ; Thu, 11 Mar 2021 14:19:57 -0800 (PST) Received: by mail-ej1-x62a.google.com with SMTP id c10so49391569ejx.9 for ; Thu, 11 Mar 2021 14:19:57 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=PU+PEkxuCZPyUA4RGvtWjC2ZXQnuk3ecTtjzX3NXk28=; b=EtzIOLd4WWFG8QSvRxqrGXH1U9iJrjCkW+GGA+/BI1TnQ8jqd0MTuxYGi0nNPbpobz WB7oQsrgMESCajedtK31aPnGOYTNFfrGLyEay8xxiocaCSu1OH/slfjPcHRM/UAGS9lf CvcVX6BmXFFwJ52Tjv5ZXL9NFiN4rVdofChE8= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=PU+PEkxuCZPyUA4RGvtWjC2ZXQnuk3ecTtjzX3NXk28=; b=R4rm48Lt4UV6htAaqlPTXQKmdUiC8Frw+UuJOZNMFqxeud5X5aqL1y3ZoD04Y+K7eu FneHjKDo572iZM5h7C0ARlTgB5x4Kng8n2IxKDE9AOOQHUiErhwYf7A0okKfWxZlOP6+ la8GTtkB2AKllVYZH4ierylK0xTDAwOmGY+BmtU0E3mjgU8n1vBQsc+Bb5zLY6pYELQ3 2+tDqO9SCdaVex3I5pfdv+h+Dvf1MBCs8bsAYCCMKHjSE42guHVbVKhkzg95tAAlhPc+ n/Z5HSX1tJy2SL1/KSsVs5mO8G0tu9mwQpSRqI4EHijv7HSLMvbV0NO7mNlvQwfbUAcK BIww== X-Gm-Message-State: AOAM530w9HwWU12f/OnWsGypFgBebLFq0q5tG9XPFdkibSr1h644Zobu BUadZenxRB0X5Aa4x68AHH32VA== X-Google-Smtp-Source: ABdhPJzDdIrAnaNzAB/vSFzneUHVBl+Vtdhjrtpf6CG2rGYRHD3MrQdr+JwIQGw4NZenp5G92R2FNQ== X-Received: by 2002:a17:907:76c7:: with SMTP id kf7mr5173335ejc.470.1615501196346; Thu, 11 Mar 2021 14:19:56 -0800 (PST) Received: from alco.lan ([80.71.134.83]) by smtp.gmail.com with ESMTPSA id b18sm1942174ejb.77.2021.03.11.14.19.55 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 11 Mar 2021 14:19:56 -0800 (PST) From: Ricardo Ribalda To: Laurent Pinchart , Mauro Carvalho Chehab , Tomasz Figa , linux-media@vger.kernel.org, linux-kernel@vger.kernel.org, senozhatsky@chromium.org, Hans Verkuil Cc: Ricardo Ribalda Subject: [PATCH v2 4/6] media: uvcvideo: set error_idx to count on EACCESS Date: Thu, 11 Mar 2021 23:19:44 +0100 Message-Id: <20210311221946.1319924-5-ribalda@chromium.org> X-Mailer: git-send-email 2.31.0.rc2.261.g7f71774620-goog In-Reply-To: <20210311221946.1319924-1-ribalda@chromium.org> References: <20210311221946.1319924-1-ribalda@chromium.org> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-media@vger.kernel.org According to the doc: The, in hindsight quite poor, solution for that is to set error_idx to count if the validation failed. Fixes v4l2-compliance: Control ioctls (Input 0): fail: v4l2-test-controls.cpp(645): invalid error index write only control test VIDIOC_G/S/TRY_EXT_CTRLS: FAIL Signed-off-by: Ricardo Ribalda Reviewed-by: Hans Verkuil --- drivers/media/usb/uvc/uvc_v4l2.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/drivers/media/usb/uvc/uvc_v4l2.c b/drivers/media/usb/uvc/uvc_v4l2.c index 157310c0ca87..36eb48622d48 100644 --- a/drivers/media/usb/uvc/uvc_v4l2.c +++ b/drivers/media/usb/uvc/uvc_v4l2.c @@ -1073,7 +1073,8 @@ static int uvc_ioctl_g_ext_ctrls(struct file *file, void *fh, ret = uvc_ctrl_get(chain, ctrl); if (ret < 0) { uvc_ctrl_rollback(handle); - ctrls->error_idx = i; + ctrls->error_idx = (ret == -EACCES) ? + ctrls->count : i; return ret; } } From patchwork Thu Mar 11 22:19:45 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ricardo Ribalda X-Patchwork-Id: 397935 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-19.0 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_CR_TRAILER, INCLUDES_PATCH, MAILING_LIST_MULTI, SPF_HELO_NONE, SPF_PASS, USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id D5BD4C4332E for ; Thu, 11 Mar 2021 22:21:03 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id B3F0764F7D for ; Thu, 11 Mar 2021 22:21:03 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230523AbhCKWUc (ORCPT ); Thu, 11 Mar 2021 17:20:32 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:48092 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229585AbhCKWT6 (ORCPT ); Thu, 11 Mar 2021 17:19:58 -0500 Received: from mail-ed1-x531.google.com (mail-ed1-x531.google.com [IPv6:2a00:1450:4864:20::531]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 2809CC061761 for ; Thu, 11 Mar 2021 14:19:58 -0800 (PST) Received: by mail-ed1-x531.google.com with SMTP id x21so5159141eds.4 for ; Thu, 11 Mar 2021 14:19:58 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=+NxfxF6MYENNTplKQDaPyj0JYf8Q7xTxx8mkc60+VVM=; b=cmdfBk3FY4BcK/I9H/TXYw39tVMK6GUJmeYusCfuzLEAIZBgvMN2nm2giUdYLARcpz 6BoK91xe9K8oHVhKafi4IA1dh60mYijPyesjZpbr9uyYXz+QIleZbNAIEQR7y6b8bApF Um/RcUl+v9cAwKSkl58T/G+f+WNalIHSjglzM= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=+NxfxF6MYENNTplKQDaPyj0JYf8Q7xTxx8mkc60+VVM=; b=pg8uXrboMRQaRGNUE6OqjVgGfhVn4Cdt+srk64InDliDA3rplf7fkzf/S0Y9UrR4CT KzH5c2Q4e/kkyT9dzs+2gtU1JoBqriHbjJzPTJ4idy2gA5UyVZl75XlUyqu06VzaUwMu Wvv6NRaTQgqLBhL0iSFz34RNx1PVj2f4uJbOvXIzrzICyA7cTpIbHKO5BW4nfvZovTSq EboXWAiLv0a5XbBYtIY1E80WgLCV/t5vZoCSvAaxQjRB4Fasg6ks0JONgYSoGHYi2jwJ bltx1fx9gmo5r0k3ZW7msiN27uxVt6wrbeZ8GCo9voieNEnJsZJPudrbkDbhoFDdXwJt CB2A== X-Gm-Message-State: AOAM532IUAaqlEMj0DrN9pANLvVkzIP6KP2xZsoXwuho1NZ2tQnVa0XH WjUHUsFZ4Uv8nuyZ6Y2dJqENWQ== X-Google-Smtp-Source: ABdhPJwu0WgyN0QkKtKMmQ987e1pAm6FPH/Olhhw0hOalUlWFzOppoe4TggQSyiOZKk6wmDPxNf+7g== X-Received: by 2002:aa7:dc15:: with SMTP id b21mr10881024edu.350.1615501196937; Thu, 11 Mar 2021 14:19:56 -0800 (PST) Received: from alco.lan ([80.71.134.83]) by smtp.gmail.com with ESMTPSA id b18sm1942174ejb.77.2021.03.11.14.19.56 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 11 Mar 2021 14:19:56 -0800 (PST) From: Ricardo Ribalda To: Laurent Pinchart , Mauro Carvalho Chehab , Tomasz Figa , linux-media@vger.kernel.org, linux-kernel@vger.kernel.org, senozhatsky@chromium.org, Hans Verkuil Cc: Ricardo Ribalda Subject: [PATCH v2 5/6] media: uvcvideo: Add support for V4L2_CTRL_TYPE_CTRL_CLASS Date: Thu, 11 Mar 2021 23:19:45 +0100 Message-Id: <20210311221946.1319924-6-ribalda@chromium.org> X-Mailer: git-send-email 2.31.0.rc2.261.g7f71774620-goog In-Reply-To: <20210311221946.1319924-1-ribalda@chromium.org> References: <20210311221946.1319924-1-ribalda@chromium.org> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-media@vger.kernel.org Create all the class controls for the device defined controls. Fixes v4l2-compliance: Control ioctls (Input 0): fail: v4l2-test-controls.cpp(216): missing control class for class 00980000 fail: v4l2-test-controls.cpp(216): missing control tclass for class 009a0000 test VIDIOC_QUERY_EXT_CTRL/QUERYMENU: FAIL Signed-off-by: Ricardo Ribalda --- drivers/media/usb/uvc/uvc_ctrl.c | 90 ++++++++++++++++++++++++++++++++ drivers/media/usb/uvc/uvcvideo.h | 7 +++ 2 files changed, 97 insertions(+) diff --git a/drivers/media/usb/uvc/uvc_ctrl.c b/drivers/media/usb/uvc/uvc_ctrl.c index b3dde98499f4..4e0ed2595ae9 100644 --- a/drivers/media/usb/uvc/uvc_ctrl.c +++ b/drivers/media/usb/uvc/uvc_ctrl.c @@ -357,6 +357,17 @@ static const struct uvc_control_info uvc_ctrls[] = { }, }; +static const struct uvc_control_class uvc_control_class[] = { + { + .id = V4L2_CID_CAMERA_CLASS, + .name = "Camera Controls", + }, + { + .id = V4L2_CID_USER_CLASS, + .name = "User Controls", + }, +}; + static const struct uvc_menu_info power_line_frequency_controls[] = { { 0, "Disabled" }, { 1, "50 Hz" }, @@ -1024,6 +1035,49 @@ static int __uvc_ctrl_get(struct uvc_video_chain *chain, return 0; } +static int __uvc_query_v4l2_class(struct uvc_device *dev, u32 req_id, + u32 found_id) +{ + bool find_next = req_id & V4L2_CTRL_FLAG_NEXT_CTRL; + int i; + + req_id &= V4L2_CTRL_ID_MASK; + + for (i = 0; i < ARRAY_SIZE(uvc_control_class); i++) { + if (!(dev->ctrl_class_bitmap & BIT(i))) + continue; + if (!find_next) { + if (uvc_control_class[i].id == req_id) + return i; + continue; + } + if ((uvc_control_class[i].id > req_id) && + (uvc_control_class[i].id < found_id)) + return i; + } + + return -ENODEV; +} + +static int uvc_query_v4l2_class(struct uvc_device *dev, u32 req_id, + u32 found_id, struct v4l2_queryctrl *v4l2_ctrl) +{ + int idx; + + idx = __uvc_query_v4l2_class(dev, req_id, found_id); + if (idx < 0) + return -ENODEV; + + memset(v4l2_ctrl, 0, sizeof(*v4l2_ctrl)); + v4l2_ctrl->id = uvc_control_class[idx].id; + strscpy(v4l2_ctrl->name, uvc_control_class[idx].name, + sizeof(v4l2_ctrl->name)); + v4l2_ctrl->type = V4L2_CTRL_TYPE_CTRL_CLASS; + v4l2_ctrl->flags = V4L2_CTRL_FLAG_WRITE_ONLY | + V4L2_CTRL_FLAG_READ_ONLY; + return 0; +} + static int __uvc_query_v4l2_ctrl(struct uvc_video_chain *chain, struct uvc_control *ctrl, struct uvc_control_mapping *mapping, @@ -1123,6 +1177,14 @@ int uvc_query_v4l2_ctrl(struct uvc_video_chain *chain, struct uvc_control_mapping *mapping; int ret; + /* Check if the ctrl is a know class */ + if (!(v4l2_ctrl->id & V4L2_CTRL_FLAG_NEXT_CTRL)) { + ret = uvc_query_v4l2_class(chain->dev, v4l2_ctrl->id, + v4l2_ctrl->id, v4l2_ctrl); + if (!ret) + return 0; + } + ret = mutex_lock_interruptible(&chain->ctrl_mutex); if (ret < 0) return -ERESTARTSYS; @@ -1133,6 +1195,13 @@ int uvc_query_v4l2_ctrl(struct uvc_video_chain *chain, goto done; } + if (v4l2_ctrl->id & V4L2_CTRL_FLAG_NEXT_CTRL) { + ret = uvc_query_v4l2_class(chain->dev, v4l2_ctrl->id, + mapping->id, v4l2_ctrl); + if (!ret) + goto done; + } + ret = __uvc_query_v4l2_ctrl(chain, ctrl, mapping, v4l2_ctrl); done: mutex_unlock(&chain->ctrl_mutex); @@ -1422,6 +1491,9 @@ static int uvc_ctrl_add_event(struct v4l2_subscribed_event *sev, unsigned elems) struct uvc_control *ctrl; int ret; + if (__uvc_query_v4l2_class(handle->chain->dev, sev->id, 0) >= 0) + return 0; + ret = mutex_lock_interruptible(&handle->chain->ctrl_mutex); if (ret < 0) return -ERESTARTSYS; @@ -1458,6 +1530,9 @@ static void uvc_ctrl_del_event(struct v4l2_subscribed_event *sev) { struct uvc_fh *handle = container_of(sev->fh, struct uvc_fh, vfh); + if (__uvc_query_v4l2_class(handle->chain->dev, sev->id, 0) >= 0) + return; + mutex_lock(&handle->chain->ctrl_mutex); list_del(&sev->node); mutex_unlock(&handle->chain->ctrl_mutex); @@ -1577,6 +1652,9 @@ int uvc_ctrl_get(struct uvc_video_chain *chain, struct uvc_control *ctrl; struct uvc_control_mapping *mapping; + if (__uvc_query_v4l2_class(chain->dev, xctrl->id, 0) >= 0) + return -EACCES; + ctrl = uvc_find_control(chain, xctrl->id, &mapping); if (ctrl == NULL) return -EINVAL; @@ -1596,6 +1674,9 @@ int uvc_ctrl_set(struct uvc_fh *handle, s32 max; int ret; + if (__uvc_query_v4l2_class(chain->dev, xctrl->id, 0) >= 0) + return -EACCES; + ctrl = uvc_find_control(chain, xctrl->id, &mapping); if (ctrl == NULL) return -EINVAL; @@ -2062,6 +2143,7 @@ static int __uvc_ctrl_add_mapping(struct uvc_device *dev, { struct uvc_control_mapping *map; unsigned int size; + int i; /* Most mappings come from static kernel data and need to be duplicated. * Mappings that come from userspace will be unnecessarily duplicated, @@ -2085,6 +2167,14 @@ static int __uvc_ctrl_add_mapping(struct uvc_device *dev, if (map->set == NULL) map->set = uvc_set_le_value; + for (i = 0; i < ARRAY_SIZE(uvc_control_class); i++) { + if (V4L2_CTRL_ID2WHICH(uvc_control_class[i].id) == + V4L2_CTRL_ID2WHICH(map->id)) { + dev->ctrl_class_bitmap |= BIT(i); + break; + } + } + list_add_tail(&map->list, &ctrl->info.mappings); uvc_dbg(dev, CONTROL, "Adding mapping '%s' to control %pUl/%u\n", map->name, ctrl->info.entity, ctrl->info.selector); diff --git a/drivers/media/usb/uvc/uvcvideo.h b/drivers/media/usb/uvc/uvcvideo.h index 97df5ecd66c9..63b5d697a438 100644 --- a/drivers/media/usb/uvc/uvcvideo.h +++ b/drivers/media/usb/uvc/uvcvideo.h @@ -262,6 +262,11 @@ struct uvc_control_mapping { u8 *data); }; +struct uvc_control_class { + u32 id; + char name[32]; +}; + struct uvc_control { struct uvc_entity *entity; struct uvc_control_info info; @@ -707,6 +712,8 @@ struct uvc_device { } async_ctrl; struct uvc_entity *gpio_unit; + + u8 ctrl_class_bitmap; }; enum uvc_handle_state { From patchwork Thu Mar 11 22:19:46 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ricardo Ribalda X-Patchwork-Id: 399138 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-19.0 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_CR_TRAILER, INCLUDES_PATCH, MAILING_LIST_MULTI, SPF_HELO_NONE, SPF_PASS, URIBL_BLOCKED, USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 5832BC43381 for ; Thu, 11 Mar 2021 22:21:03 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 2E36164F93 for ; Thu, 11 Mar 2021 22:21:03 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230510AbhCKWUb (ORCPT ); Thu, 11 Mar 2021 17:20:31 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:48096 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230118AbhCKWT7 (ORCPT ); Thu, 11 Mar 2021 17:19:59 -0500 Received: from mail-ej1-x62d.google.com (mail-ej1-x62d.google.com [IPv6:2a00:1450:4864:20::62d]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 92CB9C061763 for ; Thu, 11 Mar 2021 14:19:58 -0800 (PST) Received: by mail-ej1-x62d.google.com with SMTP id e19so49548161ejt.3 for ; Thu, 11 Mar 2021 14:19:58 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=NbPbhT2DvRa0HxCcGP6PoWLah825bR8ZY4RDvgqg8WA=; b=lJicX7FJ5deqI7OwxIw6ZUlwlyGn5VV8CT6UaWcZwBl33WV1vrOfptR4vh95JdLrsE GLZW800IXBu8UpyX5AyG8y6tKd3OZz0fCwsZi+QIOJsLnN93K6hHPSisF3+WwDv60Qk8 YgE3w0emYzudMUqDIn+LluAyEMQGrM5AjE6sU= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=NbPbhT2DvRa0HxCcGP6PoWLah825bR8ZY4RDvgqg8WA=; b=PzHpu1/bUyXiNxj6FCgC/MHxL+Vbc8/K2V8gbTzxbp8iyiPJY6sUyl0sHVtlAIzoZl wRlxKU9Qg5QiVRKB5vj7QPlS/FDKQ2fBKjFavGOBkY/Z0M8hzX3KMgTKh3RIT9qF/ySk FJxWf6j9HYQxamD3FxyxwS8eVEROGuL1+YVYuEARNH8egOK+CYImtZb/7OZa1RuN9+mU l5KQFrWRiqV2bOd37FS4rpDBfe0ps9oBvBZ2TRJr0padfwBJxFCHLN67mBuPwYPxmULF waFIinSnzdJmp5J5OZSAbKpLBVuNaw6Dplm/mm6477wMVqEPKaHyKadxLwTOgFS0ndJQ HIfQ== X-Gm-Message-State: AOAM533irGMpK+Hmqd0b08Y+0heFFzGxy8zn14mbEnPjNoyLIiJkRDM9 jibWZyJB1rWfcXFpJwHNCBgo6Q== X-Google-Smtp-Source: ABdhPJz5b66NydyOmLZdqz5yFVMU3yKizx+Q6wzTzO5kpoK22o9BnowMprQf8ne1d2TEexE8uudKGg== X-Received: by 2002:a17:906:18aa:: with SMTP id c10mr5261577ejf.248.1615501197417; Thu, 11 Mar 2021 14:19:57 -0800 (PST) Received: from alco.lan ([80.71.134.83]) by smtp.gmail.com with ESMTPSA id b18sm1942174ejb.77.2021.03.11.14.19.56 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 11 Mar 2021 14:19:57 -0800 (PST) From: Ricardo Ribalda To: Laurent Pinchart , Mauro Carvalho Chehab , Tomasz Figa , linux-media@vger.kernel.org, linux-kernel@vger.kernel.org, senozhatsky@chromium.org, Hans Verkuil Cc: Ricardo Ribalda Subject: [PATCH v2 6/6] media: uvcvideo: Set a different name for the metadata entity Date: Thu, 11 Mar 2021 23:19:46 +0100 Message-Id: <20210311221946.1319924-7-ribalda@chromium.org> X-Mailer: git-send-email 2.31.0.rc2.261.g7f71774620-goog In-Reply-To: <20210311221946.1319924-1-ribalda@chromium.org> References: <20210311221946.1319924-1-ribalda@chromium.org> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-media@vger.kernel.org All the entities must have a unique name. Fixes v4l2-compliance: Media Controller ioctls: fail: v4l2-test-media.cpp(205): v2_entity_names_set.find(key) != v2_entity_names_set.end() test MEDIA_IOC_G_TOPOLOGY: FAIL fail: v4l2-test-media.cpp(394): num_data_links != num_links test MEDIA_IOC_ENUM_ENTITIES/LINKS: FAIL Signed-off-by: Ricardo Ribalda --- drivers/media/usb/uvc/uvc_driver.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/drivers/media/usb/uvc/uvc_driver.c b/drivers/media/usb/uvc/uvc_driver.c index 30ef2a3110f7..47efa9a9be99 100644 --- a/drivers/media/usb/uvc/uvc_driver.c +++ b/drivers/media/usb/uvc/uvc_driver.c @@ -2199,7 +2199,10 @@ int uvc_register_video_device(struct uvc_device *dev, break; } - strscpy(vdev->name, dev->name, sizeof(vdev->name)); + if (type == V4L2_BUF_TYPE_META_CAPTURE) + strscpy(vdev->name, "Metadata Videodev", sizeof(vdev->name)); + else + strscpy(vdev->name, dev->name, sizeof(vdev->name)); /* * Set the driver data before calling video_register_device, otherwise