From patchwork Mon Aug 23 10:32:58 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Paul Elder X-Patchwork-Id: 13430 X-Patchwork-Delegate: paul.elder@ideasonboard.com 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 2AAE8BD87D for ; Mon, 23 Aug 2021 10:33:13 +0000 (UTC) Received: from lancelot.ideasonboard.com (localhost [IPv6:::1]) by lancelot.ideasonboard.com (Postfix) with ESMTP id 94BF26025B; Mon, 23 Aug 2021 12:33: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="acwRLOUk"; 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 545546025B for ; Mon, 23 Aug 2021 12:33: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 E81922A5; Mon, 23 Aug 2021 12:33:09 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com; s=mail; t=1629714791; bh=pR+kH8zGSuwHZr3+ytOomLdV/zzpCbPJ5gjc+94BHss=; h=From:To:Cc:Subject:Date:From; b=acwRLOUkU7FtMgetc+wiRgR3QlilHnAIFx4yf6fxtdLhlBt4D7zEIznRTR7B3xRfB Wwd17EAbi6nryFmM5JlJZPaXpaB0Aokl7U9fHF9COaVbppAMzQWMRoP4PstMDOZtkJ uZgRKUZWL8Knm9N5VzBVDbAwY9kJ+oHbQkbZIsx8= From: Paul Elder To: libcamera-devel@lists.libcamera.org Date: Mon, 23 Aug 2021 19:32:58 +0900 Message-Id: <20210823103258.1583287-1-paul.elder@ideasonboard.com> X-Mailer: git-send-email 2.27.0 MIME-Version: 1.0 Subject: [libcamera-devel] [PATCH] android: Check exposure time range for manual sensor capability 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" In the manual sensor capability validator, add a check for the exposure time range. Signed-off-by: Paul Elder Reviewed-by: Laurent Pinchart --- src/android/camera_capabilities.cpp | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) diff --git a/src/android/camera_capabilities.cpp b/src/android/camera_capabilities.cpp index bd661675..5b560b4f 100644 --- a/src/android/camera_capabilities.cpp +++ b/src/android/camera_capabilities.cpp @@ -217,6 +217,8 @@ std::vector setMetadata(CameraMetadata *metadata, uint32_t tag, bool CameraCapabilities::validateManualSensorCapability() { + camera_metadata_ro_entry_t entry; + const char *noMode = "Manual sensor capability unavailable: "; if (!staticMetadata_->entryContains(ANDROID_CONTROL_AE_AVAILABLE_MODES, @@ -231,6 +233,26 @@ bool CameraCapabilities::validateManualSensorCapability() return false; } + if (!staticMetadata_->hasEntry(ANDROID_SENSOR_INFO_EXPOSURE_TIME_RANGE)) { + LOG(HAL, Info) << noMode << "missing exposure time range"; + return false; + } + + staticMetadata_->getEntry(ANDROID_SENSOR_INFO_EXPOSURE_TIME_RANGE, &entry); + if (100000 < entry.data.i32[0]) { + LOG(HAL, Info) + << noMode + << "exposure time range minimum must be no larger than 100us"; + return false; + } + + if (entry.data.i32[1] < 100000000) { + LOG(HAL, Info) + << noMode + << "exposure time range maximum must be no smaller than 100ms"; + return false; + } + /* * \todo Return true here after we satisfy all the requirements: * https://developer.android.com/reference/android/hardware/camera2/CameraMetadata#REQUEST_AVAILABLE_CAPABILITIES_MANUAL_SENSOR