[2/2] usb/host-libusb: Fix building with libusb git master code

Submitted by Hans de Goede on June 6, 2013, 2:39 p.m.

Details

Message ID 1370529574-31069-3-git-send-email-hdegoede@redhat.com
State New
Headers show

Commit Message

Hans de Goede June 6, 2013, 2:39 p.m.
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>
---
 hw/usb/host-libusb.c | 4 ++++
 1 file changed, 4 insertions(+)

Comments

Gerd Hoffmann June 6, 2013, 2:47 p.m.
On 06/06/13 16:39, Hans de Goede wrote:
> The next libusb release will deprecate libusb_get_port_path, and since
> we compile with -Werror, this breaks the build.

Patch added to usb patch queue.

thanks,
  Gerd
Ed Maste June 7, 2013, 2:13 p.m.
On 6 June 2013 10:39, Hans de Goede <hdegoede@redhat.com> wrote:
> +#if LIBUSBX_API_VERSION >= 0x01000102
> +    rc = libusb_get_port_numbers(dev, path, 7);
> +#else
>      rc = libusb_get_port_path(ctx, dev, path, 7);
> +#endif

I just added libusb_get_port_numbers to FreeBSD's libusb, but we don't
have LIBUSBX_API_VERSION defined; we don't (yet) implement all of the
functionality that would be implied by given version.

I'm not sure if it'd be better to add the definition in FreeBSD's
libusb (and fault in missing functionality as needed, presumably), or
address it in libusb consumers with additional #ifdefs.

Patch hide | download patch | download mbox

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;
     }