From patchwork Thu May 21 13:54:23 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Umang Jain X-Patchwork-Id: 3831 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 1231F603D9 for ; Thu, 21 May 2020 15:54:24 +0200 (CEST) Authentication-Results: lancelot.ideasonboard.com; dkim=pass (1024-bit key; unprotected) header.d=uajain.com header.i=@uajain.com header.b="LNO1b5uf"; 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=wn+gdJqcuE9rglJzbT/jTFN06B0QGnuQfW53WggZ38o=; b=LNO1b5ufanmHUtu0RI3Gb85ns6yVeTG+r+hzIniZqqtEGJM0UvNLSV09Bo0fA4MbyUKd dOes8Dy+CkaJv4V/7gnYC9sx12DxEg1fY5jAQ4QS27pTFCQ3Wxc8ihyl6WQBWViNRvYkq2 inOdae1I7vFTQkEZInug1bhrvwkfQRDcs= Received: by filterdrecv-p3iad2-8ddf98858-z54vx with SMTP id filterdrecv-p3iad2-8ddf98858-z54vx-21-5EC6880F-2C 2020-05-21 13:54:23.393741462 +0000 UTC m=+4884413.876381335 Received: from mail.uajain.com (unknown) by ismtpd0007p1hnd1.sendgrid.net (SG) with ESMTP id DeCBve0bRmiF6NygHMSz7A for ; Thu, 21 May 2020 13:54:23.027 +0000 (UTC) From: Umang Jain Date: Thu, 21 May 2020 13:54:23 +0000 (UTC) Message-Id: <20200521135416.13685-2-email@uajain.com> In-Reply-To: <20200521135416.13685-1-email@uajain.com> References: <20200521135416.13685-1-email@uajain.com> Mime-Version: 1.0 X-SG-EID: 1Q40EQ7YGir8a9gjSIAdTjhngY657NMk9ckeo4dbHZDiOpywc/L3L9rFqlwE4KPcu4OVMbZ0DPo4pBBcZhwsTNJljPL69hOm6sh0zLvK/f8YcU6EYwcaDRtEIrRA1LqGi7+lhb+/Q81m6Tapah73poiLqsoJ4Qk0QyAEO35p9RnhyRGzKAZ+xwV4TFFEFVIZdwRNZA7ANIvy5+ZaVtmPutVZE9dIdENxy+63Yu/o2XQ4gw8AjCwKSvTVTW9tHii5myKb8ZwrHOJdWA03RkbRsA== To: libcamera-devel@lists.libcamera.org Subject: [libcamera-devel] [PATCH v3 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: Thu, 21 May 2020 13:54:27 -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 Reviewed-by: Laurent Pinchart --- src/libcamera/camera_manager.cpp | 19 +++++++++++++------ 1 file changed, 13 insertions(+), 6 deletions(-) diff --git a/src/libcamera/camera_manager.cpp b/src/libcamera/camera_manager.cpp index 849377a..8d9cb02 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_; @@ -120,12 +121,20 @@ int CameraManager::Private::init() if (!enumerator_ || enumerator_->enumerate()) return -ENODEV; + enumerateDevices(); + + return 0; +} + +void CameraManager::Private::enumerateDevices() +{ /* - * 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(); + std::vector &factories = + PipelineHandlerFactory::factories(); for (PipelineHandlerFactory *factory : factories) { /* @@ -144,14 +153,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