Skip to content
Snippets Groups Projects
Commit 7538ce8b authored by Deucе's avatar Deucе :ok_hand_tone4:
Browse files

If CBAUD is defined, retain the CBAUD bits in c_cflags

Otherwise, zero it out.  Most termios implementations don't put the
speed in here, but this *is* where dragons be.
parent 8c68877c
No related branches found
No related tags found
No related merge requests found
Pipeline #7068 failed
...@@ -221,10 +221,15 @@ COM_HANDLE comOpen(const char* device) ...@@ -221,10 +221,15 @@ COM_HANDLE comOpen(const char* device)
| IGNPAR /* ignore (discard) parity errors */ | IGNPAR /* ignore (discard) parity errors */
); );
t.c_oflag = 0; /* No output processing */ t.c_oflag = 0; /* No output processing */
t.c_cflag &= ~(CSIZE | CSTOPB | PARENB | PARODD); #ifdef CBAUD
t.c_cflags &= CBAUD;
#else
t.c_cflags = 0;
#else
t.c_cflag |= ( t.c_cflag |= (
CS8 /* 8 bits */ CS8 /* 8 bits */
| CREAD /* enable receiver */ | CREAD /* enable receiver */
#endif
/* /*
Fun snippet from the FreeBSD manpage: Fun snippet from the FreeBSD manpage:
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment