summaryrefslogtreecommitdiff
path: root/src/libcamera/pipeline/uvcvideo
diff options
context:
space:
mode:
authorPaul Elder <paul.elder@ideasonboard.com>2020-06-05 20:36:32 +0900
committerPaul Elder <paul.elder@ideasonboard.com>2020-06-09 14:51:02 +0900
commit5801dedd2a30e7123a0f78e6140c409c7c35988c (patch)
treeff52f40a886763a07874399f041d403c2fc3f1ae /src/libcamera/pipeline/uvcvideo
parent82d9331efd2b25fc518858499f6d37716feae3b9 (diff)
libcamera: CameraManager, PipelineHandler: Automatically map devnums to Camera
The V4L2 compatibility layer uses devnum to match video device nodes to libcamera Cameras. Some pipeline handlers don't report a devnum for their camera, which prevents the V4L2 compatibility layer from matching video device nodes to these cameras. To fix this, we first allow the camera manager to map multiple devnums to a camera. Next, we walk the media device and entity list and tell the camera manager to map every one of these devnums that is a video capture node to the camera. Since we decided that all video capture nodes that belong to a camera can be opened via the V4L2 compatibility layer to map to that camera, it would cause confusion for users if some pipeline handlers decided that only specific device nodes would map to the camera. To prevent this confusion, remove the ability for pipeline handlers to declare their own devnum-to-camera mapping. The only pipeline handler that declares the devnum mapping is the UVC pipeline handler, so remove the devnum there. We considered walking the media entity list and taking the devnum from just the one with the default flag set, but we found that some drivers (eg. vimc) don't set this flag for any entity. Instead, we take all the video capture nodes (entities with the sink pad flag set). Signed-off-by: Paul Elder <paul.elder@ideasonboard.com> Reviewed-by: Niklas Söderlund <niklas.soderlund@ragnatech.se> Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Diffstat (limited to 'src/libcamera/pipeline/uvcvideo')
-rw-r--r--src/libcamera/pipeline/uvcvideo/uvcvideo.cpp5
1 files changed, 1 insertions, 4 deletions
diff --git a/src/libcamera/pipeline/uvcvideo/uvcvideo.cpp b/src/libcamera/pipeline/uvcvideo/uvcvideo.cpp
index a0749094..80a0e77b 100644
--- a/src/libcamera/pipeline/uvcvideo/uvcvideo.cpp
+++ b/src/libcamera/pipeline/uvcvideo/uvcvideo.cpp
@@ -8,7 +8,6 @@
#include <algorithm>
#include <iomanip>
#include <math.h>
-#include <sys/sysmacros.h>
#include <tuple>
#include <libcamera/camera.h>
@@ -396,12 +395,10 @@ bool PipelineHandlerUVC::match(DeviceEnumerator *enumerator)
if (data->init(*entity))
return false;
- dev_t 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), devnum);
+ registerCamera(std::move(camera), std::move(data));
/* Enable hot-unplug notifications. */
hotplugMediaDevice(media);