[libcamera-devel,v2,3/4] android: camera_device: Default the camera location to Front
diff mbox series

Message ID 20210212054816.53561-4-paul.elder@ideasonboard.com
State Changes Requested
Headers show
Series
  • Add Unknown camera location
Related show

Commit Message

Paul Elder Feb. 12, 2021, 5:48 a.m. UTC
Since the libcamera camera now has an Unknown location, we can know if
the camera's location is actually unknown. In this case, set the android
camera location to front, as some systems may not support external
cameras.

This allows the following CTS test to pass:
- android.hardware.camera2.cts.CameraManagerTest#testCameraManagerGetDeviceIdList

Signed-off-by: Paul Elder <paul.elder@ideasonboard.com>
Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>

---
No change in v2
---
 src/android/camera_device.cpp | 3 +++
 1 file changed, 3 insertions(+)

Comments

Jacopo Mondi Feb. 12, 2021, 9:40 a.m. UTC | #1
Hi Paul,

On Fri, Feb 12, 2021 at 02:48:15PM +0900, Paul Elder wrote:
> Since the libcamera camera now has an Unknown location, we can know if
> the camera's location is actually unknown. In this case, set the android
> camera location to front, as some systems may not support external
> cameras.
>
> This allows the following CTS test to pass:
> - android.hardware.camera2.cts.CameraManagerTest#testCameraManagerGetDeviceIdList
>
> Signed-off-by: Paul Elder <paul.elder@ideasonboard.com>
> Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
> Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
>
> ---
> No change in v2
> ---
>  src/android/camera_device.cpp | 3 +++
>  1 file changed, 3 insertions(+)
>
> diff --git a/src/android/camera_device.cpp b/src/android/camera_device.cpp
> index 1e2a5b5f..3d815d21 100644
> --- a/src/android/camera_device.cpp
> +++ b/src/android/camera_device.cpp
> @@ -407,6 +407,9 @@ int CameraDevice::initialize()
>  		case properties::CameraLocationExternal:
>  			facing_ = CAMERA_FACING_EXTERNAL;
>  			break;
> +		case properties::CameraLocationUnknown:

I would LOG(Warn) or Info that we are defaulting this.
Once we have support for a config file, I presume the information for
the HAL could come from there as well.

This is good in the meantime:
Reviewed-by: Jacopo Mondi <jacopo@jmondi.org>

Thanks
  j

> +			facing_ = CAMERA_FACING_FRONT;
> +			break;
>  		}
>  	}
>
> --
> 2.27.0
>
> _______________________________________________
> libcamera-devel mailing list
> libcamera-devel@lists.libcamera.org
> https://lists.libcamera.org/listinfo/libcamera-devel

Patch
diff mbox series

diff --git a/src/android/camera_device.cpp b/src/android/camera_device.cpp
index 1e2a5b5f..3d815d21 100644
--- a/src/android/camera_device.cpp
+++ b/src/android/camera_device.cpp
@@ -407,6 +407,9 @@  int CameraDevice::initialize()
 		case properties::CameraLocationExternal:
 			facing_ = CAMERA_FACING_EXTERNAL;
 			break;
+		case properties::CameraLocationUnknown:
+			facing_ = CAMERA_FACING_FRONT;
+			break;
 		}
 	}