From owner-svn-src-all@FreeBSD.ORG Sun Dec 14 20:26:31 2008 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id EC57C106567B; Sun, 14 Dec 2008 20:26:31 +0000 (UTC) (envelope-from thompsa@FreeBSD.org) Received: from pele.citylink.co.nz (pele.citylink.co.nz [202.8.44.226]) by mx1.freebsd.org (Postfix) with ESMTP id 86C118FC12; Sun, 14 Dec 2008 20:26:31 +0000 (UTC) (envelope-from thompsa@FreeBSD.org) Received: from localhost (localhost [127.0.0.1]) by pele.citylink.co.nz (Postfix) with ESMTP id F330BFEF7; Mon, 15 Dec 2008 09:26:29 +1300 (NZDT) X-Virus-Scanned: Debian amavisd-new at citylink.co.nz Received: from pele.citylink.co.nz ([127.0.0.1]) by localhost (pele.citylink.co.nz [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id gTE420bcgnEn; Mon, 15 Dec 2008 09:26:25 +1300 (NZDT) Received: from citylink.fud.org.nz (unknown [202.8.44.45]) by pele.citylink.co.nz (Postfix) with ESMTP; Mon, 15 Dec 2008 09:26:25 +1300 (NZDT) Received: by citylink.fud.org.nz (Postfix, from userid 1001) id 2CE711142E; Mon, 15 Dec 2008 09:26:25 +1300 (NZDT) Date: Sun, 14 Dec 2008 12:26:25 -0800 From: Andrew Thompson To: Poul-Henning Kamp Message-ID: <20081214202625.GB80520@citylink.fud.org.nz> References: <200812142003.mBEK3lRR069821@svn.freebsd.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <200812142003.mBEK3lRR069821@svn.freebsd.org> User-Agent: Mutt/1.5.17 (2007-11-01) Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org Subject: Re: svn commit: r186091 - head/sys/dev/usb X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 14 Dec 2008 20:26:32 -0000 On Sun, Dec 14, 2008 at 08:03:47PM +0000, Poul-Henning Kamp wrote: > Author: phk > Date: Sun Dec 14 20:03:46 2008 > New Revision: 186091 > URL: http://svn.freebsd.org/changeset/base/186091 > > Log: > Move the code that injects received characters into the tty system into > a separate public function ucomrxchars(), to avoid requirement of > simple metadata prefixing on the USB data stream. > > Modified: > head/sys/dev/usb/ucom.c > head/sys/dev/usb/ucomvar.h > > Modified: head/sys/dev/usb/ucom.c > ============================================================================== > --- head/sys/dev/usb/ucom.c Sun Dec 14 19:39:53 2008 (r186090) > +++ head/sys/dev/usb/ucom.c Sun Dec 14 20:03:46 2008 (r186091) > @@ -700,11 +700,30 @@ ucomstartread(struct ucom_softc *sc) > return (USBD_NORMAL_COMPLETION); > } > > +void > +ucomrxchars(struct ucom_softc *sc, u_char *cp, u_int32_t cc) > +{ > + struct tty *tp = sc->sc_tty; > + > + /* Give characters to tty layer. */ > + 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); > + break; > + } > + cc--; > + cp++; > + } > + ttydisc_rint_done(tp); > +} How about passing the whole buffer before doing a per-char handoff. Andrew Index: ucom.c =================================================================== --- ucom.c (revision 186092) +++ ucom.c (working copy) @@ -704,8 +704,15 @@ void ucomrxchars(struct ucom_softc *sc, u_char *cp, u_int32_t cc) { struct tty *tp = sc->sc_tty; + size_t len; /* Give characters to tty layer. */ + if (ttydisc_can_bypass(tp)) { + DPRINTFN(7, ("ucomreadcb: buf=%*D\n", cc, cp, "")); + len = ttydisc_rint_bypass(tp, cp, cc); + cp += len; + cc -= len; + } while (cc > 0) { DPRINTFN(7, ("ucomreadcb: char = 0x%02x\n", *cp)); if (ttydisc_rint(tp, *cp, 0) == -1) {