From eac70f6dca7daa15647a51e1920abfbc789578a0 Mon Sep 17 00:00:00 2001 From: mpi Date: Fri, 8 Aug 2014 14:22:45 +0000 Subject: [PATCH] Implement polling. --- sys/dev/usb/xhci.c | 18 ++++++++++++++++-- 1 file changed, 16 insertions(+), 2 deletions(-) diff --git a/sys/dev/usb/xhci.c b/sys/dev/usb/xhci.c index 38e34b0f03f..7a3afac5f6f 100644 --- a/sys/dev/usb/xhci.c +++ b/sys/dev/usb/xhci.c @@ -1,4 +1,4 @@ -/* $OpenBSD: xhci.c,v 1.17 2014/08/08 14:17:52 mpi Exp $ */ +/* $OpenBSD: xhci.c,v 1.18 2014/08/08 14:22:45 mpi Exp $ */ /* * Copyright (c) 2014 Martin Pieuchot @@ -575,7 +575,21 @@ xhci_poll(struct usbd_bus *bus) void xhci_waitintr(struct xhci_softc *sc, struct usbd_xfer *xfer) { - DPRINTF(("%s: stub\n", __func__)); + int timo; + + for (timo = xfer->timeout; timo >= 0; timo--) { + usb_delay_ms(&sc->sc_bus, 1); + if (sc->sc_bus.dying) + break; + + if (xfer->status != USBD_IN_PROGRESS) + return; + + xhci_intr1(sc); + } + + xfer->status = USBD_TIMEOUT; + usb_transfer_complete(xfer); } void -- 2.20.1