Re: [OpenOCD-devel] JLink and LPC Link-2 problem and fix

2014-09-14 Thread Xiaofan Chen
On Fri, Sep 12, 2014 at 11:58 PM, Anders Oleson wrote: > I have submitted a patch which narrows the scope of the USB reset further. I > tested this, and when used in conjunction with Paul's 2288 patch, it works > on Linux with libusb1.0 now. To be clear, both patches are required for > Linux, and

Re: [OpenOCD-devel] JLink and LPC Link-2 problem and fix

2014-09-11 Thread Xiaofan Chen
On Thu, Sep 11, 2014 at 6:13 PM, Xiaofan Chen wrote: > On Thu, Sep 11, 2014 at 4:15 PM, Paul Fertser wrote: >> On Thu, Sep 11, 2014 at 04:01:33PM +0800, Xiaofan Chen wrote: >>> 1738 /* usb_set_configuration required under win32 */ >>> 1739 struct jtag_libusb_device *udev = jtag_libusb_get_device(

Re: [OpenOCD-devel] JLink and LPC Link-2 problem and fix

2014-09-11 Thread Xiaofan Chen
On Fri, Sep 12, 2014 at 12:46 PM, Anders Oleson wrote: > Is there a conditional compile flag for LIBUSB 0.1? Yes you can use the inverse of HAVE_LIBUSB1. Similar code: src/jtag/drivers/libusb_common.h 20 #ifdef HAVE_LIBUSB1 21 #include 22 #else 23 #include 24 #endif -- Xiaofan

Re: [OpenOCD-devel] JLink and LPC Link-2 problem and fix

2014-09-11 Thread Anders Oleson
Is there a conditional compile flag for LIBUSB 0.1? On Thu, Sep 11, 2014 at 9:35 PM, Xiaofan Chen wrote: > On Thu, Sep 11, 2014 at 11:15 PM, Anders Oleson > wrote: > > My "crude" fix was just to comment out 1740 and that works but only if we > > get rid of the reset on line 1718 also. After tha

Re: [OpenOCD-devel] JLink and LPC Link-2 problem and fix

2014-09-11 Thread Xiaofan Chen
On Thu, Sep 11, 2014 at 11:15 PM, Anders Oleson wrote: > My "crude" fix was just to comment out 1740 and that works but only if we > get rid of the reset on line 1718 also. After that reset Linux appears to > re-call set_configuration, or the reset itself is the problem. Actually IMHO the whole s

Re: [OpenOCD-devel] JLink and LPC Link-2 problem and fix

2014-09-11 Thread Anders Oleson
Apologies. I meant I tried Paul's Gerrit change 2288 with no luck. On Thu, Sep 11, 2014 at 8:23 PM, Anders Oleson wrote: > This evening I tried this without the other changes and no luck. I believe > the reason is that it may have eliminated one of the set_configuration > calls, but the reset st

Re: [OpenOCD-devel] JLink and LPC Link-2 problem and fix

2014-09-11 Thread Anders Oleson
This evening I tried this without the other changes and no luck. I believe the reason is that it may have eliminated one of the set_configuration calls, but the reset still caused a hang. Xiaofan Chen's comments appear to be correct in that this change would only address libusb1.0 also. Possibly

Re: [OpenOCD-devel] JLink and LPC Link-2 problem and fix

2014-09-11 Thread Anders Oleson
My "crude" fix was just to comment out 1740 and that works but only if we get rid of the reset on line 1718 also. After that reset Linux appears to re-call set_configuration, or the reset itself is the problem. I don't know about lightweight reset, what I saw on the USB snoop was that the set_conf

Re: [OpenOCD-devel] JLink and LPC Link-2 problem and fix

2014-09-11 Thread Anders Oleson
Here is the output for the LPC Link-2 running JLink firmware. Notice that it has only one configuration, and based on JLink's documentation I expect they all like that. The endpoints might be different for the very old ones. Looks like the USB device descriptors can't identify the LPC Link-2 versi

Re: [OpenOCD-devel] JLink and LPC Link-2 problem and fix

2014-09-11 Thread Xiaofan Chen
On Thu, Sep 11, 2014 at 4:15 PM, Paul Fertser wrote: > On Thu, Sep 11, 2014 at 04:01:33PM +0800, Xiaofan Chen wrote: >> 1738 /* usb_set_configuration required under win32 */ >> 1739 struct jtag_libusb_device *udev = jtag_libusb_get_device(devh); >> +++ #if IS_WIN32 == 1 >> 1740 jtag_libusb_set_con

Re: [OpenOCD-devel] JLink and LPC Link-2 problem and fix

2014-09-11 Thread Paul Fertser
On Thu, Sep 11, 2014 at 04:01:33PM +0800, Xiaofan Chen wrote: > 1738 /* usb_set_configuration required under win32 */ > 1739 struct jtag_libusb_device *udev = jtag_libusb_get_device(devh); > +++ #if IS_WIN32 == 1 > 1740 jtag_libusb_set_configuration(devh, 0); > +++ #endif > 1741 jtag_libusb_claim_i

Re: [OpenOCD-devel] JLink and LPC Link-2 problem and fix

2014-09-11 Thread Xiaofan Chen
On Thu, Sep 11, 2014 at 3:27 PM, Paul Fertser wrote: > On Mon, Sep 08, 2014 at 09:00:59PM -0700, Anders Oleson wrote: >> I have been working with an LPC Link-2 configured with JLink firmware (as >> distributed by Segger and LPC). This firmware basically turns the very nice >> $20 >> LPC Link-2 bo

Re: [OpenOCD-devel] JLink and LPC Link-2 problem and fix

2014-09-11 Thread Xiaofan Chen
On Thu, Sep 11, 2014 at 3:14 PM, Paul Fertser wrote: > On Thu, Sep 11, 2014 at 12:56:26PM +0800, Xiaofan Chen wrote: >> Under Windows, if using libusb-1.0 API, then the preferred driver >> is WinUSB and it does not support setting non-default configuration >> anyway. The other supported driver lib

Re: [OpenOCD-devel] JLink and LPC Link-2 problem and fix

2014-09-11 Thread Xiaofan Chen
On Thu, Sep 11, 2014 at 2:25 PM, Paul Fertser wrote: > Hello, > > On Thu, Sep 11, 2014 at 12:56:26PM +0800, Xiaofan Chen wrote: >> On Thu, Sep 11, 2014 at 12:50 PM, Xiaofan Chen wrote: >> > >> > Actually easy, Option 3 is the best. You can remove the >> > libusb_set_configuration >> > under all

Re: [OpenOCD-devel] JLink and LPC Link-2 problem and fix

2014-09-11 Thread Paul Fertser
On Mon, Sep 08, 2014 at 09:00:59PM -0700, Anders Oleson wrote: > I have been working with an LPC Link-2 configured with JLink firmware (as > distributed by Segger and LPC). This firmware basically turns the very nice > $20 > LPC Link-2 board into a JLink adapter. It is clear to me that Segger had

Re: [OpenOCD-devel] JLink and LPC Link-2 problem and fix

2014-09-11 Thread Paul Fertser
On Thu, Sep 11, 2014 at 12:56:26PM +0800, Xiaofan Chen wrote: > Under Windows, if using libusb-1.0 API, then the preferred driver > is WinUSB and it does not support setting non-default configuration > anyway. The other supported driver libusbK.sys is the same. Only > libusb0.sys supports setting n

Re: [OpenOCD-devel] JLink and LPC Link-2 problem and fix

2014-09-11 Thread Paul Fertser
On Thu, Sep 11, 2014 at 10:25:31AM +0400, Paul Fertser wrote: > Can someone with original JLink and JLink OB do the same please so > we can be sure all of the devices have only one configuration > anyway? Reported by [mbm] on IRC: JLink v8 (such as http://www.amazon.com/Jlink-Emulator-Upgrade-Sup

Re: [OpenOCD-devel] JLink and LPC Link-2 problem and fix

2014-09-10 Thread Paul Fertser
Hello, On Thu, Sep 11, 2014 at 12:56:26PM +0800, Xiaofan Chen wrote: > On Thu, Sep 11, 2014 at 12:50 PM, Xiaofan Chen wrote: > > > > Actually easy, Option 3 is the best. You can remove the > > libusb_set_configuration > > under all OS (using libusb-1.0 API). The only time usb_set_configuration >

Re: [OpenOCD-devel] JLink and LPC Link-2 problem and fix

2014-09-10 Thread Peter Stuge
Anders Oleson wrote: > 1. Based on USB ID detect the LPC Link-2 and apply this workaround Does the LPC Link-2 with JLink firmware have anything distinct in the descriptors that would allow it to be distinguished from other JLink adapters? The driver may or may not have a good reason to do the set

Re: [OpenOCD-devel] JLink and LPC Link-2 problem and fix

2014-09-10 Thread Xiaofan Chen
On Thu, Sep 11, 2014 at 12:50 PM, Xiaofan Chen wrote: > > Actually easy, Option 3 is the best. You can remove the > libusb_set_configuration > under all OS (using libusb-1.0 API). The only time usb_set_configuration > is required is when using libusb-win32 under Windows (libusb-0.1 API). > A bit

Re: [OpenOCD-devel] JLink and LPC Link-2 problem and fix

2014-09-10 Thread Xiaofan Chen
On Tue, Sep 9, 2014 at 12:00 PM, Anders Oleson wrote: > I have been working with an LPC Link-2 configured with JLink firmware (as > distributed by Segger and LPC). This firmware basically turns the very nice > $20 LPC Link-2 board into a JLink adapter. It is clear to me that Segger had > a hand in

[OpenOCD-devel] JLink and LPC Link-2 problem and fix

2014-09-08 Thread Anders Oleson
I have been working with an LPC Link-2 configured with JLink firmware (as distributed by Segger and LPC). This firmware basically turns the very nice $20 LPC Link-2 board into a JLink adapter. It is clear to me that Segger had a hand in this firmware and you can find references to it on their pages