diff options
author | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2019-05-08 21:41:19 +0200 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2019-05-08 21:41:19 +0200 |
commit | e0525b6eb192c51e02399a94d4320b23bf12e144 (patch) | |
tree | 49f73e57c5ca8cc9dc3bd538cd0ac60031f6567d | |
parent | 7957704d497af6636f2d4671eb3a4944735b0b99 (diff) | |
download | usbutils-e0525b6eb192c51e02399a94d4320b23bf12e144.tar.gz |
usbhid-dump: remove libusb.h libusb_strerror() implementation
libusb_strerror() has been around for a long time, we can rely on it
being in the library if we use it. So remove our local copy of the
function. This deletes 2 files and cleans up some autoconf logic as
well.
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
-rw-r--r-- | usbhid-dump/configure.ac | 1 | ||||
-rw-r--r-- | usbhid-dump/include/uhd/Makefile.am | 1 | ||||
-rw-r--r-- | usbhid-dump/include/uhd/dev.h | 2 | ||||
-rw-r--r-- | usbhid-dump/include/uhd/libusb.h | 25 | ||||
-rw-r--r-- | usbhid-dump/lib/Makefile.am | 3 | ||||
-rw-r--r-- | usbhid-dump/lib/libusb.c | 55 | ||||
-rw-r--r-- | usbhid-dump/src/usbhid-dump.c | 2 |
7 files changed, 3 insertions, 86 deletions
diff --git a/usbhid-dump/configure.ac b/usbhid-dump/configure.ac index 2ba0550..bc42160 100644 --- a/usbhid-dump/configure.ac +++ b/usbhid-dump/configure.ac @@ -73,7 +73,6 @@ fi # # Checks for library functions. # -AC_CHECK_FUNCS([libusb_strerror libusb_set_option]) # # Output diff --git a/usbhid-dump/include/uhd/Makefile.am b/usbhid-dump/include/uhd/Makefile.am index 891b721..77f443e 100644 --- a/usbhid-dump/include/uhd/Makefile.am +++ b/usbhid-dump/include/uhd/Makefile.am @@ -9,5 +9,4 @@ noinst_HEADERS = \ dev_list.h \ iface.h \ iface_list.h \ - libusb.h \ misc.h diff --git a/usbhid-dump/include/uhd/dev.h b/usbhid-dump/include/uhd/dev.h index 6673b2d..bd34cb6 100644 --- a/usbhid-dump/include/uhd/dev.h +++ b/usbhid-dump/include/uhd/dev.h @@ -9,7 +9,7 @@ #define __UHD_DEV_H__ #include <stdbool.h> -#include "uhd/libusb.h" +#include <libusb.h> #ifdef __cplusplus extern "C" { diff --git a/usbhid-dump/include/uhd/libusb.h b/usbhid-dump/include/uhd/libusb.h deleted file mode 100644 index bff76cf..0000000 --- a/usbhid-dump/include/uhd/libusb.h +++ /dev/null @@ -1,25 +0,0 @@ -// SPDX-License-Identifier: GPL-2.0+ -/* - * usbhid-dump - libusb API extensions - * - * Copyright (C) 2010-2011 Nikolai Kondrashov <spbnick@gmail.com> - */ - -#ifndef __UHD_LIBUSB_H__ -#define __UHD_LIBUSB_H__ - -#include <libusb.h> - -#ifdef __cplusplus -extern "C" { -#endif - -#ifndef HAVE_LIBUSB_STRERROR -extern const char *libusb_strerror(enum libusb_error err); -#endif - -#ifdef __cplusplus -} /* extern "C" */ -#endif - -#endif /* __UHD_LIBUSB_H__ */ diff --git a/usbhid-dump/lib/Makefile.am b/usbhid-dump/lib/Makefile.am index 1652874..fd0e3ae 100644 --- a/usbhid-dump/lib/Makefile.am +++ b/usbhid-dump/lib/Makefile.am @@ -10,5 +10,4 @@ libuhd_la_SOURCES = \ dev.c \ dev_list.c \ iface.c \ - iface_list.c \ - libusb.c + iface_list.c diff --git a/usbhid-dump/lib/libusb.c b/usbhid-dump/lib/libusb.c deleted file mode 100644 index 737dc62..0000000 --- a/usbhid-dump/lib/libusb.c +++ /dev/null @@ -1,55 +0,0 @@ -// SPDX-License-Identifier: GPL-2.0+ -/* - * usbhid-dump - libusb API extensions - * - * Copyright (C) 2010 Nikolai Kondrashov <spbnick@gmail.com> - */ - -#include "config.h" - -#include "uhd/libusb.h" -#include <stdbool.h> - - -#ifndef HAVE_LIBUSB_STRERROR -const char * -libusb_strerror(enum libusb_error err) -{ - switch (err) - { - case LIBUSB_SUCCESS: - return "Success"; -#define MAP(_name, _desc) \ - case LIBUSB_ERROR_##_name: \ - return _desc " (ERROR_" #_name ")" - MAP(IO, - "Input/output error"); - MAP(INVALID_PARAM, - "Invalid parameter"); - MAP(ACCESS, - "Access denied (insufficient permissions)"); - MAP(NO_DEVICE, - "No such device (it may have been disconnected)"); - MAP(NOT_FOUND, - "Entity not found"); - MAP(BUSY, - "Resource busy"); - MAP(TIMEOUT, - "Operation timed out"); - MAP(OVERFLOW, - "Overflow"); - MAP(PIPE, - "Pipe error"); - MAP(INTERRUPTED, - "System call interrupted (perhaps due to signal)"); - MAP(NO_MEM, - "Insufficient memory"); - MAP(NOT_SUPPORTED, - "Operation not supported or unimplemented on this platform"); - MAP(OTHER, "Other error"); -#undef MAP - default: - return "Unknown error code"; - } -} -#endif diff --git a/usbhid-dump/src/usbhid-dump.c b/usbhid-dump/src/usbhid-dump.c index e26fd39..ae0f101 100644 --- a/usbhid-dump/src/usbhid-dump.c +++ b/usbhid-dump/src/usbhid-dump.c @@ -8,8 +8,8 @@ #include "config.h" #include "uhd/iface_list.h" -#include "uhd/libusb.h" #include "uhd/misc.h" +#include <libusb.h> #include <assert.h> #include <stdbool.h> |