[libcamera-devel] [PATCH v3 2/4] simple-cam: Early return if no cameras are found on the system.

Jacopo Mondi jacopo at jmondi.org
Fri Dec 4 10:58:23 CET 2020


Hello
   can we remove the end . in $subject when applying ?

Thanks
    j
On Fri, Dec 04, 2020 at 12:24:50PM +0530, Umang Jain wrote:
> Failing to do so, the codepath will segfault while trying to acquire
> a non-existent camera.
>
> Signed-off-by: Umang Jain <email at uajain.com>
> Reviewed-by: Kieran Bingham <kieran.bingham at ideasonboard.com>
> Reviewed-by: Laurent Pinchart <laurent.pinchart at ideasonboard.com>
> ---
>  simple-cam.cpp | 7 +++++++
>  1 file changed, 7 insertions(+)
>
> diff --git a/simple-cam.cpp b/simple-cam.cpp
> index e88fb85..aace5c8 100644
> --- a/simple-cam.cpp
> +++ b/simple-cam.cpp
> @@ -307,6 +307,13 @@ int main()
>  	for (std::unique_ptr<Request> &request : requests)
>  		camera->queueRequest(request.get());
>
> +	if (!cm->cameras().size()) {
> +		std::cout << "No cameras were identified on the system."
> +			  << std::endl;
> +		cm->stop();
> +		return EXIT_FAILURE;
> +	}
> +
>  	/*
>  	 * --------------------------------------------------------------------
>  	 * Run an EventLoop
> --
> 2.26.2
>
> _______________________________________________
> libcamera-devel mailing list
> libcamera-devel at lists.libcamera.org
> https://lists.libcamera.org/listinfo/libcamera-devel


More information about the libcamera-devel mailing list