Message ID | 20200103054120.30979-4-paul.elder@ideasonboard.com |
---|---|
State | Superseded |
Headers | show |
Series |
|
Related | show |
Hi Paul, On Fri, Jan 03, 2020 at 12:41:19AM -0500, Paul Elder wrote: > This patch depends on patch "libcamera: pipeline: uvcvideo: Fix crash > when default entity is not found". > > Register all UVC Cameras along with their device numbers, to eventually > allow the V4L2 compatibility layer to match against it. > > Signed-off-by: Paul Elder <paul.elder@ideasonboard.com> > Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Reviewed-by: Jacopo Mondi <jacopo@jmondi.org> Thanks j > > --- > Changes in v5: > - rebased on "libcamera: pipeline: uvcvideo: Fix crash when default > entity is not found" > > No change in v4 > > New in v3 > --- > src/libcamera/pipeline/uvcvideo.cpp | 6 +++++- > 1 file changed, 5 insertions(+), 1 deletion(-) > > diff --git a/src/libcamera/pipeline/uvcvideo.cpp b/src/libcamera/pipeline/uvcvideo.cpp > index 8d7f7ea7..662b2462 100644 > --- a/src/libcamera/pipeline/uvcvideo.cpp > +++ b/src/libcamera/pipeline/uvcvideo.cpp > @@ -7,6 +7,7 @@ > > #include <algorithm> > #include <iomanip> > +#include <sys/sysmacros.h> > #include <tuple> > > #include <libcamera/camera.h> > @@ -294,6 +295,7 @@ bool PipelineHandlerUVC::match(DeviceEnumerator *enumerator) > return false; > > std::unique_ptr<UVCCameraData> data = utils::make_unique<UVCCameraData>(this); > + dev_t devnum = 0; > > /* Locate and initialise the camera data with the default video node. */ > const std::vector<MediaEntity *> &entities = media->entities(); > @@ -309,10 +311,12 @@ bool PipelineHandlerUVC::match(DeviceEnumerator *enumerator) > if (data->init(*entity)) > return false; > > + devnum = makedev((*entity)->deviceMajor(), (*entity)->deviceMinor()); > + > /* Create and register the camera. */ > std::set<Stream *> streams{ &data->stream_ }; > std::shared_ptr<Camera> camera = Camera::create(this, media->model(), streams); > - registerCamera(std::move(camera), std::move(data)); > + registerCamera(std::move(camera), std::move(data), devnum); > > /* Enable hot-unplug notifications. */ > hotplugMediaDevice(media); > -- > 2.24.1 > > _______________________________________________ > libcamera-devel mailing list > libcamera-devel@lists.libcamera.org > https://lists.libcamera.org/listinfo/libcamera-devel
Hi Paul, Thank you for the patch. On Fri, Jan 03, 2020 at 12:41:19AM -0500, Paul Elder wrote: > This patch depends on patch "libcamera: pipeline: uvcvideo: Fix crash > when default entity is not found". > > Register all UVC Cameras along with their device numbers, to eventually > allow the V4L2 compatibility layer to match against it. > > Signed-off-by: Paul Elder <paul.elder@ideasonboard.com> > Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> > > --- > Changes in v5: > - rebased on "libcamera: pipeline: uvcvideo: Fix crash when default > entity is not found" > > No change in v4 > > New in v3 > --- > src/libcamera/pipeline/uvcvideo.cpp | 6 +++++- > 1 file changed, 5 insertions(+), 1 deletion(-) > > diff --git a/src/libcamera/pipeline/uvcvideo.cpp b/src/libcamera/pipeline/uvcvideo.cpp > index 8d7f7ea7..662b2462 100644 > --- a/src/libcamera/pipeline/uvcvideo.cpp > +++ b/src/libcamera/pipeline/uvcvideo.cpp > @@ -7,6 +7,7 @@ > > #include <algorithm> > #include <iomanip> > +#include <sys/sysmacros.h> > #include <tuple> > > #include <libcamera/camera.h> > @@ -294,6 +295,7 @@ bool PipelineHandlerUVC::match(DeviceEnumerator *enumerator) > return false; > > std::unique_ptr<UVCCameraData> data = utils::make_unique<UVCCameraData>(this); > + dev_t devnum = 0; You can drop this line. > > /* Locate and initialise the camera data with the default video node. */ > const std::vector<MediaEntity *> &entities = media->entities(); > @@ -309,10 +311,12 @@ bool PipelineHandlerUVC::match(DeviceEnumerator *enumerator) > if (data->init(*entity)) > return false; > > + devnum = makedev((*entity)->deviceMajor(), (*entity)->deviceMinor()); and s/devnum/dev_t devnum/ With this you can keep my Rb tag. > + > /* Create and register the camera. */ > std::set<Stream *> streams{ &data->stream_ }; > std::shared_ptr<Camera> camera = Camera::create(this, media->model(), streams); > - registerCamera(std::move(camera), std::move(data)); > + registerCamera(std::move(camera), std::move(data), devnum); > > /* Enable hot-unplug notifications. */ > hotplugMediaDevice(media);
diff --git a/src/libcamera/pipeline/uvcvideo.cpp b/src/libcamera/pipeline/uvcvideo.cpp index 8d7f7ea7..662b2462 100644 --- a/src/libcamera/pipeline/uvcvideo.cpp +++ b/src/libcamera/pipeline/uvcvideo.cpp @@ -7,6 +7,7 @@ #include <algorithm> #include <iomanip> +#include <sys/sysmacros.h> #include <tuple> #include <libcamera/camera.h> @@ -294,6 +295,7 @@ bool PipelineHandlerUVC::match(DeviceEnumerator *enumerator) return false; std::unique_ptr<UVCCameraData> data = utils::make_unique<UVCCameraData>(this); + dev_t devnum = 0; /* Locate and initialise the camera data with the default video node. */ const std::vector<MediaEntity *> &entities = media->entities(); @@ -309,10 +311,12 @@ bool PipelineHandlerUVC::match(DeviceEnumerator *enumerator) if (data->init(*entity)) return false; + devnum = makedev((*entity)->deviceMajor(), (*entity)->deviceMinor()); + /* Create and register the camera. */ std::set<Stream *> streams{ &data->stream_ }; std::shared_ptr<Camera> camera = Camera::create(this, media->model(), streams); - registerCamera(std::move(camera), std::move(data)); + registerCamera(std::move(camera), std::move(data), devnum); /* Enable hot-unplug notifications. */ hotplugMediaDevice(media);