From 9a5f94004611c901b6914f86721185acd69fc27f Mon Sep 17 00:00:00 2001 From: Pali Rohár Date: Tue, 6 Dec 2016 23:11:47 +0100 Subject: usb-device: Check that we are not using broken libusb-1.0 library --- src/usb-device.c | 9 +++++++++ 1 file changed, 9 insertions(+) (limited to 'src/usb-device.c') diff --git a/src/usb-device.c b/src/usb-device.c index d3aa707..2913198 100644 --- a/src/usb-device.c +++ b/src/usb-device.c @@ -17,6 +17,11 @@ */ +/* Enable RTLD_DEFAULT for glibc */ +#ifndef _GNU_SOURCE +#define _GNU_SOURCE +#endif + #include #include #include @@ -24,6 +29,7 @@ #include #include #include +#include #include @@ -316,6 +322,9 @@ struct usb_device_info * usb_open_and_wait_for_device(void) { void (*prev)(int); static char progress[] = {'/','-','\\', '|'}; + if ( dlsym(RTLD_DEFAULT, "libusb_init") ) + ERROR_RETURN("You are trying to use broken libusb-1.0 library (either directly or via wrapper) which has slow listing of usb devices. It cannot be used for flashing or cold-flashing. Please use libusb 0.1.", NULL); + usb_init(); usb_find_busses(); -- cgit v1.2.3