Print all links in media_print_topology_text()
authorTodor Tomov <ttomov@mm-sol.com>
Tue, 25 Jan 2011 15:46:49 +0000 (17:46 +0200)
committerLaurent Pinchart <laurent.pinchart@ideasonboard.com>
Fri, 8 Apr 2011 08:32:49 +0000 (10:32 +0200)
Add printing of inbound links in media_print_topology_text().

Signed-off-by: Todor Tomov <ttomov@mm-sol.com>
src/main.c

index 9b34008..0bc6135 100644 (file)
@@ -267,7 +267,7 @@ static void media_print_topology_text(struct media_device *media)
                padding = printf("- entity %u: ", entity->info.id);
                printf("%s (%u pad%s, %u link%s)\n", entity->info.name,
                        entity->info.pads, entity->info.pads > 1 ? "s" : "",
                padding = printf("- entity %u: ", entity->info.id);
                printf("%s (%u pad%s, %u link%s)\n", entity->info.name,
                        entity->info.pads, entity->info.pads > 1 ? "s" : "",
-                       entity->info.links, entity->info.links > 1 ? "s" : "");
+                       entity->num_links, entity->num_links > 1 ? "s" : "");
                printf("%*ctype %s subtype %s\n", padding, ' ',
                        media_entity_type_to_string(entity->info.type),
                        media_entity_subtype_to_string(entity->info.type));
                printf("%*ctype %s subtype %s\n", padding, ' ',
                        media_entity_type_to_string(entity->info.type),
                        media_entity_subtype_to_string(entity->info.type));
@@ -286,14 +286,18 @@ static void media_print_topology_text(struct media_device *media)
 
                        for (k = 0; k < entity->num_links; k++) {
                                struct media_link *link = &entity->links[k];
 
                        for (k = 0; k < entity->num_links; k++) {
                                struct media_link *link = &entity->links[k];
-
-                               if (link->source->entity != entity ||
-                                   link->source->index != j)
+                               struct media_pad *source = link->source;
+                               struct media_pad *sink = link->sink;
+
+                               if (source->entity == entity && source->index == j)
+                                       printf("\t\t-> '%s':pad%u [",
+                                               sink->entity->info.name, sink->index);
+                               else if (sink->entity == entity && sink->index == j)
+                                       printf("\t\t<- '%s':pad%u [",
+                                               source->entity->info.name, source->index);
+                               else
                                        continue;
 
                                        continue;
 
-                               printf("\t\t-> '%s':pad%u [",
-                                       link->sink->entity->info.name, link->sink->index);
-
                                if (link->flags & MEDIA_LINK_FLAG_IMMUTABLE)
                                        printf("IMMUTABLE,");
                                if (link->flags & MEDIA_LINK_FLAG_ENABLED)
                                if (link->flags & MEDIA_LINK_FLAG_IMMUTABLE)
                                        printf("IMMUTABLE,");
                                if (link->flags & MEDIA_LINK_FLAG_ENABLED)