Received: from eggs.gnu.org ([2001:4830:134:3::10]:43908) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1aiGVK-0004EE-04 for qemu-devel@nongnu.org; Tue, 22 Mar 2016 03:13:26 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1aiGVJ-00041z-2G for qemu-devel@nongnu.org; Tue, 22 Mar 2016 03:13:25 -0400 Received: from qemu.weilnetz.de ([2a03:4000:2:362::1]:38299) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1aiGVI-00041n-SI for qemu-devel@nongnu.org; Tue, 22 Mar 2016 03:13:24 -0400 From: Stefan Weil Date: Tue, 22 Mar 2016 08:13:20 +0100 Message-Id: <1458630800-10088-1-git-send-email-sw@weilnetz.de> Subject: [Qemu-devel] [PATCH v2] usb: Support compilation without poll.h List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-devel@nongnu.org Cc: Stefan Weil , Gerd Hoffmann 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 --- v2: Modified after feedback from Gerd. hw/usb/host-libusb.c | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/hw/usb/host-libusb.c b/hw/usb/host-libusb.c index 5e7ec45..236bb2a 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 +#endif #include #include "qemu-common.h" @@ -203,6 +205,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 }; @@ -222,9 +226,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) { @@ -235,7 +243,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); @@ -246,6 +256,7 @@ static int usb_host_init(void) } } free(poll); +#endif return 0; } -- 2.1.4