From patchwork Tue Feb 26 02:18:57 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Niklas_S=C3=B6derlund?= X-Patchwork-Id: 629 Return-Path: Received: from bin-mail-out-06.binero.net (bin-mail-out-06.binero.net [195.74.38.229]) by lancelot.ideasonboard.com (Postfix) with ESMTPS id A1ED0610B7 for ; Tue, 26 Feb 2019 03:19:30 +0100 (CET) X-Halon-ID: f22da30a-396c-11e9-985a-005056917f90 Authorized-sender: niklas@soderlund.pp.se Received: from bismarck.berto.se (unknown [89.233.230.99]) by bin-vsp-out-02.atm.binero.net (Halon) with ESMTPA id f22da30a-396c-11e9-985a-005056917f90; Tue, 26 Feb 2019 03:19:29 +0100 (CET) From: =?utf-8?q?Niklas_S=C3=B6derlund?= To: libcamera-devel@lists.libcamera.org Date: Tue, 26 Feb 2019 03:18:57 +0100 Message-Id: <20190226021857.28255-9-niklas.soderlund@ragnatech.se> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20190226021857.28255-1-niklas.soderlund@ragnatech.se> References: <20190226021857.28255-1-niklas.soderlund@ragnatech.se> MIME-Version: 1.0 Subject: [libcamera-devel] [PATCH 8/8] libcamera: camera: make sure camera is configured before starting X-BeenThere: libcamera-devel@lists.libcamera.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 26 Feb 2019 02:19:30 -0000 If the camera is not configured there is little use to start it. Add a check to make sure the camera is configured before it's started. Signed-off-by: Niklas Söderlund Reviewed-by: Jacopo Mondi --- src/libcamera/camera.cpp | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/src/libcamera/camera.cpp b/src/libcamera/camera.cpp index ba8638009992170f..cbc34599d25e5ed5 100644 --- a/src/libcamera/camera.cpp +++ b/src/libcamera/camera.cpp @@ -423,12 +423,19 @@ int Camera::queueRequest(Request *request) * * \return 0 on success or a negative error code * \retval -EACCES The camera is not in a state where it can be started. + * \retval -EINVAL The camera is not configured. */ int Camera::start() { if (!stateIs(Acquired)) return -EACCES; + if (activeStreams_.empty()) { + LOG(Camera, Error) + << "Can't start camera without configuration"; + return -EINVAL; + } + LOG(Camera, Debug) << "Starting capture"; int ret = pipe_->start(this);