From patchwork Wed May 13 17:29:57 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Umang Jain X-Patchwork-Id: 3788 X-Patchwork-Delegate: umang.jain@ideasonboard.com Return-Path: Received: from o1.f.az.sendgrid.net (o1.f.az.sendgrid.net [208.117.55.132]) by lancelot.ideasonboard.com (Postfix) with ESMTPS id BDAD7603DF for ; Wed, 13 May 2020 19:29:59 +0200 (CEST) Authentication-Results: lancelot.ideasonboard.com; dkim=pass (1024-bit key; unprotected) header.d=uajain.com header.i=@uajain.com header.b="lixpZKdg"; dkim-atps=neutral DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=uajain.com; h=from:subject:in-reply-to:references:mime-version:to:cc: content-transfer-encoding:content-type; s=s1; bh=UvYCQMLtSlqyxjipAP34hYFQLE/aEzUVnGGAg2HHXJM=; b=lixpZKdgXtODfgXPBz9ubjrda9mwIqxKDn/LvUNvXGpQmtqdrtfEIUOJMJJOoMs8ey+5 r2yHalQV6QE2wYvBNAXNcFXTTPuFPS2Zlri95PcOIFN4gd36g7ABXVF2Iebay+zVuaWnz2 PSs292q5FGPqnlEJw6SutuZDjq9PjYmUI= Received: by filterdrecv-p3las1-cb48d7cc9-kxd8d with SMTP id filterdrecv-p3las1-cb48d7cc9-kxd8d-20-5EBC2E95-9 2020-05-13 17:29:57.526905451 +0000 UTC m=+4206145.711066577 Received: from mail.uajain.com (unknown) by ismtpd0007p1hnd1.sendgrid.net (SG) with ESMTP id HQRPfDjFSy6OogDvkxUFlg Wed, 13 May 2020 17:29:56.900 +0000 (UTC) From: Umang Jain Date: Wed, 13 May 2020 17:29:57 +0000 (UTC) Message-Id: <20200513172950.72685-2-email@uajain.com> In-Reply-To: <20200513172950.72685-1-email@uajain.com> References: <20200513172950.72685-1-email@uajain.com> Mime-Version: 1.0 X-SG-EID: 1Q40EQ7YGir8a9gjSIAdTjhngY657NMk9ckeo4dbHZDiOpywc/L3L9rFqlwE4KPcBLpXFhl3+P87RHKL8hWvbAoSNwQxsRzqeXhxRQRxuSi98fIkRX5KVdUyG6rC+ldV/q3cPnYJDJaQcRICEmtETcLIxNdVeM819TGq5t7q5fhdlbJX8huiFKd1beiPIV56ZLjRgjo8mXaCRy7XU2U4Q3hwcEeBosa/pZrd/EYv3T+vJ+auaGAL8c1qeasLRlWCV8mCAJ65ya3/KkrGEN0+dA== To: libcamera-devel Subject: [libcamera-devel] [PATCH v2 1/5] libcamera: camera_manager: Refactor device enumeration into separate function X-BeenThere: libcamera-devel@lists.libcamera.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 13 May 2020 17:30:01 -0000 This commit introduces no functional changes. Split device enumeration code into a separate function, so that the function can be re-used for upcoming hotplug functionality in subsequent commits. Also, fixup correct tag for \todo. Signed-off-by: Umang Jain --- src/libcamera/camera_manager.cpp | 20 ++++++++++++++------ 1 file changed, 14 insertions(+), 6 deletions(-) diff --git a/src/libcamera/camera_manager.cpp b/src/libcamera/camera_manager.cpp index fddf734..1579ad4 100644 --- a/src/libcamera/camera_manager.cpp +++ b/src/libcamera/camera_manager.cpp @@ -53,6 +53,7 @@ protected: private: int init(); + void enumerateDevices(); void cleanup(); CameraManager *cm_; @@ -121,11 +122,20 @@ int CameraManager::Private::init() return -ENODEV; /* - * TODO: Try to read handlers and order from configuration + * \todo Try to read handlers and order from configuration * file and only fallback on all handlers if there is no * configuration file. */ - std::vector &factories = PipelineHandlerFactory::factories(); + + enumerateDevices(); + + return 0; +} + +void CameraManager::Private::enumerateDevices() +{ + std::vector &factories = + PipelineHandlerFactory::factories(); for (PipelineHandlerFactory *factory : factories) { /* @@ -144,14 +154,12 @@ int CameraManager::Private::init() } } - /* TODO: register hot-plug callback here */ - - return 0; + /* \todo register hot-plug callback here */ } void CameraManager::Private::cleanup() { - /* TODO: unregister hot-plug callback here */ + /* \todo unregister hot-plug callback here */ /* * Release all references to cameras and pipeline handlers to ensure