[{"id":20751,"web_url":"https://patchwork.libcamera.org/comment/20751/","msgid":"<163645982236.1606134.7209739905676254271@Monstersaurus>","date":"2021-11-09T12:10:22","subject":"Re: [libcamera-devel] [PATCH 02/10] libcamera: event_notifier: Add\n\t'enable' constructor parameter","submitter":{"id":4,"url":"https://patchwork.libcamera.org/api/people/4/","name":"Kieran Bingham","email":"kieran.bingham@ideasonboard.com"},"content":"Quoting Jacopo Mondi (2021-10-28 12:15:12)\n> Add an 'enable' parameter to the EventNotifier class constructor.\n> \n> Currently an EvenNotifier is enabled as soon as it is constructed.\n> Add an optional parameter to the class constructor to allow post-poning\n> the notifier activation.\n> \n> As the 'enable' parameter has a default value of true, existing users\n> of the class should not be updated.\n> \n> Signed-off-by: Jacopo Mondi <jacopo@jmondi.org>\n\nLooks reasonable, and I'm sure I'm about to discover why it's needed...\n\n\nReviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com>\n\n> ---\n>  include/libcamera/base/event_notifier.h |  2 +-\n>  src/libcamera/base/event_notifier.cpp   | 12 ++++++++----\n>  2 files changed, 9 insertions(+), 5 deletions(-)\n> \n> diff --git a/include/libcamera/base/event_notifier.h b/include/libcamera/base/event_notifier.h\n> index f7722a32ef55..4d373a5290cc 100644\n> --- a/include/libcamera/base/event_notifier.h\n> +++ b/include/libcamera/base/event_notifier.h\n> @@ -25,7 +25,7 @@ public:\n>                 Exception,\n>         };\n>  \n> -       EventNotifier(int fd, Type type, Object *parent = nullptr);\n> +       EventNotifier(int fd, Type type, Object *parent = nullptr, bool enable = true);\n>         virtual ~EventNotifier();\n>  \n>         Type type() const { return type_; }\n> diff --git a/src/libcamera/base/event_notifier.cpp b/src/libcamera/base/event_notifier.cpp\n> index fd93c0878c6f..40428cf24a50 100644\n> --- a/src/libcamera/base/event_notifier.cpp\n> +++ b/src/libcamera/base/event_notifier.cpp\n> @@ -26,8 +26,11 @@ namespace libcamera {\n>   *\n>   * The EventNotifier models a file descriptor event source that can be\n>   * monitored. It is created with the file descriptor to be monitored and the\n> - * type of event, and is enabled by default. It will emit the \\ref activated\n> - * signal whenever an event of the monitored type occurs on the file descriptor.\n> + * type of event. It will emit the \\ref activated signal whenever an event of\n> + * the monitored type occurs on the file descriptor.\n> + *\n> + * An EventNotifier is enabled by default when created, unless otherwise\n> + * specified through the optional 'enable' constructor parameter.\n>   *\n>   * Supported type of events are EventNotifier::Read, EventNotifier::Write and\n>   * EventNotifier::Exception. The type is specified when constructing the\n> @@ -62,11 +65,12 @@ namespace libcamera {\n>   * \\param[in] fd The file descriptor to monitor\n>   * \\param[in] type The event type to monitor\n>   * \\param[in] parent The parent Object\n> + * \\param[in] enable Notifier enable flag\n>   */\n> -EventNotifier::EventNotifier(int fd, Type type, Object *parent)\n> +EventNotifier::EventNotifier(int fd, Type type, Object *parent, bool enable)\n>         : Object(parent), fd_(fd), type_(type), enabled_(false)\n>  {\n> -       setEnabled(true);\n> +       setEnabled(enable);\n>  }\n>  \n>  EventNotifier::~EventNotifier()\n> -- \n> 2.33.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 69270BDB1C\n\tfor <parsemail@patchwork.libcamera.org>;\n\tTue,  9 Nov 2021 12:10:27 +0000 (UTC)","from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id 1F8E060234;\n\tTue,  9 Nov 2021 13:10:27 +0100 (CET)","from perceval.ideasonboard.com (perceval.ideasonboard.com\n\t[213.167.242.64])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id E5CCB600BF\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tTue,  9 Nov 2021 13:10:24 +0100 (CET)","from pendragon.ideasonboard.com\n\t(cpc89244-aztw30-2-0-cust3082.18-1.cable.virginm.net [86.31.172.11])\n\tby perceval.ideasonboard.com (Postfix) with ESMTPSA id A10F59FF;\n\tTue,  9 Nov 2021 13:10:24 +0100 (CET)"],"Authentication-Results":"lancelot.ideasonboard.com; dkim=pass (1024-bit key;\n\tunprotected) header.d=ideasonboard.com header.i=@ideasonboard.com\n\theader.b=\"DJx7Kwtf\"; dkim-atps=neutral","DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com;\n\ts=mail; t=1636459824;\n\tbh=jg2rkuWw7aWg9Fioytf3oKc2BK5yjp+BkljxDEfGT5I=;\n\th=In-Reply-To:References:Subject:From:To:Date:From;\n\tb=DJx7KwtfkLLoxw4bSbuPZUMG8KOAM01sXF1BaBrNnUO1ruJTFMIVXU5k9u/RlhgJl\n\tG5deWgtJBbSm6LJmkWfQx7UmTbeCvn7h8M6gS2k2y7umsbgeNUuWClCUdG9Y5D+qHP\n\t+ddwYf6rPGNYZ0iL5xcPBrx3Ix26b6SPPj/EfTC8=","Content-Type":"text/plain; charset=\"utf-8\"","MIME-Version":"1.0","Content-Transfer-Encoding":"quoted-printable","In-Reply-To":"<20211028111520.256612-3-jacopo@jmondi.org>","References":"<20211028111520.256612-1-jacopo@jmondi.org>\n\t<20211028111520.256612-3-jacopo@jmondi.org>","From":"Kieran Bingham <kieran.bingham@ideasonboard.com>","To":"Jacopo Mondi <jacopo@jmondi.org>, libcamera-devel@lists.libcamera.org","Date":"Tue, 09 Nov 2021 12:10:22 +0000","Message-ID":"<163645982236.1606134.7209739905676254271@Monstersaurus>","User-Agent":"alot/0.9.1","Subject":"Re: [libcamera-devel] [PATCH 02/10] libcamera: event_notifier: Add\n\t'enable' constructor parameter","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":20780,"web_url":"https://patchwork.libcamera.org/comment/20780/","msgid":"<b5d06f2c-d30a-8b49-9b04-87f7de0d7151@ideasonboard.com>","date":"2021-11-10T08:52:35","subject":"Re: [libcamera-devel] [PATCH 02/10] libcamera: event_notifier: Add\n\t'enable' constructor parameter","submitter":{"id":86,"url":"https://patchwork.libcamera.org/api/people/86/","name":"Umang Jain","email":"umang.jain@ideasonboard.com"},"content":"Hi Jacopo,\n\nOn 10/28/21 4:45 PM, Jacopo Mondi wrote:\n> Add an 'enable' parameter to the EventNotifier class constructor.\n>\n> Currently an EvenNotifier is enabled as soon as it is constructed.\n> Add an optional parameter to the class constructor to allow post-poning\n> the notifier activation.\n>\n> As the 'enable' parameter has a default value of true, existing users\n> of the class should not be updated.\n>\n> Signed-off-by: Jacopo Mondi <jacopo@jmondi.org>\n\n\nReviewed-by: Umang Jain <umang.jain@ideasonboard.com>\n\n> ---\n>   include/libcamera/base/event_notifier.h |  2 +-\n>   src/libcamera/base/event_notifier.cpp   | 12 ++++++++----\n>   2 files changed, 9 insertions(+), 5 deletions(-)\n>\n> diff --git a/include/libcamera/base/event_notifier.h b/include/libcamera/base/event_notifier.h\n> index f7722a32ef55..4d373a5290cc 100644\n> --- a/include/libcamera/base/event_notifier.h\n> +++ b/include/libcamera/base/event_notifier.h\n> @@ -25,7 +25,7 @@ public:\n>   \t\tException,\n>   \t};\n>   \n> -\tEventNotifier(int fd, Type type, Object *parent = nullptr);\n> +\tEventNotifier(int fd, Type type, Object *parent = nullptr, bool enable = true);\n>   \tvirtual ~EventNotifier();\n>   \n>   \tType type() const { return type_; }\n> diff --git a/src/libcamera/base/event_notifier.cpp b/src/libcamera/base/event_notifier.cpp\n> index fd93c0878c6f..40428cf24a50 100644\n> --- a/src/libcamera/base/event_notifier.cpp\n> +++ b/src/libcamera/base/event_notifier.cpp\n> @@ -26,8 +26,11 @@ namespace libcamera {\n>    *\n>    * The EventNotifier models a file descriptor event source that can be\n>    * monitored. It is created with the file descriptor to be monitored and the\n> - * type of event, and is enabled by default. It will emit the \\ref activated\n> - * signal whenever an event of the monitored type occurs on the file descriptor.\n> + * type of event. It will emit the \\ref activated signal whenever an event of\n> + * the monitored type occurs on the file descriptor.\n> + *\n> + * An EventNotifier is enabled by default when created, unless otherwise\n> + * specified through the optional 'enable' constructor parameter.\n>    *\n>    * Supported type of events are EventNotifier::Read, EventNotifier::Write and\n>    * EventNotifier::Exception. The type is specified when constructing the\n> @@ -62,11 +65,12 @@ namespace libcamera {\n>    * \\param[in] fd The file descriptor to monitor\n>    * \\param[in] type The event type to monitor\n>    * \\param[in] parent The parent Object\n> + * \\param[in] enable Notifier enable flag\n>    */\n> -EventNotifier::EventNotifier(int fd, Type type, Object *parent)\n> +EventNotifier::EventNotifier(int fd, Type type, Object *parent, bool enable)\n>   \t: Object(parent), fd_(fd), type_(type), enabled_(false)\n>   {\n> -\tsetEnabled(true);\n> +\tsetEnabled(enable);\n>   }\n>   \n>   EventNotifier::~EventNotifier()","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 C8721BF415\n\tfor <parsemail@patchwork.libcamera.org>;\n\tWed, 10 Nov 2021 08:52:40 +0000 (UTC)","from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id 2C09460361;\n\tWed, 10 Nov 2021 09:52:40 +0100 (CET)","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 5717060128\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tWed, 10 Nov 2021 09:52:39 +0100 (CET)","from [192.168.1.106] (unknown [103.251.226.5])\n\tby perceval.ideasonboard.com (Postfix) with ESMTPSA id 91077D8B;\n\tWed, 10 Nov 2021 09:52:38 +0100 (CET)"],"Authentication-Results":"lancelot.ideasonboard.com; dkim=pass (1024-bit key;\n\tunprotected) header.d=ideasonboard.com header.i=@ideasonboard.com\n\theader.b=\"iVwZ2/7d\"; dkim-atps=neutral","DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com;\n\ts=mail; t=1636534359;\n\tbh=7QZQPYBKg+F4JfQT34fNmzlKdMD0F2rymFiOFhMXQuY=;\n\th=Subject:To:References:From:Date:In-Reply-To:From;\n\tb=iVwZ2/7d+BdstDVKEWnEpyFx8UvydCB7Mcs1m0CRfuD2x0xSzcgmvEak6qjqguMn2\n\tEd5nc+7wwwL977A1+kcqr/l4+Cn50JNSTwu+/Rdtb3E7litxRruIAeUjCiJdCYbDFs\n\tth2w2mqqkR6nWrM/0NkNbwggP6uvtjf80wbx4XBQ=","To":"Jacopo Mondi <jacopo@jmondi.org>, libcamera-devel@lists.libcamera.org","References":"<20211028111520.256612-1-jacopo@jmondi.org>\n\t<20211028111520.256612-3-jacopo@jmondi.org>","From":"Umang Jain <umang.jain@ideasonboard.com>","Message-ID":"<b5d06f2c-d30a-8b49-9b04-87f7de0d7151@ideasonboard.com>","Date":"Wed, 10 Nov 2021 14:22:35 +0530","User-Agent":"Mozilla/5.0 (X11; Linux x86_64; rv:78.0) Gecko/20100101\n\tThunderbird/78.10.2","MIME-Version":"1.0","In-Reply-To":"<20211028111520.256612-3-jacopo@jmondi.org>","Content-Type":"text/plain; charset=utf-8; format=flowed","Content-Transfer-Encoding":"7bit","Content-Language":"en-US","Subject":"Re: [libcamera-devel] [PATCH 02/10] libcamera: event_notifier: Add\n\t'enable' constructor parameter","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":20890,"web_url":"https://patchwork.libcamera.org/comment/20890/","msgid":"<YY256mb6coe5pFmO@pendragon.ideasonboard.com>","date":"2021-11-12T00:48:42","subject":"Re: [libcamera-devel] [PATCH 02/10] libcamera: event_notifier: Add\n\t'enable' constructor parameter","submitter":{"id":2,"url":"https://patchwork.libcamera.org/api/people/2/","name":"Laurent Pinchart","email":"laurent.pinchart@ideasonboard.com"},"content":"Hi Jacopo,\n\nThank you for the patch.\n\nOn Thu, Oct 28, 2021 at 01:15:12PM +0200, Jacopo Mondi wrote:\n> Add an 'enable' parameter to the EventNotifier class constructor.\n> \n> Currently an EvenNotifier is enabled as soon as it is constructed.\n\ns/EvenNotifier/EventNotifier/\n\n> Add an optional parameter to the class constructor to allow post-poning\n\ns/post-poning/postponing/\n\n> the notifier activation.\n\ns/activation/enablement/ (as activation refers to the notifier reporting\nan event).\n\n> As the 'enable' parameter has a default value of true, existing users\n> of the class should not be updated.\n\ns/should not be updated/don't need to be updated/\n\n> Signed-off-by: Jacopo Mondi <jacopo@jmondi.org>\n> ---\n>  include/libcamera/base/event_notifier.h |  2 +-\n>  src/libcamera/base/event_notifier.cpp   | 12 ++++++++----\n>  2 files changed, 9 insertions(+), 5 deletions(-)\n> \n> diff --git a/include/libcamera/base/event_notifier.h b/include/libcamera/base/event_notifier.h\n> index f7722a32ef55..4d373a5290cc 100644\n> --- a/include/libcamera/base/event_notifier.h\n> +++ b/include/libcamera/base/event_notifier.h\n> @@ -25,7 +25,7 @@ public:\n>  \t\tException,\n>  \t};\n>  \n> -\tEventNotifier(int fd, Type type, Object *parent = nullptr);\n> +\tEventNotifier(int fd, Type type, Object *parent = nullptr, bool enable = true);\n>  \tvirtual ~EventNotifier();\n>  \n>  \tType type() const { return type_; }\n> diff --git a/src/libcamera/base/event_notifier.cpp b/src/libcamera/base/event_notifier.cpp\n> index fd93c0878c6f..40428cf24a50 100644\n> --- a/src/libcamera/base/event_notifier.cpp\n> +++ b/src/libcamera/base/event_notifier.cpp\n> @@ -26,8 +26,11 @@ namespace libcamera {\n>   *\n>   * The EventNotifier models a file descriptor event source that can be\n>   * monitored. It is created with the file descriptor to be monitored and the\n> - * type of event, and is enabled by default. It will emit the \\ref activated\n> - * signal whenever an event of the monitored type occurs on the file descriptor.\n> + * type of event. It will emit the \\ref activated signal whenever an event of\n> + * the monitored type occurs on the file descriptor.\n> + *\n> + * An EventNotifier is enabled by default when created, unless otherwise\n> + * specified through the optional 'enable' constructor parameter.\n\nI'd squash this with the paragraph dealing with enablement:\n\n * The \\a enable parameter controls whether the notifier is created enabled or\n * disabled. When the notifier is disabled it ignores events and does not emit\n * the \\ref activated signal. The notifier can be manually enabled or disabled\n * with the setEnabled() function.\n\nThe patch looks OK to me, so\n\nReviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>\n\nI don't know how it will be used though, so I may propose an alternative\nwhen reviewing the rest of the series.\n\n>   *\n>   * Supported type of events are EventNotifier::Read, EventNotifier::Write and\n>   * EventNotifier::Exception. The type is specified when constructing the\n> @@ -62,11 +65,12 @@ namespace libcamera {\n>   * \\param[in] fd The file descriptor to monitor\n>   * \\param[in] type The event type to monitor\n>   * \\param[in] parent The parent Object\n> + * \\param[in] enable Notifier enable flag\n>   */\n> -EventNotifier::EventNotifier(int fd, Type type, Object *parent)\n> +EventNotifier::EventNotifier(int fd, Type type, Object *parent, bool enable)\n>  \t: Object(parent), fd_(fd), type_(type), enabled_(false)\n>  {\n> -\tsetEnabled(true);\n> +\tsetEnabled(enable);\n>  }\n>  \n>  EventNotifier::~EventNotifier()","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 0559BBF415\n\tfor <parsemail@patchwork.libcamera.org>;\n\tFri, 12 Nov 2021 00:49:07 +0000 (UTC)","from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id 370F66034D;\n\tFri, 12 Nov 2021 01:49:06 +0100 (CET)","from perceval.ideasonboard.com (perceval.ideasonboard.com\n\t[213.167.242.64])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id 7A72160232\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tFri, 12 Nov 2021 01:49:04 +0100 (CET)","from pendragon.ideasonboard.com\n\t(117.145-247-81.adsl-dyn.isp.belgacom.be [81.247.145.117])\n\tby perceval.ideasonboard.com (Postfix) with ESMTPSA id 07CFC2F3;\n\tFri, 12 Nov 2021 01:49:04 +0100 (CET)"],"Authentication-Results":"lancelot.ideasonboard.com; dkim=pass (1024-bit key;\n\tunprotected) header.d=ideasonboard.com header.i=@ideasonboard.com\n\theader.b=\"mwpXIq2C\"; dkim-atps=neutral","DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com;\n\ts=mail; t=1636678144;\n\tbh=FMhpIUW4nWDzwd5uOpbDPpE0xdje+rsyW9gTcSIXmek=;\n\th=Date:From:To:Cc:Subject:References:In-Reply-To:From;\n\tb=mwpXIq2C1TDqHHJrdEOhXu7sttCBfgWZgRP6ImE2AOc5oOobZQvp7Ypo2dzbX3oZk\n\taCWegRymeQq8nzDzjtv/8M0wNgQNIhE5Y9ZlzU0EsaCVsMXZCODFZYvW7EXA2D/pyO\n\tcRD/Z8obTjxXr8/J8h5yTeR0cOkcrjXcCKKTHqHo=","Date":"Fri, 12 Nov 2021 02:48:42 +0200","From":"Laurent Pinchart <laurent.pinchart@ideasonboard.com>","To":"Jacopo Mondi <jacopo@jmondi.org>","Message-ID":"<YY256mb6coe5pFmO@pendragon.ideasonboard.com>","References":"<20211028111520.256612-1-jacopo@jmondi.org>\n\t<20211028111520.256612-3-jacopo@jmondi.org>","MIME-Version":"1.0","Content-Type":"text/plain; charset=utf-8","Content-Disposition":"inline","In-Reply-To":"<20211028111520.256612-3-jacopo@jmondi.org>","Subject":"Re: [libcamera-devel] [PATCH 02/10] libcamera: event_notifier: Add\n\t'enable' constructor parameter","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>","Cc":"libcamera-devel@lists.libcamera.org","Errors-To":"libcamera-devel-bounces@lists.libcamera.org","Sender":"\"libcamera-devel\" <libcamera-devel-bounces@lists.libcamera.org>"}}]