On Wed, Jun 23, 2021 at 4:20 PM Xiaofan Chen
<xiaof...@users.sourceforge.net> wrote:
>
> To proof my theory,  I apply the following dirty fix to openocd and now 
> latest openocd git has not issues with latest libusb git.
>
> https://github.com/libusb/libusb/issues/928
> diff --git a/src/jtag/drivers/libusb_helper.c 
> b/src/jtag/drivers/libusb_helper.c
> index f0122d534..05c6e5574 100644
> --- a/src/jtag/drivers/libusb_helper.c
> +++ b/src/jtag/drivers/libusb_helper.c
> @@ -163,7 +163,7 @@ int jtag_libusb_open(const uint16_t vids[], const 
> uint16_t pids[],
>         bool serial_mismatch = false;
>         struct libusb_device_handle *libusb_handle = NULL;
>
> -       if (libusb_init(&jtag_libusb_context) < 0)
> +       if (libusb_init(NULL) < 0)
>                 return ERROR_FAIL;
>
>         cnt = libusb_get_device_list(jtag_libusb_context, &devs);
>
>
> ---

Now it's clear!
The bug is inside stlink driver in OpenOCD
Thanks for the dirty fix, it helps identifying the issue.
Strange that it doesn't crash in Linux too!

I will put a patch in openocd gerrit and report to you the link.
It would be great if you could test it and approve it in gerrit.

Antonio


---

** [tickets:#308] ST-link connect issue using latest libusb-1.0.dll**

**Status:** new
**Milestone:** 0.11.0
**Created:** Fri Jun 11, 2021 10:12 AM UTC by asier70
**Last Updated:** Wed Jun 23, 2021 02:20 PM UTC
**Owner:** nobody


For years I compile openocd and libusb-1.0 by myself from the newest sources 
(cross-compilation under ubuntu on Windows 10 for windows 10 x64). I noticed 
problem with the newest libusb-1.0.dll - I can't connect to st-link (ver. 2.1 
and also 3). Log ends with:
~~~
Debug: 46 239 stlink_usb.c:3420 stlink_open(): stlink_open
Debug: 47 243 stlink_usb.c:3432 stlink_open(): transport: 4 vid: 0x0483 pid: 
0x3744 serial:
Debug: 48 248 stlink_usb.c:3432 stlink_open(): transport: 4 vid: 0x0483 pid: 
0x3748 serial:
Debug: 49 255 stlink_usb.c:3432 stlink_open(): transport: 4 vid: 0x0483 pid: 
0x374b serial:
Debug: 50 261 stlink_usb.c:3432 stlink_open(): transport: 4 vid: 0x0483 pid: 
0x374d serial:
Debug: 51 269 stlink_usb.c:3432 stlink_open(): transport: 4 vid: 0x0483 pid: 
0x374e serial:
Debug: 52 275 stlink_usb.c:3432 stlink_open(): transport: 4 vid: 0x0483 pid: 
0x374f serial:
Debug: 53 280 stlink_usb.c:3432 stlink_open(): transport: 4 vid: 0x0483 pid: 
0x3752 serial:
Debug: 54 289 stlink_usb.c:3432 stlink_open(): transport: 4 vid: 0x0483 pid: 
0x3753 serial:
~~~
and openocd is exited without any information like "open failed". Connecting to 
DAP-Link v2 with bulk works. This issue is for latest libusb-1.0.dll version 
1.0.24.11627 (and 1.0.24.11623 as I checked).
For older version 1.0.24.11608 all works fine:
~~~
Debug: 46 217 stlink_usb.c:3420 stlink_open(): stlink_open
Debug: 47 221 stlink_usb.c:3432 stlink_open(): transport: 4 vid: 0x0483 pid: 
0x3744 serial:
Debug: 48 226 stlink_usb.c:3432 stlink_open(): transport: 4 vid: 0x0483 pid: 
0x3748 serial:
Debug: 49 234 stlink_usb.c:3432 stlink_open(): transport: 4 vid: 0x0483 pid: 
0x374b serial:
Debug: 50 240 stlink_usb.c:3432 stlink_open(): transport: 4 vid: 0x0483 pid: 
0x374d serial:
Debug: 51 246 stlink_usb.c:3432 stlink_open(): transport: 4 vid: 0x0483 pid: 
0x374e serial:
Debug: 52 254 stlink_usb.c:3432 stlink_open(): transport: 4 vid: 0x0483 pid: 
0x374f serial:
Debug: 53 260 stlink_usb.c:3432 stlink_open(): transport: 4 vid: 0x0483 pid: 
0x3752 serial:
Debug: 54 269 stlink_usb.c:3432 stlink_open(): transport: 4 vid: 0x0483 pid: 
0x3753 serial:
Info : 55 1722 stlink_usb.c:1318 stlink_usb_version(): STLINK V2J37M27 (API v2) 
VID:PID 0483:3752
Debug: 56 1729 stlink_usb.c:1543 stlink_usb_exit_mode(): MODE: 0x01
~~~
Any suggestions?


---

Sent from sourceforge.net because openocd-devel@lists.sourceforge.net is 
subscribed to https://sourceforge.net/p/openocd/tickets/

To unsubscribe from further messages, a project admin can change settings at 
https://sourceforge.net/p/openocd/admin/tickets/options.  Or, if this is a 
mailing list, you can unsubscribe from the mailing list.


Reply via email to