[{"id":35637,"web_url":"https://patchwork.libcamera.org/comment/35637/","msgid":"<175653190989.3397211.4513910951107913815@neptunite.rasen.tech>","date":"2025-08-30T05:31:49","subject":"Re: [RFC PATCH v1 1/2] libcamera: device_enumerator: Take list of\n\tentity names in ctor","submitter":{"id":17,"url":"https://patchwork.libcamera.org/api/people/17/","name":"Paul Elder","email":"paul.elder@ideasonboard.com"},"content":"Quoting Barnabás Pőcze (2025-08-15 22:52:52)\n> Make it possible to pass a list of entity names to the `DeviceMatch`\n> constructor, thereby simplifying the construction if there is a known\n> set of entity names by avoiding the repeated `add()` calls.\n> \n> Signed-off-by: Barnabás Pőcze <barnabas.pocze@ideasonboard.com>\n\nReviewed-by: Paul Elder <paul.elder@ideasonboard.com>\n\n> ---\n>  include/libcamera/internal/device_enumerator.h | 5 ++++-\n>  src/libcamera/device_enumerator.cpp            | 7 +++++--\n>  2 files changed, 9 insertions(+), 3 deletions(-)\n> \n> diff --git a/include/libcamera/internal/device_enumerator.h b/include/libcamera/internal/device_enumerator.h\n> index db3532a98..cb055e166 100644\n> --- a/include/libcamera/internal/device_enumerator.h\n> +++ b/include/libcamera/internal/device_enumerator.h\n> @@ -7,8 +7,10 @@\n>  \n>  #pragma once\n>  \n> +#include <initializer_list>\n>  #include <memory>\n>  #include <string>\n> +#include <string_view>\n>  #include <vector>\n>  \n>  #include <libcamera/base/signal.h>\n> @@ -20,7 +22,8 @@ class MediaDevice;\n>  class DeviceMatch\n>  {\n>  public:\n> -       DeviceMatch(const std::string &driver);\n> +       DeviceMatch(const std::string &driver,\n> +                   std::initializer_list<std::string_view> entities = {});\n>  \n>         void add(const std::string &entity);\n>  \n> diff --git a/src/libcamera/device_enumerator.cpp b/src/libcamera/device_enumerator.cpp\n> index ae17862f6..ec98418fa 100644\n> --- a/src/libcamera/device_enumerator.cpp\n> +++ b/src/libcamera/device_enumerator.cpp\n> @@ -66,9 +66,12 @@ LOG_DEFINE_CATEGORY(DeviceEnumerator)\n>  /**\n>   * \\brief Construct a media device search pattern\n>   * \\param[in] driver The Linux device driver name that created the media device\n> + * \\param[in] entities The list of media graph entity names to search\n>   */\n> -DeviceMatch::DeviceMatch(const std::string &driver)\n> -       : driver_(driver)\n> +DeviceMatch::DeviceMatch(const std::string &driver,\n> +                        std::initializer_list<std::string_view> entities)\n> +       : driver_(driver),\n> +         entities_(entities.begin(), entities.end())\n>  {\n>  }\n>  \n> -- \n> 2.50.1\n>","headers":{"Return-Path":"<libcamera-devel-bounces@lists.libcamera.org>","X-Original-To":"parsemail@patchwork.libcamera.org","Delivered-To":"parsemail@patchwork.libcamera.org","Received":["from lancelot.ideasonboard.com (lancelot.ideasonboard.com\n\t[92.243.16.209])\n\tby patchwork.libcamera.org (Postfix) with ESMTPS id A0AE9BEFBE\n\tfor <parsemail@patchwork.libcamera.org>;\n\tSat, 30 Aug 2025 05:31:58 +0000 (UTC)","from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id 81B096931C;\n\tSat, 30 Aug 2025 07:31:57 +0200 (CEST)","from perceval.ideasonboard.com (perceval.ideasonboard.com\n\t[IPv6:2001:4b98:dc2:55:216:3eff:fef7:d647])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id D3F58613AD\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tSat, 30 Aug 2025 07:31:56 +0200 (CEST)","from neptunite.rasen.tech (unknown\n\t[IPv6:2404:7a81:160:2100:675b:5305:1ae:ae0d])\n\tby perceval.ideasonboard.com (Postfix) with UTF8SMTPSA id 87AB718B9; \n\tSat, 30 Aug 2025 07:30:50 +0200 (CEST)"],"Authentication-Results":"lancelot.ideasonboard.com; dkim=pass (1024-bit key;\n\tunprotected) header.d=ideasonboard.com header.i=@ideasonboard.com\n\theader.b=\"q1J3xGJ9\"; dkim-atps=neutral","DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com;\n\ts=mail; t=1756531851;\n\tbh=89oUSdy+Y2BupSetC3FJZMqKVGFQjhVfkBbYfpvBI44=;\n\th=In-Reply-To:References:Subject:From:To:Date:From;\n\tb=q1J3xGJ9RNIIJ5wf0NEUKNr9IlaH5os8i+Rf2lNqG4cgXb5osvOv5Udl0PaTEErrA\n\t3LbTj5oBqHi9ycPJ23dZnOjAllOtu8ei5q60GmD5Ac5r6dqQ4LlvPCmheuCx4g9t0D\n\t/lTGHjLkpcJ+FmA/rAD23jc9mb7a/6babcxyLkkk=","Content-Type":"text/plain; charset=\"utf-8\"","MIME-Version":"1.0","Content-Transfer-Encoding":"quoted-printable","In-Reply-To":"<20250815135253.2231076-1-barnabas.pocze@ideasonboard.com>","References":"<20250815135253.2231076-1-barnabas.pocze@ideasonboard.com>","Subject":"Re: [RFC PATCH v1 1/2] libcamera: device_enumerator: Take list of\n\tentity names in ctor","From":"Paul Elder <paul.elder@ideasonboard.com>","To":"=?utf-8?q?Barnab=C3=A1s_P=C5=91cze?= <barnabas.pocze@ideasonboard.com>,\n\tlibcamera-devel@lists.libcamera.org","Date":"Sat, 30 Aug 2025 14:31:49 +0900","Message-ID":"<175653190989.3397211.4513910951107913815@neptunite.rasen.tech>","User-Agent":"alot/0.0.0","X-BeenThere":"libcamera-devel@lists.libcamera.org","X-Mailman-Version":"2.1.29","Precedence":"list","List-Id":"<libcamera-devel.lists.libcamera.org>","List-Unsubscribe":"<https://lists.libcamera.org/options/libcamera-devel>,\n\t<mailto:libcamera-devel-request@lists.libcamera.org?subject=unsubscribe>","List-Archive":"<https://lists.libcamera.org/pipermail/libcamera-devel/>","List-Post":"<mailto:libcamera-devel@lists.libcamera.org>","List-Help":"<mailto:libcamera-devel-request@lists.libcamera.org?subject=help>","List-Subscribe":"<https://lists.libcamera.org/listinfo/libcamera-devel>,\n\t<mailto:libcamera-devel-request@lists.libcamera.org?subject=subscribe>","Errors-To":"libcamera-devel-bounces@lists.libcamera.org","Sender":"\"libcamera-devel\" <libcamera-devel-bounces@lists.libcamera.org>"}}]