From owner-p4-projects@FreeBSD.ORG Thu Aug 21 21:49:21 2008 Return-Path: Delivered-To: p4-projects@freebsd.org Received: by hub.freebsd.org (Postfix, from userid 32767) id 8AAA01065689; Thu, 21 Aug 2008 21:49:21 +0000 (UTC) Delivered-To: perforce@FreeBSD.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 36541106567E for ; Thu, 21 Aug 2008 21:49:21 +0000 (UTC) (envelope-from ed@FreeBSD.org) Received: from repoman.freebsd.org (repoman.freebsd.org [IPv6:2001:4f8:fff6::29]) by mx1.freebsd.org (Postfix) with ESMTP id 2227A8FC1D for ; Thu, 21 Aug 2008 21:49:21 +0000 (UTC) (envelope-from ed@FreeBSD.org) Received: from repoman.freebsd.org (localhost [127.0.0.1]) by repoman.freebsd.org (8.14.2/8.14.2) with ESMTP id m7LLnLGa025153 for ; Thu, 21 Aug 2008 21:49:21 GMT (envelope-from ed@FreeBSD.org) Received: (from perforce@localhost) by repoman.freebsd.org (8.14.2/8.14.1/Submit) id m7LLnLff025151 for perforce@freebsd.org; Thu, 21 Aug 2008 21:49:21 GMT (envelope-from ed@FreeBSD.org) Date: Thu, 21 Aug 2008 21:49:21 GMT Message-Id: <200808212149.m7LLnLff025151@repoman.freebsd.org> X-Authentication-Warning: repoman.freebsd.org: perforce set sender to ed@FreeBSD.org using -f From: Ed Schouten To: Perforce Change Reviews Cc: Subject: PERFORCE change 148058 for review X-BeenThere: p4-projects@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: p4 projects tree changes List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 21 Aug 2008 21:49:21 -0000 http://perforce.freebsd.org/chv.cgi?CH=148058 Change 148058 by ed@ed_flippo on 2008/08/21 21:48:49 Commit my ucom(4) changes as well. As I expected, hardware flow control wasn't properly fixed in the ucom(4) driver. Affected files ... .. //depot/projects/mpsafetty/sys/dev/usb/ucom.c#5 edit Differences ... ==== //depot/projects/mpsafetty/sys/dev/usb/ucom.c#5 (text+ko) ==== @@ -128,6 +128,7 @@ static tsw_open_t ucomtty_open; static tsw_close_t ucomtty_close; static tsw_outwakeup_t ucomtty_outwakeup; +static tsw_inwakeup_t ucomtty_inwakeup; static tsw_ioctl_t ucomtty_ioctl; static tsw_param_t ucomtty_param; static tsw_modem_t ucomtty_modem; @@ -138,6 +139,7 @@ .tsw_open = ucomtty_open, .tsw_close = ucomtty_close, .tsw_outwakeup = ucomtty_outwakeup, + .tsw_inwakeup = ucomtty_inwakeup, .tsw_ioctl = ucomtty_ioctl, .tsw_param = ucomtty_param, .tsw_modem = ucomtty_modem, @@ -500,10 +502,6 @@ return (error); } -#if 0 - ttsetwater(tp); -#endif - if (t->c_cflag & CRTS_IFLOW) { sc->sc_state |= UCS_RTS_IFLOW; } else if (sc->sc_state & UCS_RTS_IFLOW) { @@ -511,10 +509,6 @@ (void)ucomtty_modem(tp, SER_RTS, 0); } -#if 0 - ttyldoptim(tp); -#endif - uerr = ucomstartread(sc); if (uerr != USBD_NORMAL_COMPLETION) return (EIO); @@ -554,24 +548,6 @@ if (sc->sc_oxfer == NULL) return; - /* XXX: hardware flow control. We should use inwakeup here. */ -#if 0 - if (tp->t_state & TS_TBLOCK) { - if (ISSET(sc->sc_mcr, SER_RTS) && - ISSET(sc->sc_state, UCS_RTS_IFLOW)) { - DPRINTF(("ucomtty_outwakeup: clear RTS\n")); - (void)ucomtty_modem(tp, 0, SER_RTS); - } - } else { - if (!ISSET(sc->sc_mcr, SER_RTS) && - tp->t_rawq.c_cc <= tp->t_ilowat && - ISSET(sc->sc_state, UCS_RTS_IFLOW)) { - DPRINTF(("ucomtty_outwakeup: set RTS\n")); - (void)ucomtty_modem(tp, SER_RTS, 0); - } - } -#endif - if (sc->sc_state & UCS_TXBUSY) return; @@ -600,35 +576,22 @@ } } -#if 0 static void -ucomstop(struct tty *tp, int flag) +ucomtty_inwakeup(struct tty *tp) { struct ucom_softc *sc = tty_softc(tp); - int s; - DPRINTF(("ucomstop: %d\n", flag)); + DPRINTF(("ucomtty_inwakeup: sc = %p\n", sc)); - if ((flag & FREAD) && (sc->sc_state & UCS_RXSTOP) == 0) { - DPRINTF(("ucomstop: read\n")); - ucomstopread(sc); - ucomstartread(sc); - } + if (sc->sc_dying) + return; - if (flag & FWRITE) { - DPRINTF(("ucomstop: write\n")); - if (ISSET(tp->t_state, TS_BUSY)) { - /* XXX do what? */ - if (!ISSET(tp->t_state, TS_TTSTOP)) - SET(tp->t_state, TS_FLUSH); - } + if (!ISSET(sc->sc_mcr, SER_RTS) && + ISSET(sc->sc_state, UCS_RTS_IFLOW)) { + DPRINTF(("ucomtty_outwakeup: set RTS\n")); + (void)ucomtty_modem(tp, SER_RTS, 0); } - - ucomtty_outwakeup(tp); - - DPRINTF(("ucomstop: done\n")); } -#endif static void ucomwritecb(usbd_xfer_handle xfer, usbd_private_handle p, usbd_status status) @@ -663,13 +626,6 @@ cc -= sc->sc_opkthdrlen; sc->sc_state &= ~UCS_TXBUSY; -#if 0 - CLR(tp->t_state, TS_BUSY); - if (ISSET(tp->t_state, TS_FLUSH)) - CLR(tp->t_state, TS_FLUSH); - else - ndflush(&tp->t_outq, cc); -#endif ucomtty_outwakeup(tp); } @@ -744,9 +700,11 @@ while (cc > 0) { DPRINTFN(7, ("ucomreadcb: char = 0x%02x\n", *cp)); if (ttydisc_rint(tp, *cp, 0) == -1) { - /* XXX what should we do? */ - printf("%s: lost %d chars\n", - device_get_nameunit(sc->sc_dev), cc); + if (ISSET(sc->sc_mcr, SER_RTS) && + ISSET(sc->sc_state, UCS_RTS_IFLOW)) { + DPRINTF(("ucomtty_outwakeup: clear RTS\n")); + (void)ucomtty_modem(tp, 0, SER_RTS); + } break; } cc--; @@ -760,12 +718,6 @@ printf("%s: read start failed\n", device_get_nameunit(sc->sc_dev)); /* XXX what should we dow now? */ } - -#if 0 - if ((sc->sc_state & UCS_RTS_IFLOW) && !ISSET(sc->sc_mcr, SER_RTS) - && !(tp->t_state & TS_TBLOCK)) - ucomtty_modem(tp, SER_RTS, 0); -#endif } static void