ftdi: use "adapter usb location" instead of ftdi_location command
authorOleksij Rempel <o.rempel@pengutronix.de>
Fri, 16 Nov 2018 07:58:58 +0000 (08:58 +0100)
committerMatthias Welwarsky <matthias@welwarsky.de>
Tue, 19 Feb 2019 08:53:47 +0000 (08:53 +0000)
Use unified "adapter usb location" instead of driver specific
command.

Change-Id: I568a76b87d09cea0f40f1580cf81f7c51402f6f1
Signed-off-by: Oleksij Rempel <o.rempel@pengutronix.de>
Reviewed-on: http://openocd.zylin.com/4771
Tested-by: jenkins
Reviewed-by: Matthias Welwarsky <matthias@welwarsky.de>
doc/openocd.texi
src/jtag/drivers/ftdi.c
src/target/startup.tcl

index f9a9297b0eaf71a39d105e1bf157fc4f2645f61d..9918cee06d53dd420432ff52493951f8c7c9b457 100644 (file)
@@ -2368,6 +2368,7 @@ the hardware can support.
 Returns the name of the debug adapter driver being used.
 @end deffn
 
+@anchor{adapter_usb_location}
 @deffn Command {adapter usb location} <bus>-<port>[.<port>]...
 Specifies the physical USB port of the adapter to use. The path
 roots at @var{bus} and walks down the physical ports, with each
@@ -2510,7 +2511,10 @@ If not specified, serial numbers are not considered.
 and are not restricted to containing only decimal digits.)
 @end deffn
 
-@deffn {Config Command} {ftdi_location} <bus>:<port>[,<port>]...
+@deffn {Config Command} {ftdi_location} <bus>-<port>[.<port>]...
+@emph{DEPRECATED -- avoid using this.
+Use the @xref{adapter_usb_location, adapter usb location} command instead.}
+
 Specifies the physical USB port of the adapter to use. The path
 roots at @var{bus} and walks down the physical ports, with each
 @var{port} option specifying a deeper level in the bus topology, the last
index 1afedd1af5adf617da2bdf97ee85b95b89c936d9..b709d28daaa678ffb1fd1c153ef49e0367e98579 100644 (file)
@@ -69,6 +69,7 @@
 #endif
 
 /* project specific includes */
+#include <jtag/drivers/jtag_usb_common.h>
 #include <jtag/interface.h>
 #include <jtag/swd.h>
 #include <transport/transport.h>
@@ -89,7 +90,6 @@
 
 static char *ftdi_device_desc;
 static char *ftdi_serial;
-static char *ftdi_location;
 static uint8_t ftdi_channel;
 static uint8_t ftdi_jtag_mode = JTAG_MODE;
 
@@ -658,7 +658,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,
-                               ftdi_serial, ftdi_location, ftdi_channel);
+                               ftdi_serial, jtag_usb_get_location(), ftdi_channel);
                if (mpsse_ctx)
                        break;
        }
@@ -704,7 +704,6 @@ static int ftdi_quit(void)
 
        free(ftdi_device_desc);
        free(ftdi_serial);
-       free(ftdi_location);
 
        free(swd_cmd_queue);
 
@@ -737,21 +736,6 @@ COMMAND_HANDLER(ftdi_handle_serial_command)
        return ERROR_OK;
 }
 
-#ifdef HAVE_LIBUSB_GET_PORT_NUMBERS
-COMMAND_HANDLER(ftdi_handle_location_command)
-{
-       if (CMD_ARGC == 1) {
-               if (ftdi_location)
-                       free(ftdi_location);
-               ftdi_location = strdup(CMD_ARGV[0]);
-       } else {
-               return ERROR_COMMAND_SYNTAX_ERROR;
-       }
-
-       return ERROR_OK;
-}
-#endif
-
 COMMAND_HANDLER(ftdi_handle_channel_command)
 {
        if (CMD_ARGC == 1)
@@ -966,15 +950,6 @@ static const struct command_registration ftdi_command_handlers[] = {
                .help = "set the serial number of the FTDI device",
                .usage = "serial_string",
        },
-#ifdef HAVE_LIBUSB_GET_PORT_NUMBERS
-       {
-               .name = "ftdi_location",
-               .handler = &ftdi_handle_location_command,
-               .mode = COMMAND_CONFIG,
-               .help = "set the USB bus location of the FTDI device",
-               .usage = "<bus>:port[,port]...",
-       },
-#endif
        {
                .name = "ftdi_channel",
                .handler = &ftdi_handle_channel_command,
index cf844e1f64c3734a0f5b76978688c52048e52b1b..4d4426f98cff971d32bce73f9826f41a4324addc 100644 (file)
@@ -221,3 +221,9 @@ proc cortex_a8 args {
        echo "DEPRECATED! use 'cortex_a' not 'cortex_a8'"
        eval cortex_a $args
 }
+
+# deprecated ftdi cmds
+proc ftdi_location args {
+       echo "DEPRECATED! use 'adapter usb location' not 'ftdi_location'"
+       eval adapter usb location $args
+}