adapter/cmsis-dap: Fix 'usb interface' command

Simplify syntax error handling and make the documentation and code
consistent.

Change-Id: Ib8ee5adff2071964fc6d8e153f3eb82dd20054f3
Signed-off-by: Marc Schink <dev@zapb.de>
Reviewed-on: https://review.openocd.org/c/openocd/+/9067
Tested-by: jenkins
Reviewed-by: Tomas Vanek <vanekt@fbl.cz>
This commit is contained in:
Marc Schink
2025-08-02 11:13:50 +02:00
committed by Antonio Borneo
parent 1950befd76
commit 727c0d46e3
2 changed files with 6 additions and 6 deletions

View File

@@ -659,10 +659,10 @@ static void cmsis_dap_usb_cancel_all(struct cmsis_dap *dap)
COMMAND_HANDLER(cmsis_dap_handle_usb_interface_command)
{
if (CMD_ARGC == 1)
COMMAND_PARSE_NUMBER(int, CMD_ARGV[0], cmsis_dap_usb_interface);
else
LOG_ERROR("expected exactly one argument to cmsis_dap_usb_interface <interface_number>");
if (CMD_ARGC != 1)
return ERROR_COMMAND_SYNTAX_ERROR;
COMMAND_PARSE_NUMBER(int, CMD_ARGV[0], cmsis_dap_usb_interface);
return ERROR_OK;
}
@@ -673,7 +673,7 @@ const struct command_registration cmsis_dap_usb_subcommand_handlers[] = {
.handler = &cmsis_dap_handle_usb_interface_command,
.mode = COMMAND_CONFIG,
.help = "set the USB interface number to use (for USB bulk backend only)",
.usage = "<interface_number>",
.usage = "<number>",
},
COMMAND_REGISTRATION_DONE
};