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

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