Linux - added control flag to inhibit CR to NL conversion
    when opening the serial port for RDWR
pull/2/head
David Freese 2010-02-18 18:50:19 -06:00
rodzic ccaaa1eb03
commit 933af6c242
1 zmienionych plików z 16 dodań i 5 usunięć

Wyświetl plik

@ -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: