From patchwork Tue Jun 16 13:12:37 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Paul Elder X-Patchwork-Id: 4052 Return-Path: Received: from perceval.ideasonboard.com (perceval.ideasonboard.com [213.167.242.64]) by lancelot.ideasonboard.com (Postfix) with ESMTPS id 6E22361F72 for ; Tue, 16 Jun 2020 15:13:15 +0200 (CEST) Authentication-Results: lancelot.ideasonboard.com; dkim=pass (1024-bit key; unprotected) header.d=ideasonboard.com header.i=@ideasonboard.com header.b="rijpeSy5"; dkim-atps=neutral Received: from jade.flets-east.jp (unknown [IPv6:2400:4051:61:600:2807:bdfa:f6a:8e53]) by perceval.ideasonboard.com (Postfix) with ESMTPSA id 00D4DF9; Tue, 16 Jun 2020 15:13:13 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com; s=mail; t=1592313195; bh=X6Y22/HXPaFaIt3DLstO462rDuQfw/K1Wx07VMwjTHg=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=rijpeSy5wCwSAZWsMTYkAyMu3WpA936d5sogAOyvizDxSaqkJU1BJTiLC/7WvLeoF ovtYwBGTtXj5GcuRAV//GUco4YYypkvj6kb0KcZQlPNKFRo/PiocoVkHhg+IzobvoP 0FEZb87aWKJE00rnPvXD01zwvazo6OEbxDv8fgDg= From: Paul Elder To: libcamera-devel@lists.libcamera.org Date: Tue, 16 Jun 2020 22:12:37 +0900 Message-Id: <20200616131244.70308-9-paul.elder@ideasonboard.com> X-Mailer: git-send-email 2.27.0 In-Reply-To: <20200616131244.70308-1-paul.elder@ideasonboard.com> References: <20200616131244.70308-1-paul.elder@ideasonboard.com> MIME-Version: 1.0 Subject: [libcamera-devel] [PATCH 08/15] v4l2: v4l2_camera: Re-validate configuration after adjusted 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: Tue, 16 Jun 2020 13:13:16 -0000 If the camera configuration has been adjusted, validate it again to ensure that it's valid, before configuring the camera with it. Signed-off-by: Paul Elder --- src/v4l2/v4l2_camera.cpp | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/src/v4l2/v4l2_camera.cpp b/src/v4l2/v4l2_camera.cpp index 2557320..fdbf461 100644 --- a/src/v4l2/v4l2_camera.cpp +++ b/src/v4l2/v4l2_camera.cpp @@ -119,11 +119,18 @@ int V4L2Camera::configure(StreamConfiguration *streamConfigOut, LOG(V4L2Compat, Debug) << "Configuration invalid"; return -EINVAL; } - if (validation == CameraConfiguration::Adjusted) + if (validation == CameraConfiguration::Adjusted) { LOG(V4L2Compat, Debug) << "Configuration adjusted"; + validation = config_->validate(); + if (validation != CameraConfiguration::Valid) { + LOG(V4L2Compat, Error) + << "Configuration adjusted but not valid"; + return -EINVAL; + } + } - LOG(V4L2Compat, Debug) << "Validated configuration is: " - << streamConfig.toString(); + LOG(V4L2Compat, Debug) + << "Validated configuration is: " << streamConfig.toString(); int ret = camera_->configure(config_.get()); if (ret < 0)