This is an automated email from Gerrit.

Oleksij Rempel ([email protected]) just uploaded a new patch set to 
Gerrit, which you can find at http://openocd.zylin.com/4771

-- gerrit

commit ffae3c412c9fad76e45787fdd4068a3236b583fc
Author: Oleksij Rempel <[email protected]>
Date:   Fri Nov 16 09:23:25 2018 +0100

    ftdi: use "adapter usb location" instead of ftdi_location command
    
    Use unified "adapter usb location" instead of driver specific
    command.
    
    Change-Id: I568a76b87d09cea0f40f1580cf81f7c51402f6f1
    Signed-off-by: Oleksij Rempel <[email protected]>

diff --git a/doc/openocd.texi b/doc/openocd.texi
index 3f00d44..dea4d21 100644
--- a/doc/openocd.texi
+++ b/doc/openocd.texi
@@ -2502,6 +2502,8 @@ and are not restricted to containing only decimal digits.)
 @end deffn
 
 @deffn {Config Command} {ftdi_location} <bus>:<port>[.<port>]...
+This command is deprecated. Please use @command{adapter usb location}.
+
 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
diff --git a/src/jtag/drivers/ftdi.c b/src/jtag/drivers/ftdi.c
index 1afedd1..7a4fe7c 100644
--- a/src/jtag/drivers/ftdi.c
+++ b/src/jtag/drivers/ftdi.c
@@ -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, 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);
 
@@ -740,13 +739,11 @@ COMMAND_HANDLER(ftdi_handle_serial_command)
 #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 {
+       LOG_WARNING("this command is deprecated, please use: adapter usb 
location");
+       if (CMD_ARGC == 1)
+               jtag_usb_set_location(CMD_ARGV[0]);
+       else
                return ERROR_COMMAND_SYNTAX_ERROR;
-       }
 
        return ERROR_OK;
 }
diff --git a/src/jtag/drivers/mpsse.c b/src/jtag/drivers/mpsse.c
index 8924892..d171d7c 100644
--- a/src/jtag/drivers/mpsse.c
+++ b/src/jtag/drivers/mpsse.c
@@ -23,6 +23,7 @@
 #include "mpsse.h"
 #include "helper/log.h"
 #include <libusb.h>
+#include <jtag/drivers/jtag_usb_common.h>
 
 /* Compatibility define for older libusb-1.0 */
 #ifndef LIBUSB_CALL
@@ -321,9 +322,10 @@ error:
 }
 
 struct mpsse_ctx *mpsse_open(const uint16_t *vid, const uint16_t *pid, const 
char *description,
-       const char *serial, const char *location, int channel)
+       const char *serial, int channel)
 {
        struct mpsse_ctx *ctx = calloc(1, sizeof(*ctx));
+       const char *location = jtag_usb_get_location();
        int err;
 
        if (!ctx)
diff --git a/src/jtag/drivers/mpsse.h b/src/jtag/drivers/mpsse.h
index 651eef9..cda24e6 100644
--- a/src/jtag/drivers/mpsse.h
+++ b/src/jtag/drivers/mpsse.h
@@ -41,7 +41,7 @@ struct mpsse_ctx;
 
 /* Device handling */
 struct mpsse_ctx *mpsse_open(const uint16_t *vid, const uint16_t *pid, const 
char *description,
-       const char *serial, const char *location, int channel);
+       const char *serial, int channel);
 void mpsse_close(struct mpsse_ctx *ctx);
 bool mpsse_is_high_speed(struct mpsse_ctx *ctx);
 

-- 


_______________________________________________
OpenOCD-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/openocd-devel

Reply via email to