On Wed, Jun 23, 2021 at 10:23 PM Xiaofan Chen <xiaof...@gmail.com> wrote: > > On Wed, Jun 23, 2021 at 10:06 PM Xiaofan Chen <xiaof...@gmail.com> wrote: > > > > On Wed, Jun 23, 2021 at 8:13 PM Xiaofan Chen <xiaof...@gmail.com> wrote: > > > > > > On Sat, Jun 19, 2021 at 5:11 PM Xiaofan Chen <xiaof...@gmail.com> wrote: > > > > > > > > On Sun, Jun 13, 2021 at 7:02 PM Xiaofan Chen <xiaof...@gmail.com> wrote: > > > > > > > > > > I can see that there is an issue with ST-Link now. I can > > > > > > reproduce it myself. > > > > > > https://sourceforge.net/p/openocd/tickets/308/ > > > > > > https://github.com/libusb/libusb/issues/928 > > > > > > > > > > Based on my investigation, the issue is not with libusb > > > > > but rather openocd. Please take a look at the libusb > > > > > ticket #928 to see if my analysis is correct or not. Thanks. > > > > > > > > > > > > > Just wondering if anyone has looked into Ticket 308. Thanks. > > > > https://sourceforge.net/p/openocd/tickets/308/ > > > > > > > > I do not have issues connecting to stlink with the latest > > > > libusb git from the following project which also uses libusb. > > > > https://github.com/stlink-org/stlink > > > > > > I have made some progress to identify the particular libusb > > > commit which causes the differences in behavior. > > > > > > Please refer to my updates here. > > > https://sourceforge.net/p/openocd/tickets/308/ > > > https://github.com/libusb/libusb/issues/928 > > > > > > Particular complicated libusb commit (by right it should be splitted > > > into multiple changes, but anyway we are short of maintainers): > > > https://github.com/libusb/libusb/commit/32a22069428cda9d63aa666e92fb8882a83d4515 > > > > > > However, I am not so sure if that paticular change is the root cause > > > or openocd stlink_usb.c is the culprit. > > > > Thanks to the pointer of the original reporter (asier70) and > > Antonio Borneo in openocd ticket 308, I think > > I have identify the issue in stlink_usb.c. > > > > Yes the above libusb patch libusb (32a2206) changed a bit of the behavior > > of libusb code but openocd stlink_usb.c does not handle the context right. > > It assumes that libusb_init() is called with NULL context but that is not > > true as per libusb_helper.c. > > > > Why FTDI adapter does not have such issue, because it does not use > > libusb_helper.h and uses libusb by itself with the mpsse backend. > > https://github.com/ntfreak/openocd/blob/master/src/jtag/drivers/mpsse.c > > > > Why does other libusb_helper based adapter not have such an issue, > > because they do not use async transfer and do not use the context. > > > > Please help to check if my analysis is correct or not. Thanks. I am > > not a programmer myself. > > To proof my analysis, I use the following dirty fix of libusb_helper.c, > then openocd git latest HEAD has no issues with latest libsub git HEAD. > I am not saying this is the right fix though.
Just want to update that Antonio has come out with the fix and the fix has been merged in git head. https://github.com/ntfreak/openocd/commit/cff0e417da58adef1ceef9a63a99412c2cc87ff3 -- Xiaofan