From: Stefan Weil <sw@weilnetz.de>
To: QEMU Developer <qemu-devel@nongnu.org>
Cc: Stefan Weil <sw@weilnetz.de>, Gerd Hoffmann <kraxel@redhat.com>
Subject: [Qemu-devel] [PATCH] usb: Support compilation without poll.h
Date: Wed, 16 Mar 2016 21:22:09 +0100 [thread overview]
Message-ID: <1458159729-683-1-git-send-email-sw@weilnetz.de> (raw)
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>
---
I did not test whether this USB host code works on Windows,
but at least it compiles with this hack.
Suggestions for a better fix are welcome.
Regards,
Stefan
hw/usb/host-libusb.c | 8 ++++++++
1 file changed, 8 insertions(+)
diff --git a/hw/usb/host-libusb.c b/hw/usb/host-libusb.c
index 5e7ec45..139028e 100644
--- a/hw/usb/host-libusb.c
+++ b/hw/usb/host-libusb.c
@@ -34,7 +34,9 @@
*/
#include "qemu/osdep.h"
+#ifdef CONFIG_PPOLL
#include <poll.h>
+#endif
#include <libusb.h>
#include "qemu-common.h"
@@ -203,18 +205,24 @@ static const char *err_names[] = {
static libusb_context *ctx;
static uint32_t loglevel;
+#ifdef CONFIG_PPOLL
static void usb_host_handle_fd(void *opaque)
{
struct timeval tv = { 0, 0 };
libusb_handle_events_timeout(ctx, &tv);
}
+#endif
static void usb_host_add_fd(int fd, short events, void *user_data)
{
+#ifdef CONFIG_PPOLL
qemu_set_fd_handler(fd,
(events & POLLIN) ? usb_host_handle_fd : NULL,
(events & POLLOUT) ? usb_host_handle_fd : NULL,
ctx);
+#else
+ g_assert(events == 0);
+#endif
}
static void usb_host_del_fd(int fd, void *user_data)
--
2.1.4
next reply other threads:[~2016-03-16 20:22 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-03-16 20:22 Stefan Weil [this message]
2016-03-18 12:20 ` [Qemu-devel] [PATCH] usb: Support compilation without poll.h Gerd Hoffmann
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1458159729-683-1-git-send-email-sw@weilnetz.de \
--to=sw@weilnetz.de \
--cc=kraxel@redhat.com \
--cc=qemu-devel@nongnu.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).