tcsetattr() in termios not working correctly
basically, here is what im using to initialize a serial port to 9600 baud, and 8 N 1.
int fd;
struct termios options;
fd=open("/dev/ttyS0", O_RDWR | O_NOCTTY | O_NDELAY);
if (fd==-1)
return (-1);
fcntl(fd, F_SETFL, 0);
tcgetattr(fd,&options);
options.c_ispeed=9600;
options.c_ospeed=9600;
printf("speed = %i bps \n",(int)options.c_ispeed);
options.c_cflag |= (CLOCAL | CREAD);
options.c_lflag &= ~(ICANON | ECHO | ECHOE | ISIG);
options.c_cflag &= ~CSTOPB;
options.c_cflag |= CS8;
options.c_cc[VMIN] = 0;
options.c_cc[VTIME] =10;
tcsetattr(fd,TCSANOW,&options);
while this program runs i do a stty -F /dev/ttyS0 and here is what i get:
speed 0 baud; line = 0;
min = 0; time = 10;
ignbrk -brkint -icrnl -imaxbel
-opost -onlcr
-isig -icanon -iexten -echo -echoe -echok -echoctl -echoke
(and of course no data flow on the port)
notice the 'speed 0 baud', i know this serial port functions correctly as i've used minicom on it many times, perhaps someone can shed some light on this little dilemma for me.
thnxs
"Did you ever notice how fast Windows runs? Neither did I."