Print all links in media_print_topology_text()
[media-ctl.git] / src / media.c
index 456b882..512330a 100644 (file)
@@ -44,7 +44,7 @@ struct media_pad *media_entity_remote_source(struct media_pad *pad)
        for (i = 0; i < pad->entity->num_links; ++i) {
                struct media_link *link = &pad->entity->links[i];
 
-               if (!(link->flags & MEDIA_LINK_FLAG_ACTIVE))
+               if (!(link->flags & MEDIA_LINK_FLAG_ENABLED))
                        continue;
 
                if (link->sink == pad)
@@ -129,6 +129,7 @@ int media_setup_link(struct media_device *media,
        }
 
        link->flags = flags;
+       link->twin->flags = flags;
        return 0;
 }
 
@@ -148,7 +149,7 @@ int media_reset_links(struct media_device *media)
                                continue;
 
                        ret = media_setup_link(media, link->source, link->sink,
-                                              link->flags & ~MEDIA_LINK_FLAG_ACTIVE);
+                                              link->flags & ~MEDIA_LINK_FLAG_ENABLED);
                        if (ret < 0)
                                return ret;
                }
@@ -225,12 +226,12 @@ static int media_enum_links(struct media_device *media)
                                fwdlink = media_entity_add_link(source);
                                fwdlink->source = &source->pads[link->source.index];
                                fwdlink->sink = &sink->pads[link->sink.index];
-                               fwdlink->flags = links.links[i].flags;
+                               fwdlink->flags = link->flags;
 
                                backlink = media_entity_add_link(sink);
                                backlink->source = &source->pads[link->source.index];
                                backlink->sink = &sink->pads[link->sink.index];
-                               backlink->flags = links.links[i].flags;
+                               backlink->flags = link->flags;
 
                                fwdlink->twin = backlink;
                                backlink->twin = fwdlink;
@@ -286,8 +287,8 @@ static int media_enum_entities(struct media_device *media)
                media->entities_count++;
 
                /* Find the corresponding device name. */
-               if (media_entity_type(entity) != MEDIA_ENTITY_TYPE_NODE &&
-                   media_entity_type(entity) != MEDIA_ENTITY_TYPE_SUBDEV)
+               if (media_entity_type(entity) != MEDIA_ENTITY_TYPE_DEVNODE &&
+                   media_entity_type(entity) != MEDIA_ENTITY_TYPE_V4L2_SUBDEV)
                        continue;
 
                sprintf(sysname, "/sys/dev/char/%u:%u", entity->info.v4l.major,