[{"id":5105,"web_url":"https://patchwork.libcamera.org/comment/5105/","msgid":"<20200607155253.GA22208@pendragon.ideasonboard.com>","date":"2020-06-07T15:52:53","subject":"Re: [libcamera-devel] [PATCH v3 1/5] libcamera: camera_manager:\n\tRefactor device enumeration into separate function","submitter":{"id":2,"url":"https://patchwork.libcamera.org/api/people/2/","name":"Laurent Pinchart","email":"laurent.pinchart@ideasonboard.com"},"content":"Hi Umang,\n\nThank you for the patch.\n\nOn Thu, May 21, 2020 at 01:54:23PM +0000, Umang Jain wrote:\n> This commit introduces no functional changes.\n> Split device enumeration code into a separate function,\n> so that the function can be re-used for upcoming hotplug\n> functionality in subsequent commits.\n> \n> Also, fixup correct tag for \\todo.\n> \n> Signed-off-by: Umang Jain <email@uajain.com>\n> ---\n>  src/libcamera/camera_manager.cpp | 19 +++++++++++++------\n>  1 file changed, 13 insertions(+), 6 deletions(-)\n> \n> diff --git a/src/libcamera/camera_manager.cpp b/src/libcamera/camera_manager.cpp\n> index 849377a..8d9cb02 100644\n> --- a/src/libcamera/camera_manager.cpp\n> +++ b/src/libcamera/camera_manager.cpp\n> @@ -53,6 +53,7 @@ protected:\n>  \n>  private:\n>  \tint init();\n> +\tvoid enumerateDevices();\n\nI'd name this function createPipelineHandlers() to reflect its purpose,\nas device enumeration is done before calling it.\n\n>  \tvoid cleanup();\n>  \n>  \tCameraManager *cm_;\n> @@ -120,12 +121,20 @@ int CameraManager::Private::init()\n>  \tif (!enumerator_ || enumerator_->enumerate())\n>  \t\treturn -ENODEV;\n>  \n> +\tenumerateDevices();\n> +\n> +\treturn 0;\n> +}\n> +\n> +void CameraManager::Private::enumerateDevices()\n> +{\n>  \t/*\n> -\t * TODO: Try to read handlers and order from configuration\n> +\t * \\todo Try to read handlers and order from configuration\n>  \t * file and only fallback on all handlers if there is no\n>  \t * configuration file.\n>  \t */\n> -\tstd::vector<PipelineHandlerFactory *> &factories = PipelineHandlerFactory::factories();\n> +\tstd::vector<PipelineHandlerFactory *> &factories =\n> +\t\tPipelineHandlerFactory::factories();\n>  \n>  \tfor (PipelineHandlerFactory *factory : factories) {\n>  \t\t/*\n> @@ -144,14 +153,12 @@ int CameraManager::Private::init()\n>  \t\t}\n>  \t}\n>  \n> -\t/* TODO: register hot-plug callback here */\n> -\n> -\treturn 0;\n> +\t/* \\todo register hot-plug callback here */\n>  }\n>  \n>  void CameraManager::Private::cleanup()\n>  {\n> -\t/* TODO: unregister hot-plug callback here */\n> +\t/* \\todo unregister hot-plug callback here */\n\ns/unregister/Unregister/\n\nReviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>\n\n>  \n>  \t/*\n>  \t * Release all references to cameras and pipeline handlers to ensure","headers":{"Return-Path":"<laurent.pinchart@ideasonboard.com>","Received":["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 3BA85600F7\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tSun,  7 Jun 2020 17:53:13 +0200 (CEST)","from pendragon.ideasonboard.com (81-175-216-236.bb.dnainternet.fi\n\t[81.175.216.236])\n\tby perceval.ideasonboard.com (Postfix) with ESMTPSA id A8EA52C9;\n\tSun,  7 Jun 2020 17:53:12 +0200 (CEST)"],"Authentication-Results":"lancelot.ideasonboard.com; dkim=pass (1024-bit key; \n\tunprotected) header.d=ideasonboard.com\n\theader.i=@ideasonboard.com\n\theader.b=\"QTalZyTJ\"; dkim-atps=neutral","DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com;\n\ts=mail; t=1591545192;\n\tbh=QGdPRUp0pf68cZIx9kFSrXZ5iwK/504c5kwprPHbCoE=;\n\th=Date:From:To:Cc:Subject:References:In-Reply-To:From;\n\tb=QTalZyTJt4APnrSyCzcs1JkAAaSfEGSoGTQMYodYdV/ruymWfuffe1akspvuj/UTQ\n\tGocaElqjUNzG5itD1rVGDXJX3GvACX91UZH7Md7NU9ziLB4qijrcTbZlIqgl8+T/Pa\n\tlURIJfVJMhAew1Pt1ze5aaYHXxWVMv3gpekRJv7w=","Date":"Sun, 7 Jun 2020 18:52:53 +0300","From":"Laurent Pinchart <laurent.pinchart@ideasonboard.com>","To":"Umang Jain <email@uajain.com>","Cc":"libcamera-devel@lists.libcamera.org","Message-ID":"<20200607155253.GA22208@pendragon.ideasonboard.com>","References":"<20200521135416.13685-1-email@uajain.com>\n\t<20200521135416.13685-2-email@uajain.com>","MIME-Version":"1.0","Content-Type":"text/plain; charset=utf-8","Content-Disposition":"inline","In-Reply-To":"<20200521135416.13685-2-email@uajain.com>","Subject":"Re: [libcamera-devel] [PATCH v3 1/5] libcamera: camera_manager:\n\tRefactor device enumeration into separate function","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>","X-List-Received-Date":"Sun, 07 Jun 2020 15:53:13 -0000"}}]