qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [PATCH] usb-host: workaround libusb bug


From: Gerd Hoffmann
Subject: Re: [PATCH] usb-host: workaround libusb bug
Date: Wed, 2 Sep 2020 10:09:37 +0200

> > +#include <linux/usbdevice_fs.h>

> > +        int rc = ioctl(hostfd, USBDEVFS_GET_SPEED, NULL);
> 
> This (further) breaks a bunch of the Travis jobs - I assume because libusb 
> doesn't
> always have this symbol:
> 
>   ../hw/usb/host-libusb.c:954:32: error: ‘USBDEVFS_GET_SPEED’ undeclared 
> (first use in this function)

It isn't libusb, it is the kernel (linux/usbdevice_fs.h).

/me checks git ...
Added in 4.13, so available for quite a while.
I guess that is the prehistoric ubuntu version travis has?

Given that we only need that workaround with rather new libusb versions
(which have libusb_wrap_sys_device() support) which most likely isn't
present in that old ubuntu version we can probably just do this:

diff --git a/hw/usb/host-libusb.c b/hw/usb/host-libusb.c
index 08604f787fdf..c25102f3aca1 100644
--- a/hw/usb/host-libusb.c
+++ b/hw/usb/host-libusb.c
@@ -942,7 +942,7 @@ static int usb_host_open(USBHostDevice *s, libusb_device 
*dev, int hostfd)
     usb_host_ep_update(s);
 
     libusb_speed = libusb_get_device_speed(dev);
-#ifdef CONFIG_LINUX
+#if LIBUSB_API_VERSION >= 0x01000107 && defined(CONFIG_LINUX)
     if (hostfd && libusb_speed == 0) {
         /*
          * Workaround libusb bug: libusb_get_device_speed() does not




reply via email to

[Prev in Thread] Current Thread [Next in Thread]