[igt-dev] [PATCH i-g-t 2/3] lib/igt_chamelium: Added is_mapped to track mapped ports

Kunal Joshi kunal1.joshi at intel.com
Thu Jul 13 09:17:25 UTC 2023


Added boolean is_mapped, which is true for mapped ports
and only plug mapped ports

Signed-off-by: Kunal Joshi <kunal1.joshi at intel.com>
---
 lib/igt_chamelium.c | 7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)

diff --git a/lib/igt_chamelium.c b/lib/igt_chamelium.c
index 95983ff25..a737330a6 100644
--- a/lib/igt_chamelium.c
+++ b/lib/igt_chamelium.c
@@ -99,6 +99,7 @@ struct chamelium_port {
 	char *name;
 	bool adapter_allowed;
 	char *connector_path;
+	bool is_mapped;
 };
 
 struct chamelium_frame_dump {
@@ -2721,6 +2722,7 @@ static bool chamelium_autodiscover(struct chamelium *chamelium)
 			igt_info("Failed to auto-discover port %d\n", port_id);
 			goto unplug_port;
 		}
+		port->is_mapped = true;
 		is_any_port_mapped = true;
 
 		/* If we found a connector for our port, increment the number of valid Chamelium ports. */
@@ -2746,9 +2748,10 @@ unplug_port:
 	}
 
 	/* After we're all set, turn on all supported ports */
-	for (i = 0; i < chamelium->port_count; i++) {
+	for (i = 0; i < CHAMELIUM_MAX_PORTS; i++) {
 		struct chamelium_port *port = &chamelium->ports[i];
-		chamelium_plug(chamelium, port);
+		if (port->is_mapped)
+			chamelium_plug(chamelium, port);
 	}
 	sleep(CHAMELIUM_HOTPLUG_DETECTION_DELAY);
 
-- 
2.25.1



More information about the igt-dev mailing list