qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
* [Qemu-devel] [PATCH v2] usb: Support compilation without poll.h
@ 2016-03-22  7:13 Stefan Weil
  2016-05-11  8:38 ` Gerd Hoffmann
  2016-05-11  9:14 ` Peter Maydell
  0 siblings, 2 replies; 4+ messages in thread
From: Stefan Weil @ 2016-03-22  7:13 UTC (permalink / raw)
  To: qemu-devel; +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 <sw@weilnetz.de>
---

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 <poll.h>
+#endif
 #include <libusb.h>
 
 #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

^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: [Qemu-devel] [PATCH v2] usb: Support compilation without poll.h
  2016-03-22  7:13 [Qemu-devel] [PATCH v2] usb: Support compilation without poll.h Stefan Weil
@ 2016-05-11  8:38 ` Gerd Hoffmann
  2016-05-11  9:14 ` Peter Maydell
  1 sibling, 0 replies; 4+ messages in thread
From: Gerd Hoffmann @ 2016-05-11  8:38 UTC (permalink / raw)
  To: Stefan Weil; +Cc: qemu-devel

On Di, 2016-03-22 at 08:13 +0100, Stefan Weil wrote:
> This is a hack to support compilation with Mingw-w64 which provides
> a libusb-1.0 package, but no poll.h.

Added to usb patch queue.

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [Qemu-devel] [PATCH v2] usb: Support compilation without poll.h
  2016-03-22  7:13 [Qemu-devel] [PATCH v2] usb: Support compilation without poll.h Stefan Weil
  2016-05-11  8:38 ` Gerd Hoffmann
@ 2016-05-11  9:14 ` Peter Maydell
  2016-05-11  9:54   ` Gerd Hoffmann
  1 sibling, 1 reply; 4+ messages in thread
From: Peter Maydell @ 2016-05-11  9:14 UTC (permalink / raw)
  To: Stefan Weil; +Cc: QEMU Developers, Gerd Hoffmann

On 22 March 2016 at 07:13, Stefan Weil <sw@weilnetz.de> wrote:
> 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>
> ---
>
> v2: Modified after feedback from Gerd.

>  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;

Would it make more sense to just disable this functionality
entirely rather than leaving it compiling but not working?

thanks
-- PMM

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [Qemu-devel] [PATCH v2] usb: Support compilation without poll.h
  2016-05-11  9:14 ` Peter Maydell
@ 2016-05-11  9:54   ` Gerd Hoffmann
  0 siblings, 0 replies; 4+ messages in thread
From: Gerd Hoffmann @ 2016-05-11  9:54 UTC (permalink / raw)
  To: Peter Maydell; +Cc: Stefan Weil, QEMU Developers

On Mi, 2016-05-11 at 10:14 +0100, Peter Maydell wrote:
> On 22 March 2016 at 07:13, Stefan Weil <sw@weilnetz.de> wrote:
> > This is a hack to support compilation with Mingw-w64 which provides
> > a libusb-1.0 package, but no poll.h.

> Would it make more sense to just disable this functionality
> entirely rather than leaving it compiling but not working?

It should be possible to get things working on windows, given that a
libusb port exists now.

/me hopes that having things at least compile might encourage people to
fill the missing bits.

I guess we'll have to either add some windows-specific bits for event
handling (simliar to win_chr_init() in qemu-char.c) or do timer-based
polling.

cheers,
  Gerd

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2016-05-11  9:54 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2016-03-22  7:13 [Qemu-devel] [PATCH v2] usb: Support compilation without poll.h Stefan Weil
2016-05-11  8:38 ` Gerd Hoffmann
2016-05-11  9:14 ` Peter Maydell
2016-05-11  9:54   ` Gerd Hoffmann

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).