[Spice-devel] [PATCH usbredirserver] Fix libusb-1.0.22 deprecated libusb_set_debug
Han Han
hhan at redhat.com
Thu Aug 2 07:19:59 UTC 2018
Since libusb-1.0.22, libusb_set_debug is deprecated and replaced with
libusb_set_option.
Details:
https://github.com/libusb/libusb/commit/539f22e2fd916558d11ab9a66f10f461c5593168
Compiling error:
usbredirhost.c: In function ‘usbredirhost_open_full’:
usbredirhost.c:753:5: error: ‘libusb_set_debug’ is deprecated: Use
libusb_set_option instead [-Werror=deprecated-declarations]
libusb_set_debug(host->ctx, host->verbose);
^~~~~~~~~~~~~~~~
Signed-off-by: Han Han <hhan at redhat.com>
---
usbredirhost/usbredirhost.c | 4 ++++
usbredirserver/usbredirserver.c | 4 ++++
2 files changed, 8 insertions(+)
diff --git a/usbredirhost/usbredirhost.c b/usbredirhost/usbredirhost.c
index 3666227..d55cd5c 100644
--- a/usbredirhost/usbredirhost.c
+++ b/usbredirhost/usbredirhost.c
@@ -750,7 +750,11 @@ struct usbredirhost *usbredirhost_open_full(
usbredirparser_init(host->parser, version, caps, USB_REDIR_CAPS_SIZE,
parser_flags);
+#if LIBUSB_API_VERSION >= 0x01000106
+ libusb_set_option(host->ctx, LIBUSB_OPTION_LOG_LEVEL, host->verbose);
+#else
libusb_set_debug(host->ctx, host->verbose);
+#endif
if (usbredirhost_set_device(host, usb_dev_handle) != usb_redir_success) {
usbredirhost_close(host);
diff --git a/usbredirserver/usbredirserver.c b/usbredirserver/usbredirserver.c
index 849aa05..6aa2740 100644
--- a/usbredirserver/usbredirserver.c
+++ b/usbredirserver/usbredirserver.c
@@ -297,7 +297,11 @@ int main(int argc, char *argv[])
exit(1);
}
+#if LIBUSB_API_VERSION >= 0x01000106
+ libusb_set_option(ctx, LIBUSB_OPTION_LOG_LEVEL, verbose);
+#else
libusb_set_debug(ctx, verbose);
+#endif
if (ipv4_addr) {
server_fd = socket(AF_INET, SOCK_STREAM, 0);
--
2.18.0
More information about the Spice-devel
mailing list