• Home
  • History
  • Annotate
Name Date Size #Lines LOC

..03-May-2022-

termios/H15-Oct-2019-

.travis.ymlH A D15-Oct-2019113

LICENSEH A D15-Oct-20191.3 KiB

README.mdH A D15-Oct-20193.2 KiB

example_test.goH A D15-Oct-2019683

go.modH A D15-Oct-2019159

go.sumH A D15-Oct-2019420

term.goH A D15-Oct-20191.8 KiB

term_bsdi.goH A D15-Oct-2019998

term_bsdu.goH A D15-Oct-2019994

term_darwin.goH A D15-Oct-2019965

term_linux.goH A D15-Oct-20191.4 KiB

term_open_posix.goH A D15-Oct-2019845

term_posix.goH A D15-Oct-20195 KiB

term_solaris.goH A D15-Oct-20192.1 KiB

term_test.goH A D15-Oct-20191.7 KiB

term_windows.goH A D15-Oct-20194.2 KiB

README.md

1
2# term
3    import "github.com/pkg/term"
4
5Package term manages POSIX terminals. As POSIX terminals are connected to,
6or emulate, a UART, this package also provides control over the various
7UART and serial line parameters.
8
9
10
11
12
13
14## func CBreakMode
15``` go
16func CBreakMode(t *Term) error
17```
18CBreakMode places the terminal into cbreak mode.
19
20
21## func RawMode
22``` go
23func RawMode(t *Term) error
24```
25RawMode places the terminal into raw mode.
26
27
28## func Speed
29``` go
30func Speed(baud int) func(*Term) error
31```
32Speed sets the baud rate option for the terminal.
33
34
35
36## type Term
37``` go
38type Term struct {
39    // contains filtered or unexported fields
40}
41```
42Term represents an asynchronous communications port.
43
44
45
46
47
48
49
50
51
52### func Open
53``` go
54func Open(name string, options ...func(*Term) error) (*Term, error)
55```
56Open opens an asynchronous communications port.
57
58
59
60
61### func (\*Term) Available
62``` go
63func (t *Term) Available() (int, error)
64```
65Available returns how many bytes are unused in the buffer.
66
67
68
69### func (\*Term) Buffered
70``` go
71func (t *Term) Buffered() (int, error)
72```
73Buffered returns the number of bytes that have been written into the current buffer.
74
75
76
77### func (\*Term) Close
78``` go
79func (t *Term) Close() error
80```
81Close closes the device and releases any associated resources.
82
83
84
85### func (\*Term) DTR
86``` go
87func (t *Term) DTR() (bool, error)
88```
89DTR returns the state of the DTR (data terminal ready) signal.
90
91
92
93### func (\*Term) Flush
94``` go
95func (t *Term) Flush() error
96```
97Flush flushes both data received but not read, and data written but not transmitted.
98
99
100
101### func (\*Term) RTS
102``` go
103func (t *Term) RTS() (bool, error)
104```
105RTS returns the state of the RTS (data terminal ready) signal.
106
107
108
109### func (\*Term) Read
110``` go
111func (t *Term) Read(b []byte) (int, error)
112```
113Read reads up to len(b) bytes from the terminal. It returns the number of
114bytes read and an error, if any. EOF is signaled by a zero count with
115err set to io.EOF.
116
117
118
119### func (\*Term) Restore
120``` go
121func (t *Term) Restore() error
122```
123Restore restores the state of the terminal captured at the point that
124the terminal was originally opened.
125
126
127
128### func (\*Term) SendBreak
129``` go
130func (t *Term) SendBreak() error
131```
132SendBreak sends a break signal.
133
134
135
136### func (\*Term) SetCbreak
137``` go
138func (t *Term) SetCbreak() error
139```
140SetCbreak sets cbreak mode.
141
142
143
144### func (\*Term) SetDTR
145``` go
146func (t *Term) SetDTR(v bool) error
147```
148SetDTR sets the DTR (data terminal ready) signal.
149
150
151
152### func (\*Term) SetOption
153``` go
154func (t *Term) SetOption(options ...func(*Term) error) error
155```
156SetOption takes one or more option function and applies them in order to Term.
157
158
159
160### func (\*Term) SetRTS
161``` go
162func (t *Term) SetRTS(v bool) error
163```
164SetRTS sets the RTS (data terminal ready) signal.
165
166
167
168### func (\*Term) SetRaw
169``` go
170func (t *Term) SetRaw() error
171```
172SetRaw sets raw mode.
173
174
175
176### func (\*Term) SetSpeed
177``` go
178func (t *Term) SetSpeed(baud int) error
179```
180SetSpeed sets the receive and transmit baud rates.
181
182
183
184### func (\*Term) Write
185``` go
186func (t *Term) Write(b []byte) (int, error)
187```
188Write writes len(b) bytes to the terminal. It returns the number of bytes
189written and an error, if any. Write returns a non-nil error when n !=
190len(b).
191
192
193
194
195
196
197
198
199
200- - -
201Generated by [godoc2md](http://godoc.org/github.com/davecheney/godoc2md)