From patchwork Wed Dec 2 14:16:20 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: 29132 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 7B061C3300 for ; Wed, 2 Dec 2026 14:16:33 +0000 (UTC) Received: from lancelot.ideasonboard.com (localhost [IPv6:::1]) by lancelot.ideasonboard.com (Postfix) with ESMTP id 23E456AADD; Wed, 2 Dec 2026 15:16:29 +0100 (CET) Authentication-Results: lancelot.ideasonboard.com; dkim=pass (1024-bit key; unprotected) header.d=ideasonboard.com header.i=@ideasonboard.com header.b="eWOmmN3z"; dkim-atps=neutral Received: from perceval.ideasonboard.com (perceval.ideasonboard.com [213.167.242.64]) by lancelot.ideasonboard.com (Postfix) with ESMTPS id C69746AAD1 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 E63B54BB 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=1796220828; bh=Di9u++UgcOcXW6MprQ/V1daHKX5jWzl9GU/zXr1VaS4=; h=From:To:Subject:Date:In-Reply-To:References:From; b=eWOmmN3zXh6iVgHT1eOqjB8QJBBaGXg3Rfi1aReSPFT+RAXkyhXdgwZUVAKDkucUT g1+wh4fav8RvUkssplc4j6HsEipIGtDiV5Kn89IWYYXjCSW6+AbJ+MyGKextvYuYTB t0DJ7PgnhmQIR/sbSg+jyyPNG/X50tN2Ft5cUEnA= From: =?utf-8?q?Barnab=C3=A1s_P=C5=91cze?= To: libcamera-devel@lists.libcamera.org Subject: [PATCH v2 1/4] libcamera: v4l2_videodevice: streamOff(): Handle device disconnection Date: Wed, 2 Dec 2026 15:16:20 +0100 Message-ID: <20261202141623.1375959-2-barnabas.pocze@ideasonboard.com> X-Mailer: git-send-email 2.56.1 In-Reply-To: <20261202141623.1375959-1-barnabas.pocze@ideasonboard.com> References: <20261202141623.1375959-1-barnabas.pocze@ideasonboard.com> 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 If the `VIDIOC_STREAMOFF` reports `ENODEV`, meaning that the device is no longer available/connected, then proceed normally and cancel all pending buffers, and do not report an error. For example, this relevant for UVC, as `VIDIOC_STREAMOFF` will report `ENODEV` after disconnection, and returning buffers is crucial as the "uvcvideo" depends on `streamOff()` returning all pending buffers. Otherwise some requests will not be completed, leading to an assertion failure in `PipelineHandler::stop()`. Signed-off-by: Barnabás Pőcze Reviewed-by: Kieran Bingham --- src/libcamera/v4l2_videodevice.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/libcamera/v4l2_videodevice.cpp b/src/libcamera/v4l2_videodevice.cpp index 41dc5d0f65..35408fa13d 100644 --- a/src/libcamera/v4l2_videodevice.cpp +++ b/src/libcamera/v4l2_videodevice.cpp @@ -2031,7 +2031,7 @@ int V4L2VideoDevice::streamOff() watchdog_.stop(); ret = ioctl(VIDIOC_STREAMOFF, &bufferType_); - if (ret < 0) { + if (ret < 0 && ret != -ENODEV) { LOG(V4L2, Error) << "Failed to stop streaming: " << strerror(-ret); return ret;