[libcamera-devel] [PATCH] libcamera: camera_manager: Return EBUSY if enumerator exists

Niklas Söderlund niklas.soderlund at ragnatech.se
Mon Jan 21 17:01:40 CET 2019


Hi Kieran,

On 2019-01-21 11:41:26 +0000, Kieran Bingham wrote:
> In the case that someone calls CameraManager::start() and it has already
> started/enumerated, instead of returning -ENODEV, return -EBUSY.
> 
> Signed-off-by: Kieran Bingham <kieran.bingham at ideasonboard.com>

While working with this on the cam utility it struck me, should we 
return negative error codes from CameraManager? This faces the 
application and it might be unexpected for it to receive a negative 
error.

In any case this change matches our documentation and is a good change.

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

> ---
>  src/libcamera/camera_manager.cpp | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/src/libcamera/camera_manager.cpp b/src/libcamera/camera_manager.cpp
> index d76eaa7ace86..21cb36dcb9b5 100644
> --- a/src/libcamera/camera_manager.cpp
> +++ b/src/libcamera/camera_manager.cpp
> @@ -76,7 +76,7 @@ CameraManager::~CameraManager()
>  int CameraManager::start()
>  {
>  	if (enumerator_)
> -		return -ENODEV;
> +		return -EBUSY;
>  
>  	enumerator_ = DeviceEnumerator::create();
>  	if (enumerator_->enumerate())
> -- 
> 2.17.1
> 
> _______________________________________________
> libcamera-devel mailing list
> libcamera-devel at lists.libcamera.org
> https://lists.libcamera.org/listinfo/libcamera-devel

-- 
Regards,
Niklas Söderlund


More information about the libcamera-devel mailing list