libcamera: media_device: Skip all non-data links during enumeration

The MediaDevice::populateLinks() function iterates over data links by
skipping interface links. This isn't very future-proof, it will break if
the kernel adds new types of links. Fix it by only considering data
links instead of blacklisting interface links.

Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Tested-by: Jean-Michel Hautbois <jeanmichel.hautbois@ideasonboard.com>
Reviewed-by: Jean-Michel Hautbois <jeanmichel.hautbois@ideasonboard.com>
Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
This commit is contained in:
Laurent Pinchart 2021-12-06 20:47:47 +02:00
parent e788807371
commit 1c88396a54

View file

@ -695,12 +695,9 @@ bool MediaDevice::populateLinks(const struct media_v2_topology &topology)
(topology.ptr_links);
for (unsigned int i = 0; i < topology.num_links; ++i) {
/*
* Skip links between entities and interfaces: we only care
* about pad-2-pad links here.
*/
if ((mediaLinks[i].flags & MEDIA_LNK_FL_LINK_TYPE) ==
MEDIA_LNK_FL_INTERFACE_LINK)
/* We only care about pad-2-pad links here. */
if ((mediaLinks[i].flags & MEDIA_LNK_FL_LINK_TYPE) !=
MEDIA_LNK_FL_DATA_LINK)
continue;
/* Store references to source and sink pads in the link. */