[libcamera-devel] checking camera state for shutdown

Christian Rauch Rauch.Christian at gmx.de
Thu Sep 22 00:01:47 CEST 2022


Hi,

I am trying to shut down the camera and camera manager properly, but I
am getting messages such as "Camera in Stopping state trying
queueRequest() requiring state Running" and "Removing media device
/dev/media1 while still in use".

The general approach I am using is to
1. disconnect callbacks:
     camera->requestCompleted.disconnect();
2. stop camera:
    camera->stop();
    camera->release();
3. stop camera manager:
    camera_manager.stop();

But the messages above tell me that my callbacks, which re-queue the
requests, are not finished before I call stop, and the camera has not
been stopped when I stop the camera manager. I can work around this by a
"sleep(1)" after the disconnect, but this is not nice.

Since the camera state is only accessible via internal/private API, how
is a user supposed to control the ordered shutdown of cameras etc.? Do
we need public API that lets a user check the camera state? Or should
the disconnect, stop and release calls make sure that the objects reach
these states before returning?

Best,
Christian



More information about the libcamera-devel mailing list