Skip to contentSkip to conversation

usb: fix usb-host build on windows.

PATCH In review Gerd Hoffmann 3 participants 3 messages Jun 24, 2020

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 usb: fix usb-host build on windows.

Seems the new API is not available on windows.
Update #ifdefs accordingly.

Fixes 9f815e83e983 ("usb: add hostdevice property to usb-host")
---
 hw/usb/host-libusb.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
hw/usb/host-libusb.c +2 -2
index ad7ed8fb0c67..c474551d8456 100644
@@ -907,7 +907,7 @@ static int usb_host_open(USBHostDevice *s, libusb_device *dev, int hostfd)
             goto fail;
         }
     } else {
-#if LIBUSB_API_VERSION >= 0x01000107
+#if LIBUSB_API_VERSION >= 0x01000107 && !defined(CONFIG_WIN32)
         trace_usb_host_open_hostfd(hostfd);
 
         rc = libusb_wrap_sys_device(ctx, hostfd, &s->dh);
@@ -1107,7 +1107,7 @@ static void usb_host_realize(USBDevice *udev, Error **errp)
     QTAILQ_INIT(&s->isorings);
     s->hostfd = -1;
 
-#if LIBUSB_API_VERSION >= 0x01000107
+#if LIBUSB_API_VERSION >= 0x01000107 && !defined(CONFIG_WIN32)
     if (s->hostdevice) {
         int fd;
         s->needs_autoscan = false;
Signature · 1 line
2.18.4
Tested-by on v1 1/1
#1 lore raw
Quoted 34 lines · Gerd Hoffmann

Seems the new API is not available on windows.
Update #ifdefs accordingly.

Fixes 9f815e83e983 ("usb: add hostdevice property to usb-host")
---
 hw/usb/host-libusb.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
hw/usb/host-libusb.c +1 -1
index ad7ed8fb0c67..c474551d8456 100644
@@ -907,7 +907,7 @@ static int usb_host_open(USBHostDevice *s,
 libusb_device *dev, int hostfd)
             goto fail;
         }
     } else {
-#if LIBUSB_API_VERSION >= 0x01000107
+#if LIBUSB_API_VERSION >= 0x01000107 && !defined(CONFIG_WIN32)
         trace_usb_host_open_hostfd(hostfd);
 
         rc = libusb_wrap_sys_device(ctx, hostfd, &s->dh);
hw/usb/host-libusb.c +1 -1
@@ -1107,7 +1107,7 @@ static void usb_host_realize(USBDevice *udev, Error
 **errp)
     QTAILQ_INIT(&s->isorings);
     s->hostfd = -1;
 
-#if LIBUSB_API_VERSION >= 0x01000107
+#if LIBUSB_API_VERSION >= 0x01000107 && !defined(CONFIG_WIN32)
     if (s->hostdevice) {
         int fd;
         s->needs_autoscan = false;
Quoted 4 lines

--
2.18.4

Thanks for the quick fix, so:

Reviewed-by on v1 1/1
#2 lore raw
In reply to Gerd Hoffmann
Quoted 25 lines · Gerd Hoffmann

Seems the new API is not available on windows.
Update #ifdefs accordingly.

Fixes 9f815e83e983 ("usb: add hostdevice property to usb-host")
---
 hw/usb/host-libusb.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
hw/usb/host-libusb.c +1 -1
index ad7ed8fb0c67..c474551d8456 100644
@@ -907,7 +907,7 @@ static int usb_host_open(USBHostDevice *s, libusb_device *dev, int hostfd)
             goto fail;
         }
     } else {
-#if LIBUSB_API_VERSION >= 0x01000107
+#if LIBUSB_API_VERSION >= 0x01000107 && !defined(CONFIG_WIN32)
         trace_usb_host_open_hostfd(hostfd);
 
         rc = libusb_wrap_sys_device(ctx, hostfd, &s->dh);

hw/usb/host-libusb.c static void usb_host_realize(USBDevice *udev, Error **errp) · line 1113

Quoted 8 lines
hw/usb/host-libusb.c +1 -1
@@ -1107,7 +1107,7 @@ static void usb_host_realize(USBDevice *udev, Error **errp)
     QTAILQ_INIT(&s->isorings);
     s->hostfd = -1;
 
-#if LIBUSB_API_VERSION >= 0x01000107
+#if LIBUSB_API_VERSION >= 0x01000107 && !defined(CONFIG_WIN32)
     if (s->hostdevice) {
         int fd;
         s->needs_autoscan = false;