From 58b635792c0c20e564e7923192c07a3dee21ceda Mon Sep 17 00:00:00 2001 From: Sergey Lyubka Date: Fri, 19 Oct 2018 15:07:22 +0100 Subject: [PATCH] Enable hwfc for mac --- serial/open_darwin.go | 27 +++++++++++++++++---------- 1 file changed, 17 insertions(+), 10 deletions(-) diff --git a/serial/open_darwin.go b/serial/open_darwin.go index 70860d9..ff2537f 100644 --- a/serial/open_darwin.go +++ b/serial/open_darwin.go @@ -40,16 +40,19 @@ type tcflag_t uint64 // sys/termios.h const ( - kCS5 = 0x00000000 - kCS6 = 0x00000100 - kCS7 = 0x00000200 - kCS8 = 0x00000300 - kCLOCAL = 0x00008000 - kCREAD = 0x00000800 - kCSTOPB = 0x00000400 - kIGNPAR = 0x00000004 - kPARENB = 0x00001000 - kPARODD = 0x00002000 + kCS5 = 0x00000000 + kCS6 = 0x00000100 + kCS7 = 0x00000200 + kCS8 = 0x00000300 + kCLOCAL = 0x00008000 + kCREAD = 0x00000800 + kCSTOPB = 0x00000400 + kIGNPAR = 0x00000004 + kPARENB = 0x00001000 + kPARODD = 0x00002000 + kCCTS_OFLOW = 0x00010000 + kCRTS_IFLOW = 0x00020000 + kCRTSCTS = kCCTS_OFLOW | kCRTS_IFLOW kNCCS = 20 @@ -188,6 +191,10 @@ func convertOptions(options OpenOptions) (*termios, error) { return nil, errors.New("Invalid setting for ParityMode.") } + if options.HardwareFlowControl { + result.c_cflag |= kCRTSCTS + } + return &result, nil }