summaryrefslogtreecommitdiff
path: root/src/libcamera/device_enumerator_udev.cpp
diff options
context:
space:
mode:
authorLaurent Pinchart <laurent.pinchart@ideasonboard.com>2019-09-09 13:26:37 +0300
committerLaurent Pinchart <laurent.pinchart@ideasonboard.com>2019-09-13 20:13:22 +0300
commit7516d410803309b42f45865eac6dec1a157e1976 (patch)
tree270747f4aae5c1e864bc0f076f3ac3b453f0e98e /src/libcamera/device_enumerator_udev.cpp
parentb3cdccbff9fb8e4da6eab06f2fe3e1f02aa29939 (diff)
libcamera: device_enumerator_udev: Delay device node lookup
When populating media devices, we look up device nodes for every entity in the media device, regardless of if the entity is present in the orphans list. This causes unnecessary lookups (that may also fail as the device node may not be ready yet at that time). Move the lookup at a later time, when the device node is actually needed. Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com> Reviewed-by: Paul Elder <paul.elder@ideasonboard.com>
Diffstat (limited to 'src/libcamera/device_enumerator_udev.cpp')
-rw-r--r--src/libcamera/device_enumerator_udev.cpp2
1 files changed, 1 insertions, 1 deletions
diff --git a/src/libcamera/device_enumerator_udev.cpp b/src/libcamera/device_enumerator_udev.cpp
index e0c646c9..210f5c1f 100644
--- a/src/libcamera/device_enumerator_udev.cpp
+++ b/src/libcamera/device_enumerator_udev.cpp
@@ -180,10 +180,10 @@ int DeviceEnumeratorUdev::populateMediaDevice(const std::shared_ptr<MediaDevice>
dev_t devnum = makedev(entity->deviceMajor(),
entity->deviceMinor());
- std::string deviceNode = lookupDeviceNode(devnum);
/* Take device from orphan list first, if it is in the list. */
if (std::find(orphans_.begin(), orphans_.end(), devnum) != orphans_.end()) {
+ std::string deviceNode = lookupDeviceNode(devnum);
if (deviceNode.empty())
return -EINVAL;