jlink: Make libusb optional 04/4204/3
authorMarc Schink <openocd-dev@marcschink.de>
Sat, 20 May 2017 12:34:21 +0000 (14:34 +0200)
committerSpencer Oliver <spen@spen-soft.co.uk>
Tue, 3 Oct 2017 10:18:40 +0000 (11:18 +0100)
libusb is now optional for libjaylink because support for TCP/IP
devices is always available.

Change-Id: I03f2566f8e1703276671ac0f353f72394d21f2f0
Signed-off-by: Marc Schink <openocd-dev@marcschink.de>
Reviewed-on: http://openocd.zylin.com/4204
Tested-by: jenkins
Reviewed-by: Spencer Oliver <spen@spen-soft.co.uk>
configure.ac
src/jtag/drivers/jlink.c

index fd06a0b..562ec5a 100644 (file)
@@ -655,7 +655,7 @@ PROCESS_ADAPTERS([USB0_ADAPTERS], ["x$use_libusb0" = "xyes"], [libusb-0.1])
 PROCESS_ADAPTERS([HIDAPI_ADAPTERS], ["x$use_hidapi" = "xyes"], [hidapi])
 PROCESS_ADAPTERS([HIDAPI_USB1_ADAPTERS], ["x$use_hidapi" = "xyes" -a "x$use_libusb1" = "xyes"], [hidapi and libusb-1.x])
 PROCESS_ADAPTERS([LIBFTDI_ADAPTERS], ["x$use_libftdi" = "xyes"], [libftdi])
-PROCESS_ADAPTERS([LIBJAYLINK_ADAPTERS], ["x$use_libusb1" = "xyes" -a "x$use_internal_libjaylink" = "xyes" -o "x$use_libjaylink" = "xyes"], [libusb-1.x or libjaylink-0.1])
+PROCESS_ADAPTERS([LIBJAYLINK_ADAPTERS], ["x$use_internal_libjaylink" = "xyes" -o "x$use_libjaylink" = "xyes"], [libjaylink-0.1])
 
 AS_IF([test "x$build_openjtag" = "xyes"], [
   AS_IF([test "x$use_libusb1" != "xyes" -a "x$use_libusb0" != "xyes"], [
index c05141a..893d43e 100644 (file)
@@ -551,6 +551,11 @@ static int jlink_init(void)
        LOG_DEBUG("Using libjaylink %s (compiled with %s).",
                jaylink_version_package_get_string(), JAYLINK_VERSION_PACKAGE_STRING);
 
+       if (!jaylink_library_has_cap(JAYLINK_CAP_HIF_USB) && use_usb_address) {
+               LOG_ERROR("J-Link driver does not support USB devices.");
+               return ERROR_JTAG_INIT_FAILED;
+       }
+
        ret = jaylink_init(&jayctx);
 
        if (ret != JAYLINK_OK) {
@@ -610,7 +615,9 @@ static int jlink_init(void)
                if (use_usb_address) {
                        ret = jaylink_device_get_usb_address(devs[i], &address);
 
-                       if (ret != JAYLINK_OK) {
+                       if (ret == JAYLINK_ERR_NOT_SUPPORTED) {
+                               continue;
+                       } else if (ret != JAYLINK_OK) {
                                LOG_WARNING("jaylink_device_get_usb_address() failed: %s.",
                                        jaylink_strerror_name(ret));
                                continue;