[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: |
Thu, 3 Sep 2020 07:33:00 +0200 |
On Wed, Sep 02, 2020 at 03:31:46PM +0100, Alex Bennée wrote:
>
> 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?
Patch is on the list already:
20200902081445.3291-1-kraxel@redhat.com/">https://patchwork.ozlabs.org/project/qemu-devel/patch/20200902081445.3291-1-kraxel@redhat.com/
Feel free to include it in testing pull.
take care,
Gerd