mirror of
https://github.com/wjwwood/serial.git
synced 2026-01-23 04:04:54 +08:00
Make MARK/SPACE partiy support optional
This commit is contained in:
parent
6e47bdd0ae
commit
6f464948f0
@ -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
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user