From 80ea8053329d84157666ed36afb7cff73ab505a6 Mon Sep 17 00:00:00 2001 From: Paul Fertser Date: Fri, 15 Aug 2014 11:31:16 +0400 Subject: [PATCH] transport: emit a warning when a user tries to reselect a transport Even though changing transport is impossible, reselecting it should be harmless. Change-Id: I6c1c2786134e826f47f848b590e6d712b6fd2206 Signed-off-by: Paul Fertser Reviewed-on: http://openocd.zylin.com/2251 Tested-by: jenkins Reviewed-by: Spencer Oliver --- src/transport/transport.c | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/src/transport/transport.c b/src/transport/transport.c index 072a0d38..3f5337e3 100644 --- a/src/transport/transport.c +++ b/src/transport/transport.c @@ -286,9 +286,13 @@ static int jim_transport_select(Jim_Interp *interp, int argc, Jim_Obj * const *a break; case 2: /* assign */ if (session) { - /* can't change session's transport after-the-fact */ - LOG_ERROR("session's transport is already selected."); - return JIM_ERR; + if (!strcmp(session->name, argv[1]->bytes)) { + LOG_WARNING("Transport \"%s\" was already selected", session->name); + return JIM_OK; + } else { + LOG_ERROR("Can't change session's transport after the initial selection was made"); + return JIM_ERR; + } } /* Is this transport supported by our debug adapter? -- 2.39.5