Skip to contentSkip to conversation

hw: usb: fix break on older kernel headers that miss USBDEVFS_GET_SPEED

PATCH New Enrico Weigelt, metux IT consult 1 participant 1 message Nov 27, 2020

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 hw: usb: fix break on older kernel headers that miss USBDEVFS_GET_SPEED

Older kernel headers lack the USBDEVFS_GET_SPEED ioctl. Qemu can easily work without it, but the api version check isn't sufficient. Instead time consuming bisection, for finding the really correct version, just change the ifdef to look for the symbol, instead of api version.

---
 hw/usb/host-libusb.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
hw/usb/host-libusb.c +1 -1
index b950501d10..c894a4b148 100644
@@ -941,7 +941,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);
-#if LIBUSB_API_VERSION >= 0x01000107 && defined(CONFIG_LINUX)
+#ifdef USBDEVFS_GET_SPEED
     if (hostfd && libusb_speed == 0) {
         /*
          * Workaround libusb bug: libusb_get_device_speed() does not
Signature · 1 line
2.11.0