jtag: rewrite command 'adapter name' as COMMAND_HANDLER 93/7493/2
authorAntonio Borneo <borneo.antonio@gmail.com>
Sun, 18 Dec 2022 21:11:14 +0000 (22:11 +0100)
committerAntonio Borneo <borneo.antonio@gmail.com>
Sat, 25 Mar 2023 18:12:38 +0000 (18:12 +0000)
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
src/jtag/adapter.c

index eb73fcb9a3d3b2e835d594d4296e5e0f4e04a197..76a6620be43159cac97181703a9ca9b7d933f2d8 100644 (file)
@@ -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",

Linking to existing account procedure

If you already have an account and want to add another login method you MUST first sign in with your existing account and then change URL to read https://review.openocd.org/login/?link to get to this page again but this time it'll work for linking. Thank you.

SSH host keys fingerprints

1024 SHA256:YKx8b7u5ZWdcbp7/4AeXNaqElP49m6QrwfXaqQGJAOk gerrit-code-review@openocd.zylin.com (DSA)
384 SHA256:jHIbSQa4REvwCFG4cq5LBlBLxmxSqelQPem/EXIrxjk gerrit-code-review@openocd.org (ECDSA)
521 SHA256:UAOPYkU9Fjtcao0Ul/Rrlnj/OsQvt+pgdYSZ4jOYdgs gerrit-code-review@openocd.org (ECDSA)
256 SHA256:A13M5QlnozFOvTllybRZH6vm7iSt0XLxbA48yfc2yfY gerrit-code-review@openocd.org (ECDSA)
256 SHA256:spYMBqEYoAOtK7yZBrcwE8ZpYt6b68Cfh9yEVetvbXg gerrit-code-review@openocd.org (ED25519)
+--[ED25519 256]--+
|=..              |
|+o..   .         |
|*.o   . .        |
|+B . . .         |
|Bo. = o S        |
|Oo.+ + =         |
|oB=.* = . o      |
| =+=.+   + E     |
|. .=o   . o      |
+----[SHA256]-----+
2048 SHA256:0Onrb7/PHjpo6iVZ7xQX2riKN83FJ3KGU0TvI0TaFG4 gerrit-code-review@openocd.zylin.com (RSA)