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: Alex Bennée
Subject: Re: [PATCH] usb-host: workaround libusb bug
Date: Wed, 02 Sep 2020 15:31:46 +0100
User-agent: mu4e 1.5.5; emacs 28.0.50

Gerd Hoffmann <kraxel@redhat.com> writes:

>> > +#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

That works. Do you want to include that in your next PR or send a patch
for me to include in my testing/next PR?

In the meantime:

Reviewed-by: Alex Bennée <alex.bennee@linaro.org>
Tested-by: Alex Bennée <alex.bennee@linaro.org>

-- 
Alex Bennée



reply via email to

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