File: setserial.8.in

package info (click to toggle)
setserial 2.17-45.3
  • links: PTS
  • area: main
  • in suites: squeeze
  • size: 600 kB
  • ctags: 166
  • sloc: sh: 3,196; ansic: 815; makefile: 130
file content (520 lines) | stat: -rw-r--r-- 17,637 bytes parent folder | download | duplicates (7)
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
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
.\" Copyright 1992, 1993 Rickard E. Faith (faith@cs.unc.edu)
.\" May be distributed under the GNU General Public License
.\" Portions of this text are from the README in setserial-2.01.tar.z,
.\" but I can't figure out who wrote that document.  If anyone knows,
.\" please tell me
.\"
.\" [tytso:19940519.2239EDT]  I did... - Ted Ts'o (tytso@mit.edu)
.\"
.TH SETSERIAL 8 "@RELEASE_MONTH@ @RELEASE_YEAR@" "Setserial @RELEASE_VERSION@
.SH NAME
setserial \- get/set Linux serial port information
.SH SYNOPSIS
.B setserial
.B "[ \-abqvVWz ]"
device
.BR "[ " parameter1 " [ " arg " ] ] ..."

.B "setserial -g"
.B "[ \-abGv ]"
device1 ...
.SH DESCRIPTION
.B setserial
is a program designed to set and/or report the configuration information
associated with a serial port.  This information includes what I/O
port and IRQ a particular serial port is using, and whether or not the
break key should be interpreted as the Secure Attention Key, and so
on.

During the normal bootup process, only COM ports 1-4 are initialized,
using the default I/O ports and IRQ values, as listed below.  In order
to initialize any additional serial ports, or to change the COM 1-4
ports to a nonstadard configuration, the
.B setserial 
program should be used.  Typically it is called from an
.I rc.serial
script, which is usually run out of 
.IR /etc/rc.local .

The
.I device
argument or arguments specifies the serial device which should be configured or
interrogated.  It will usually have the following form:
.BR /dev/cua[0-3] .

If no parameters are specified,
.B setserial
will print out the port type (i.e., 8250, 16450, 16550, 16550A, etc.), the
hardware I/O port, the hardware IRQ line, its "baud base," and some of
its operational flags.

If the
.B \-g
option is given, the arguments to setserial are interpreted as a list
of devices for which the characteristics of those devices should be
printed.  

Without the 
.B \-g
option, the first argument to setserial is interpreted as the device
to be modified or characteristics to be printed, and any additional
arguments are interpreted as parameters which should be assigned
to that serial device.

For the most part, superuser privilege is required to set the
configuration parameters of a serial port.  A few serial port parameters
can be set by normal users, however, and these will be noted as
exceptions in this manual page.

.SH OPTIONS
.B Setserial
accepts the following options:

.TP
.B \-a
When reporting the configuration of a serial device, print all
available information.
.TP
.B \-b
When reporting the configuration of a serial device, print a summary
of the device's configuration, which might be suitable for printing
during the bootup process, during the /etc/rc script.
.TP
.B \-G
Print out the configuration information of the serial port in a form which
can be fed back to setserial as command-line arguments.
.TP
.B \-q
Be quiet.  
.B Setserial
will print fewer lines of output.
.TP
.B \-v
Be verbose.
.B Setserial
will print additional status output.
.TP
.B \-V
Display version and exit.
.TP
.B \-W
Do wild interrupt initialization and exit.  This option is no longer 
relevant in Linux kernels after version 2.1.
.TP
.B \-z
Zero out the serial flags before starting to set flags.  This is related
to the automatic saving of serial flags using the \-G flag.

.SH PARAMETERS
The following parameters can be assigned to a serial port.

All argument values are assumed to be in decimal unless preceeded by "0x".

.TP
.BR port " port_number"
The
.B port
option sets the I/O port, as described above.
.TP
.BR irq " irq_number"
The
.B irq
option sets the hardware IRQ, as described above.
.TP
.BR uart " uart_type"
This option is used to set the UART type.  The permitted types are
.BR none ,
8250, 16450, 16550, 16550A, 16650, 16650V2, 16654, 16750, 16850, 16950, and
16954.
Using UART type
.B none
will disable the port.

Some internal modems are billed as having a "16550A UART with a 1k
buffer".  This is a lie.  They do not have really have a 16550A
compatible UART; instead what they have is a 16450 compatible UART
with a 1k receive buffer to prevent receiver overruns.  This is
important, because they do not have a transmit FIFO.  Hence, they are
not compatible with a 16550A UART, and the autoconfiguration process
will correctly identify them as 16450's.  If you attempt to override
this using the 
.B uart
parameter, you will see dropped characters during file transmissions.
These UART's usually have other problems: the
.B skip_test
parameter also often must be specified.
.TP
.B autoconfig
When this parameter is given, 
.B setserial
will ask the kernel to attempt to automatically configure the serial
port.  The I/O port must be correctly set; the kernel will attempt to
determine the UART type, and if the
.B auto_irq 
parameter is set, Linux will attempt to automatically determine the
IRQ.  The
.B autoconfig
parameter should be given after the
.BR port , auto_irq ", and " skip_test
parameters have been specified.
.TP
.B auto_irq
During autoconfiguration, try to determine the IRQ.  This feature is
not guaranteed to always produce the correct result; some hardware
configurations will fool the Linux kernel.  It is generally safer not
to use the 
.B auto_irq
feature, but rather to specify the IRQ to be used explicitly, using
the
.B irq 
parameter.
.TP
.B ^auto_irq
During autoconfiguration, do
.I not
try to determine the IRQ.
.TP
.B skip_test
During autoconfiguration, skip the UART test.  Some internal modems do
not have National Semiconductor compatible UART's, but have cheap
imitations instead.  Some of these cheasy imitations UART's do not
fully support the loopback detection mode, which is used by the kernel
to make sure there really is a UART at a particular address before
attempting to configure it.  So for certain internal modems you will
need to specify this parameter so Linux can initialize the UART
correctly.
.TP
.B ^skip_test
During autoconfiguration, do
.I not
skip the UART test.
.TP
.BR baud_base " baud_base"
This option sets the base baud rate, which is the clock frequency divided
by 16.  Normally this value is 115200, which is also the fastest baud
rate which the UART can support. 
.TP
.B
spd_hi
Use 57.6kb when the application requests 38.4kb.  
This parameter may be specified by a non-privileged user.
.TP
.B spd_vhi
Use 115kb when the application requests 38.4kb.
This parameter may be specified by a non-privileged user.
.TP
.B spd_shi
Use 230kb when the application requests 38.4kb.
This parameter may be specified by a non-privileged user.
.TP
.B spd_warp
Use 460kb when the application requests 38.4kb.
This parameter may be specified by a non-privileged user.
.TP
.B spd_cust
Use the custom divisor to set the speed when the application requests
38.4kb.  In this case, the baud rate is the
.B baud_base
divided by the
.BR divisor .
This parameter may be specified by a non-privileged user.
.TP
.B spd_normal
Use 38.4kb when the application requests 38.4kb.
This parameter may be specified by a non-privileged user.
.TP
.BR divisor " divisor"
This option sets the custom divison.  This divisor will be used then the
.B spd_cust
option is selected and the serial port is set to 38.4kb by the
application.
This parameter may be specified by a non-privileged user.
.TP
.B sak
Set the break key at the Secure Attention Key.
.TP
.B ^sak
disable the Secure Attention Key.
.TP
.B fourport
Configure the port as an AST Fourport card.
.TP
.B ^fourport
Disable AST Fourport configuration.
.TP
.BR close_delay " delay"
Specify the amount of time, in hundredths of a second, that DTR should
remain low on a serial line after the callout device is closed, before
the blocked dialin device raises DTR again.  The default value of this
option is 50, or a half-second delay.
.TP
.BR closing_wait " delay"
Specify the amount of time, in hundredths of a second, that the kernel
should wait for data to be transmitted from the serial port while
closing the port.  If "none" is
specified, no delay will occur. If "infinite" is specified the kernel 
will wait indefinitely  for the buffered data to be transmitted.  
The default setting is 3000 or 30 seconds of delay.  
This default is generally appropriate for most devices.  If too long 
a delay is selected, then
the serial port may hang for a long time if when a serial port which
is not connected, and has data pending, is closed.  If too short a
delay is selected, then there is a risk that some of the transmitted
data is output at all.  If the device is extremely slow, like a plotter, 
the closing_wait may need to be larger.  
.TP
.B session_lockout
Lock out callout port (/dev/cuaXX) accesses across different sessions.
That is, once a process has opened a port, do not allow a process with
a different session ID to open that port until the first process has
closed it.
.TP
.B ^session_lockout
Do not lock out callout port accesses across different sessions.
.TP
.B pgrp_lockout
Lock out callout port (/dev/cuaXX) accesses across different process groups.
That is, once a process has opened a port, do not allow a process in a
different process group to open that port until the first process has
closed it.
.TP
.B ^pgrp_lockout
Do not lock out callout port accesses across different process groups.
.TP
.B hup_notify
Notify a process blocked on opening a dial in line when a process has
finished using a callout line (either by closing it or by the serial
line being hung up) by returning EAGAIN to the open.  

The application of this parameter is for getty's which are blocked on
a serial port's dial in line.  This allows the getty to reset the
modem (which may have had its configuration modified by the
application using the callout device) before blocking on the open again.
.TP
.B ^hup_notify
Do not notify a process blocked on opening a dial in line when the
callout device is hung up.
.TP
.B split_termios
Treat the termios settings used by the callout device and the termios
settings used by the dialin devices as separate.  
.TP
.B ^split_termios
Use the same termios structure to store both the dialin and callout
ports.  This is the default option.
.TP
.B callout_nohup
If this particular serial port is opened as a callout device, do not
hangup the tty when carrier detect is dropped.
.TP
.B ^callout_nohup
Do not skip hanging up the tty when a serial port is opened as a
callout device.  Of course, the HUPCL termios flag must be enabled if
the hangup is to occur.
.TP
.B low_latency
Minimize the receive latency of the serial device at the cost of
greater CPU utilization.  (Normally there is an average of 5-10ms
latency before characters are handed off to the line discpline to
minimize overhead.)  This is off by default, but certain real-time
applications may find this useful.
.TP
.B ^low_latency
Optimize for efficient CPU processing of serial characters at the cost of 
paying an average of 5-10ms of latency before the characters are processed.
This is the default.
.SH CONSIDERATIONS OF CONFIGURING SERIAL PORTS
It is important to note that setserial merely tells the Linux kernel
where it should expect to find the I/O port and IRQ lines of a
particular serial port.  It does *not* configure the hardware, the
actual serial board, to use a particular I/O port.  In order to do
that, you will need to physically program the serial board, usually by
setting some jumpers or by switching some DIP switches.

This section will provide some pointers in helping you decide how you
would like to configure your serial ports.

The "standard MS-DOS" port associations are given below:

.nf
.RS
/dev/ttys0 (COM1), port 0x3f8, irq 4
/dev/ttys1 (COM2), port 0x2f8, irq 3
/dev/ttys2 (COM3), port 0x3e8, irq 4
/dev/ttys3 (COM4), port 0x2e8, irq 3
.RE
.fi

Due to the limitations in the design of the AT/ISA bus architecture,
normally an IRQ line may not be shared between two or more serial
ports.  If you attempt to do this, one or both serial ports will
become unreliable if you try to use both simultaneously.  This
limitation can be overcome by special multi-port serial port boards,
which are designed to share multiple serial ports over a single IRQ
line.  Multi-port serial cards supported by Linux include the AST
FourPort, the Accent Async board, the Usenet Serial II board, the
Bocaboard BB-1004, BB-1008, and BB-2016 boards, and the HUB-6 serial
board.

The selection of an alternative IRQ line
is difficult, since most of them are already used.  The following table
lists the "standard MS-DOS" assignments of available IRQ lines:

.nf
.RS
IRQ 3: COM2
IRQ 4: COM1
IRQ 5: LPT2
IRQ 7: LPT1
.RE
.fi

Most people find that IRQ 5 is a good choice, assuming that there is
only one parallel port active in the computer.  Another good choice is
IRQ 2 (aka IRQ 9); although this IRQ is sometimes used by network
cards, and very rarely VGA cards will be configured to use IRQ 2 as a
vertical retrace interrupt.  If your VGA card is configured this way;
try to disable it so you can reclaim that IRQ line for some other
card.  It's not necessary for Linux and most other Operating systems.

The only other available IRQ lines are 3, 4, and 7, and these are
probably used by the other serial and parallel ports.  (If your serial
card has a 16bit card edge connector, and supports higher interrupt
numbers, then IRQ 10, 11, 12, and 15 are also available.)

On AT class machines, IRQ 2 is seen as IRQ 9, and Linux will interpret it
in this manner.

IRQ's other than 2 (9), 3, 4, 5, 7, 10, 11, 12, and 15, should
.I not
be used, since they are assigned to other hardware and cannot, in general,
be changed.  Here are the "standard" assignments:

.nf
.RS
IRQ  0      Timer channel 0
IRQ  1      Keyboard
IRQ  2      Cascade for controller 2
IRQ  3      Serial port 2
IRQ  4      Serial port 1
IRQ  5      Parallel port 2 (Reserved in PS/2)
IRQ  6      Floppy diskette
IRQ  7      Parallel port 1
IRQ  8      Real-time clock
IRQ  9      Redirected to IRQ2
IRQ 10      Reserved
IRQ 11      Reserved
IRQ 12      Reserved (Auxillary device in PS/2)
IRQ 13      Math coprocessor
IRQ 14      Hard disk controller
IRQ 15      Reserved
.RE
.fi

.SH MULTIPORT CONFIGURATION

Certain multiport serial boards which share multiple ports on a single
IRQ use one or more ports to indicate whether or not there are any
pending ports which need to be serviced.  If your multiport board
supports these ports, you should make use of them to avoid potential
lockups if the interrupt gets lost.

In order to set these ports specify
.B set_multiport
as a parameter, and follow it with the multiport parameters.  The
multiport parameters take the form of specifying the 
.I port
that should be checked, a 
.I mask
which indicate which bits in the register are significant, and finally, a
.I match
parameter which specifies what the significant bits in that register must 
match when there is no more pending work to be done.

Up to four such port/mask/match combinations may be specified.  The
first such combinations should be specified by setting the parameters
.BR port1 ,
.BR mask1 ,
and
.BR match1 .
The second such combination should be specified with
.BR port2 ,
.BR mask2 ,
and
.BR match2 ,
and so on.  In order to disable this multiport checking, set 
.B port1
to be zero.

In order to view the current multiport settings, specify the parameter
.B get_multiport
on the command line.

Here are some multiport settings for some common serial boards:

.nf
.RS
AST FourPort    port1 0x1BF mask1 0xf match1 0xf

Boca BB-1004/8  port1 0x107 mask1 0xff match1 0

Boca BB-2016    port1 0x107 mask1 0xff match1 0 
                port2 0x147 mask2 0xff match2 0
.RE
.fi

.SH Hayes ESP Configuration
.B Setserial
may also be used to configure ports on a Hayes ESP serial board.
.PP
The following parameters when configuring ESP ports:
.TP
.B rx_trigger
This is the trigger level (in bytes) of the receive FIFO. Larger
values may result in fewer interrupts and hence better performance;
however, a value too high could result in data loss. Valid values
are 1 through 1023.
.TP
.B tx_trigger
This is the trigger level (in bytes) of the transmit FIFO. Larger
values may result in fewer interrupts and hence better performance;
however, a value too high could result in degraded transmit
performance. Valid values are 1 through 1023.
.TP
.B flow_off
This is the level (in bytes) at which the ESP port will "flow off"
the remote transmitter (i.e. tell him to stop stop sending more
bytes).  Valid values are 1 through 1023.  This value should be
greater than the receive trigger level and the flow on level.
.TP
.B flow_on
This is the level (in bytes) at which the ESP port will "flow on"
the remote transmitter (i.e. tell him to resume sending bytes) after
having flowed it off.  Valid values are 1 through 1023.  This value
should be less than the flow off level, but greater than the receive
trigger level.
.TP 
.B rx_timeout
This is the amount of time that the ESP port will wait after
receiving the final character before signaling an interrupt.  Valid
values are 0 through 255.  A value too high will increase latency,
and a value too low will cause unnecessary interrupts.

.SH CAUTION
CAUTION: Configuring a serial port to use an incorrect I/O port 
can lock up your machine.
.SH FILES
.BR /etc/rc.local
.BR /etc/rc.serial
.SH "SEE ALSO"
.BR tty (4),
.BR ttys (4),
kernel/chr_drv/serial.c
.SH AUTHOR
The original version of setserial was written by Rick Sladkey
(jrs@world.std.com), and was modified by Michael K. Johnson
(johnsonm@stolaf.edu).

This version has since been rewritten from scratch by Theodore Ts'o
(tytso@mit.edu) on 1/1/93.  Any bugs or problems are solely his
responsibility.