From patchwork Wed Jul 8 13:44:07 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Paul Elder X-Patchwork-Id: 8680 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 11068BD792 for ; Wed, 8 Jul 2020 13:44:55 +0000 (UTC) Received: from lancelot.ideasonboard.com (localhost [IPv6:::1]) by lancelot.ideasonboard.com (Postfix) with ESMTP id D08066113A; Wed, 8 Jul 2020 15:44:54 +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="YrpBVaq0"; dkim-atps=neutral Received: from perceval.ideasonboard.com (perceval.ideasonboard.com [213.167.242.64]) by lancelot.ideasonboard.com (Postfix) with ESMTPS id C31736112A for ; Wed, 8 Jul 2020 15:44:53 +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 0224D51B; Wed, 8 Jul 2020 15:44:51 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com; s=mail; t=1594215893; bh=c89MD+LOXeobk9hIKyUv+20dlcY9m/6VtWWHeM7Qy1s=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=YrpBVaq0kuJHk65NWOWyCv2rfmtK3jruEnLDjZiuSJjA/MpWRnbRVE6ljqgeiUQDY Dufhht7KmwrIYdHKaM6uRLUD7uB2PVMzjuWX5LswasY4cI/0kjGAC6f1cgRKpiAkj0 GpukfIN2Nw8WbkJ4Y+zBvWDMFSCtcK96DnBISb/k= From: Paul Elder To: libcamera-devel@lists.libcamera.org Date: Wed, 8 Jul 2020 22:44:07 +0900 Message-Id: <20200708134417.67747-12-paul.elder@ideasonboard.com> X-Mailer: git-send-email 2.27.0 In-Reply-To: <20200708134417.67747-1-paul.elder@ideasonboard.com> References: <20200708134417.67747-1-paul.elder@ideasonboard.com> MIME-Version: 1.0 Subject: [libcamera-devel] [PATCH v4 11/21] 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 --- 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.