[{"id":31434,"web_url":"https://patchwork.libcamera.org/comment/31434/","msgid":"<d6e33b99-a4af-49c4-8fe2-3837b0d3069d@ideasonboard.com>","date":"2024-09-27T07:48:02","subject":"Re: [PATCH 1/4] libcamera: media_device: Add helper to return\n\tmatching entities","submitter":{"id":86,"url":"https://patchwork.libcamera.org/api/people/86/","name":"Umang Jain","email":"umang.jain@ideasonboard.com"},"content":"Hi Kieran,\n\nThank you for the patch.\n\nOn 16/09/24 7:32 pm, Kieran Bingham wrote:\n> Provide a helper on the MediaDevice to return a list of all\n> available entities which match a given function in the graph.\n>\n> As a drive by, also fix a whitespace error in the documentation of\n> MediaDevice::setupLink.\n>\n> Signed-off-by: Kieran Bingham <kieran.bingham@ideasonboard.com>\n\nReviewed-by: Umang Jain <umang.jain@ideasonboard.com>\n> ---\n>   include/libcamera/internal/media_device.h |  2 ++\n>   src/libcamera/media_device.cpp            | 24 ++++++++++++++++++++++-\n>   2 files changed, 25 insertions(+), 1 deletion(-)\n>\n> diff --git a/include/libcamera/internal/media_device.h b/include/libcamera/internal/media_device.h\n> index e412d3a0b7e3..b3a48b98d64b 100644\n> --- a/include/libcamera/internal/media_device.h\n> +++ b/include/libcamera/internal/media_device.h\n> @@ -55,6 +55,8 @@ public:\n>   \n>   \tSignal<> disconnected;\n>   \n> +\tstd::vector<MediaEntity *> locateEntities(unsigned int function);\n> +\n>   protected:\n>   \tstd::string logPrefix() const override;\n>   \n> diff --git a/src/libcamera/media_device.cpp b/src/libcamera/media_device.cpp\n> index d71dad74df70..d1e0dee2ff0f 100644\n> --- a/src/libcamera/media_device.cpp\n> +++ b/src/libcamera/media_device.cpp\n> @@ -793,7 +793,7 @@ void MediaDevice::fixupEntityFlags(struct media_v2_entity *entity)\n>    * low-level link setup as it performs no checks on the validity of the \\a\n>    * flags, and assumes that the supplied \\a flags are valid for the link (e.g.\n>    * immutable links cannot be disabled).\n> -*\n> + *\n>    * \\sa MediaLink::setEnabled(bool enable)\n>    *\n>    * \\return 0 on success or a negative error code otherwise\n> @@ -828,4 +828,26 @@ int MediaDevice::setupLink(const MediaLink *link, unsigned int flags)\n>   \treturn 0;\n>   }\n>   \n> +/**\n> + * \\brief Identify all entities of a common function in the MediaDevice\n> + * \\param[in] function The entity function to search for\n> + *\n> + * Search all entities within the graph of the MediaDevice and return\n> + * a vector of those which match the given function.\n> + *\n> + * \\return A vector of matching entities\n> + */\n> +std::vector<MediaEntity *> MediaDevice::locateEntities(unsigned int function)\n> +{\n> +\tstd::vector<MediaEntity *> found;\n> +\n> +\t/* Gather all the entities matching the function they expose. */\n> +\tfor (MediaEntity *entity : entities()) {\n> +\t\tif (entity->function() == function)\n> +\t\t\tfound.push_back(entity);\n> +\t}\n> +\n> +\treturn found;\n> +}\n> +\n>   } /* namespace libcamera */","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 5C836C3257\n\tfor <parsemail@patchwork.libcamera.org>;\n\tFri, 27 Sep 2024 07:48:09 +0000 (UTC)","from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id 51E816350F;\n\tFri, 27 Sep 2024 09:48:08 +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 90D1B618DB\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tFri, 27 Sep 2024 09:48:06 +0200 (CEST)","from [IPV6:2405:201:2015:f873:55d7:c02e:b2eb:ee3f] (unknown\n\t[IPv6:2405:201:2015:f873:55d7:c02e:b2eb:ee3f])\n\tby perceval.ideasonboard.com (Postfix) with ESMTPSA id 68E268BF;\n\tFri, 27 Sep 2024 09:46:37 +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=\"hisOqqtC\"; dkim-atps=neutral","DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com;\n\ts=mail; t=1727423197;\n\tbh=c3tpOj43Za1x7GoEHq4/ckHxmv5irShDVk7EW2yW0iw=;\n\th=Date:Subject:To:References:From:In-Reply-To:From;\n\tb=hisOqqtCbC/GH1jmBjcmoHlbbQ/soORRWnLD487lgEngFjEWF9Z8HQXvxRx/vo9VA\n\tGgKYxcCdgcE5PVR63R/ES4VUVlsyzYtG8/4K6a10ovxhetP79egPnBs7bIiDdpuKEU\n\tf+6lG4fDOskPpyD7y23Q22vTmgI/1IfuNERKeknQ=","Message-ID":"<d6e33b99-a4af-49c4-8fe2-3837b0d3069d@ideasonboard.com>","Date":"Fri, 27 Sep 2024 13:18:02 +0530","MIME-Version":"1.0","User-Agent":"Mozilla Thunderbird","Subject":"Re: [PATCH 1/4] libcamera: media_device: Add helper to return\n\tmatching entities","To":"Kieran Bingham <kieran.bingham@ideasonboard.com>,\n\tlibcamera devel <libcamera-devel@lists.libcamera.org>","References":"<20240916140241.47845-1-kieran.bingham@ideasonboard.com>\n\t<20240916140241.47845-2-kieran.bingham@ideasonboard.com>","Content-Language":"en-US","From":"Umang Jain <umang.jain@ideasonboard.com>","In-Reply-To":"<20240916140241.47845-2-kieran.bingham@ideasonboard.com>","Content-Type":"text/plain; charset=UTF-8; format=flowed","Content-Transfer-Encoding":"7bit","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>"}},{"id":31443,"web_url":"https://patchwork.libcamera.org/comment/31443/","msgid":"<ukdln7k5pr6npdrk4jpco76dz7gqw5dv5s2z5zzzolifouwlly@6yj2kf7fyrqi>","date":"2024-09-27T13:47:23","subject":"Re: [PATCH 1/4] libcamera: media_device: Add helper to return\n\tmatching entities","submitter":{"id":143,"url":"https://patchwork.libcamera.org/api/people/143/","name":"Jacopo Mondi","email":"jacopo.mondi@ideasonboard.com"},"content":"Hi Kieran\n\nOn Mon, Sep 16, 2024 at 04:02:38PM GMT, Kieran Bingham wrote:\n> Provide a helper on the MediaDevice to return a list of all\n> available entities which match a given function in the graph.\n>\n> As a drive by, also fix a whitespace error in the documentation of\n> MediaDevice::setupLink.\n>\n> Signed-off-by: Kieran Bingham <kieran.bingham@ideasonboard.com>\n> ---\n>  include/libcamera/internal/media_device.h |  2 ++\n>  src/libcamera/media_device.cpp            | 24 ++++++++++++++++++++++-\n>  2 files changed, 25 insertions(+), 1 deletion(-)\n>\n> diff --git a/include/libcamera/internal/media_device.h b/include/libcamera/internal/media_device.h\n> index e412d3a0b7e3..b3a48b98d64b 100644\n> --- a/include/libcamera/internal/media_device.h\n> +++ b/include/libcamera/internal/media_device.h\n> @@ -55,6 +55,8 @@ public:\n>\n>  \tSignal<> disconnected;\n>\n> +\tstd::vector<MediaEntity *> locateEntities(unsigned int function);\n> +\n>  protected:\n>  \tstd::string logPrefix() const override;\n>\n> diff --git a/src/libcamera/media_device.cpp b/src/libcamera/media_device.cpp\n> index d71dad74df70..d1e0dee2ff0f 100644\n> --- a/src/libcamera/media_device.cpp\n> +++ b/src/libcamera/media_device.cpp\n> @@ -793,7 +793,7 @@ void MediaDevice::fixupEntityFlags(struct media_v2_entity *entity)\n>   * low-level link setup as it performs no checks on the validity of the \\a\n>   * flags, and assumes that the supplied \\a flags are valid for the link (e.g.\n>   * immutable links cannot be disabled).\n> -*\n> + *\n>   * \\sa MediaLink::setEnabled(bool enable)\n>   *\n>   * \\return 0 on success or a negative error code otherwise\n> @@ -828,4 +828,26 @@ int MediaDevice::setupLink(const MediaLink *link, unsigned int flags)\n>  \treturn 0;\n>  }\n>\n> +/**\n> + * \\brief Identify all entities of a common function in the MediaDevice\n> + * \\param[in] function The entity function to search for\n> + *\n> + * Search all entities within the graph of the MediaDevice and return\n> + * a vector of those which match the given function.\n\nI would add that 'function' is expected to be expressed using the\nMEDIA_ENT_F_* macros defined by the Media Controller API.\n\n> + *\n> + * \\return A vector of matching entities\n> + */\n> +std::vector<MediaEntity *> MediaDevice::locateEntities(unsigned int function)\n> +{\n> +\tstd::vector<MediaEntity *> found;\n> +\n> +\t/* Gather all the entities matching the function they expose. */\n> +\tfor (MediaEntity *entity : entities()) {\n> +\t\tif (entity->function() == function)\n> +\t\t\tfound.push_back(entity);\n> +\t}\n> +\n> +\treturn found;\n> +}\n> +\n\nReviewed-by: Jacopo Mondi <jacopo.mondi@ideasonboard.com>\n\nThanks\n  j\n\n>  } /* namespace libcamera */\n> --\n> 2.46.0\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 E511DC3257\n\tfor <parsemail@patchwork.libcamera.org>;\n\tFri, 27 Sep 2024 13:47:32 +0000 (UTC)","from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id A672163532;\n\tFri, 27 Sep 2024 15:47:32 +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 149A26353B\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tFri, 27 Sep 2024 15:47:31 +0200 (CEST)","from ideasonboard.com (mob-5-90-58-180.net.vodafone.it\n\t[5.90.58.180])\n\tby perceval.ideasonboard.com (Postfix) with ESMTPSA id E4713A27;\n\tFri, 27 Sep 2024 15:46:01 +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=\"ay0Lhjxe\"; dkim-atps=neutral","DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com;\n\ts=mail; t=1727444762;\n\tbh=pkiT7N6OYQG1Z1r0nbA8B5diQNr9itKbT/MLiLCxseQ=;\n\th=Date:From:To:Cc:Subject:References:In-Reply-To:From;\n\tb=ay0LhjxeeZkeA5BTLhMYYsQaz0Vjk1b2zEGlcAOdbOEn5jvdqNJ+czL6j3kJn4vBy\n\tBrPAU88hlPlSUli+t5GpEaM23nl8AphaD3GoHD0eO1ntMKNMFo8dplfTKCV7N5Ca7x\n\t0cdrauPTofheKNe5BBbGJ5DbfEaK81ROp3AO5Zdk=","Date":"Fri, 27 Sep 2024 15:47:23 +0200","From":"Jacopo Mondi <jacopo.mondi@ideasonboard.com>","To":"Kieran Bingham <kieran.bingham@ideasonboard.com>","Cc":"libcamera devel <libcamera-devel@lists.libcamera.org>","Subject":"Re: [PATCH 1/4] libcamera: media_device: Add helper to return\n\tmatching entities","Message-ID":"<ukdln7k5pr6npdrk4jpco76dz7gqw5dv5s2z5zzzolifouwlly@6yj2kf7fyrqi>","References":"<20240916140241.47845-1-kieran.bingham@ideasonboard.com>\n\t<20240916140241.47845-2-kieran.bingham@ideasonboard.com>","MIME-Version":"1.0","Content-Type":"text/plain; charset=utf-8","Content-Disposition":"inline","In-Reply-To":"<20240916140241.47845-2-kieran.bingham@ideasonboard.com>","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>"}},{"id":31528,"web_url":"https://patchwork.libcamera.org/comment/31528/","msgid":"<172787936627.532453.7506894963907656594@ping.linuxembedded.co.uk>","date":"2024-10-02T14:29:26","subject":"Re: [PATCH 1/4] libcamera: media_device: Add helper to return\n\tmatching entities","submitter":{"id":4,"url":"https://patchwork.libcamera.org/api/people/4/","name":"Kieran Bingham","email":"kieran.bingham@ideasonboard.com"},"content":"Quoting Jacopo Mondi (2024-09-27 14:47:23)\n> Hi Kieran\n> \n> On Mon, Sep 16, 2024 at 04:02:38PM GMT, Kieran Bingham wrote:\n> > Provide a helper on the MediaDevice to return a list of all\n> > available entities which match a given function in the graph.\n> >\n> > As a drive by, also fix a whitespace error in the documentation of\n> > MediaDevice::setupLink.\n> >\n> > Signed-off-by: Kieran Bingham <kieran.bingham@ideasonboard.com>\n> > ---\n> >  include/libcamera/internal/media_device.h |  2 ++\n> >  src/libcamera/media_device.cpp            | 24 ++++++++++++++++++++++-\n> >  2 files changed, 25 insertions(+), 1 deletion(-)\n> >\n> > diff --git a/include/libcamera/internal/media_device.h b/include/libcamera/internal/media_device.h\n> > index e412d3a0b7e3..b3a48b98d64b 100644\n> > --- a/include/libcamera/internal/media_device.h\n> > +++ b/include/libcamera/internal/media_device.h\n> > @@ -55,6 +55,8 @@ public:\n> >\n> >       Signal<> disconnected;\n> >\n> > +     std::vector<MediaEntity *> locateEntities(unsigned int function);\n> > +\n> >  protected:\n> >       std::string logPrefix() const override;\n> >\n> > diff --git a/src/libcamera/media_device.cpp b/src/libcamera/media_device.cpp\n> > index d71dad74df70..d1e0dee2ff0f 100644\n> > --- a/src/libcamera/media_device.cpp\n> > +++ b/src/libcamera/media_device.cpp\n> > @@ -793,7 +793,7 @@ void MediaDevice::fixupEntityFlags(struct media_v2_entity *entity)\n> >   * low-level link setup as it performs no checks on the validity of the \\a\n> >   * flags, and assumes that the supplied \\a flags are valid for the link (e.g.\n> >   * immutable links cannot be disabled).\n> > -*\n> > + *\n> >   * \\sa MediaLink::setEnabled(bool enable)\n> >   *\n> >   * \\return 0 on success or a negative error code otherwise\n> > @@ -828,4 +828,26 @@ int MediaDevice::setupLink(const MediaLink *link, unsigned int flags)\n> >       return 0;\n> >  }\n> >\n> > +/**\n> > + * \\brief Identify all entities of a common function in the MediaDevice\n> > + * \\param[in] function The entity function to search for\n> > + *\n> > + * Search all entities within the graph of the MediaDevice and return\n> > + * a vector of those which match the given function.\n> \n> I would add that 'function' is expected to be expressed using the\n> MEDIA_ENT_F_* macros defined by the Media Controller API.\n> \n\nUpdated to:\n\n * Search all entities within the graph of the MediaDevice and return\n * a vector of those which match the given function as defined by the\n * MEDIA_ENT_F_* macros of the media controller API.\n\n\n> > + *\n> > + * \\return A vector of matching entities\n> > + */\n> > +std::vector<MediaEntity *> MediaDevice::locateEntities(unsigned int function)\n> > +{\n> > +     std::vector<MediaEntity *> found;\n> > +\n> > +     /* Gather all the entities matching the function they expose. */\n> > +     for (MediaEntity *entity : entities()) {\n> > +             if (entity->function() == function)\n> > +                     found.push_back(entity);\n> > +     }\n> > +\n> > +     return found;\n> > +}\n> > +\n> \n> Reviewed-by: Jacopo Mondi <jacopo.mondi@ideasonboard.com>\n> \n> Thanks\n>   j\n> \n> >  } /* namespace libcamera */\n> > --\n> > 2.46.0\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 33F34BD80A\n\tfor <parsemail@patchwork.libcamera.org>;\n\tWed,  2 Oct 2024 14:29:32 +0000 (UTC)","from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id E072063525;\n\tWed,  2 Oct 2024 16:29:30 +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 1AA2763510\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tWed,  2 Oct 2024 16:29:29 +0200 (CEST)","from pendragon.ideasonboard.com\n\t(cpc89244-aztw30-2-0-cust6594.18-1.cable.virginm.net [86.31.185.195])\n\tby perceval.ideasonboard.com (Postfix) with ESMTPSA id 875293EA;\n\tWed,  2 Oct 2024 16:27:56 +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=\"exJpo8HX\"; dkim-atps=neutral","DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com;\n\ts=mail; t=1727879276;\n\tbh=fAnaYj3JLRgw5+j7OYDBOHtrxFcwj2u5R9vTRYtvQt4=;\n\th=In-Reply-To:References:Subject:From:Cc:To:Date:From;\n\tb=exJpo8HXBvurQOsCANtXOroNgstiiUTZQuI2GUU4qPMmk0WSLHIB4rAZ6E7mdFEnF\n\t+w8C/9VoKsosiU5iKQ69o6GjGkXdNAbsftRuBORmmlm53vHoHxkR2XRPu4emHLrWZf\n\tHgQKQjzCBmww95918FvKjn1I5aP5JK/+o8uerUCA=","Content-Type":"text/plain; charset=\"utf-8\"","MIME-Version":"1.0","Content-Transfer-Encoding":"quoted-printable","In-Reply-To":"<ukdln7k5pr6npdrk4jpco76dz7gqw5dv5s2z5zzzolifouwlly@6yj2kf7fyrqi>","References":"<20240916140241.47845-1-kieran.bingham@ideasonboard.com>\n\t<20240916140241.47845-2-kieran.bingham@ideasonboard.com>\n\t<ukdln7k5pr6npdrk4jpco76dz7gqw5dv5s2z5zzzolifouwlly@6yj2kf7fyrqi>","Subject":"Re: [PATCH 1/4] libcamera: media_device: Add helper to return\n\tmatching entities","From":"Kieran Bingham <kieran.bingham@ideasonboard.com>","Cc":"libcamera devel <libcamera-devel@lists.libcamera.org>","To":"Jacopo Mondi <jacopo.mondi@ideasonboard.com>","Date":"Wed, 02 Oct 2024 15:29:26 +0100","Message-ID":"<172787936627.532453.7506894963907656594@ping.linuxembedded.co.uk>","User-Agent":"alot/0.10","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>"}},{"id":31623,"web_url":"https://patchwork.libcamera.org/comment/31623/","msgid":"<9e1f4b23-55fe-4725-8d6e-cf381655b56e@ideasonboard.com>","date":"2024-10-08T14:34:20","subject":"Re: [PATCH 1/4] libcamera: media_device: Add helper to return\n\tmatching entities","submitter":{"id":156,"url":"https://patchwork.libcamera.org/api/people/156/","name":"Dan Scally","email":"dan.scally@ideasonboard.com"},"content":"Hi Kieran\n\nOn 02/10/2024 15:29, Kieran Bingham wrote:\n> Quoting Jacopo Mondi (2024-09-27 14:47:23)\n>> Hi Kieran\n>>\n>> On Mon, Sep 16, 2024 at 04:02:38PM GMT, Kieran Bingham wrote:\n>>> Provide a helper on the MediaDevice to return a list of all\n>>> available entities which match a given function in the graph.\n>>>\n>>> As a drive by, also fix a whitespace error in the documentation of\n>>> MediaDevice::setupLink.\n>>>\n>>> Signed-off-by: Kieran Bingham <kieran.bingham@ideasonboard.com>\n>>> ---\n>>>   include/libcamera/internal/media_device.h |  2 ++\n>>>   src/libcamera/media_device.cpp            | 24 ++++++++++++++++++++++-\n>>>   2 files changed, 25 insertions(+), 1 deletion(-)\n>>>\n>>> diff --git a/include/libcamera/internal/media_device.h b/include/libcamera/internal/media_device.h\n>>> index e412d3a0b7e3..b3a48b98d64b 100644\n>>> --- a/include/libcamera/internal/media_device.h\n>>> +++ b/include/libcamera/internal/media_device.h\n>>> @@ -55,6 +55,8 @@ public:\n>>>\n>>>        Signal<> disconnected;\n>>>\n>>> +     std::vector<MediaEntity *> locateEntities(unsigned int function);\n>>> +\n>>>   protected:\n>>>        std::string logPrefix() const override;\n>>>\n>>> diff --git a/src/libcamera/media_device.cpp b/src/libcamera/media_device.cpp\n>>> index d71dad74df70..d1e0dee2ff0f 100644\n>>> --- a/src/libcamera/media_device.cpp\n>>> +++ b/src/libcamera/media_device.cpp\n>>> @@ -793,7 +793,7 @@ void MediaDevice::fixupEntityFlags(struct media_v2_entity *entity)\n>>>    * low-level link setup as it performs no checks on the validity of the \\a\n>>>    * flags, and assumes that the supplied \\a flags are valid for the link (e.g.\n>>>    * immutable links cannot be disabled).\n>>> -*\n>>> + *\n>>>    * \\sa MediaLink::setEnabled(bool enable)\n>>>    *\n>>>    * \\return 0 on success or a negative error code otherwise\n>>> @@ -828,4 +828,26 @@ int MediaDevice::setupLink(const MediaLink *link, unsigned int flags)\n>>>        return 0;\n>>>   }\n>>>\n>>> +/**\n>>> + * \\brief Identify all entities of a common function in the MediaDevice\n>>> + * \\param[in] function The entity function to search for\n>>> + *\n>>> + * Search all entities within the graph of the MediaDevice and return\n>>> + * a vector of those which match the given function.\n>> I would add that 'function' is expected to be expressed using the\n>> MEDIA_ENT_F_* macros defined by the Media Controller API.\n>>\n> Updated to:\n>\n>   * Search all entities within the graph of the MediaDevice and return\n>   * a vector of those which match the given function as defined by the\n>   * MEDIA_ENT_F_* macros of the media controller API.\n>\nOn the back of which:\n\n\nReviewed-by: Daniel Scally <dan.scally@ideasonboard.com>\n\n>>> + *\n>>> + * \\return A vector of matching entities\n>>> + */\n>>> +std::vector<MediaEntity *> MediaDevice::locateEntities(unsigned int function)\n>>> +{\n>>> +     std::vector<MediaEntity *> found;\n>>> +\n>>> +     /* Gather all the entities matching the function they expose. */\n>>> +     for (MediaEntity *entity : entities()) {\n>>> +             if (entity->function() == function)\n>>> +                     found.push_back(entity);\n>>> +     }\n>>> +\n>>> +     return found;\n>>> +}\n>>> +\n>> Reviewed-by: Jacopo Mondi <jacopo.mondi@ideasonboard.com>\n>>\n>> Thanks\n>>    j\n>>\n>>>   } /* namespace libcamera */\n>>> --\n>>> 2.46.0\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 DD3EEBD80A\n\tfor <parsemail@patchwork.libcamera.org>;\n\tTue,  8 Oct 2024 14:34:26 +0000 (UTC)","from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id AC5A66353B;\n\tTue,  8 Oct 2024 16:34:25 +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 EC6F1618CB\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tTue,  8 Oct 2024 16:34:23 +0200 (CEST)","from [192.168.0.43]\n\t(cpc141996-chfd3-2-0-cust928.12-3.cable.virginm.net [86.13.91.161])\n\tby perceval.ideasonboard.com (Postfix) with ESMTPSA id 338CBA47\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tTue,  8 Oct 2024 16:32:46 +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=\"HKbx9PId\"; dkim-atps=neutral","DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com;\n\ts=mail; t=1728397967;\n\tbh=M+H+ByBczTdjo1yh5kMFKNak7cGYa6xd/J/cmNkzjP0=;\n\th=Date:Subject:To:References:From:In-Reply-To:From;\n\tb=HKbx9PIdV3ua+a60zbRTWurXV54b3Hm9kHJVkcWCL5TbwDzl4X4ZNZEw3djO+1gYz\n\tmnXs1azynRtSUEmDwCVgeo2Z7+7mTUOzyvoLgCCBag1gm/icupF/MKq7zMyxKTiAW2\n\tU2gkwW+KKDuxnc7Es+lvTiZ9g/7rzK+e9Zs8SxEk=","Message-ID":"<9e1f4b23-55fe-4725-8d6e-cf381655b56e@ideasonboard.com>","Date":"Tue, 8 Oct 2024 15:34:20 +0100","MIME-Version":"1.0","User-Agent":"Mozilla Thunderbird","Subject":"Re: [PATCH 1/4] libcamera: media_device: Add helper to return\n\tmatching entities","To":"libcamera-devel@lists.libcamera.org","References":"<20240916140241.47845-1-kieran.bingham@ideasonboard.com>\n\t<20240916140241.47845-2-kieran.bingham@ideasonboard.com>\n\t<ukdln7k5pr6npdrk4jpco76dz7gqw5dv5s2z5zzzolifouwlly@6yj2kf7fyrqi>\n\t<172787936627.532453.7506894963907656594@ping.linuxembedded.co.uk>","Content-Language":"en-US","From":"Dan Scally <dan.scally@ideasonboard.com>","Autocrypt":"addr=dan.scally@ideasonboard.com; keydata=\n\txsFNBGLydlEBEADa5O2s0AbUguprfvXOQun/0a8y2Vk6BqkQALgeD6KnXSWwaoCULp18etYW\n\tB31bfgrdphXQ5kUQibB0ADK8DERB4wrzrUb5CMxLBFE7mQty+v5NsP0OFNK9XTaAOcmD+Ove\n\teIjYvqurAaro91jrRVrS1gBRxIFqyPgNvwwL+alMZhn3/2jU2uvBmuRrgnc/e9cHKiuT3Dtq\n\tMHGPKL2m+plk+7tjMoQFfexoQ1JKugHAjxAhJfrkXh6uS6rc01bYCyo7ybzg53m1HLFJdNGX\n\tsUKR+dQpBs3SY4s66tc1sREJqdYyTsSZf80HjIeJjU/hRunRo4NjRIJwhvnK1GyjOvvuCKVU\n\tRWpY8dNjNu5OeAfdrlvFJOxIE9M8JuYCQTMULqd1NuzbpFMjc9524U3Cngs589T7qUMPb1H1\n\tNTA81LmtJ6Y+IV5/kiTUANflpzBwhu18Ok7kGyCq2a2jsOcVmk8gZNs04gyjuj8JziYwwLbf\n\tvzABwpFVcS8aR+nHIZV1HtOzyw8CsL8OySc3K9y+Y0NRpziMRvutrppzgyMb9V+N31mK9Mxl\n\t1YkgaTl4ciNWpdfUe0yxH03OCuHi3922qhPLF4XX5LN+NaVw5Xz2o3eeWklXdouxwV7QlN33\n\tu4+u2FWzKxDqO6WLQGjxPE0mVB4Gh5Pa1Vb0ct9Ctg0qElvtGQARAQABzShEYW4gU2NhbGx5\n\tIDxkYW4uc2NhbGx5QGlkZWFzb25ib2FyZC5jb20+wsGNBBMBCAA3FiEEsdtt8OWP7+8SNfQe\n\tkiQuh/L+GMQFAmLydlIFCQWjmoACGwMECwkIBwUVCAkKCwUWAgMBAAAKCR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00uFhEwv2YfiyGk6iGF2W40s2pH2t6oeuGgmiZ7g6d0MEK8Ql/4zPItvr1c1rpwpXUC1\n\tu1kQWgtnNjFHX3KiYdqjcZeRBiry1X0zY+4Y24wUU0KsEewJwjhmCKAsju1RpdlPg2kC","In-Reply-To":"<172787936627.532453.7506894963907656594@ping.linuxembedded.co.uk>","Content-Type":"text/plain; charset=UTF-8; format=flowed","Content-Transfer-Encoding":"7bit","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>"}}]