From patchwork Thu Jul 9 13:28:21 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Paul Elder X-Patchwork-Id: 8724 Return-Path: X-Original-To: parsemail@patchwork.libcamera.org Delivered-To: parsemail@patchwork.libcamera.org Received: from lancelot.ideasonboard.com (lancelot.ideasonboard.com [92.243.16.209]) by patchwork.libcamera.org (Postfix) with ESMTPS id 058DDBD792 for ; Thu, 9 Jul 2020 13:29:13 +0000 (UTC) Received: from lancelot.ideasonboard.com (localhost [IPv6:::1]) by lancelot.ideasonboard.com (Postfix) with ESMTP id C409B61221; Thu, 9 Jul 2020 15:29:12 +0200 (CEST) Authentication-Results: lancelot.ideasonboard.com; dkim=fail reason="signature verification failed" (1024-bit key; unprotected) header.d=ideasonboard.com header.i=@ideasonboard.com header.b="KpTlZn17"; dkim-atps=neutral Received: from perceval.ideasonboard.com (perceval.ideasonboard.com [IPv6:2001:4b98:dc2:55:216:3eff:fef7:d647]) by lancelot.ideasonboard.com (Postfix) with ESMTPS id DF383611BA for ; Thu, 9 Jul 2020 15:29:11 +0200 (CEST) Received: from pyrite.rasen.tech (unknown [IPv6:2400:4051:61:600:2c71:1b79:d06d:5032]) by perceval.ideasonboard.com (Postfix) with ESMTPSA id 238C8525; Thu, 9 Jul 2020 15:29:09 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com; s=mail; t=1594301351; bh=SZ6JKm2SfkqebE7nZSCnGt56qj/+Uqx9h2hx8UxIjds=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=KpTlZn17SKPylTy6xtuXExzTp+rvuHhemjm0hdsrZ4lSRq9st2+IaC7O67ZoCr+5j LIPtwN7MveDVq6OsgG3lb5WelLCXNBIy8HICxtPEcEaj7WxXgYkNti0ffOGOh0a1O/ 6hgcdNM96UCX0yTI+7Bms1ov8yFZRjweXCYFwNXc= From: Paul Elder To: libcamera-devel@lists.libcamera.org Date: Thu, 9 Jul 2020 22:28:21 +0900 Message-Id: <20200709132835.112593-10-paul.elder@ideasonboard.com> X-Mailer: git-send-email 2.27.0 In-Reply-To: <20200709132835.112593-1-paul.elder@ideasonboard.com> References: <20200709132835.112593-1-paul.elder@ideasonboard.com> MIME-Version: 1.0 Subject: [libcamera-devel] [PATCH v5 09/23] libcamera: pipeline_handler: Fatal if registering camera without media devices 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: , Errors-To: libcamera-devel-bounces@lists.libcamera.org Sender: "libcamera-devel" Pipeline handlers must acquire media devices via PipelineHander::acquireMediaDevice so that the media devices can be registered with the pipeline handler, so that they can be automatically added to the devnum map for the v4l2 compatibility layer to use. Die fatally if any camera trying to be registered has not acquired any media devices via acquireMediaDevice. Signed-off-by: Paul Elder Reviewed-by: Laurent Pinchart --- No change in v5 Cosmetic change in v4 No change in v3 --- src/libcamera/pipeline_handler.cpp | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/libcamera/pipeline_handler.cpp b/src/libcamera/pipeline_handler.cpp index de5ca09..ccd45ed 100644 --- a/src/libcamera/pipeline_handler.cpp +++ b/src/libcamera/pipeline_handler.cpp @@ -496,6 +496,10 @@ void PipelineHandler::registerCamera(std::shared_ptr camera, cameraData_[camera.get()] = std::move(data); cameras_.push_back(camera); + if (mediaDevices_.empty()) + LOG(Pipeline, Fatal) + << "Registering camera with no media devices!"; + /* * Walk the entity list and map the devnums of all capture video nodes * to the camera.