Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
Setting up /dev/uart.debug-console output for DCSD
struct termios tty;
memset (&tty, 0, sizeof tty);
if (tcgetattr (serial_fd, &tty) != 0)
return -1;
// set speed
cfsetospeed (&tty, B115200);
// set control options
tty.c_cflag &= ~CRTSCTS; // disable hardware flow control
tty.c_cflag |= CLOCAL; // local line - do not change "owner" of port
tty.c_cflag &= ~CSIZE; // clean data bits
tty.c_cflag |= CS8; // set 8 data bits
tty.c_cflag &= ~PARENB; // clean parity bit
tty.c_cflag &= ~CSTOPB; // set 1 stop bits by cleaning CSTOPB
// set output options
tty.c_oflag &= ~OPOST; // set raw output
if (tcsetattr (serial_fd, TCSANOW, &tty) != 0)
return -1;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.