File 0001-Allow-building-against-older-libusb-without-bus-port.patch of Package dfu-util

From ce621b05fae8839000b8c2538302a6982d3685ac Mon Sep 17 00:00:00 2001
From: Tormod Volden <debian.tormod@gmail.com>
Date: Tue, 16 Feb 2016 23:37:44 +0100
Subject: [PATCH] Allow building against older libusb without bus/port path
 support

Our new USB bus/port matching functionality requires libusb
1.0.16 or newer. To allow building against older libusb
versions we'll just disable this feature if needed.

At some point in the future we'll might require libusb 1.0.16
through configure.ac instead.

Signed-off-by: Tormod Volden <debian.tormod@gmail.com>
---
 src/dfu_util.c | 5 +++++
 src/main.c     | 4 ++++
 2 files changed, 9 insertions(+)

diff --git a/src/dfu_util.c b/src/dfu_util.c
index fa3af58..3582294 100644
--- a/src/dfu_util.c
+++ b/src/dfu_util.c
@@ -291,6 +291,7 @@ char path_buf[MAX_PATH_LEN];
 
 char *get_path(libusb_device *dev)
 {
+#if (defined(LIBUSB_API_VERSION) && LIBUSB_API_VERSION >= 0x01000102) || (defined(LIBUSBX_API_VERSION) && LIBUSBX_API_VERSION >= 0x01000102)
 	uint8_t path[8];
 	int r,j;
 	r = libusb_get_port_numbers(dev, path, sizeof(path));
@@ -301,6 +302,10 @@ char *get_path(libusb_device *dev)
 		};
 	}
 	return path_buf;
+#else
+# warning "libusb too old - building without USB path support!"
+	return NULL;
+#endif
 }
 
 void probe_devices(libusb_context *ctx)
diff --git a/src/main.c b/src/main.c
index 06ca189..38e7768 100644
--- a/src/main.c
+++ b/src/main.c
@@ -276,7 +276,11 @@ int main(int argc, char **argv)
 			parse_vendprod(optarg);
 			break;
 		case 'p':
+#if (defined(LIBUSB_API_VERSION) && LIBUSB_API_VERSION >= 0x01000102) || (defined(LIBUSBX_API_VERSION) && LIBUSBX_API_VERSION >= 0x01000102)
 			match_path = optarg;
+#else
+			errx(EX_SOFTWARE, "This dfu-util was built without USB path support");
+#endif
 			break;
 		case 'c':
 			/* Configuration */
-- 
1.9.1