218e99
From 4de8173704a782b602f2d5412b2b9d08ceb9fc1d Mon Sep 17 00:00:00 2001
218e99
From: Stefan Hajnoczi <stefanha@redhat.com>
218e99
Date: Tue, 13 Aug 2013 08:31:21 +0200
218e99
Subject: usb/host-libusb: Fix building with libusb git master code
218e99
218e99
RH-Author: Stefan Hajnoczi <stefanha@redhat.com>
218e99
Message-id: <1376382681-14630-1-git-send-email-stefanha@redhat.com>
218e99
Patchwork-id: 53201
218e99
O-Subject: [PATCH] usb/host-libusb: Fix building with libusb git master code
218e99
Bugzilla: 996469
218e99
RH-Acked-by: Gerd Hoffmann <kraxel@redhat.com>
218e99
RH-Acked-by: Miroslav Rezanina <mrezanin@redhat.com>
218e99
RH-Acked-by: Hans de Goede <hdegoede@redhat.com>
218e99
218e99
From: Hans de Goede <hdegoede@redhat.com>
218e99
218e99
Upstream-status: bc45de8c21dfc3bc3896a78b33d5a6d9e710dfff
218e99
Brew: https://brewweb.devel.redhat.com/taskinfo?taskID=6159903
218e99
BZ: 996469
218e99
218e99
The next libusb release will deprecate libusb_get_port_path, and since
218e99
we compile with -Werror, this breaks the build.
218e99
218e99
Signed-off-by: Hans de Goede <hdegoede@redhat.com>
218e99
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
218e99
(cherry picked from commit bc45de8c21dfc3bc3896a78b33d5a6d9e710dfff)
218e99
Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
218e99
218e99
diff --git a/hw/usb/host-libusb.c b/hw/usb/host-libusb.c
218e99
index 3a582c5..0c12b0f 100644
218e99
--- a/hw/usb/host-libusb.c
218e99
+++ b/hw/usb/host-libusb.c
218e99
@@ -241,7 +241,11 @@ static int usb_host_get_port(libusb_device *dev, char *port, size_t len)
218e99
     size_t off;
218e99
     int rc, i;
218e99
 
218e99
+#if LIBUSBX_API_VERSION >= 0x01000102
218e99
+    rc = libusb_get_port_numbers(dev, path, 7);
218e99
+#else
218e99
     rc = libusb_get_port_path(ctx, dev, path, 7);
218e99
+#endif
218e99
     if (rc < 0) {
218e99
         return 0;
218e99
     }