PERFORCE change 69963 for review

Marcel Moolenaar marcel at FreeBSD.org
Sun Jan 30 00:32:04 PST 2005


http://perforce.freebsd.org/chv.cgi?CH=69963

Change 69963 by marcel at marcel_nfs on 2005/01/30 08:31:58

	Make the DTE drain the output and wait for the DCE to
	drop DSR. This fixes termination problems when the DCE
	needs a lot of time to receive the data.
	
	Lower the speed to 19200. The Zilog Z8530 can't even
	be programmed for 115200.

Affected files ...

.. //depot/projects/uart/dev/uart/uarttest.c#4 edit

Differences ...

==== //depot/projects/uart/dev/uart/uarttest.c#4 (text+ko) ====

@@ -100,6 +100,12 @@
 		}
 	}
 	printf("dte: %u bytes transmitted\n", count);
+
+	ioctl(fd, TIOCDRAIN);
+	do {
+		sleep(1);
+		ioctl(fd, TIOCMGET, &sig);
+	} while (sig & TIOCM_DSR);
 }
 
 static void
@@ -185,7 +191,7 @@
 	tcgetattr(fd, &t0);
 	t1 = t0;
 	cfmakeraw(&t1);
-	cfsetspeed(&t1, B115200);
+	cfsetspeed(&t1, B19200);
 	switch (how) {
 	case AS_DCE:
 		t1.c_cflag |= CRTS_IFLOW;
@@ -211,7 +217,6 @@
 		break;
 	}
 
-	sleep(2);
 	tcsetattr(fd, TCSADRAIN, &t0);
 	close(fd);
 	return (EX_OK);


More information about the p4-projects mailing list