helper: remove fix for libusb pre-v1.0.9
authorAntonio Borneo <borneo.antonio@gmail.com>
Sat, 15 May 2021 22:48:49 +0000 (00:48 +0200)
committerAntonio Borneo <borneo.antonio@gmail.com>
Mon, 30 Aug 2021 13:51:46 +0000 (13:51 +0000)
Libusb v1.0.9 has been released on April 2012. We can reasonably
expect that every user has already updated his system to a libusb
newer of equel to v1.0.9.

Remove the fix for older libusb.

Change-Id: I0c40e53d7af85a11b0bb265bbf8035857a2dfce1
Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com>
Reviewed-on: https://review.openocd.org/c/openocd/+/6253
Tested-by: jenkins
Reviewed-by: Xiaofan Chen <xiaofanc@gmail.com>
configure.ac
src/helper/Makefile.am
src/helper/replacements.c
src/helper/replacements.h

index bd2e5c4f9178bd4531f87be3d41bcef1c64ca1ae..a178284ee9af78485c8f6d068900c5d3185de1c5 100644 (file)
@@ -570,9 +570,6 @@ AS_IF([test "x$build_xlnx_pcie_xvc" = "xyes"], [
 PKG_CHECK_MODULES([LIBUSB1], [libusb-1.0], [
        use_libusb1=yes
        AC_DEFINE([HAVE_LIBUSB1], [1], [Define if you have libusb-1.x])
-       PKG_CHECK_EXISTS([libusb-1.0 >= 1.0.9],
-               [AC_DEFINE([HAVE_LIBUSB_ERROR_NAME], [1], [Define if your libusb has libusb_error_name()])],
-               [AC_MSG_WARN([libusb-1.x older than 1.0.9 detected, consider updating])])
        LIBUSB1_CFLAGS=`echo $LIBUSB1_CFLAGS | sed 's/-I/-isystem /'`
        AC_MSG_NOTICE([libusb-1.0 header bug workaround: LIBUSB1_CFLAGS changed to "$LIBUSB1_CFLAGS"])
        PKG_CHECK_EXISTS([libusb-1.0 >= 1.0.16],
index 42cee80d3a9453f6aa418dbd6c005a2f727704d5..0d886843ce7f69779711d86372e71195864a6013 100644 (file)
@@ -1,7 +1,5 @@
 noinst_LTLIBRARIES += %D%/libhelper.la
 
-%C%_libhelper_la_CPPFLAGS = $(AM_CPPFLAGS) $(LIBUSB1_CFLAGS)
-
 %C%_libhelper_la_SOURCES = \
        %D%/binarybuffer.c \
        %D%/options.c \
index 81b1976d0c34a27aba66f738b342040375d90a02..c34b17ec5a079b26205d86ae4a266ca26b4fd509 100644 (file)
@@ -275,45 +275,3 @@ int win_select(int max_fd, fd_set *rfds, fd_set *wfds, fd_set *efds, struct time
        return retcode;
 }
 #endif
-
-#if defined HAVE_LIBUSB1 && !defined HAVE_LIBUSB_ERROR_NAME
-#include <libusb.h>
-/* Verbatim from git://git.libusb.org/libusb.git tag 1.0.9
- * The libusb_error enum is compatible down to v0.9.1
- */
-const char *libusb_error_name(int error_code)
-{
-       enum libusb_error error = error_code;
-       switch (error) {
-       case LIBUSB_SUCCESS:
-               return "LIBUSB_SUCCESS";
-       case LIBUSB_ERROR_IO:
-               return "LIBUSB_ERROR_IO";
-       case LIBUSB_ERROR_INVALID_PARAM:
-               return "LIBUSB_ERROR_INVALID_PARAM";
-       case LIBUSB_ERROR_ACCESS:
-               return "LIBUSB_ERROR_ACCESS";
-       case LIBUSB_ERROR_NO_DEVICE:
-               return "LIBUSB_ERROR_NO_DEVICE";
-       case LIBUSB_ERROR_NOT_FOUND:
-               return "LIBUSB_ERROR_NOT_FOUND";
-       case LIBUSB_ERROR_BUSY:
-               return "LIBUSB_ERROR_BUSY";
-       case LIBUSB_ERROR_TIMEOUT:
-               return "LIBUSB_ERROR_TIMEOUT";
-       case LIBUSB_ERROR_OVERFLOW:
-               return "LIBUSB_ERROR_OVERFLOW";
-       case LIBUSB_ERROR_PIPE:
-               return "LIBUSB_ERROR_PIPE";
-       case LIBUSB_ERROR_INTERRUPTED:
-               return "LIBUSB_ERROR_INTERRUPTED";
-       case LIBUSB_ERROR_NO_MEM:
-               return "LIBUSB_ERROR_NO_MEM";
-       case LIBUSB_ERROR_NOT_SUPPORTED:
-               return "LIBUSB_ERROR_NOT_SUPPORTED";
-       case LIBUSB_ERROR_OTHER:
-               return "LIBUSB_ERROR_OTHER";
-       }
-       return "**UNKNOWN**";
-}
-#endif
index 5aecf41822e833328386347cc810e563a6bcfa9e..4d70d9cf30bb347597fae57f258c44bf93db02dd 100644 (file)
@@ -328,8 +328,4 @@ typedef struct {
 
 #endif /* HAVE_ELF64 */
 
-#if defined HAVE_LIBUSB1 && !defined HAVE_LIBUSB_ERROR_NAME
-const char *libusb_error_name(int error_code);
-#endif /* defined HAVE_LIBUSB1 && !defined HAVE_LIBUSB_ERROR_NAME */
-
 #endif /* OPENOCD_HELPER_REPLACEMENTS_H */