forked from albenik/go-serial
-
Notifications
You must be signed in to change notification settings - Fork 0
/
constants_linux.go
64 lines (57 loc) · 1.35 KB
/
constants_linux.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
//
// Copyright 2014-2017 Cristian Maglie. All rights reserved.
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
//
package serial
import "golang.org/x/sys/unix"
const (
devicesBasePath = "/dev"
regexFilter = "(ttyS|ttyUSB|ttyACM|ttyAMA|rfcomm|ttyO)[0-9]{1,3}"
tcCMSPAR = unix.CMSPAR
tcIUCLC = unix.IUCLC
tcCRTSCTS uint32 = unix.CRTSCTS
ioctlTcflsh = unix.TCFLSH
)
var (
baudrateMap = map[int]uint32{
0: unix.B9600, // Default to 9600
50: unix.B50,
75: unix.B75,
110: unix.B110,
134: unix.B134,
150: unix.B150,
200: unix.B200,
300: unix.B300,
600: unix.B600,
1200: unix.B1200,
1800: unix.B1800,
2400: unix.B2400,
4800: unix.B4800,
9600: unix.B9600,
19200: unix.B19200,
38400: unix.B38400,
57600: unix.B57600,
115200: unix.B115200,
230400: unix.B230400,
460800: unix.B460800,
500000: unix.B500000,
576000: unix.B576000,
921600: unix.B921600,
1000000: unix.B1000000,
1152000: unix.B1152000,
1500000: unix.B1500000,
2000000: unix.B2000000,
2500000: unix.B2500000,
3000000: unix.B3000000,
3500000: unix.B3500000,
4000000: unix.B4000000,
}
databitsMap = map[int]uint32{
0: unix.CS8, // Default to 8 bits
5: unix.CS5,
6: unix.CS6,
7: unix.CS7,
8: unix.CS8,
}
)