Use unsigned values for termios setting

This allows the last (most significant) bit to be set without
overflow errors. The error becomes visible after adding the
CRTSCTS constant on linux/386:

   const tcCRTSCTS uint = 0x80000000
This commit is contained in:
Cristian Maglie
2016-10-20 23:55:06 +02:00
parent 7178181a28
commit 9398f35b69
6 changed files with 23 additions and 23 deletions

View File

@@ -13,7 +13,7 @@ const regexFilter = "^(cu|tty)\\..*"
// termios manipulation functions
var baudrateMap = map[int]int{
var baudrateMap = map[int]uint{
0: syscall.B9600, // Default to 9600
50: syscall.B50,
75: syscall.B75,
@@ -37,7 +37,7 @@ var baudrateMap = map[int]int{
921600: syscall.B921600,
}
var databitsMap = map[int]int{
var databitsMap = map[int]uint{
0: syscall.CS8, // Default to 8 bits
5: syscall.CS5,
6: syscall.CS6,
@@ -45,15 +45,15 @@ var databitsMap = map[int]int{
8: syscall.CS8,
}
const tcCMSPAR int = 0 // may be CMSPAR or PAREXT
const tcIUCLC int = 0
const tcCMSPAR uint = 0 // may be CMSPAR or PAREXT
const tcIUCLC uint = 0
const tcCCTS_OFLOW int = 0x00010000
const tcCRTS_IFLOW int = 0x00020000
const tcCCTS_OFLOW uint = 0x00010000
const tcCRTS_IFLOW uint = 0x00020000
const tcCRTSCTS int = tcCCTS_OFLOW
const tcCRTSCTS uint = tcCCTS_OFLOW
func termiosMask(data int) uint32 {
func termiosMask(data uint) uint32 {
return uint32(data)
}