jtag: rewrite command 'adapter name' as COMMAND_HANDLER
Trivial change. Add the mandatory 'usage' field. Change-Id: Id92af5cd873fb86f5de79f785f156d1ef734b005 Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com> Reviewed-on: https://review.openocd.org/c/openocd/+/7493 Tested-by: jenkins
This commit is contained in:
parent
5da4ef25c8
commit
19e2a0d6af
|
@ -378,21 +378,18 @@ done:
|
|||
return equal;
|
||||
}
|
||||
|
||||
static int jim_adapter_name(Jim_Interp *interp, int argc, Jim_Obj * const *argv)
|
||||
COMMAND_HANDLER(handle_adapter_name)
|
||||
{
|
||||
struct jim_getopt_info goi;
|
||||
jim_getopt_setup(&goi, interp, argc-1, argv + 1);
|
||||
|
||||
/* return the name of the interface */
|
||||
/* TCL code might need to know the exact type... */
|
||||
/* FUTURE: we allow this as a means to "set" the interface. */
|
||||
if (goi.argc != 0) {
|
||||
Jim_WrongNumArgs(goi.interp, 1, goi.argv-1, "(no params)");
|
||||
return JIM_ERR;
|
||||
}
|
||||
const char *name = adapter_driver ? adapter_driver->name : NULL;
|
||||
Jim_SetResultString(goi.interp, name ? name : "undefined", -1);
|
||||
return JIM_OK;
|
||||
|
||||
if (CMD_ARGC != 0)
|
||||
return ERROR_COMMAND_SYNTAX_ERROR;
|
||||
|
||||
command_print(CMD, "%s", adapter_driver ? adapter_driver->name : "undefined");
|
||||
|
||||
return ERROR_OK;
|
||||
}
|
||||
|
||||
COMMAND_HANDLER(adapter_transports_command)
|
||||
|
@ -1127,9 +1124,10 @@ static const struct command_registration adapter_command_handlers[] = {
|
|||
{
|
||||
.name = "name",
|
||||
.mode = COMMAND_ANY,
|
||||
.jim_handler = jim_adapter_name,
|
||||
.handler = handle_adapter_name,
|
||||
.help = "Returns the name of the currently "
|
||||
"selected adapter (driver)",
|
||||
.usage = "",
|
||||
},
|
||||
{
|
||||
.name = "srst",
|
||||
|
|
Loading…
Reference in New Issue