jtag/vsllink: switch to command 'adapter serial'

The driver vsllink defines the command 'vsllink usb_serial' to
specify the serial string of the adapter.

Remove and deprecate the driver command, and use 'adapter serial'.

Change-Id: Iadcc018b8aa8974ccd7156915b84e58270fad29d
Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com>
Reviewed-on: https://review.openocd.org/c/openocd/+/6654
Reviewed-by: Tomas Vanek <vanekt@fbl.cz>
Tested-by: jenkins
This commit is contained in:
Antonio Borneo 2021-10-07 22:39:45 +02:00
parent c41d9f6190
commit 271e5416af
5 changed files with 12 additions and 31 deletions

View File

@ -2371,9 +2371,9 @@ This command is only available if your libusb1 is at least version 1.0.16.
Specifies the @var{serial_string} of the adapter to use. Specifies the @var{serial_string} of the adapter to use.
If this command is not specified, serial strings are not checked. If this command is not specified, serial strings are not checked.
Only the following adapter drivers use the serial string from this command: Only the following adapter drivers use the serial string from this command:
cmsis_dap, ft232r, ftdi, kitprog, presto. cmsis_dap, ft232r, ftdi, kitprog, presto, vsllink.
The following adapters have their own command to specify the serial string: The following adapters have their own command to specify the serial string:
hla, jlink, st-link, vsllink, xds110. hla, jlink, st-link, xds110.
@end deffn @end deffn
@section Interface Drivers @section Interface Drivers

View File

@ -87,7 +87,6 @@ struct versaloon_interface_t versaloon_interface = {
.ep_out = VERSALOON_OUTP, .ep_out = VERSALOON_OUTP,
.ep_in = VERSALOON_INP, .ep_in = VERSALOON_INP,
.interface = VERSALOON_IFACE, .interface = VERSALOON_IFACE,
.serialstring = NULL,
.buf_size = 256, .buf_size = 256,
} }
}; };

View File

@ -94,8 +94,6 @@ struct versaloon_usb_setting_t {
uint8_t ep_out; uint8_t ep_out;
uint8_t ep_in; uint8_t ep_in;
uint8_t interface; uint8_t interface;
char *serialstring;
uint16_t buf_size; uint16_t buf_size;
}; };

View File

@ -499,21 +499,6 @@ COMMAND_HANDLER(vsllink_handle_usb_pid_command)
return ERROR_OK; return ERROR_OK;
} }
COMMAND_HANDLER(vsllink_handle_usb_serial_command)
{
if (CMD_ARGC > 1)
return ERROR_COMMAND_SYNTAX_ERROR;
free(versaloon_interface.usb_setting.serialstring);
if (CMD_ARGC == 1)
versaloon_interface.usb_setting.serialstring = strdup(CMD_ARGV[0]);
else
versaloon_interface.usb_setting.serialstring = NULL;
return ERROR_OK;
}
COMMAND_HANDLER(vsllink_handle_usb_bulkin_command) COMMAND_HANDLER(vsllink_handle_usb_bulkin_command)
{ {
if (CMD_ARGC != 1) if (CMD_ARGC != 1)
@ -786,14 +771,14 @@ static int vsllink_check_usb_strings(
char desc_string[256]; char desc_string[256];
int retval; int retval;
if (versaloon_interface.usb_setting.serialstring) { if (adapter_get_required_serial()) {
retval = libusb_get_string_descriptor_ascii(usb_device_handle, retval = libusb_get_string_descriptor_ascii(usb_device_handle,
usb_desc->iSerialNumber, (unsigned char *)desc_string, usb_desc->iSerialNumber, (unsigned char *)desc_string,
sizeof(desc_string)); sizeof(desc_string));
if (retval < 0) if (retval < 0)
return ERROR_FAIL; return ERROR_FAIL;
if (strncmp(desc_string, versaloon_interface.usb_setting.serialstring, if (strncmp(desc_string, adapter_get_required_serial(),
sizeof(desc_string))) sizeof(desc_string)))
return ERROR_FAIL; return ERROR_FAIL;
} }
@ -903,13 +888,6 @@ static const struct command_registration vsllink_subcommand_handlers[] = {
.help = "Set USB PID", .help = "Set USB PID",
.usage = "<pid>", .usage = "<pid>",
}, },
{
.name = "usb_serial",
.handler = &vsllink_handle_usb_serial_command,
.mode = COMMAND_CONFIG,
.help = "Set or disable check for USB serial",
.usage = "[<serial>]",
},
{ {
.name = "usb_bulkin", .name = "usb_bulkin",
.handler = &vsllink_handle_usb_bulkin_command, .handler = &vsllink_handle_usb_bulkin_command,

View File

@ -371,8 +371,8 @@ proc vsllink_usb_pid args {
lappend _telnet_autocomplete_skip vsllink_usb_serial lappend _telnet_autocomplete_skip vsllink_usb_serial
proc vsllink_usb_serial args { proc vsllink_usb_serial args {
echo "DEPRECATED! use 'vsllink usb_serial' not 'vsllink_usb_serial'" echo "DEPRECATED! use 'adapter serial' not 'vsllink_usb_serial'"
eval vsllink usb_serial $args eval adapter serial $args
} }
lappend _telnet_autocomplete_skip vsllink_usb_bulkin lappend _telnet_autocomplete_skip vsllink_usb_bulkin
@ -771,4 +771,10 @@ proc "presto serial" {args} {
eval adapter serial $args eval adapter serial $args
} }
lappend _telnet_autocomplete_skip "vsllink usb_serial"
proc "vsllink usb_serial" {args} {
echo "DEPRECATED! use 'adapter serial' not 'vsllink usb_serial'"
eval adapter serial $args
}
# END MIGRATION AIDS # END MIGRATION AIDS