igt-dev.lists.freedesktop.org archive mirror
 help / color / mirror / Atom feed
* [igt-dev] [PATCH i-g-t] lib/chamelium: Ping the chamelium before use
@ 2018-07-28  9:30 Chris Wilson
  2018-07-28  9:46 ` Chris Wilson
                   ` (5 more replies)
  0 siblings, 6 replies; 7+ messages in thread
From: Chris Wilson @ 2018-07-28  9:30 UTC (permalink / raw)
  To: igt-dev

Check we can talk to the device before hitting any asserts.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
---
 lib/igt_chamelium.c | 23 ++++++++++++++++++++++-
 1 file changed, 22 insertions(+), 1 deletion(-)

diff --git a/lib/igt_chamelium.c b/lib/igt_chamelium.c
index b8418e13e..15f9b870c 100644
--- a/lib/igt_chamelium.c
+++ b/lib/igt_chamelium.c
@@ -1520,6 +1520,23 @@ static bool chamelium_read_config(struct chamelium *chamelium, int drm_fd)
 	return chamelium_read_port_mappings(chamelium, drm_fd);
 }
 
+static bool __chamelium_reset(struct chamelium *chamelium)
+{
+	xmlrpc_value *res;
+
+	/* Cleanup the last error, if any */
+	if (chamelium->env.fault_occurred) {
+		xmlrpc_env_clean(&chamelium->env);
+		xmlrpc_env_init(&chamelium->env);
+	}
+
+	xmlrpc_client_call2f_va(&chamelium->env, chamelium->client,
+				chamelium->url, "Reset", "()", &res);
+	xmlrpc_DECREF(res);
+
+	return !chamelium->env.fault_occurred;
+}
+
 /**
  * chamelium_reset:
  * @chamelium: The Chamelium instance to use
@@ -1530,7 +1547,7 @@ static bool chamelium_read_config(struct chamelium *chamelium, int drm_fd)
 void chamelium_reset(struct chamelium *chamelium)
 {
 	igt_debug("Resetting the chamelium\n");
-	xmlrpc_DECREF(chamelium_rpc(chamelium, NULL, "Reset", "()"));
+	igt_assert(__chamelium_reset(chamelium));
 }
 
 static void chamelium_exit_handler(int sig)
@@ -1582,6 +1599,10 @@ struct chamelium *chamelium_init(int drm_fd)
 		goto error;
 	}
 
+	/* Ping the device before use and reset it to defaults */
+	if (!__chamelium_reset(chamelium))
+		goto error;
+
 	if (!chamelium_read_config(chamelium, drm_fd))
 		goto error;
 
-- 
2.18.0

_______________________________________________
igt-dev mailing list
igt-dev@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/igt-dev

^ permalink raw reply related	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2018-07-28 15:11 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2018-07-28  9:30 [igt-dev] [PATCH i-g-t] lib/chamelium: Ping the chamelium before use Chris Wilson
2018-07-28  9:46 ` Chris Wilson
2018-07-28 11:14 ` [igt-dev] ✗ Fi.CI.BAT: failure for lib/chamelium: Ping the chamelium before use (rev2) Patchwork
2018-07-28 11:16 ` [igt-dev] [PATCH i-g-t] lib/chamelium: Ping the chamelium before use Chris Wilson
2018-07-28 11:56 ` [igt-dev] ✓ Fi.CI.BAT: success for lib/chamelium: Ping the chamelium before use (rev3) Patchwork
2018-07-28 13:48 ` [igt-dev] ✗ Fi.CI.IGT: failure for lib/chamelium: Ping the chamelium before use (rev2) Patchwork
2018-07-28 15:11 ` [igt-dev] ✓ Fi.CI.IGT: success for lib/chamelium: Ping the chamelium before use (rev3) Patchwork

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).