[libcamera-devel] [PATCH 8/8] libcamera: camera: make sure camera is configured before starting

Jacopo Mondi jacopo at jmondi.org
Tue Feb 26 18:21:26 CET 2019


Hi Niklas,

On Tue, Feb 26, 2019 at 03:18:57AM +0100, Niklas Söderlund wrote:
> If the camera is not configured there is little use to start it. Add a
> check to make sure the camera is configured before it's started.
>

As commented on the previous patch, shouldn't this (and more..)
be caught by the state machine?

Thanks
  j


> Signed-off-by: Niklas Söderlund <niklas.soderlund at ragnatech.se>
> ---
>  src/libcamera/camera.cpp | 7 +++++++
>  1 file changed, 7 insertions(+)
>
> diff --git a/src/libcamera/camera.cpp b/src/libcamera/camera.cpp
> index ba8638009992170f..cbc34599d25e5ed5 100644
> --- a/src/libcamera/camera.cpp
> +++ b/src/libcamera/camera.cpp
> @@ -423,12 +423,19 @@ int Camera::queueRequest(Request *request)
>   *
>   * \return 0 on success or a negative error code
>   * \retval -EACCES The camera is not in a state where it can be started.
> + * \retval -EINVAL The camera is not configured.
>   */
>  int Camera::start()
>  {
>  	if (!stateIs(Acquired))
>  		return -EACCES;
>
> +	if (activeStreams_.empty()) {
> +		LOG(Camera, Error)
> +			<< "Can't start camera without configuration";
> +		return -EINVAL;
> +	}
> +
>  	LOG(Camera, Debug) << "Starting capture";
>
>  	int ret = pipe_->start(this);
> --
> 2.20.1
>
> _______________________________________________
> libcamera-devel mailing list
> libcamera-devel at lists.libcamera.org
> https://lists.libcamera.org/listinfo/libcamera-devel
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 833 bytes
Desc: not available
URL: <https://lists.libcamera.org/pipermail/libcamera-devel/attachments/20190226/6f1ca463/attachment.sig>


More information about the libcamera-devel mailing list