[libcamera-devel] [PATCH] android: Check exposure time range for manual sensor capability
Paul Elder
paul.elder at ideasonboard.com
Mon Aug 23 12:32:58 CEST 2021
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]) {
+ 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
--
2.27.0
More information about the libcamera-devel
mailing list