[libcamera-devel] [PATCH] android: Check exposure time range for manual sensor capability
Laurent Pinchart
laurent.pinchart at ideasonboard.com
Tue Aug 24 02:33:08 CEST 2021
Hi Paul,
Thank you for the patch.
On Mon, Aug 23, 2021 at 07:32:58PM +0900, Paul Elder wrote:
> In the manual sensor capability validator, add a check for the exposure
> time range.
>
> Signed-off-by: Paul Elder <paul.elder at ideasonboard.com>
> ---
> 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<U> 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<uint8_t>(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]) {
You know that C++ has a > operator ? :-) It would match the following
text:
if (is larger than 100us)
"must be no larger than 100";
With this addressed,
Reviewed-by: Laurent Pinchart <laurent.pinchart at ideasonboard.com>
> + 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
--
Regards,
Laurent Pinchart
More information about the libcamera-devel
mailing list