I\'m trying to learn how to program the ttyS0 serial port in Linux using C. I have another machine connected to my serial port sending alternating hex values of 5f and 6f about
The following line will cause problems:
options.c_cflag &= CSTOPB;
It will reset all other bits of the c_cflag.
If you want to use 1 stop bit, then use:
options.c_cflag &= ~CSTOPB;
If you want to use 2 stop bits, then use:
options.c_cflag |= CSTOPB;
EDIT:
Also the following line cause problems:
fcntl(fd, F_SETFL, 0);
It will reset several important flags.