From patchwork Wed Dec 2 14:16:19 2026 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Barnab=C3=A1s_P=C5=91cze?= X-Patchwork-Id: 29131 Return-Path: X-Original-To: parsemail@patchwork.libcamera.org Delivered-To: parsemail@patchwork.libcamera.org Received: from lancelot.ideasonboard.com (lancelot.ideasonboard.com [92.243.16.209]) by patchwork.libcamera.org (Postfix) with ESMTPS id 368C3C3300 for ; Wed, 2 Dec 2026 14:16:30 +0000 (UTC) Received: from lancelot.ideasonboard.com (localhost [IPv6:::1]) by lancelot.ideasonboard.com (Postfix) with ESMTP id 67D146AA68; Wed, 2 Dec 2026 15:16:28 +0100 (CET) Authentication-Results: lancelot.ideasonboard.com; dkim=pass (1024-bit key; unprotected) header.d=ideasonboard.com header.i=@ideasonboard.com header.b="WUz06QwR"; dkim-atps=neutral Received: from perceval.ideasonboard.com (perceval.ideasonboard.com [213.167.242.64]) by lancelot.ideasonboard.com (Postfix) with ESMTPS id 9C94E6AA68 for ; Wed, 2 Dec 2026 15:16:26 +0100 (CET) Received: from pb-laptop.local (185.182.215.118.nat.pool.zt.hu [185.182.215.118]) by perceval.ideasonboard.com (Postfix) with ESMTPSA id B8DE13A4 for ; Wed, 2 Dec 2026 15:13:47 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com; s=mail; t=1796220827; bh=zz9dwCs7ypGeZEygBzAwNQP+16+T7M4/goPaFI5s8OM=; h=From:To:Subject:Date:From; b=WUz06QwRNBr2iPfsLTnyMdhUD3C9UlBoRHykjVbhbAn3fhM4aSQiv/9+wRsxT/0ne UMbb/JfMubZnf1ueknWjpsvyrA9ia/59JHY3aWYwooKRqUaPrfzxH345ejeCw3qKW5 r7hiT39/q3jGwJqzlga9Bb4bjLTB2hPP/7C0r1Ac= From: =?utf-8?q?Barnab=C3=A1s_P=C5=91cze?= To: libcamera-devel@lists.libcamera.org Subject: [PATCH v2 0/4] libcamera: atomic-disconnects Date: Wed, 2 Dec 2026 15:16:19 +0100 Message-ID: <20261202141623.1375959-1-barnabas.pocze@ideasonboard.com> X-Mailer: git-send-email 2.56.1 MIME-Version: 1.0 X-BeenThere: libcamera-devel@lists.libcamera.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: libcamera-devel-bounces@lists.libcamera.org 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