jtag/vsllink: switch to command 'adapter serial'
authorAntonio Borneo <borneo.antonio@gmail.com>
Thu, 7 Oct 2021 20:39:45 +0000 (22:39 +0200)
committerAntonio Borneo <borneo.antonio@gmail.com>
Sun, 28 Nov 2021 10:59:01 +0000 (10:59 +0000)
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
doc/openocd.texi
src/jtag/drivers/versaloon/versaloon.c
src/jtag/drivers/versaloon/versaloon.h
src/jtag/drivers/vsllink.c
src/jtag/startup.tcl

index 1e2524c7ec9520b163df3706ae0488c19105ae39..c76fc076c5e53788ab4a68f5ee6fb44215788c76 100644 (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.
 If this command is not specified, serial strings are not checked.
 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:
-hla, jlink, st-link, vsllink, xds110.
+hla, jlink, st-link, xds110.
 @end deffn
 
 @section Interface Drivers
index b17c1d49b603f302dbe7aef06202f5674288974e..7c2efefaa0be8504aba9e5b117072265e0b4c5a0 100644 (file)
@@ -87,7 +87,6 @@ struct versaloon_interface_t versaloon_interface = {
                .ep_out                 = VERSALOON_OUTP,
                .ep_in                  = VERSALOON_INP,
                .interface              = VERSALOON_IFACE,
-               .serialstring   = NULL,
                .buf_size               = 256,
        }
 };
index 22e73fb35b1bc1d5a67223233658519899c4d805..e4aafb2506eebf6dc9f6c1ceb43000144160727d 100644 (file)
@@ -94,8 +94,6 @@ struct versaloon_usb_setting_t {
        uint8_t ep_out;
        uint8_t ep_in;
        uint8_t interface;
-       char *serialstring;
-
        uint16_t buf_size;
 };
 
index 9cec2bea7b80c92517aa2d5bbd243eec58a29126..f59a7033ee7abe5d9202c35178a2707914323873 100644 (file)
@@ -499,21 +499,6 @@ COMMAND_HANDLER(vsllink_handle_usb_pid_command)
        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)
 {
        if (CMD_ARGC != 1)
@@ -786,14 +771,14 @@ static int vsllink_check_usb_strings(
        char desc_string[256];
        int retval;
 
-       if (versaloon_interface.usb_setting.serialstring) {
+       if (adapter_get_required_serial()) {
                retval = libusb_get_string_descriptor_ascii(usb_device_handle,
                        usb_desc->iSerialNumber, (unsigned char *)desc_string,
                        sizeof(desc_string));
                if (retval < 0)
                        return ERROR_FAIL;
 
-               if (strncmp(desc_string, versaloon_interface.usb_setting.serialstring,
+               if (strncmp(desc_string, adapter_get_required_serial(),
                                sizeof(desc_string)))
                        return ERROR_FAIL;
        }
@@ -903,13 +888,6 @@ static const struct command_registration vsllink_subcommand_handlers[] = {
                .help = "Set USB 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",
                .handler = &vsllink_handle_usb_bulkin_command,
index b8b866fbe7856a4e135c6f9e94a9ec044b0be7e2..95fe55ca72382d77686fa0d80fc15190e264fa1b 100644 (file)
@@ -371,8 +371,8 @@ proc vsllink_usb_pid args {
 
 lappend _telnet_autocomplete_skip vsllink_usb_serial
 proc vsllink_usb_serial args {
-       echo "DEPRECATED! use 'vsllink usb_serial' not 'vsllink_usb_serial'"
-       eval vsllink usb_serial $args
+       echo "DEPRECATED! use 'adapter serial' not 'vsllink_usb_serial'"
+       eval adapter serial $args
 }
 
 lappend _telnet_autocomplete_skip vsllink_usb_bulkin
@@ -771,4 +771,10 @@ proc "presto 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