[0/5] Fix uvcvideo pipelinehandler keeping /dev/video# open
mbox series

Message ID 20240820195016.16028-1-hdegoede@redhat.com
Headers show
Series
  • Fix uvcvideo pipelinehandler keeping /dev/video# open
Related show

Message

Hans de Goede Aug. 20, 2024, 7:50 p.m. UTC
Hi all,

ATM the uvcvideo pipeline handler always keeps the uvcvideo /dev/video#
node for a pipeline open after enumerating the camera.

This is a problem for uvcvideo, as keeping the /dev/video# node open stops
the underlying USB device and the USB bus controller from being able to
enter runtime-suspend causing significant unnecessary power-usage.

This series makes the uvcvideo pipeline handler open /dev/video# on
acquire and close it on release to fix this.

I've pushed this to the software-isp gitlab repo for CI:
https://gitlab.freedesktop.org/camera/libcamera-softisp/-/commits/pipeline-acquireDevice

Regards,

Hans


Hans de Goede (5):
  pipeline_handler: Fix unlocking media devices too early when there are
    multiple cameras
  pipeline_handler: Call releaseDevice() before unlocking media devices
  pipeline_handler: Add acquireDevice() method to mirror existing
    releaseDevice()
  camera: Use invokeMethod() for pipe_->acquire() and pipe_->release()
  uvcvideo: Implement acquireDevice() + releaseDevice()

 include/libcamera/internal/pipeline_handler.h |  3 +-
 src/libcamera/camera.cpp                      |  6 ++-
 src/libcamera/pipeline/uvcvideo/uvcvideo.cpp  | 46 ++++++++++++++++++
 src/libcamera/pipeline_handler.cpp            | 48 ++++++++++++++-----
 4 files changed, 89 insertions(+), 14 deletions(-)