From d2aceead8980bfe30adb21aa15d362dbd6df2c11 Mon Sep 17 00:00:00 2001 From: WhiteCat Date: Thu, 28 Nov 2019 18:24:48 +0800 Subject: [PATCH] add the ParityMark support for linux --- serial_linux.go | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/serial_linux.go b/serial_linux.go index 65420f3..ba0e802 100644 --- a/serial_linux.go +++ b/serial_linux.go @@ -5,6 +5,7 @@ package serial import ( "fmt" "os" + "syscall" "time" "unsafe" @@ -95,6 +96,10 @@ func openPort(name string, baud int, databits byte, parity Parity, stopbits Stop cflagToUse |= unix.PARODD case ParityEven: cflagToUse |= unix.PARENB + case ParityMark: + cflagToUse |= syscall.PARENB + cflagToUse |= unix.CMSPAR + cflagToUse |= syscall.PARODD default: return nil, ErrBadParity }