drivers/jtag: usb_blaster: make command handlers more strict
If user used wrong argument number for some usb_blaster_* commands then openocd show just warning message. This commit makes command handler's behaviour more strict and openocd treats wrong argument number as an error. In addition we already have 'help' and 'usage' information in struct command_registration ublast_command_handlers[], so we can drop redundancy messages in command handlers. Change-Id: I73b8c75ec60a18e5258a4bdffe972e8a1afc1066 Signed-off-by: Antony Pavlov <antonynpavlov@gmail.com> Reviewed-on: http://openocd.zylin.com/1942 Tested-by: jenkins Reviewed-by: Paul Fertser <fercerpav@gmail.com> Reviewed-by: Spencer Oliver <spen@spen-soft.co.uk>
This commit is contained in:
parent
7e4fb97559
commit
b27c53354d
|
@ -881,11 +881,10 @@ static int ublast_quit(void)
|
|||
|
||||
COMMAND_HANDLER(ublast_handle_device_desc_command)
|
||||
{
|
||||
if (CMD_ARGC == 1)
|
||||
info.ublast_device_desc = strdup(CMD_ARGV[0]);
|
||||
else
|
||||
LOG_ERROR("require exactly one argument to "
|
||||
"ublast_device_desc <description>");
|
||||
if (CMD_ARGC != 1)
|
||||
return ERROR_COMMAND_SYNTAX_ERROR;
|
||||
|
||||
info.ublast_device_desc = strdup(CMD_ARGV[0]);
|
||||
|
||||
return ERROR_OK;
|
||||
}
|
||||
|
@ -983,21 +982,20 @@ COMMAND_HANDLER(ublast_handle_pin_command)
|
|||
|
||||
COMMAND_HANDLER(ublast_handle_lowlevel_drv_command)
|
||||
{
|
||||
if (CMD_ARGC == 1)
|
||||
info.lowlevel_name = strdup(CMD_ARGV[0]);
|
||||
else
|
||||
LOG_ERROR("require exactly one argument to "
|
||||
"usb_blaster_lowlevel_driver (ftdi|ftd2xx)");
|
||||
if (CMD_ARGC != 1)
|
||||
return ERROR_COMMAND_SYNTAX_ERROR;
|
||||
|
||||
info.lowlevel_name = strdup(CMD_ARGV[0]);
|
||||
|
||||
return ERROR_OK;
|
||||
}
|
||||
|
||||
COMMAND_HANDLER(ublast_firmware_command)
|
||||
{
|
||||
if (CMD_ARGC == 1)
|
||||
info.firmware_path = strdup(CMD_ARGV[0]);
|
||||
else
|
||||
LOG_ERROR("require exactly one argument to "
|
||||
"ublast_firmware_command <path>");
|
||||
if (CMD_ARGC != 1)
|
||||
return ERROR_COMMAND_SYNTAX_ERROR;
|
||||
|
||||
info.firmware_path = strdup(CMD_ARGV[0]);
|
||||
|
||||
return ERROR_OK;
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue