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 <fercerpav@gmail.com>
Reviewed-on: http://openocd.zylin.com/2251
Tested-by: jenkins
Reviewed-by: Spencer Oliver <spen@spen-soft.co.uk>
This commit is contained in:
Paul Fertser 2014-08-15 11:31:16 +04:00 committed by Spencer Oliver
parent 8390f71428
commit 80ea805332
1 changed files with 7 additions and 3 deletions

View 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?