transport: clarify error message when transport is not selected

When no transport is selected, the error message dumps the available
transports, but not how to actually select one.

Change-Id: I63da2a4b59e3f6cc8d30bd631e41a82636a056ef
Signed-off-by: Karl Palsson <karlp@tweak.net.au>
Signed-off-by: Paul Fertser <fercerpav@gmail.com>
Reviewed-on: http://openocd.zylin.com/2406
Tested-by: jenkins
Reviewed-by: Spencer Oliver <spen@spen-soft.co.uk>
This commit is contained in:
Karl Palsson 2014-11-21 22:05:41 +00:00 committed by Spencer Oliver
parent 513436a17a
commit 881d08ddbd
1 changed files with 4 additions and 3 deletions

View File

@ -239,12 +239,13 @@ COMMAND_HANDLER(handle_transport_init)
{ {
LOG_DEBUG("%s", __func__); LOG_DEBUG("%s", __func__);
if (!session) { if (!session) {
LOG_ERROR("session's transport is not selected."); LOG_ERROR("session transport was not selected. Use 'transport select <transport>'");
/* no session transport configured, print transports then fail */ /* no session transport configured, print transports then fail */
LOG_ERROR("Transports available:");
const char * const *vector = allowed_transports; const char * const *vector = allowed_transports;
while (*vector) { while (*vector) {
LOG_ERROR("allow transport '%s'", *vector); LOG_ERROR("%s", *vector);
vector++; vector++;
} }
return ERROR_FAIL; return ERROR_FAIL;
@ -277,7 +278,7 @@ static int jim_transport_select(Jim_Interp *interp, int argc, Jim_Obj * const *a
switch (argc) { switch (argc) {
case 1: /* return/display */ case 1: /* return/display */
if (!session) { if (!session) {
LOG_ERROR("session's transport is not selected."); LOG_ERROR("session transport was not selected. Use 'transport select <transport>'");
return JIM_ERR; return JIM_ERR;
} else { } else {
Jim_SetResultString(interp, session->name, -1); Jim_SetResultString(interp, session->name, -1);