diff options
| author | Ian Dowse <iedowse@FreeBSD.org> | 2005-04-12 00:26:40 +0000 |
|---|---|---|
| committer | Ian Dowse <iedowse@FreeBSD.org> | 2005-04-12 00:26:40 +0000 |
| commit | f04d2ba47f0f5fa1d2ed8fe209ecc0b04bd6c470 (patch) | |
| tree | 1395337a9f93bb8d2695cd93295bf5e87e5955a3 /sys/dev/usb | |
| parent | 308f942ec9d864b8546c5177faf5f82c659c583b (diff) | |
Notes
Diffstat (limited to 'sys/dev/usb')
| -rw-r--r-- | sys/dev/usb/ucom.c | 13 |
1 files changed, 8 insertions, 5 deletions
diff --git a/sys/dev/usb/ucom.c b/sys/dev/usb/ucom.c index 445609c81c26..0260cb6d8c9f 100644 --- a/sys/dev/usb/ucom.c +++ b/sys/dev/usb/ucom.c @@ -297,6 +297,7 @@ ucomopen(struct tty *tp, struct cdev *dev) goto fail; } + sc->sc_state |= UCS_RXSTOP; ucomstartread(sc); sc->sc_poll = 1; @@ -621,7 +622,7 @@ ucomstop(struct tty *tp, int flag) DPRINTF(("ucomstop: %d\n", flag)); - if (flag & FREAD) { + if ((flag & FREAD) && (sc->sc_state & UCS_RXSTOP) == 0) { DPRINTF(("ucomstop: read\n")); ucomstopread(sc); ucomstartread(sc); @@ -701,10 +702,9 @@ ucomstartread(struct ucom_softc *sc) DPRINTF(("ucomstartread: start\n")); - sc->sc_state &= ~UCS_RXSTOP; - - if (sc->sc_bulkin_pipe == NULL) + if (sc->sc_bulkin_pipe == NULL || (sc->sc_state & UCS_RXSTOP) == 0) return (USBD_NORMAL_COMPLETION); + sc->sc_state &= ~UCS_RXSTOP; usbd_setup_xfer(sc->sc_ixfer, sc->sc_bulkin_pipe, (usbd_private_handle)sc, @@ -713,7 +713,8 @@ ucomstartread(struct ucom_softc *sc) USBD_NO_TIMEOUT, ucomreadcb); err = usbd_transfer(sc->sc_ixfer); - if (err != USBD_IN_PROGRESS) { + if (err && err != USBD_IN_PROGRESS) { + sc->sc_state |= UCS_RXSTOP; DPRINTF(("ucomstartread: err = %s\n", usbd_errstr(err))); return (err); } @@ -738,11 +739,13 @@ ucomreadcb(usbd_xfer_handle xfer, usbd_private_handle p, usbd_status status) if (!(sc->sc_state & UCS_RXSTOP)) printf("%s: ucomreadcb: %s\n", USBDEVNAME(sc->sc_dev), usbd_errstr(status)); + sc->sc_state |= UCS_RXSTOP; if (status == USBD_STALLED) usbd_clear_endpoint_stall_async(sc->sc_bulkin_pipe); /* XXX we should restart after some delay. */ return; } + sc->sc_state |= UCS_RXSTOP; usbd_get_xfer_status(xfer, NULL, (void **)&cp, &cc, NULL); DPRINTF(("ucomreadcb: got %d chars, tp = %p\n", cc, tp)); |
