svn commit: r186292 - head/sys/dev/usb

Andrew Thompson thompsa at FreeBSD.org
Thu Dec 18 19:08:19 UTC 2008


Author: thompsa
Date: Thu Dec 18 19:08:19 2008
New Revision: 186292
URL: http://svn.freebsd.org/changeset/base/186292

Log:
  Attempt to handoff the entire buffer with ttydisc_rint_bypass() before banging
  each char separately.

Modified:
  head/sys/dev/usb/ucom.c

Modified: head/sys/dev/usb/ucom.c
==============================================================================
--- head/sys/dev/usb/ucom.c	Thu Dec 18 18:44:46 2008	(r186291)
+++ head/sys/dev/usb/ucom.c	Thu Dec 18 19:08:19 2008	(r186292)
@@ -706,17 +706,20 @@ ucomrxchars(struct ucom_softc *sc, u_cha
 	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;
+	if (ttydisc_can_bypass(tp)) {
+		DPRINTFN(7, ("ucomreadcb: buf = %*D\n", cc, cp, ""));
+		cc = ttydisc_rint_bypass(tp, cp, cc);
+	} else {
+		while (cc > 0) {
+			DPRINTFN(7, ("ucomreadcb: char = 0x%02x\n", *cp));
+			if (ttydisc_rint(tp, *cp, 0) == -1)
+				break;
+			cc--;
+			cp++;
 		}
-		cc--;
-		cp++;
 	}
+	if (cc > 0)
+		device_printf(sc->sc_dev, "lost %d chars\n", cc);
 	ttydisc_rint_done(tp);
 }
 


More information about the svn-src-all mailing list