[libcamera-devel,v5,10/10] android: libcamera: add useful debug prints
diff mbox series

Message ID 20221028031726.4849-11-nicholas@rothemail.net
State Accepted
Headers show
Series
  • [libcamera-devel,v5,01/10] ipa: workaround libcxx duration limitation
Related show

Commit Message

Nicolas Dufresne via libcamera-devel Oct. 28, 2022, 3:17 a.m. UTC
From: Nicholas Roth <nicholas@rothemail.net>

I identified opportunities to make libcamera's log output easier to
understand while working to get it working on my Android device as a
HAL. These additional logging statements came out of that and will
hopefully prove useful to Android distribution maintainers with the same
goal as mine and to users who attempt to debug tools like Waydroid.

Signed-off-by: Nicholas Roth <nicholas@rothemail.net>
---
 src/android/camera_capabilities.cpp | 12 +++++++++---
 src/android/camera_hal_manager.cpp  |  3 ++-
 2 files changed, 11 insertions(+), 4 deletions(-)

Comments

Kieran Bingham Oct. 28, 2022, 10:33 a.m. UTC | #1
Quoting Nicholas Roth via libcamera-devel (2022-10-28 04:17:26)
> From: Nicholas Roth <nicholas@rothemail.net>
> 
> I identified opportunities to make libcamera's log output easier to
> understand while working to get it working on my Android device as a
> HAL. These additional logging statements came out of that and will
> hopefully prove useful to Android distribution maintainers with the same
> goal as mine and to users who attempt to debug tools like Waydroid.
> 
> Signed-off-by: Nicholas Roth <nicholas@rothemail.net>

This looks fine to me.


Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com>

> ---
>  src/android/camera_capabilities.cpp | 12 +++++++++---
>  src/android/camera_hal_manager.cpp  |  3 ++-
>  2 files changed, 11 insertions(+), 4 deletions(-)
> 
> diff --git a/src/android/camera_capabilities.cpp b/src/android/camera_capabilities.cpp
> index 64bd8dde..ef0d10d0 100644
> --- a/src/android/camera_capabilities.cpp
> +++ b/src/android/camera_capabilities.cpp
> @@ -374,14 +374,20 @@ void CameraCapabilities::computeHwLevel(
>         camera_metadata_enum_android_info_supported_hardware_level
>                 hwLevel = ANDROID_INFO_SUPPORTED_HARDWARE_LEVEL_FULL;
>  
> -       if (!caps.count(ANDROID_REQUEST_AVAILABLE_CAPABILITIES_MANUAL_SENSOR))
> +       if (!caps.count(ANDROID_REQUEST_AVAILABLE_CAPABILITIES_MANUAL_SENSOR)) {
> +               LOG(HAL, Info) << noFull << "missing manual sensor";
>                 hwLevel = ANDROID_INFO_SUPPORTED_HARDWARE_LEVEL_LIMITED;
> +       }
>  
> -       if (!caps.count(ANDROID_REQUEST_AVAILABLE_CAPABILITIES_MANUAL_POST_PROCESSING))
> +       if (!caps.count(ANDROID_REQUEST_AVAILABLE_CAPABILITIES_MANUAL_POST_PROCESSING)) {
> +               LOG(HAL, Info) << noFull << "missing manual post processing";
>                 hwLevel = ANDROID_INFO_SUPPORTED_HARDWARE_LEVEL_LIMITED;
> +       }
>  
> -       if (!caps.count(ANDROID_REQUEST_AVAILABLE_CAPABILITIES_BURST_CAPTURE))
> +       if (!caps.count(ANDROID_REQUEST_AVAILABLE_CAPABILITIES_BURST_CAPTURE)) {
> +               LOG(HAL, Info) << noFull << "missing burst capture";
>                 hwLevel = ANDROID_INFO_SUPPORTED_HARDWARE_LEVEL_LIMITED;
> +       }
>  
>         found = staticMetadata_->getEntry(ANDROID_SYNC_MAX_LATENCY, &entry);
>         if (!found || *entry.data.i32 != 0) {
> diff --git a/src/android/camera_hal_manager.cpp b/src/android/camera_hal_manager.cpp
> index 7512cc4e..b229e2d5 100644
> --- a/src/android/camera_hal_manager.cpp
> +++ b/src/android/camera_hal_manager.cpp
> @@ -140,7 +140,8 @@ void CameraHalManager::cameraAdded(std::shared_ptr<Camera> cam)
>          */
>         if (!isCameraExternal && !halConfig_.exists()) {
>                 LOG(HAL, Error)
> -                       << "HAL configuration file is mandatory for internal cameras";
> +                       << "HAL configuration file is mandatory for internal cameras."
> +                       << " Camera " << cam->id() << "failed to load";
>                 return;
>         }
>  
> -- 
> 2.34.1
>
Jacopo Mondi Oct. 28, 2022, 11:01 a.m. UTC | #2
Hi

On Thu, Oct 27, 2022 at 10:17:26PM -0500, Nicholas Roth via libcamera-devel wrote:
> From: Nicholas Roth <nicholas@rothemail.net>
>
> I identified opportunities to make libcamera's log output easier to
> understand while working to get it working on my Android device as a
> HAL. These additional logging statements came out of that and will
> hopefully prove useful to Android distribution maintainers with the same
> goal as mine and to users who attempt to debug tools like Waydroid.
>
> Signed-off-by: Nicholas Roth <nicholas@rothemail.net>

Reviewed-by: Jacopo Mondi <jacopo@jmondi.org>

Thanks
  j

> ---
>  src/android/camera_capabilities.cpp | 12 +++++++++---
>  src/android/camera_hal_manager.cpp  |  3 ++-
>  2 files changed, 11 insertions(+), 4 deletions(-)
>
> diff --git a/src/android/camera_capabilities.cpp b/src/android/camera_capabilities.cpp
> index 64bd8dde..ef0d10d0 100644
> --- a/src/android/camera_capabilities.cpp
> +++ b/src/android/camera_capabilities.cpp
> @@ -374,14 +374,20 @@ void CameraCapabilities::computeHwLevel(
>  	camera_metadata_enum_android_info_supported_hardware_level
>  		hwLevel = ANDROID_INFO_SUPPORTED_HARDWARE_LEVEL_FULL;
>
> -	if (!caps.count(ANDROID_REQUEST_AVAILABLE_CAPABILITIES_MANUAL_SENSOR))
> +	if (!caps.count(ANDROID_REQUEST_AVAILABLE_CAPABILITIES_MANUAL_SENSOR)) {
> +		LOG(HAL, Info) << noFull << "missing manual sensor";
>  		hwLevel = ANDROID_INFO_SUPPORTED_HARDWARE_LEVEL_LIMITED;
> +	}
>
> -	if (!caps.count(ANDROID_REQUEST_AVAILABLE_CAPABILITIES_MANUAL_POST_PROCESSING))
> +	if (!caps.count(ANDROID_REQUEST_AVAILABLE_CAPABILITIES_MANUAL_POST_PROCESSING)) {
> +		LOG(HAL, Info) << noFull << "missing manual post processing";
>  		hwLevel = ANDROID_INFO_SUPPORTED_HARDWARE_LEVEL_LIMITED;
> +	}
>
> -	if (!caps.count(ANDROID_REQUEST_AVAILABLE_CAPABILITIES_BURST_CAPTURE))
> +	if (!caps.count(ANDROID_REQUEST_AVAILABLE_CAPABILITIES_BURST_CAPTURE)) {
> +		LOG(HAL, Info) << noFull << "missing burst capture";
>  		hwLevel = ANDROID_INFO_SUPPORTED_HARDWARE_LEVEL_LIMITED;
> +	}
>
>  	found = staticMetadata_->getEntry(ANDROID_SYNC_MAX_LATENCY, &entry);
>  	if (!found || *entry.data.i32 != 0) {
> diff --git a/src/android/camera_hal_manager.cpp b/src/android/camera_hal_manager.cpp
> index 7512cc4e..b229e2d5 100644
> --- a/src/android/camera_hal_manager.cpp
> +++ b/src/android/camera_hal_manager.cpp
> @@ -140,7 +140,8 @@ void CameraHalManager::cameraAdded(std::shared_ptr<Camera> cam)
>  	 */
>  	if (!isCameraExternal && !halConfig_.exists()) {
>  		LOG(HAL, Error)
> -			<< "HAL configuration file is mandatory for internal cameras";
> +			<< "HAL configuration file is mandatory for internal cameras."
> +			<< " Camera " << cam->id() << "failed to load";
>  		return;
>  	}
>
> --
> 2.34.1
>

Patch
diff mbox series

diff --git a/src/android/camera_capabilities.cpp b/src/android/camera_capabilities.cpp
index 64bd8dde..ef0d10d0 100644
--- a/src/android/camera_capabilities.cpp
+++ b/src/android/camera_capabilities.cpp
@@ -374,14 +374,20 @@  void CameraCapabilities::computeHwLevel(
 	camera_metadata_enum_android_info_supported_hardware_level
 		hwLevel = ANDROID_INFO_SUPPORTED_HARDWARE_LEVEL_FULL;
 
-	if (!caps.count(ANDROID_REQUEST_AVAILABLE_CAPABILITIES_MANUAL_SENSOR))
+	if (!caps.count(ANDROID_REQUEST_AVAILABLE_CAPABILITIES_MANUAL_SENSOR)) {
+		LOG(HAL, Info) << noFull << "missing manual sensor";
 		hwLevel = ANDROID_INFO_SUPPORTED_HARDWARE_LEVEL_LIMITED;
+	}
 
-	if (!caps.count(ANDROID_REQUEST_AVAILABLE_CAPABILITIES_MANUAL_POST_PROCESSING))
+	if (!caps.count(ANDROID_REQUEST_AVAILABLE_CAPABILITIES_MANUAL_POST_PROCESSING)) {
+		LOG(HAL, Info) << noFull << "missing manual post processing";
 		hwLevel = ANDROID_INFO_SUPPORTED_HARDWARE_LEVEL_LIMITED;
+	}
 
-	if (!caps.count(ANDROID_REQUEST_AVAILABLE_CAPABILITIES_BURST_CAPTURE))
+	if (!caps.count(ANDROID_REQUEST_AVAILABLE_CAPABILITIES_BURST_CAPTURE)) {
+		LOG(HAL, Info) << noFull << "missing burst capture";
 		hwLevel = ANDROID_INFO_SUPPORTED_HARDWARE_LEVEL_LIMITED;
+	}
 
 	found = staticMetadata_->getEntry(ANDROID_SYNC_MAX_LATENCY, &entry);
 	if (!found || *entry.data.i32 != 0) {
diff --git a/src/android/camera_hal_manager.cpp b/src/android/camera_hal_manager.cpp
index 7512cc4e..b229e2d5 100644
--- a/src/android/camera_hal_manager.cpp
+++ b/src/android/camera_hal_manager.cpp
@@ -140,7 +140,8 @@  void CameraHalManager::cameraAdded(std::shared_ptr<Camera> cam)
 	 */
 	if (!isCameraExternal && !halConfig_.exists()) {
 		LOG(HAL, Error)
-			<< "HAL configuration file is mandatory for internal cameras";
+			<< "HAL configuration file is mandatory for internal cameras."
+			<< " Camera " << cam->id() << "failed to load";
 		return;
 	}