{"id":21044,"url":"https://patchwork.libcamera.org/api/1.1/covers/21044/?format=json","web_url":"https://patchwork.libcamera.org/cover/21044/","project":{"id":1,"url":"https://patchwork.libcamera.org/api/1.1/projects/1/?format=json","name":"libcamera","link_name":"libcamera","list_id":"libcamera_core","list_email":"libcamera-devel@lists.libcamera.org","web_url":"","scm_url":"","webscm_url":""},"msgid":"<20240827164255.314432-1-hdegoede@redhat.com>","date":"2024-08-27T16:42:52","name":"[v2,0/3] Fix uvcvideo pipelinehandler keeping /dev/video# open","submitter":{"id":102,"url":"https://patchwork.libcamera.org/api/1.1/people/102/?format=json","name":"Hans de Goede","email":"hdegoede@redhat.com"},"mbox":"https://patchwork.libcamera.org/cover/21044/mbox/","series":[{"id":4546,"url":"https://patchwork.libcamera.org/api/1.1/series/4546/?format=json","web_url":"https://patchwork.libcamera.org/project/libcamera/list/?series=4546","date":"2024-08-27T16:42:52","name":"Fix uvcvideo pipelinehandler keeping /dev/video# open","version":2,"mbox":"https://patchwork.libcamera.org/series/4546/mbox/"}],"comments":"https://patchwork.libcamera.org/api/covers/21044/comments/","headers":{"Return-Path":"<libcamera-devel-bounces@lists.libcamera.org>","X-Original-To":"parsemail@patchwork.libcamera.org","Delivered-To":"parsemail@patchwork.libcamera.org","Received":["from lancelot.ideasonboard.com (lancelot.ideasonboard.com\n\t[92.243.16.209])\n\tby patchwork.libcamera.org (Postfix) with ESMTPS id DB5BAC323E\n\tfor <parsemail@patchwork.libcamera.org>;\n\tTue, 27 Aug 2024 16:43:11 +0000 (UTC)","from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id BFC4563469;\n\tTue, 27 Aug 2024 18:43:10 +0200 (CEST)","from us-smtp-delivery-124.mimecast.com\n\t(us-smtp-delivery-124.mimecast.com [170.10.129.124])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id D23816345D\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tTue, 27 Aug 2024 18:43:08 +0200 (CEST)","from mx-prod-mc-02.mail-002.prod.us-west-2.aws.redhat.com\n\t(ec2-54-186-198-63.us-west-2.compute.amazonaws.com [54.186.198.63])\n\tby relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3,\n\tcipher=TLS_AES_256_GCM_SHA384) id us-mta-313-IfSBOt3XMSKk9oUMhuQPuQ-1;\n\tTue, 27 Aug 2024 12:43:06 -0400","from mx-prod-int-03.mail-002.prod.us-west-2.aws.redhat.com\n\t(mx-prod-int-03.mail-002.prod.us-west-2.aws.redhat.com\n\t[10.30.177.12])\n\t(using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)\n\tkey-exchange X25519 server-signature RSA-PSS (2048 bits)\n\tserver-digest SHA256) (No client certificate requested)\n\tby mx-prod-mc-02.mail-002.prod.us-west-2.aws.redhat.com (Postfix)\n\twith ESMTPS\n\tid 67F831955D4D for <libcamera-devel@lists.libcamera.org>;\n\tTue, 27 Aug 2024 16:43:05 +0000 (UTC)","from localhost.localdomain (unknown [10.39.192.136])\n\tby mx-prod-int-03.mail-002.prod.us-west-2.aws.redhat.com (Postfix)\n\twith ESMTP id 16E741955D89; Tue, 27 Aug 2024 16:43:03 +0000 (UTC)"],"Authentication-Results":"lancelot.ideasonboard.com; dkim=pass (1024-bit key;\n\tunprotected) header.d=redhat.com header.i=@redhat.com\n\theader.b=\"IxOIM3Mi\"; dkim-atps=neutral","DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com;\n\ts=mimecast20190719; t=1724776987;\n\th=from:from:reply-to:subject:subject:date:date:message-id:message-id:\n\tto:to:cc:cc:mime-version:mime-version:content-type:content-type:\n\tcontent-transfer-encoding:content-transfer-encoding;\n\tbh=eB7JnFQ/nUQiKmDHODaZCQNZUgBBa50sREzFZZPS2Ag=;\n\tb=IxOIM3MiNurqRfD2JKgTXD/kQq6/eGYCIgpbOBVbj6QTBZO+pAF28EVlr1mlAAZZXsClUZ\n\tVTFGhIrUB9Fne5dHvuqlF7Dlybxhkw+4KggLHcj5dtrLPpO7v/euM256ldTNxYFCzSHn7D\n\tLtBhFEcGrwSHfUKyZJm9oRVoUwzyEY0=","X-MC-Unique":"IfSBOt3XMSKk9oUMhuQPuQ-1","From":"Hans de Goede <hdegoede@redhat.com>","To":"libcamera-devel@lists.libcamera.org","Cc":"Milan Zamazal <mzamazal@redhat.com>, Maxime Ripard <mripard@redhat.com>, \n\tHans de Goede <hdegoede@redhat.com>","Subject":"[PATCH v2 0/3] Fix uvcvideo pipelinehandler keeping /dev/video# open","Date":"Tue, 27 Aug 2024 18:42:52 +0200","Message-ID":"<20240827164255.314432-1-hdegoede@redhat.com>","MIME-Version":"1.0","X-Scanned-By":"MIMEDefang 3.0 on 10.30.177.12","X-Mimecast-Spam-Score":"0","X-Mimecast-Originator":"redhat.com","Content-Transfer-Encoding":"8bit","Content-Type":"text/plain; charset=\"US-ASCII\"; x-default=true","X-BeenThere":"libcamera-devel@lists.libcamera.org","X-Mailman-Version":"2.1.29","Precedence":"list","List-Id":"<libcamera-devel.lists.libcamera.org>","List-Unsubscribe":"<https://lists.libcamera.org/options/libcamera-devel>,\n\t<mailto:libcamera-devel-request@lists.libcamera.org?subject=unsubscribe>","List-Archive":"<https://lists.libcamera.org/pipermail/libcamera-devel/>","List-Post":"<mailto:libcamera-devel@lists.libcamera.org>","List-Help":"<mailto:libcamera-devel-request@lists.libcamera.org?subject=help>","List-Subscribe":"<https://lists.libcamera.org/listinfo/libcamera-devel>,\n\t<mailto:libcamera-devel-request@lists.libcamera.org?subject=subscribe>","Errors-To":"libcamera-devel-bounces@lists.libcamera.org","Sender":"\"libcamera-devel\" <libcamera-devel-bounces@lists.libcamera.org>"},"content":"Hi all,\n\nThe uvcvideo pipeline handler always keeps the uvcvideo /dev/video# device\nfor a pipeline open after enumerating the camera.\n\nThis is a problem for uvcvideo, as keeping the /dev/video# node open stops\nthe underlying USB device and the USB bus controller from being able to\nenter runtime-suspend causing significant unnecessary power-usage.\n\nHere is v2 of my series making the uvcvideo pipeline handler open\n/dev/video# on acquire and close it on release to fix this.\n\nChanges in v2:\n- Drop the first 2 patches these have already been merged\n- Add a note to both the doxygen documentation as well as to the commit\n  messages that opening/closing /dev/video# from acquire()/release()\n  as done by the uvcvideo pipeline handler is an exception and that this\n  behavior should not be copied by other pipeline handlers\n- Other doxygen doc fixes / improvements\n- Only unlock media devices on acquireDevice() failure if useCount_ == 0\n- Drop PipelineHandler::lock_, update \"\\context\" in doxygen docs\n\nI've pushed this to the software-isp gitlab repo for CI:\nhttps://gitlab.freedesktop.org/camera/libcamera-softisp/-/commits/pipeline-acquireDevice-v2\n\nand it has passed CI.\n\nRegards,\n\nHans\n\n\nHans de Goede (3):\n  pipeline_handler: Add acquireDevice() method to mirror existing\n    releaseDevice()\n  camera: Use invokeMethod() for pipe_->acquire() and pipe_->release()\n  uvcvideo: Implement acquireDevice() + releaseDevice()\n\n include/libcamera/internal/pipeline_handler.h |  8 +--\n src/libcamera/camera.cpp                      |  6 +-\n src/libcamera/pipeline/uvcvideo/uvcvideo.cpp  | 45 ++++++++++++++\n src/libcamera/pipeline_handler.cpp            | 60 ++++++++++++++-----\n 4 files changed, 98 insertions(+), 21 deletions(-)"}