[libcamera-devel,v4,5/6] libcamera: camera_sensor: Do not default 'rotation'
diff mbox series

Message ID 20201230230603.123486-6-jacopo@jmondi.org
State Superseded
Headers show
Series
  • libcamera: camera_sensor: Make validation more strict
Related show

Commit Message

Jacopo Mondi Dec. 30, 2020, 11:06 p.m. UTC
The 'rotation' property is not critical. Only register it if the
sensor driver reports it.

Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Signed-off-by: Jacopo Mondi <jacopo@jmondi.org>
---
 src/libcamera/camera_sensor.cpp | 8 +++-----
 1 file changed, 3 insertions(+), 5 deletions(-)

Comments

Niklas Söderlund Jan. 4, 2021, 1:22 p.m. UTC | #1
Hi Jacopo,

Thanks for your patch.

On 2020-12-31 00:06:02 +0100, Jacopo Mondi wrote:
> The 'rotation' property is not critical. Only register it if the
> sensor driver reports it.
> 
> Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
> Signed-off-by: Jacopo Mondi <jacopo@jmondi.org>

Reviewed-by: Niklas Söderlund <niklas.soderlund@ragnatech.se>

> ---
>  src/libcamera/camera_sensor.cpp | 8 +++-----
>  1 file changed, 3 insertions(+), 5 deletions(-)
> 
> diff --git a/src/libcamera/camera_sensor.cpp b/src/libcamera/camera_sensor.cpp
> index 98207cde71f5..ae7b33bddeab 100644
> --- a/src/libcamera/camera_sensor.cpp
> +++ b/src/libcamera/camera_sensor.cpp
> @@ -374,13 +374,11 @@ int CameraSensor::initProperties()
>  	}
>  	properties_.set(properties::Location, propertyValue);
>  
> -	/* Camera Rotation: default is 0 degrees. */
>  	const auto &rotationControl = controls.find(V4L2_CID_CAMERA_SENSOR_ROTATION);
> -	if (rotationControl != controls.end())
> +	if (rotationControl != controls.end()) {
>  		propertyValue = rotationControl->second.def().get<int32_t>();
> -	else
> -		propertyValue = 0;
> -	properties_.set(properties::Rotation, propertyValue);
> +		properties_.set(properties::Rotation, propertyValue);
> +	}
>  
>  	properties_.set(properties::PixelArraySize, pixelArraySize_);
>  	properties_.set(properties::PixelArrayActiveAreas, { activeArea_ });
> -- 
> 2.29.2
> 
> _______________________________________________
> libcamera-devel mailing list
> libcamera-devel@lists.libcamera.org
> https://lists.libcamera.org/listinfo/libcamera-devel

Patch
diff mbox series

diff --git a/src/libcamera/camera_sensor.cpp b/src/libcamera/camera_sensor.cpp
index 98207cde71f5..ae7b33bddeab 100644
--- a/src/libcamera/camera_sensor.cpp
+++ b/src/libcamera/camera_sensor.cpp
@@ -374,13 +374,11 @@  int CameraSensor::initProperties()
 	}
 	properties_.set(properties::Location, propertyValue);
 
-	/* Camera Rotation: default is 0 degrees. */
 	const auto &rotationControl = controls.find(V4L2_CID_CAMERA_SENSOR_ROTATION);
-	if (rotationControl != controls.end())
+	if (rotationControl != controls.end()) {
 		propertyValue = rotationControl->second.def().get<int32_t>();
-	else
-		propertyValue = 0;
-	properties_.set(properties::Rotation, propertyValue);
+		properties_.set(properties::Rotation, propertyValue);
+	}
 
 	properties_.set(properties::PixelArraySize, pixelArraySize_);
 	properties_.set(properties::PixelArrayActiveAreas, { activeArea_ });