Skip to content

Commit

Permalink
serial_posix: fix even parity
Browse files Browse the repository at this point in the history
Previously, when even parity was requested, PARODD was erroneously retained, and thus could actually result in odd parity being set (retained from what was set by tcgetattr)
  • Loading branch information
akavel authored May 9, 2017
1 parent 37be519 commit d85ea55
Showing 1 changed file with 1 addition and 0 deletions.
1 change: 1 addition & 0 deletions serial_posix.go
Original file line number Diff line number Diff line change
Expand Up @@ -113,6 +113,7 @@ func openPort(name string, baud int, databits byte, parity Parity, stopbits Stop
st.c_cflag |= C.PARODD
case ParityEven:
st.c_cflag |= C.PARENB
st.c_cflag &= ^C.tcflag_t(C.PARODD)
default:
return nil, ErrBadParity
}
Expand Down

0 comments on commit d85ea55

Please sign in to comment.