diff options
author | Anders <anders@openpuma.org> | 2014-09-12 08:44:33 -0700 |
---|---|---|
committer | Spencer Oliver <spen@spen-soft.co.uk> | 2014-10-06 11:58:57 +0000 |
commit | 61d8b2cabfd967a1702f2c14661b03d8dcb7d44c (patch) | |
tree | 984db84f6cff66a6579e0da69efd0197fca76f05 /src | |
parent | ca8f8e7e77ec2263044288e540c7276155155a48 (diff) |
jtag/drivers/jlink.c: fix for LPC Link-2 running JLink firmware on Linux
Change 2288 fixed the extraneous reset caused by set_configuration that
crashed the LPC Link-2 running JLink firmware and works on windows platforms.
On Linux however, conditional code was still calling USB reset and caused
the adapter to crash on any non-windows platforms.
Change-Id: Ibf2a02d0dcdd91ccb71d86231cd8311dcadfee1e
Signed-off-by: anders@openpuma.org
Reviewed-on: http://openocd.zylin.com/2297
Tested-by: jenkins
Reviewed-by: Xiaofan <xiaofanc@gmail.com>
Reviewed-by: Spencer Oliver <spen@spen-soft.co.uk>
Diffstat (limited to 'src')
-rw-r--r-- | src/jtag/drivers/jlink.c | 22 |
1 files changed, 12 insertions, 10 deletions
diff --git a/src/jtag/drivers/jlink.c b/src/jtag/drivers/jlink.c index 55b1e45f..2177b08e 100644 --- a/src/jtag/drivers/jlink.c +++ b/src/jtag/drivers/jlink.c @@ -1713,7 +1713,15 @@ static struct jlink *jlink_usb_open() * committing them! */ -#if IS_WIN32 == 0 +/* This entire block can probably be removed. It was a workaround for + * libusb0.1 and old JLink firmware. It has already be removed for + * windows and causing problems (LPC Link-2 with JLink firmware) on + * Linux with libusb1.0. + * + * However, for now the behavior will be left unchanged for non-windows + * platforms using libusb0.1 due to lack of testing. + */ +#if IS_WIN32 == 0 && HAVE_LIBUSB1 == 0 jtag_libusb_reset_device(devh); @@ -1735,19 +1743,13 @@ static struct jlink *jlink_usb_open() #endif - /* usb_set_configuration required under win32 */ + /* usb_set_configuration is only required under win32 + * with libusb 0.1 and libusb0.sys. For libusb 1.0 it is a no-op + * since the configuration is already set. */ struct jtag_libusb_device *udev = jtag_libusb_get_device(devh); jtag_libusb_set_configuration(devh, 0); jtag_libusb_claim_interface(devh, 0); -#if 0 - /* - * This makes problems under Mac OS X. And is not needed - * under Windows. Hopefully this will not break a linux build - */ - usb_set_altinterface(result->usb_handle, 0); -#endif - /* Use the OB endpoints if the JLink we matched is a Jlink-OB adapter */ uint16_t matched_pid; if (jtag_libusb_get_pid(udev, &matched_pid) == ERROR_OK) { |