summaryrefslogtreecommitdiff
path: root/hw/usb
diff options
context:
space:
mode:
authorStefan Weil <sw@weilnetz.de>2016-03-22 08:13:20 +0100
committerGerd Hoffmann <kraxel@redhat.com>2016-05-11 10:37:39 +0200
commita277c3e094d5e9f653ccc861f59e07c94c7fe6c7 (patch)
tree184fb6da2c4b45577362abae7a568b062591a2fc /hw/usb
parent1f66fe5778ca906448385ee004b38381ae067755 (diff)
usb: Support compilation without poll.h
This is a hack to support compilation with Mingw-w64 which provides a libusb-1.0 package, but no poll.h. Signed-off-by: Stefan Weil <sw@weilnetz.de> Message-id: 1458630800-10088-1-git-send-email-sw@weilnetz.de Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
Diffstat (limited to 'hw/usb')
-rw-r--r--hw/usb/host-libusb.c13
1 files changed, 12 insertions, 1 deletions
diff --git a/hw/usb/host-libusb.c b/hw/usb/host-libusb.c
index 6458a94485..8b774f4939 100644
--- a/hw/usb/host-libusb.c
+++ b/hw/usb/host-libusb.c
@@ -34,7 +34,9 @@
*/
#include "qemu/osdep.h"
+#ifndef CONFIG_WIN32
#include <poll.h>
+#endif
#include <libusb.h>
#include "qapi/error.h"
@@ -204,6 +206,8 @@ static const char *err_names[] = {
static libusb_context *ctx;
static uint32_t loglevel;
+#ifndef CONFIG_WIN32
+
static void usb_host_handle_fd(void *opaque)
{
struct timeval tv = { 0, 0 };
@@ -223,9 +227,13 @@ static void usb_host_del_fd(int fd, void *user_data)
qemu_set_fd_handler(fd, NULL, NULL, NULL);
}
+#endif /* !CONFIG_WIN32 */
+
static int usb_host_init(void)
{
+#ifndef CONFIG_WIN32
const struct libusb_pollfd **poll;
+#endif
int i, rc;
if (ctx) {
@@ -236,7 +244,9 @@ static int usb_host_init(void)
return -1;
}
libusb_set_debug(ctx, loglevel);
-
+#ifdef CONFIG_WIN32
+ /* FIXME: add support for Windows. */
+#else
libusb_set_pollfd_notifiers(ctx, usb_host_add_fd,
usb_host_del_fd,
ctx);
@@ -247,6 +257,7 @@ static int usb_host_init(void)
}
}
free(poll);
+#endif
return 0;
}