Now rc.serial used for initial setup of serial lines

This commit is contained in:
ache 1994-06-04 00:44:00 +00:00
parent 7a9508d2f0
commit 6557b616d1
3 changed files with 189 additions and 1 deletions

8
etc/rc
View File

@ -1,5 +1,5 @@
#!/bin/sh
# $Id: rc,v 1.23 1994/05/23 11:22:10 ache Exp $
# $Id: rc,v 1.24 1994/06/01 17:04:01 paul Exp $
# From: @(#)rc 5.27 (Berkeley) 6/5/91
# System startup script run by init on autoboot
@ -69,6 +69,12 @@ rm -f /fastboot # XXX (root now writeable)
# the machine runs UTC CMOS clock). See adjkerntz(8) for details.
adjkerntz -i
# configure serial devices
if [ -f /etc/rc.serial ]
then
sh /etc/rc.serial
fi
# set hostname, turn on network
echo 'starting network'
. /etc/netstart

91
etc/rc.d/serial Normal file
View File

@ -0,0 +1,91 @@
# Change some defauls for serial devices.
# Standard defaults are:
# dtrwait 300
# 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
stty </dev/ttyid$i -clocal crtscts hupcl 9600 reprint ^R
stty </dev/ttyld$i -clocal -crtscts -hupcl 0
stty </dev/cuai0$i -clocal crtscts hupcl 9600 reprint ^R
stty </dev/cual0$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/cuai0$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/cual0$i 300
done
}
modem() {
# Modem that supports CTS and perhaps RTS handshaking.
for i in $*
do
comcontrol /dev/ttyd$i dtrwait 100 # may depend on modem
# Lock crtscts on.
# Speed reasonable for V42bis.
stty </dev/ttyid$i crtscts 57600
stty </dev/ttyld$i crtscts
stty </dev/cuai0$i crtscts 57600
stty </dev/cual0$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/cuai0$i clocal -hupcl 1200
stty </dev/cual0$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/cuai0$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

91
etc/rc.serial Normal file
View File

@ -0,0 +1,91 @@
# Change some defauls for serial devices.
# Standard defaults are:
# dtrwait 300
# 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
stty </dev/ttyid$i -clocal crtscts hupcl 9600 reprint ^R
stty </dev/ttyld$i -clocal -crtscts -hupcl 0
stty </dev/cuai0$i -clocal crtscts hupcl 9600 reprint ^R
stty </dev/cual0$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/cuai0$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/cual0$i 300
done
}
modem() {
# Modem that supports CTS and perhaps RTS handshaking.
for i in $*
do
comcontrol /dev/ttyd$i dtrwait 100 # may depend on modem
# Lock crtscts on.
# Speed reasonable for V42bis.
stty </dev/ttyid$i crtscts 57600
stty </dev/ttyld$i crtscts
stty </dev/cuai0$i crtscts 57600
stty </dev/cual0$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/cuai0$i clocal -hupcl 1200
stty </dev/cual0$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/cuai0$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