#include <stdio.h>
#include <unistd.h>
#include <fcntl.h>
#include <termios.h>
int main(void)
{
int fd;
struct termios opts;
int ret;
char *buffer = "Hello";
fd = open("/dev/ttySAC3", O_RDWR);
if (fd < 0)
{
printf("open ttys3");
return 1;
}
printf("tty3 open ok!");
tcgetattr(fd, &opts);
opts.c_cflag |= CLOCAL;
opts.c_cflag &= ~CRTSCTS;
opts.c_cflag &= ~CSIZE;
opts.c_cflag |= CS8;
opts.c_cflag &= ~CSTOPB;
opts.c_cflag &= ~PARENB;
cfsetispeed(&opts, B115200);
cfsetospeed(&opts, B115200);
tcsetattr(fd, TCSANOW, &opts);
write(fd, buffer, 5);
close(fd);
return 0;
}
#include <unistd.h>
#include <fcntl.h>
#include <termios.h>
int main(void)
{
int fd;
struct termios opts;
int ret;
char *buffer = "Hello";
fd = open("/dev/ttySAC3", O_RDWR);
if (fd < 0)
{
printf("open ttys3");
return 1;
}
printf("tty3 open ok!");
tcgetattr(fd, &opts);
opts.c_cflag |= CLOCAL;
opts.c_cflag &= ~CRTSCTS;
opts.c_cflag &= ~CSIZE;
opts.c_cflag |= CS8;
opts.c_cflag &= ~CSTOPB;
opts.c_cflag &= ~PARENB;
cfsetispeed(&opts, B115200);
cfsetospeed(&opts, B115200);
tcsetattr(fd, TCSANOW, &opts);
write(fd, buffer, 5);
close(fd);
return 0;
}