This is an automated email from Gerrit.

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

-- gerrit

commit d6e086f167171bb0918a2f029ceb7d9c96516ab7
Author: Tom Verbeure <[email protected]>
Date:   Sat Jun 15 16:10:25 2019 -0700

    driver/mpsse: allow multiple instances with same vid/pid
    
    If you have, on the same PC, multiple JTAG USB devices that use the mpsse
    driver and that have the same vid/pid, there are common scenarios where
    you can not use more than one openocd instance.
    
    For example:
    
    Assume you have 2 USB devices with vid/pid/serial:
    
    0x15ba/0x002b/S0001
    0x15ba/0x002b/S0002
    
    Assume that the USB devices are enumerated in that order by
    libusb_get_device_list(...).
    
    In your openocd_1.cfg, you request for the device with serial
    number S0001.
    
    openocd will correctly find this USB device, and open it using
    libusb_open(...).
    
    In your openocd_2.cfg, you request for the device with serial
    number S0002.
    
    When you start openocd with this second .cfg file, it will fail.
    
    The reason is because the mpsse driver will call libusb_open(...) on the
    first device with matching vid/pid. Since the first openocd instance
    has already opened that device, this call will fail, LOG_ERROR
    will be called, and openocd will abort.
    
    The solution is to only call LOG_INFO after the libusb_open fail, and
    move on to the next USB device until the device has been found that
    matches and that can be opened.
    
    An additional benefit of this patch is that it will also allow
    using multiple mpsse devices with the same vid/pid and with the same
    serial number.
    
    E.g. the serial number on all Olimex ARM-USB-OCD-H devices is identical.
    
    With this patch, for multiple openocd instances, the USB devices will
    be assign in the order they are listed by libusb_get_device_list(...).
    
    Change-Id: Ic9500113a3f2410d93ed82c8844c216317b01ef6
    Signed-off-by: Tom Verbeure <[email protected]>

diff --git a/src/jtag/drivers/mpsse.c b/src/jtag/drivers/mpsse.c
index a881803..be43697 100644
--- a/src/jtag/drivers/mpsse.c
+++ b/src/jtag/drivers/mpsse.c
@@ -185,7 +185,7 @@ static bool open_matching_device(struct mpsse_ctx *ctx, 
const uint16_t *vid, con
 
                err = libusb_open(device, &ctx->usb_dev);
                if (err != LIBUSB_SUCCESS) {
-                       LOG_ERROR("libusb_open() failed with %s",
+                       LOG_INFO("libusb_open() failed with %s",
                                  libusb_error_name(err));
                        continue;
                }

-- 


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

Reply via email to