Hi! It’s my first topic and I write cause I can’t found any answer for
my problem. I use that code
#include <termios.h>
#include <fcntl.h>
#include <unistd.h>
#include <stdlib.h>
void main()
{
struct termios termios_p;
speed_t speed;
int fd=open( “/dev/ser2”, O_RDWR ); //external rs232
in my PC
speed = B9600;
cfsetispeed( &termios_p, speed );
cfsetospeed( &termios_p, speed );
tcsetattr( fd, TCSADRAIN, &termios_p);
// read or write here
close(fd);
}
First time I use this program it works good. But next time this
program stops on open() function. If I restart system this program
run properly but also only one time. I don’t know why. What should I
change in thic code?
I work as root and the permission of /dev/ser2 is rw-rw-rw-.
thx for any answers.