Removed termiosMask(..) and use the correct bitmask type

This requires a bit of copying in darwin 386/amd64 but simplifies
the overall design.
This commit is contained in:
Cristian Maglie
2016-10-22 15:39:46 +02:00
parent 50993cc77b
commit a3909960d3
6 changed files with 149 additions and 101 deletions

View File

@@ -13,7 +13,7 @@ const regexFilter = "(ttyS|ttyUSB|ttyACM|ttyAMA|rfcomm|ttyO)[0-9]{1,3}"
// termios manipulation functions
var baudrateMap = map[int]uint{
var baudrateMap = map[int]uint32{
0: syscall.B9600, // Default to 9600
50: syscall.B50,
75: syscall.B75,
@@ -47,7 +47,7 @@ var baudrateMap = map[int]uint{
4000000: syscall.B4000000,
}
var databitsMap = map[int]uint{
var databitsMap = map[int]uint32{
0: syscall.CS8, // Default to 8 bits
5: syscall.CS5,
6: syscall.CS6,
@@ -55,16 +55,10 @@ var databitsMap = map[int]uint{
8: syscall.CS8,
}
const tcCMSPAR uint = 0 // may be CMSPAR or PAREXT
const tcCMSPAR uint32 = 0 // may be CMSPAR or PAREXT
const tcIUCLC = syscall.IUCLC
const tcCRTSCTS uint = 0x80000000
func termiosMask(data uint) uint32 {
return uint32(data)
}
// syscall wrappers
const tcCRTSCTS uint32 = 0x80000000
//sys ioctl(fd int, req uint64, data uintptr) (err error)