freebsd-dev/etc/rc.serial
1995-04-09 09:54:51 +00:00

93 lines
2.5 KiB
Plaintext

# Change some defauls for serial devices.
# Standard defaults are:
# dtrwait 300 drainwait 0
# initial cflag from <sys/ttydefaults.h> = cread cs8 hupcl
# initial iflag, lflag and oflag all 0
# speed 9600
# special chars from <sys/ttydefaults.h>
# nothing locked
# except for serial consoles the initial iflag, lflag and oflag are from
# <sys/ttydefaults.h> and clocal is locked on.
default() {
# Reset everything changed by the other functions to initial defaults.
for i in $*
do
comcontrol /dev/ttyd$i dtrwait 300 drainwait 0
stty </dev/ttyid$i -clocal crtscts hupcl 9600 reprint ^R
stty </dev/ttyld$i -clocal -crtscts -hupcl 0
stty </dev/cuaia$i -clocal crtscts hupcl 9600 reprint ^R
stty </dev/cuala$i -clocal -crtscts -hupcl 0
done
}
maybe() {
# Special settings.
for i in $*
do
# Don't use ^R; it breaks bash's ^R when typed ahead.
stty </dev/ttyid$i reprint undef
stty </dev/cuaia$i reprint undef
# Lock clocal off on dialin device for security.
stty </dev/ttyld$i clocal
# Lock the speeds to use old binaries that don't support them.
# Any legal speed works to lock the initial speed.
stty </dev/ttyld$i 300
stty </dev/cuala$i 300
done
}
modem() {
# Modem that supports CTS and perhaps RTS handshaking.
for i in $*
do
# may depend on modem
comcontrol /dev/ttyd$i dtrwait 100 drainwait 180
# Lock crtscts on.
# Speed reasonable for V42bis.
stty </dev/ttyid$i crtscts 57600
stty </dev/ttyld$i crtscts
stty </dev/cuaia$i crtscts 57600
stty </dev/cuala$i crtscts
done
}
mouse() {
# Mouse on either callin or callout port.
for i in $*
do
# Lock clocal on, hupcl off.
# Standard speed for Microsoft mouse.
stty </dev/ttyid$i clocal -hupcl 1200
stty </dev/ttyld$i clocal hupcl
stty </dev/cuaia$i clocal -hupcl 1200
stty </dev/cuala$i clocal hupcl
done
}
terminal() {
# Terminal that supports CTS and perhaps RTS handshaking
# with the cable or terminal arranged so that DCD is on
# at least while the terminal is on.
# Also works for bidirectional communications to another pc
# provided at most one side runs getty.
# Same as modem() except we want a faster speed and no dtrwait.
modem $*
for i in $*
do
comcontrol /dev/ttyd$i dtrwait 0
stty </dev/ttyid$i 115200
stty </dev/cuaia$i 115200
done
}
# Don't use anything from this file unless you have some buggy programs
# that require it.
#
# Edit the functions and the examples to suit your system.
#
# 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
# mouse 2
# modem 1
# terminal 0