36
bzero(&newtio, sizeof(newtio)); /*
clear struct for new port settings */
/*
BAUDRATE: Set bps rate. You could also
use cfsetispeed and cfsetospeed.
CRTSCTS : output hardware flow control
(only used if the cable has
all necessary lines. See
sect. 7 of Serial-HOWTO)
CS8 : 8n1 (8bit,no parity,1
stopbit)
CLOCAL : local connection, no modem
contol
CREAD : enable receiving characters
*/
newtio.c_cflag = BAUDRATE | CRTSCTS |
CS8 | CLOCAL | CREAD;
/*
IGNPAR : ignore bytes with parity
errors
ICRNL : map CR to NL (otherwise a CR
input on the other computer
will not terminate input)
otherwise make device raw (no other
input processing)
*/
newtio.c_iflag = IGNPAR | ICRNL;
/*
Raw output.
*/
newtio.c_oflag = 0;
/*
ICANON : enable canonical input
disable all echo functionality, and
don't send signals to calling program
*/
newtio.c_lflag = ICANON;
/*
initialize all control characters
default values can be found in
/usr/include/termios.h, and are given
Komentáře k této Příručce