mirror of
https://git.hardenedbsd.org/hardenedbsd/HardenedBSD.git
synced 2024-11-18 17:00:49 +01:00
92 lines
2.5 KiB
Plaintext
92 lines
2.5 KiB
Plaintext
# 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
|