This is an automated email from Gerrit.

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

-- gerrit

commit 26738c1d36f2f6048aa16634106519929975127f
Author: Antonio Borneo <[email protected]>
Date:   Mon Jun 29 23:58:09 2020 +0200

    cmsis-dap: fix USB interface for NXP LCP-Link2
    
    The adapter NXP LCP-Link2 is a USB composite device that provides
    five interfaces; among three of them that are of HID class, only
    one is cmsis-dap.
    
    Accordingly to ticket 255, OpenOCD code is not opening the right
    HID interface; then it fails to communicate with the cmsis-dap
    while checking the adapter's info.
    
    Unfortunately, hidapi does not provide any support for reading the
    string descriptor of the interface, otherwise it would have been
    trivial to look for the right cmsis-dap interface.
    In fact the cmsis-dap specification reports:
        The CMSIS-DAP Firmware can be also part of a USB composite
        device. If this case, the HID Interface String must
        contain the sub-string CMSIS-DAP.
    This requirement is satisfied by the USB device descriptor of the
    LPC-Link2 reported below, but cannot be used.
    
    Add a quirk to let OpenOCD only accept interface number zero on a
    LPC-Link2 device.
    
    Bus 001 Device 050: ID 1fc9:0090 NXP Semiconductors
    Device Descriptor:
      bLength                18
      bDescriptorType         1
      bcdUSB               2.00
      bDeviceClass          239 Miscellaneous Device
      bDeviceSubClass         2
      bDeviceProtocol         1 Interface Association
      bMaxPacketSize0        64
      idVendor           0x1fc9 NXP Semiconductors
      idProduct          0x0090
      bcdDevice            1.00
      iManufacturer           1 NXP Semiconductors
      iProduct                2 LPC-LINK2 CMSIS-DAP V5.224
      iSerial                 3 I3F4AABA
      bNumConfigurations      1
      Configuration Descriptor:
        bLength                 9
        bDescriptorType         2
        wTotalLength       0x00ab
        bNumInterfaces          5
        bConfigurationValue     1
        iConfiguration          0
        bmAttributes         0x80
          (Bus Powered)
        MaxPower              500mA
        Interface Descriptor:
          bLength                 9
          bDescriptorType         4
          bInterfaceNumber        0
          bAlternateSetting       0
          bNumEndpoints           2
          bInterfaceClass         3 Human Interface Device
          bInterfaceSubClass      0
          bInterfaceProtocol      0
          iInterface              4 LPC-LINK2 CMSIS-DAP V5.224
            HID Device Descriptor:
              bLength                 9
              bDescriptorType        33
              bcdHID               1.00
              bCountryCode            0 Not supported
              bNumDescriptors         1
              bDescriptorType        34 Report
              wDescriptorLength      35
             Report Descriptors:
               ** UNAVAILABLE **
          Endpoint Descriptor:
            bLength                 7
            bDescriptorType         5
            bEndpointAddress     0x81  EP 1 IN
            bmAttributes            3
              Transfer Type            Interrupt
              Synch Type               None
              Usage Type               Data
            wMaxPacketSize     0x0400  1x 1024 bytes
            bInterval               4
          Endpoint Descriptor:
            bLength                 7
            bDescriptorType         5
            bEndpointAddress     0x01  EP 1 OUT
            bmAttributes            3
              Transfer Type            Interrupt
              Synch Type               None
              Usage Type               Data
            wMaxPacketSize     0x0400  1x 1024 bytes
            bInterval               4
        Interface Descriptor:
          bLength                 9
          bDescriptorType         4
          bInterfaceNumber        4
          bAlternateSetting       0
          bNumEndpoints           2
          bInterfaceClass         3 Human Interface Device
          bInterfaceSubClass      0
          bInterfaceProtocol      0
          iInterface              7 LPC-LINK2 DATA PORT
            HID Device Descriptor:
              bLength                 9
              bDescriptorType        33
              bcdHID               1.00
              bCountryCode            0 Not supported
              bNumDescriptors         1
              bDescriptorType        34 Report
              wDescriptorLength      35
             Report Descriptors:
               ** UNAVAILABLE **
          Endpoint Descriptor:
            bLength                 7
            bDescriptorType         5
            bEndpointAddress     0x84  EP 4 IN
            bmAttributes            3
              Transfer Type            Interrupt
              Synch Type               None
              Usage Type               Data
            wMaxPacketSize     0x0400  1x 1024 bytes
            bInterval               1
          Endpoint Descriptor:
            bLength                 7
            bDescriptorType         5
            bEndpointAddress     0x04  EP 4 OUT
            bmAttributes            3
              Transfer Type            Interrupt
              Synch Type               None
              Usage Type               Data
            wMaxPacketSize     0x0400  1x 1024 bytes
            bInterval               1
        Interface Association:
          bLength                 8
          bDescriptorType        11
          bFirstInterface         1
          bInterfaceCount         2
          bFunctionClass          2 Communications
          bFunctionSubClass       2 Abstract (modem)
          bFunctionProtocol       0
          iFunction               5 VCOM
        Interface Descriptor:
          bLength                 9
          bDescriptorType         4
          bInterfaceNumber        1
          bAlternateSetting       0
          bNumEndpoints           1
          bInterfaceClass         2 Communications
          bInterfaceSubClass      2 Abstract (modem)
          bInterfaceProtocol      0
          iInterface              5 VCOM
          CDC Header:
            bcdCDC               1.10
          CDC Call Management:
            bmCapabilities       0x01
              call management
            bDataInterface          2
          CDC ACM:
            bmCapabilities       0x02
              line coding and serial state
          CDC Union:
            bMasterInterface        1
            bSlaveInterface         2
          Endpoint Descriptor:
            bLength                 7
            bDescriptorType         5
            bEndpointAddress     0x83  EP 3 IN
            bmAttributes            3
              Transfer Type            Interrupt
              Synch Type               None
              Usage Type               Data
            wMaxPacketSize     0x0010  1x 16 bytes
            bInterval               4
        Interface Descriptor:
          bLength                 9
          bDescriptorType         4
          bInterfaceNumber        2
          bAlternateSetting       0
          bNumEndpoints           2
          bInterfaceClass        10 CDC Data
          bInterfaceSubClass      0
          bInterfaceProtocol      0
          iInterface              5 VCOM
          Endpoint Descriptor:
            bLength                 7
            bDescriptorType         5
            bEndpointAddress     0x02  EP 2 OUT
            bmAttributes            2
              Transfer Type            Bulk
              Synch Type               None
              Usage Type               Data
            wMaxPacketSize     0x0200  1x 512 bytes
            bInterval               0
          Endpoint Descriptor:
            bLength                 7
            bDescriptorType         5
            bEndpointAddress     0x82  EP 2 IN
            bmAttributes            2
              Transfer Type            Bulk
              Synch Type               None
              Usage Type               Data
            wMaxPacketSize     0x0200  1x 512 bytes
            bInterval               0
        Interface Descriptor:
          bLength                 9
          bDescriptorType         4
          bInterfaceNumber        3
          bAlternateSetting       0
          bNumEndpoints           2
          bInterfaceClass         3 Human Interface Device
          bInterfaceSubClass      0
          bInterfaceProtocol      0
          iInterface              6 LPCSIO
            HID Device Descriptor:
              bLength                 9
              bDescriptorType        33
              bcdHID               1.11
              bCountryCode            0 Not supported
              bNumDescriptors         1
              bDescriptorType        34 Report
              wDescriptorLength      33
             Report Descriptors:
               ** UNAVAILABLE **
          Endpoint Descriptor:
            bLength                 7
            bDescriptorType         5
            bEndpointAddress     0x85  EP 5 IN
            bmAttributes            3
              Transfer Type            Interrupt
              Synch Type               None
              Usage Type               Data
            wMaxPacketSize     0x0040  1x 64 bytes
            bInterval               2
          Endpoint Descriptor:
            bLength                 7
            bDescriptorType         5
            bEndpointAddress     0x05  EP 5 OUT
            bmAttributes            3
              Transfer Type            Interrupt
              Synch Type               None
              Usage Type               Data
            wMaxPacketSize     0x0040  1x 64 bytes
            bInterval               2
    Device Qualifier (for other device speed):
      bLength                10
      bDescriptorType         6
      bcdUSB               2.00
      bDeviceClass            0
      bDeviceSubClass         0
      bDeviceProtocol         0
      bMaxPacketSize0        64
      bNumConfigurations      1
    Device Status:     0x0000
      (Bus Powered)
    
    Change-Id: Ib3d46f87743a2d35a266842cb356035d898d466e
    Signed-off-by: Antonio Borneo <[email protected]>
    Suggested-by: Masatoshi Tateishi <[email protected]>
    Reported-by: Donald Bailey <[email protected]>
    Fixes: https://sourceforge.net/p/openocd/tickets/255/

diff --git a/src/jtag/drivers/cmsis_dap_usb.c b/src/jtag/drivers/cmsis_dap_usb.c
index 8915836..d87d0c9 100644
--- a/src/jtag/drivers/cmsis_dap_usb.c
+++ b/src/jtag/drivers/cmsis_dap_usb.c
@@ -270,6 +270,10 @@ static int cmsis_dap_usb_open(void)
                                found = true;
                }
 
+               /* LPC-LINK2 has cmsis-dap on interface 0 and other HID 
functions on other interfaces */
+               if (cur_dev->vendor_id == 0x1fc9 && cur_dev->product_id == 
0x0090 && cur_dev->interface_number != 0)
+                       found = false;
+
                if (found) {
                        /* we have found an adapter, so exit further checks */
                        /* check serial number matches if given */

-- 


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

Reply via email to