jtag/ftdi: switch to command 'adapter serial' 51/6651/3
authorAntonio Borneo <borneo.antonio@gmail.com>
Thu, 7 Oct 2021 20:28:30 +0000 (22:28 +0200)
committerAntonio Borneo <borneo.antonio@gmail.com>
Sun, 28 Nov 2021 10:57:22 +0000 (10:57 +0000)
The driver ftdi defines the command 'ftdi serial' to specify the
serial string of the adapter.

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

Change-Id: Ia5b1f325b9fab8f58b5ea70f8b807e50b148b939
Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com>
Reviewed-on: https://review.openocd.org/c/openocd/+/6651
Tested-by: jenkins
doc/openocd.texi
src/jtag/drivers/ftdi.c
src/jtag/startup.tcl
tcl/interface/ftdi/flossjtag.cfg

index 2891f3519c99a62c19cadc9d643e3490cd4a9c2b..5b9d65047b3ca836c430526e6e76dcc4977dcbd2 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:
 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.
+cmsis_dap, ft232r, ftdi.
 The following adapters have their own command to specify the serial string:
 The following adapters have their own command to specify the serial string:
-ftdi, hla, jlink, kitprog, presto, st-link, vsllink, xds110.
+hla, jlink, kitprog, presto, st-link, vsllink, xds110.
 @end deffn
 
 @section Interface Drivers
 @end deffn
 
 @section Interface Drivers
@@ -2512,15 +2512,6 @@ of the adapter. If not specified, the device description is ignored
 during device selection.
 @end deffn
 
 during device selection.
 @end deffn
 
-@deffn {Config Command} {ftdi serial} serial-number
-Specifies the @var{serial-number} of the adapter to use,
-in case the vendor provides unique IDs and more than one adapter
-is connected to the host.
-If not specified, serial numbers are not considered.
-(Note that USB serial numbers can be arbitrary Unicode strings,
-and are not restricted to containing only decimal digits.)
-@end deffn
-
 @deffn {Config Command} {ftdi channel} channel
 Selects the channel of the FTDI device to use for MPSSE operations. Most
 adapters use the default, channel 0, but there are exceptions.
 @deffn {Config Command} {ftdi channel} channel
 Selects the channel of the FTDI device to use for MPSSE operations. Most
 adapters use the default, channel 0, but there are exceptions.
index 8366774bc1e527a95b556627cc028905c75b1dd2..7671cee5d08fdbad14a3e615f60018fb37f3c73f 100644 (file)
@@ -90,7 +90,6 @@
 #define SWD_MODE (LSB_FIRST | POS_EDGE_IN | NEG_EDGE_OUT)
 
 static char *ftdi_device_desc;
 #define SWD_MODE (LSB_FIRST | POS_EDGE_IN | NEG_EDGE_OUT)
 
 static char *ftdi_device_desc;
-static char *ftdi_serial;
 static uint8_t ftdi_channel;
 static uint8_t ftdi_jtag_mode = JTAG_MODE;
 
 static uint8_t ftdi_channel;
 static uint8_t ftdi_jtag_mode = JTAG_MODE;
 
@@ -672,7 +671,7 @@ static int ftdi_initialize(void)
 
        for (int i = 0; ftdi_vid[i] || ftdi_pid[i]; i++) {
                mpsse_ctx = mpsse_open(&ftdi_vid[i], &ftdi_pid[i], ftdi_device_desc,
 
        for (int i = 0; ftdi_vid[i] || ftdi_pid[i]; i++) {
                mpsse_ctx = mpsse_open(&ftdi_vid[i], &ftdi_pid[i], ftdi_device_desc,
-                               ftdi_serial, adapter_usb_get_location(), ftdi_channel);
+                               adapter_get_required_serial(), adapter_usb_get_location(), ftdi_channel);
                if (mpsse_ctx)
                        break;
        }
                if (mpsse_ctx)
                        break;
        }
@@ -717,7 +716,6 @@ static int ftdi_quit(void)
        }
 
        free(ftdi_device_desc);
        }
 
        free(ftdi_device_desc);
-       free(ftdi_serial);
 
        free(swd_cmd_queue);
 
 
        free(swd_cmd_queue);
 
@@ -736,18 +734,6 @@ COMMAND_HANDLER(ftdi_handle_device_desc_command)
        return ERROR_OK;
 }
 
        return ERROR_OK;
 }
 
-COMMAND_HANDLER(ftdi_handle_serial_command)
-{
-       if (CMD_ARGC == 1) {
-               free(ftdi_serial);
-               ftdi_serial = strdup(CMD_ARGV[0]);
-       } else {
-               return ERROR_COMMAND_SYNTAX_ERROR;
-       }
-
-       return ERROR_OK;
-}
-
 COMMAND_HANDLER(ftdi_handle_channel_command)
 {
        if (CMD_ARGC == 1)
 COMMAND_HANDLER(ftdi_handle_channel_command)
 {
        if (CMD_ARGC == 1)
@@ -955,13 +941,6 @@ static const struct command_registration ftdi_subcommand_handlers[] = {
                .help = "set the USB device description of the FTDI device",
                .usage = "description_string",
        },
                .help = "set the USB device description of the FTDI device",
                .usage = "description_string",
        },
-       {
-               .name = "serial",
-               .handler = &ftdi_handle_serial_command,
-               .mode = COMMAND_CONFIG,
-               .help = "set the serial number of the FTDI device",
-               .usage = "serial_string",
-       },
        {
                .name = "channel",
                .handler = &ftdi_handle_channel_command,
        {
                .name = "channel",
                .handler = &ftdi_handle_channel_command,
index b5f4a0298005ba6eea289b27563511bc78328148..b21ddc646affb9d887fb1b2a2d4671b8d6e1081b 100644 (file)
@@ -215,8 +215,8 @@ proc ftdi_device_desc args {
 
 lappend _telnet_autocomplete_skip ftdi_serial
 proc ftdi_serial args {
 
 lappend _telnet_autocomplete_skip ftdi_serial
 proc ftdi_serial args {
-       echo "DEPRECATED! use 'ftdi serial' not 'ftdi_serial'"
-       eval ftdi serial $args
+       echo "DEPRECATED! use 'adapter serial' not 'ftdi_serial'"
+       eval adapter serial $args
 }
 
 lappend _telnet_autocomplete_skip ftdi_channel
 }
 
 lappend _telnet_autocomplete_skip ftdi_channel
@@ -753,4 +753,10 @@ proc "ft232r serial_desc" {args} {
        eval adapter serial $args
 }
 
        eval adapter serial $args
 }
 
+lappend _telnet_autocomplete_skip "ftdi serial"
+proc "ftdi serial" {args} {
+       echo "DEPRECATED! use 'adapter serial' not 'ftdi serial'"
+       eval adapter serial $args
+}
+
 # END MIGRATION AIDS
 # END MIGRATION AIDS
index 2e3cfca4895706f9a47621a00026ae4df8758f61..c1506a2e9b859c1be0111b635fca8a602fb572d7 100644 (file)
@@ -20,7 +20,7 @@ echo "so it could be marked as working or fixed."
 adapter driver ftdi
 ftdi vid_pid 0x0403 0x6010
 ftdi device_desc "FLOSS-JTAG"
 adapter driver ftdi
 ftdi vid_pid 0x0403 0x6010
 ftdi device_desc "FLOSS-JTAG"
-#ftdi serial "FJ000001"
+# adapter serial "FJ000001"
 
 ftdi layout_init 0x0008 0x180b
 ftdi layout_signal nTRST -data 0x0010 -oe 0x0010
 
 ftdi layout_init 0x0008 0x180b
 ftdi layout_signal nTRST -data 0x0010 -oe 0x0010

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)