]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/blob - etc/rc.serial
This commit was generated by cvs2svn to compensate for changes in r2345,
[FreeBSD/FreeBSD.git] / etc / rc.serial
1 # Change some defauls for serial devices.
2 # Standard defaults are:
3 #       dtrwait 300
4 #       initial cflag from <sys/ttydefaults.h> = cread cs8 hupcl
5 #       initial iflag, lflag and oflag all 0
6 #       speed 9600
7 #       special chars from <sys/ttydefaults.h>
8 #       nothing locked
9 # except for serial consoles the initial iflag, lflag and oflag are from
10 # <sys/ttydefaults.h> and clocal is locked on.
11
12 default() {
13         # Reset everything changed by the other functions to initial defaults.
14         for i in $*
15         do
16                 comcontrol /dev/ttyd$i dtrwait 300
17                 stty </dev/ttyid$i -clocal  crtscts  hupcl 9600 reprint ^R
18                 stty </dev/ttyld$i -clocal -crtscts -hupcl 0
19                 stty </dev/cuai0$i -clocal  crtscts  hupcl 9600 reprint ^R
20                 stty </dev/cual0$i -clocal -crtscts -hupcl 0
21         done
22 }
23
24 maybe() {
25         # Special settings.
26         for i in $*
27         do
28                 # Don't use ^R; it breaks bash's ^R when typed ahead.
29                 stty </dev/ttyid$i reprint undef
30                 stty </dev/cuai0$i reprint undef
31                 # Lock clocal off on dialin device for security.
32                 stty </dev/ttyld$i clocal
33                 # Lock the speeds to use old binaries that don't support them.
34                 # Any legal speed works to lock the initial speed.
35                 stty </dev/ttyld$i 300
36                 stty </dev/cual0$i 300
37         done
38 }
39
40 modem() {
41         # Modem that supports CTS and perhaps RTS handshaking.
42         for i in $*
43         do
44                 comcontrol /dev/ttyd$i dtrwait 100      # may depend on modem
45                 # Lock crtscts on.
46                 # Speed reasonable for V42bis.
47                 stty </dev/ttyid$i crtscts 57600
48                 stty </dev/ttyld$i crtscts
49                 stty </dev/cuai0$i crtscts 57600
50                 stty </dev/cual0$i crtscts
51         done
52 }
53
54 mouse() {
55         # Mouse on either callin or callout port.
56         for i in $*
57         do
58                 # Lock clocal on, hupcl off.
59                 # Standard speed for Microsoft mouse.
60                 stty </dev/ttyid$i clocal -hupcl 1200
61                 stty </dev/ttyld$i clocal  hupcl
62                 stty </dev/cuai0$i clocal -hupcl 1200
63                 stty </dev/cual0$i clocal  hupcl
64         done
65 }
66
67 terminal() {
68         # Terminal that supports CTS and perhaps RTS handshaking
69         # with the cable or terminal arranged so that DCD is on
70         # at least while the terminal is on.
71         # Also works for bidirectional communications to another pc
72         # provided at most one side runs getty.
73         # Same as modem() except we want a faster speed and no dtrwait.
74         modem $*
75         for i in $*
76         do
77                 comcontrol /dev/ttyd$i dtrwait 0
78                 stty </dev/ttyid$i 115200
79                 stty </dev/cuai0$i 115200
80         done
81 }
82
83 # Don't use anything from this file unless you have some buggy programs
84 # that require it.
85 #
86 # Edit the functions and the examples to suit your system.
87 #
88 # maybe         0 1 2 3 4 5 6 7 8 9 a b c d e f g h i j k l m n o p q r s t u v
89 # mouse             2
90 # modem           1
91 # terminal      0