diff svr-chansession.c @ 312:24056a5eb75b ucc-axis-hack

serial works better. enable DSS.
author matt-ucc@ucc.asn.au
date Sun, 26 Mar 2006 13:05:31 +0000
parents 6e5f8ce73bf2
children fabcee551349
line wrap: on
line diff
--- a/svr-chansession.c	Sun Mar 26 08:28:16 2006 +0000
+++ b/svr-chansession.c	Sun Mar 26 13:05:31 2006 +0000
@@ -647,6 +647,7 @@
 static void serial_connect(struct Channel *channel) {
 
 	int serial_fd;
+	struct termios options;
 
 	TRACE(("enter serial_connect"))
 
@@ -659,7 +660,24 @@
 	}
 
 	TRACE(("success serial_connect"))
-	/* XXX TODO - code to set the serial fd to the right baud/settings etc */
+
+	/* set some serial options. XXX needs attention */
+	tcgetattr(serial_fd, &options);
+
+	cfsetispeed(&options, B9600);
+	cfsetospeed(&options, B9600);
+
+	options.c_cflag &= ~CSIZE; /* Mask the character size bits */
+	options.c_cflag |= CS8;    /* Select 8 data bits */
+	options.c_cflag &= ~PARENB;
+	options.c_cflag &= ~CSTOPB;
+	options.c_cflag &= ~CSIZE;
+
+	options.c_lflag &= ~(ICANON | ECHO | ECHOE | ISIG);
+	options.c_iflag |= (INPCK | ISTRIP);
+
+	tcsetattr(serial_fd, TCSANOW, &options);
+
 
 	ses.maxfd = MAX(serial_fd, channel->writefd);
 	setnonblocking(serial_fd);