thebeanogamer / rpms / qemu-kvm

Forked from rpms/qemu-kvm 5 months ago
Clone
Blob Blame History Raw
From 4de8173704a782b602f2d5412b2b9d08ceb9fc1d Mon Sep 17 00:00:00 2001
From: Stefan Hajnoczi <stefanha@redhat.com>
Date: Tue, 13 Aug 2013 08:31:21 +0200
Subject: usb/host-libusb: Fix building with libusb git master code

RH-Author: Stefan Hajnoczi <stefanha@redhat.com>
Message-id: <1376382681-14630-1-git-send-email-stefanha@redhat.com>
Patchwork-id: 53201
O-Subject: [PATCH] usb/host-libusb: Fix building with libusb git master code
Bugzilla: 996469
RH-Acked-by: Gerd Hoffmann <kraxel@redhat.com>
RH-Acked-by: Miroslav Rezanina <mrezanin@redhat.com>
RH-Acked-by: Hans de Goede <hdegoede@redhat.com>

From: Hans de Goede <hdegoede@redhat.com>

Upstream-status: bc45de8c21dfc3bc3896a78b33d5a6d9e710dfff
Brew: https://brewweb.devel.redhat.com/taskinfo?taskID=6159903
BZ: 996469

The next libusb release will deprecate libusb_get_port_path, and since
we compile with -Werror, this breaks the build.

Signed-off-by: Hans de Goede <hdegoede@redhat.com>
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
(cherry picked from commit bc45de8c21dfc3bc3896a78b33d5a6d9e710dfff)
Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>

diff --git a/hw/usb/host-libusb.c b/hw/usb/host-libusb.c
index 3a582c5..0c12b0f 100644
--- a/hw/usb/host-libusb.c
+++ b/hw/usb/host-libusb.c
@@ -241,7 +241,11 @@ static int usb_host_get_port(libusb_device *dev, char *port, size_t len)
     size_t off;
     int rc, i;
 
+#if LIBUSBX_API_VERSION >= 0x01000102
+    rc = libusb_get_port_numbers(dev, path, 7);
+#else
     rc = libusb_get_port_path(ctx, dev, path, 7);
+#endif
     if (rc < 0) {
         return 0;
     }