Subject: kern/10573: uftdi drops characters
To: None <>
From: IWAMOTO Toshihiro <>
List: netbsd-bugs
Date: 07/12/2000 10:48:15
>Number:         10573
>Category:       kern
>Synopsis:       uftdi drops characters
>Confidential:   no
>Severity:       serious
>Priority:       high
>Responsible:    kern-bug-people
>State:          open
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Wed Jul 12 10:49:00 PDT 2000
>Originator:     IWAMOTO Toshihiro
>Release:        a few days ago -current
System: NetBSD 1.5B NetBSD 1.5B (KIKU) #44: Tue Jul 11 22:11:25 JST 2000 i386

	The uftdi/ucom driver drops one byte for every 64 bytes of output,
	if output data are written in large chunks.
	This is because ucomwritecb considers the amount of written data
	is the same as the amount of transferred bytes in USB layer.
	This is not true for the uftdi case as each outgoing USB packet
	has one byte padding.

	I discovered this bug while trying to create a slip link over
	The code below works around the problem.
	The real fix will be to add a member to ucom_softc to hold
	padding length (or a function which converts USB transferred bytes
	to tty written bytes).

--- /sys/dev/usb/ucom.c	Thu Mar  2 11:45:38 2000
+++ ./ucom.c	Thu Jul 13 02:03:49 2000
@@ -913,6 +913,9 @@
 	usbd_get_xfer_status(xfer, NULL, NULL, &cc, NULL);
 	DPRINTFN(5,("ucomwritecb: cc=%d\n", cc));
+	/* XXX uftdi specific */
+	cc = (cc > 0) ? cc - 1 : 0;
 	s = spltty();
 	CLR(tp->t_state, TS_BUSY);
 	if (ISSET(tp->t_state, TS_FLUSH))