Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- int
- set_line(int speed)
- {
- struct termios tio;
- memcpy(&tio, &line_tio, sizeof(tio));
- tcgetattr(line_fd, &tio); /* Get the current attributes of the Serial port */
- cfsetispeed(&tio,B9600); /* Set Read Speed as 9600 */
- cfsetospeed(&tio,B9600); /* Set Write Speed as 9600 */
- cfmakeraw(&tio);
- //tio.c_cflag |= CREAD | CLOCAL;
- tio.c_cc[VTIME] = 0; /* Wait indefinetly */
- // tio.c_cc[VMIN] = 1;
- if (tcsetattr(line_fd, TCSAFLUSH, &tio) != 0)
- return (-1);
- sleep(1);
- tcflush(line_fd, TCIOFLUSH);
- return (0);
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement