thebeanogamer / rpms / qemu-kvm

Forked from rpms/qemu-kvm 5 months ago
Clone

Blame SOURCES/kvm-Fix-libusb-1.0.22-deprecated-libusb_set_debug-with-l.patch

ae23c9
From f79fc6d50a69dc3443f028b8f0fa11fe0f94810c Mon Sep 17 00:00:00 2001
ae23c9
From: Danilo de Paula <ddepaula@redhat.com>
ae23c9
Date: Mon, 27 Aug 2018 17:15:07 +0100
ae23c9
Subject: [PATCH] Fix libusb-1.0.22 deprecated libusb_set_debug with
ae23c9
 libusb_set_option
ae23c9
ae23c9
RH-Author: Danilo de Paula <ddepaula@redhat.com>
ae23c9
Message-id: <20180827171507.6372-2-ddepaula@redhat.com>
ae23c9
Patchwork-id: 81932
ae23c9
O-Subject: [qemu-kvm RHEL8/virt212 PATCH 1/1] Fix libusb-1.0.22 deprecated libusb_set_debug with libusb_set_option
ae23c9
Bugzilla: 1622656
ae23c9
RH-Acked-by: Eduardo Habkost <ehabkost@redhat.com>
ae23c9
RH-Acked-by: Gerd Hoffmann <kraxel@redhat.com>
ae23c9
RH-Acked-by: Laurent Vivier <lvivier@redhat.com>
ae23c9
ae23c9
From: John Thomson <git@johnthomson.fastmail.com.au>
ae23c9
ae23c9
libusb-1.0.22 marked libusb_set_debug deprecated
ae23c9
it is replaced with
ae23c9
libusb_set_option(libusb_context, LIBUSB_OPTION_LOG_LEVEL, libusb_log_level);
ae23c9
ae23c9
details here: https://github.com/libusb/libusb/commit/539f22e2fd916558d11ab9a66f10f461c5593168
ae23c9
ae23c9
Warning here:
ae23c9
ae23c9
  CC      hw/usb/host-libusb.o
ae23c9
/builds/xen/src/qemu-xen/hw/usb/host-libusb.c: In function 'usb_host_init':
ae23c9
/builds/xen/src/qemu-xen/hw/usb/host-libusb.c:250:5: error: 'libusb_set_debug' is deprecated: Use libusb_set_option instead [-Werror=deprecated-declarations]
ae23c9
     libusb_set_debug(ctx, loglevel);
ae23c9
     ^~~~~~~~~~~~~~~~
ae23c9
In file included from /builds/xen/src/qemu-xen/hw/usb/host-libusb.c:40:0:
ae23c9
/usr/include/libusb-1.0/libusb.h:1300:18: note: declared here
ae23c9
 void LIBUSB_CALL libusb_set_debug(libusb_context *ctx, int level);
ae23c9
                  ^~~~~~~~~~~~~~~~
ae23c9
cc1: all warnings being treated as errors
ae23c9
make: *** [/builds/xen/src/qemu-xen/rules.mak:66: hw/usb/host-libusb.o] Error 1
ae23c9
make: Leaving directory '/builds/xen/src/xen/tools/qemu-xen-build'
ae23c9
ae23c9
Signed-off-by: John Thomson <git@johnthomson.fastmail.com.au>
ae23c9
Message-id: 20180405132046.4968-1-git@johnthomson.fastmail.com.au
ae23c9
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
ae23c9
ae23c9
(cherry picked from commit 9d8fa0df49af16a208fa961c2968fba4daffcc07)
ae23c9
Signed-off-by: Danilo C. L. de Paula <ddepaula@redhat.com>
ae23c9
---
ae23c9
 hw/usb/host-libusb.c | 4 ++++
ae23c9
 1 file changed, 4 insertions(+)
ae23c9
ae23c9
diff --git a/hw/usb/host-libusb.c b/hw/usb/host-libusb.c
ae23c9
index 0290fb8..f31e9cb 100644
ae23c9
--- a/hw/usb/host-libusb.c
ae23c9
+++ b/hw/usb/host-libusb.c
ae23c9
@@ -248,7 +248,11 @@ static int usb_host_init(void)
ae23c9
     if (rc != 0) {
ae23c9
         return -1;
ae23c9
     }
ae23c9
+#if LIBUSB_API_VERSION >= 0x01000106
ae23c9
+    libusb_set_option(ctx, LIBUSB_OPTION_LOG_LEVEL, loglevel);
ae23c9
+#else
ae23c9
     libusb_set_debug(ctx, loglevel);
ae23c9
+#endif
ae23c9
 #ifdef CONFIG_WIN32
ae23c9
     /* FIXME: add support for Windows. */
ae23c9
 #else
ae23c9
-- 
ae23c9
1.8.3.1
ae23c9