[v2,0/4] libcamera: atomic-disconnects
mbox series

Message ID 20261202141623.1375959-1-barnabas.pocze@ideasonboard.com
Headers show
Series
  • libcamera: atomic-disconnects
Related show

Message

Barnabás Pőcze Dec. 2, 2026, 2:16 p.m. UTC
Currently a disconnected camera is not stopped properly because the disconnection
process does not call PipelineHandler::stop(), and it is a no-op if the applications
tries to call Camera::stop() after the disconnection.

So make it possible (and in fact require applications) to call Camera::stop() after
a camera has been disconnected if it was previously running.

Testing with UVC as well has uncovered an issue which is addressed in the first commit.
It still shows

  ERROR V4L2 v4l2_videodevice.cpp:1322 /dev/video12[23:cap]: Unable to request 0 buffers: No such device

during the stop() call, but that shouldn't be a big issue, probably.

---

changes in v2:
  * extend commit messages as requested
  * add missing documentation
  * handle device disconnection gracefully in `V4L2VideoDevice::streamOff()` (for UVC)

v1: https://patchwork.libcamera.org/project/libcamera/list/?series=6386

---

Barnabás Pőcze (2):
  libcamera: v4l2_videodevice: streamOff(): Handle device disconnection
  libcamera: camera: Make `disconnected_` atomic

Stefan Klug (2):
  libcamera: pipeline_handler: Add an assertion to detect bad
    synchronization
  libcamera: pipeline_handler: Allow calling stop() on a disconnected
    camera

 include/libcamera/internal/camera.h |  6 +++--
 src/libcamera/camera.cpp            | 39 ++++++++++++++++-------------
 src/libcamera/pipeline_handler.cpp  | 11 ++++++++
 src/libcamera/v4l2_videodevice.cpp  |  2 +-
 4 files changed, 38 insertions(+), 20 deletions(-)

--
2.56.1