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

Message ID 20201230180120.78407-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, 6:01 p.m. UTC
The 'rotation' property is not critical. Only register if the
sensor driver reports it.

Signed-off-by: Jacopo Mondi <jacopo@jmondi.org>
---
 src/libcamera/camera_sensor.cpp | 7 +------
 1 file changed, 1 insertion(+), 6 deletions(-)

Comments

Laurent Pinchart Dec. 30, 2020, 8:15 p.m. UTC | #1
Hi Jacopo,

Thank you for the patch.

On Wed, Dec 30, 2020 at 07:01:19PM +0100, Jacopo Mondi wrote:
> The 'rotation' property is not critical. Only register if the

s/register/register it/

> sensor driver reports it.
> 
> Signed-off-by: Jacopo Mondi <jacopo@jmondi.org>

Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>

> ---
>  src/libcamera/camera_sensor.cpp | 7 +------
>  1 file changed, 1 insertion(+), 6 deletions(-)
> 
> diff --git a/src/libcamera/camera_sensor.cpp b/src/libcamera/camera_sensor.cpp
> index 1a316da45511..f7b20b396914 100644
> --- a/src/libcamera/camera_sensor.cpp
> +++ b/src/libcamera/camera_sensor.cpp
> @@ -379,16 +379,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()) {
>  		propertyValue = rotationControl->second.def().get<int32_t>();
> -	} else {
> -		propertyValue = 0;
> -		LOG(CameraSensor, Debug)
> -			<< "Rotation property defaulted to 0 degrees";
> +		properties_.set(properties::Rotation, propertyValue);
>  	}
> -	properties_.set(properties::Rotation, propertyValue);
>  
>  	properties_.set(properties::PixelArraySize, pixelArraySize_);
>  	properties_.set(properties::PixelArrayActiveAreas, { activeAreaSize_ });

Patch
diff mbox series

diff --git a/src/libcamera/camera_sensor.cpp b/src/libcamera/camera_sensor.cpp
index 1a316da45511..f7b20b396914 100644
--- a/src/libcamera/camera_sensor.cpp
+++ b/src/libcamera/camera_sensor.cpp
@@ -379,16 +379,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()) {
 		propertyValue = rotationControl->second.def().get<int32_t>();
-	} else {
-		propertyValue = 0;
-		LOG(CameraSensor, Debug)
-			<< "Rotation property defaulted to 0 degrees";
+		properties_.set(properties::Rotation, propertyValue);
 	}
-	properties_.set(properties::Rotation, propertyValue);
 
 	properties_.set(properties::PixelArraySize, pixelArraySize_);
 	properties_.set(properties::PixelArrayActiveAreas, { activeAreaSize_ });