Disable RTS/CTS handshake by default

Fix #3
This commit is contained in:
Cristian Maglie
2016-10-20 23:17:26 +02:00
parent fe0dfe76d3
commit 7178181a28
4 changed files with 15 additions and 0 deletions

View File

@@ -46,6 +46,11 @@ var databitsMap = map[int]int{
const tcCMSPAR int = 0 // may be CMSPAR or PAREXT const tcCMSPAR int = 0 // may be CMSPAR or PAREXT
const tcIUCLC int = 0 const tcIUCLC int = 0
const tcCCTS_OFLOW int = 0x00010000
const tcCRTS_IFLOW int = 0x00020000
const tcCRTSCTS int = (tcCCTS_OFLOW | tcCRTS_IFLOW)
// syscall wrappers // syscall wrappers
//sys ioctl(fd int, req uint64, data uintptr) (err error) //sys ioctl(fd int, req uint64, data uintptr) (err error)

View File

@@ -48,6 +48,11 @@ var databitsMap = map[int]int{
const tcCMSPAR int = 0 // may be CMSPAR or PAREXT const tcCMSPAR int = 0 // may be CMSPAR or PAREXT
const tcIUCLC int = 0 const tcIUCLC int = 0
const tcCCTS_OFLOW int = 0x00010000
const tcCRTS_IFLOW int = 0x00020000
const tcCRTSCTS int = tcCCTS_OFLOW
func termiosMask(data int) uint32 { func termiosMask(data int) uint32 {
return uint32(data) return uint32(data)
} }

View File

@@ -58,6 +58,8 @@ var databitsMap = map[int]int{
const tcCMSPAR int = 0 // may be CMSPAR or PAREXT const tcCMSPAR int = 0 // may be CMSPAR or PAREXT
const tcIUCLC = syscall.IUCLC const tcIUCLC = syscall.IUCLC
const tcCRTSCTS int = 0x80000000
func termiosMask(data int) uint32 { func termiosMask(data int) uint32 {
return uint32(data) return uint32(data)
} }

View File

@@ -203,6 +203,9 @@ func setRawMode(settings *syscall.Termios) {
// Set local mode // Set local mode
settings.Cflag |= termiosMask(syscall.CREAD | syscall.CLOCAL) settings.Cflag |= termiosMask(syscall.CREAD | syscall.CLOCAL)
// Explicitly disable RTS/CTS flow control
settings.Cflag &= ^termiosMask(tcCRTSCTS)
// Set raw mode // Set raw mode
settings.Lflag &= ^termiosMask(syscall.ICANON | syscall.ECHO | syscall.ECHOE | syscall.ECHOK | settings.Lflag &= ^termiosMask(syscall.ICANON | syscall.ECHO | syscall.ECHOE | syscall.ECHOK |
syscall.ECHONL | syscall.ECHOCTL | syscall.ECHOPRT | syscall.ECHOKE | syscall.ISIG | syscall.IEXTEN) syscall.ECHONL | syscall.ECHOCTL | syscall.ECHOPRT | syscall.ECHOKE | syscall.ISIG | syscall.IEXTEN)