Hi, I wrote a program which have to change proprieties for the serial port via the termios commands, but it not saved. When I ran the program it gave the old values then after changes gave the new, that seems correct, but when i ran again i got same value, Normally I had to get the last value, i.e : the new value of the previous running ???? here is the program and the 2 execution
#include <stdio.h> #include <unistd.h> #include <fcntl.h> #include <stdlib.h> #include <sys/io.h> #include <termios.h> int main(){ int fd=0; fd = open("/dev/ttyS0", O_RDWR | O_NOCTTY | O_NDELAY); if (fd < 0) { printf("open error "); exit(-1); } struct termios my_termios; tcgetattr(fd, &my_termios); printf("old cflag=%08x\n", my_termios.c_cflag); cfsetospeed(&my_termios, B9600); printf("old cflag=%08x\n", my_termios.c_cflag); exit(0); } Compteur# ./oo Old cflag=00001cb2 New cflag=00000cbd Compteur# Compteur# ./oo Old cflag=00001cb2 // value here should be 00000cbd New cflag=00000cbd thanks for help regards