Merge pull request #3401 from Cacodemon345/patch-140

unix_serial_passthrough: Define cleanups and changes
This commit is contained in:
Miran Grča
2023-06-12 16:45:23 +02:00
committed by GitHub

View File

@@ -21,7 +21,7 @@
# define _DEFAULT_SOURCE 1 # define _DEFAULT_SOURCE 1
# define _BSD_SOURCE 1 # define _BSD_SOURCE 1
#endif #endif
#ifdef __FreeBSD__ #if defined(__FreeBSD__) || defined(__OpenBSD__) || defined(__NetBSD__) || defined(__DragonFly__)
# define __BSD_VISIBLE 1 # define __BSD_VISIBLE 1
#endif #endif
#include <stdio.h> #include <stdio.h>
@@ -168,7 +168,7 @@ plat_serpt_set_params(void *p)
term_attr.c_cflag &= CSTOPB; term_attr.c_cflag &= CSTOPB;
if (dev->serial->lcr & 0x04) if (dev->serial->lcr & 0x04)
term_attr.c_cflag |= CSTOPB; term_attr.c_cflag |= CSTOPB;
#if defined(__APPLE__) || defined(__FreeBSD__) #if !defined(__linux__)
term_attr.c_cflag &= PARENB | PARODD; term_attr.c_cflag &= PARENB | PARODD;
#else #else
term_attr.c_cflag &= PARENB | PARODD | CMSPAR; term_attr.c_cflag &= PARENB | PARODD | CMSPAR;
@@ -177,7 +177,7 @@ plat_serpt_set_params(void *p)
term_attr.c_cflag |= PARENB; term_attr.c_cflag |= PARENB;
if (!(dev->serial->lcr & 0x10)) if (!(dev->serial->lcr & 0x10))
term_attr.c_cflag |= PARODD; term_attr.c_cflag |= PARODD;
#if !defined(__APPLE__) && !defined(__FreeBSD__) #if defined(__linux__)
if ((dev->serial->lcr & 0x20)) if ((dev->serial->lcr & 0x20))
term_attr.c_cflag |= CMSPAR; term_attr.c_cflag |= CMSPAR;
#endif #endif