From patchwork Sat Jul 4 13:31:31 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Paul Elder X-Patchwork-Id: 8634 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 CD490BD792 for ; Sat, 4 Jul 2020 13:32:22 +0000 (UTC) Received: from lancelot.ideasonboard.com (localhost [IPv6:::1]) by lancelot.ideasonboard.com (Postfix) with ESMTP id 9A41B60E43; Sat, 4 Jul 2020 15:32:22 +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="Z/Rs0BUF"; dkim-atps=neutral Received: from perceval.ideasonboard.com (perceval.ideasonboard.com [213.167.242.64]) by lancelot.ideasonboard.com (Postfix) with ESMTPS id EB56660E1D for ; Sat, 4 Jul 2020 15:32:20 +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 6A9E455B; Sat, 4 Jul 2020 15:32:19 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com; s=mail; t=1593869540; bh=2IX1hEfkyQPDUCMdsaQMM+1pwJgX+AlnnxcElgKGAC4=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Z/Rs0BUFSgv9JqiL/G0McWdf5xzj+Kb3ZXvVu4N+XX01ObzAvFqgFMVavGLGbI5ct qkI7xzYLWn70AiYW4rDGCpIL/SsxLKmK9Up95u3IiyoZleDRlEyv6ssxUNFWzW0U5X F48QuuCEIAt5u/PBAz36BpTniUfue9cmYFILxAek= From: Paul Elder To: libcamera-devel@lists.libcamera.org Date: Sat, 4 Jul 2020 22:31:31 +0900 Message-Id: <20200704133140.1738660-14-paul.elder@ideasonboard.com> X-Mailer: git-send-email 2.27.0 In-Reply-To: <20200704133140.1738660-1-paul.elder@ideasonboard.com> References: <20200704133140.1738660-1-paul.elder@ideasonboard.com> MIME-Version: 1.0 Subject: [libcamera-devel] [PATCH v3 13/22] 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 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..8a6c9c2 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_.size()) + 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.