1
0
mirror of https://github.com/wjwwood/serial.git synced 2026-01-22 19:54:57 +08:00

Make MARK/SPACE partiy support optional

This commit is contained in:
David Hodo 2014-12-09 14:50:37 -06:00
parent 6e47bdd0ae
commit 6f464948f0

View File

@ -369,12 +369,17 @@ Serial::SerialImpl::reconfigurePort ()
options.c_cflag |= (PARENB); options.c_cflag |= (PARENB);
} else if (parity_ == parity_odd) { } else if (parity_ == parity_odd) {
options.c_cflag |= (PARENB | PARODD); options.c_cflag |= (PARENB | PARODD);
} else if (parity_ == parity_mark) { }
// CMSPAR is not defined on OSX. don't support mark or space parity
#ifdef CMSPAR
else if (parity_ == parity_mark) {
options.c_cflag |= (PARENB | CMSPAR | PARODD); options.c_cflag |= (PARENB | CMSPAR | PARODD);
} else if (parity_ == parity_space) { } else if (parity_ == parity_space) {
options.c_cflag |= (PARENB | CMSPAR); options.c_cflag |= (PARENB | CMSPAR);
options.c_cflag &= (tcflag_t) ~(PARODD); options.c_cflag &= (tcflag_t) ~(PARODD);
} else { }
#endif //CMSPAR
else {
throw invalid_argument ("invalid parity"); throw invalid_argument ("invalid parity");
} }
// setup flow control // setup flow control