[libcamera-devel,09/10] libcamera: pipeline: uvc: Mark the media device as hotpluggable

Message ID 20190124101651.9993-10-laurent.pinchart@ideasonboard.com
State Accepted
Headers show
Series
  • Hotplug support and object lifetime management
Related show

Commit Message

Laurent Pinchart Jan. 24, 2019, 10:16 a.m. UTC
UVC devices can be hot-unplugged. Mark the corresponding media device as
hotpluggable to ensure proper disconnection support.

Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
---
 src/libcamera/pipeline/uvcvideo.cpp | 1 +
 1 file changed, 1 insertion(+)

Comments

Niklas Söderlund Jan. 24, 2019, 6:06 p.m. UTC | #1
Hi Laurent,

Thanks for your efforts.

On 2019-01-24 12:16:50 +0200, Laurent Pinchart wrote:
> UVC devices can be hot-unplugged. Mark the corresponding media device as
> hotpluggable to ensure proper disconnection support.
> 
> Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>

Reviewed-by: Niklas Söderlund <niklas.soderlund@ragnatech.se>

> ---
>  src/libcamera/pipeline/uvcvideo.cpp | 1 +
>  1 file changed, 1 insertion(+)
> 
> diff --git a/src/libcamera/pipeline/uvcvideo.cpp b/src/libcamera/pipeline/uvcvideo.cpp
> index c8f1bf553bfe..f84fa41515f1 100644
> --- a/src/libcamera/pipeline/uvcvideo.cpp
> +++ b/src/libcamera/pipeline/uvcvideo.cpp
> @@ -49,6 +49,7 @@ bool PipelineHandlerUVC::match(DeviceEnumerator *enumerator)
>  
>  	std::shared_ptr<Camera> camera = Camera::create(this, dev_->model());
>  	registerCamera(std::move(camera));
> +	hotplugMediaDevice(dev_.get());
>  
>  	return true;
>  }
> -- 
> Regards,
> 
> Laurent Pinchart
> 
> _______________________________________________
> libcamera-devel mailing list
> libcamera-devel@lists.libcamera.org
> https://lists.libcamera.org/listinfo/libcamera-devel

Patch

diff --git a/src/libcamera/pipeline/uvcvideo.cpp b/src/libcamera/pipeline/uvcvideo.cpp
index c8f1bf553bfe..f84fa41515f1 100644
--- a/src/libcamera/pipeline/uvcvideo.cpp
+++ b/src/libcamera/pipeline/uvcvideo.cpp
@@ -49,6 +49,7 @@  bool PipelineHandlerUVC::match(DeviceEnumerator *enumerator)
 
 	std::shared_ptr<Camera> camera = Camera::create(this, dev_->model());
 	registerCamera(std::move(camera));
+	hotplugMediaDevice(dev_.get());
 
 	return true;
 }