]> git.sur5r.net Git - openocd/commitdiff
transport: emit a warning when a user tries to reselect a transport
authorPaul Fertser <fercerpav@gmail.com>
Fri, 15 Aug 2014 07:31:16 +0000 (11:31 +0400)
committerSpencer Oliver <spen@spen-soft.co.uk>
Tue, 19 Aug 2014 20:19:58 +0000 (20:19 +0000)
Even though changing transport is impossible, reselecting it should be
harmless.

Change-Id: I6c1c2786134e826f47f848b590e6d712b6fd2206
Signed-off-by: Paul Fertser <fercerpav@gmail.com>
Reviewed-on: http://openocd.zylin.com/2251
Tested-by: jenkins
Reviewed-by: Spencer Oliver <spen@spen-soft.co.uk>
src/transport/transport.c

index 072a0d38544d59b0c18f0748efe3d10b266753d1..3f5337e35a7c95464ffd4d9bed48c1047360cc68 100644 (file)
@@ -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?