From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:53081) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1agtOZ-0000dh-5T for qemu-devel@nongnu.org; Fri, 18 Mar 2016 08:20:48 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1agtOV-000511-Tz for qemu-devel@nongnu.org; Fri, 18 Mar 2016 08:20:47 -0400 Received: from mx1.redhat.com ([209.132.183.28]:55024) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1agtOV-00050f-NS for qemu-devel@nongnu.org; Fri, 18 Mar 2016 08:20:43 -0400 Message-ID: <1458303641.6882.33.camel@redhat.com> From: Gerd Hoffmann Date: Fri, 18 Mar 2016 13:20:41 +0100 In-Reply-To: <1458159729-683-1-git-send-email-sw@weilnetz.de> References: <1458159729-683-1-git-send-email-sw@weilnetz.de> Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable Mime-Version: 1.0 Subject: Re: [Qemu-devel] [PATCH] usb: Support compilation without poll.h List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Stefan Weil Cc: QEMU Developer On Mi, 2016-03-16 at 21:22 +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. >=20 > Signed-off-by: Stefan Weil > --- >=20 > I did not test whether this USB host code works on Windows, > but at least it compiles with this hack. >=20 > Suggestions for a better fix are welcome. >=20 > Regards, > Stefan >=20 > hw/usb/host-libusb.c | 8 ++++++++ > 1 file changed, 8 insertions(+) >=20 > 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 @@ > */ > =20 > #include "qemu/osdep.h" > +#ifdef CONFIG_PPOLL > #include > +#endif > #include > =20 > #include "qemu-common.h" > @@ -203,18 +205,24 @@ static const char *err_names[] =3D { > static libusb_context *ctx; > static uint32_t loglevel; > =20 > +#ifdef CONFIG_PPOLL > static void usb_host_handle_fd(void *opaque) > { > struct timeval tv =3D { 0, 0 }; > libusb_handle_events_timeout(ctx, &tv); > } > +#endif > =20 > 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 =3D=3D 0); > +#endif > } > =20 > static void usb_host_del_fd(int fd, void *user_data) Hmm. I'm wondering how libusb @ windows is notified about pending data. Probably not using file descriptors but something else ... I'd suggest to use CONFIG_WIN32 instead of CONFIG_POLL, to make clear what this is about. You can #ifdef out the whole block with all three usb_host_*_fd functions, and the libusb call which registers these callbacks somewhere further down in the code. The later place should probably get a /* FIXME */ in the #else branch as I expect we need to do something on windows too. cheers, Gerd