From 933af6c242c68c4f68e820bacbe03620af519d8a Mon Sep 17 00:00:00 2001 From: David Freese Date: Thu, 18 Feb 2010 18:50:19 -0600 Subject: [PATCH] Serial bug fix Linux - added control flag to inhibit CR to NL conversion when opening the serial port for RDWR --- src/rigcontrol/serial.cxx | 21 ++++++++++++++++----- 1 file changed, 16 insertions(+), 5 deletions(-) diff --git a/src/rigcontrol/serial.cxx b/src/rigcontrol/serial.cxx index 5f0329db..dd8e93ec 100644 --- a/src/rigcontrol/serial.cxx +++ b/src/rigcontrol/serial.cxx @@ -65,25 +65,36 @@ bool Cserial::OpenPort() { tcgetattr (fd, &oldtio); newtio = oldtio; + // 8 data bits newtio.c_cflag &= ~CSIZE; - newtio.c_cflag |= CS8 | CLOCAL | CREAD; - + newtio.c_cflag |= CS8; + // enable receiver, set local mode + newtio.c_cflag |= (CLOCAL | CREAD); + // no parity newtio.c_cflag &= ~PARENB; if (stopbits == 1) - newtio.c_cflag &= ~CSTOPB; // 1 stop bit + // 1 stop bit + newtio.c_cflag &= ~CSTOPB; else - newtio.c_cflag |= CSTOPB; // 2 stop bit + // 2 stop bit + newtio.c_cflag |= CSTOPB; if (rtscts) + // h/w handshake newtio.c_cflag |= CRTSCTS; else + // no h/w handshake newtio.c_cflag &= ~CRTSCTS; + // raw input newtio.c_lflag &= ~(ICANON | ECHO | ECHOE | ISIG); + // raw output newtio.c_oflag &= ~OPOST; - + // software flow control disabled newtio.c_iflag &= ~IXON; + // do not translate CR to NL + newtio.c_iflag &= ~ICRNL; switch(baud) { case 300: