1996-02-24 20:51:25 +01:00
|
|
|
#!/bin/sh
|
1999-08-28 01:37:10 +02:00
|
|
|
# $FreeBSD$
|
1996-02-24 20:51:25 +01:00
|
|
|
|
1996-01-31 16:03:18 +01:00
|
|
|
# Change some defaults for serial devices.
|
1994-06-04 02:44:00 +02:00
|
|
|
# Standard defaults are:
|
1995-04-09 11:54:51 +02:00
|
|
|
# dtrwait 300 drainwait 0
|
1994-06-04 02:44:00 +02:00
|
|
|
# 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.
|
1996-02-24 20:51:25 +01:00
|
|
|
|
|
|
|
ci=$1; shift # call in device identifier
|
|
|
|
co=$1; shift # call out device identifier
|
|
|
|
|
1994-06-04 02:44:00 +02:00
|
|
|
for i in $*
|
|
|
|
do
|
1999-08-25 18:01:45 +02:00
|
|
|
comcontrol /dev/tty${ci}${i} dtrwait 300 drainwait 0
|
1999-08-27 12:59:40 +02:00
|
|
|
stty < /dev/ttyi${ci}${i} -clocal crtscts hupcl 9600 reprint ^R
|
1999-08-25 18:01:45 +02:00
|
|
|
stty < /dev/ttyl${ci}${i} -clocal -crtscts -hupcl 0
|
1999-08-27 12:59:40 +02:00
|
|
|
stty < /dev/cuai${co}${i} -clocal crtscts hupcl 9600 reprint ^R
|
1999-08-25 18:01:45 +02:00
|
|
|
stty < /dev/cual${co}${i} -clocal -crtscts -hupcl 0
|
1994-06-04 02:44:00 +02:00
|
|
|
done
|
|
|
|
}
|
|
|
|
|
|
|
|
maybe() {
|
|
|
|
# Special settings.
|
1996-02-24 20:51:25 +01:00
|
|
|
|
|
|
|
ci=$1; shift
|
|
|
|
co=$1; shift
|
|
|
|
|
1994-06-04 02:44:00 +02:00
|
|
|
for i in $*
|
|
|
|
do
|
|
|
|
# Don't use ^R; it breaks bash's ^R when typed ahead.
|
1999-08-25 18:01:45 +02:00
|
|
|
stty < /dev/ttyi${ci}${i} reprint undef
|
|
|
|
stty < /dev/cuai${co}${i} reprint undef
|
1994-06-04 02:44:00 +02:00
|
|
|
# Lock clocal off on dialin device for security.
|
1999-08-25 18:01:45 +02:00
|
|
|
stty < /dev/ttyl${ci}${i} clocal
|
1994-06-04 02:44:00 +02:00
|
|
|
# Lock the speeds to use old binaries that don't support them.
|
|
|
|
# Any legal speed works to lock the initial speed.
|
1999-08-25 18:01:45 +02:00
|
|
|
stty < /dev/ttyl${ci}${i} 300
|
|
|
|
stty < /dev/cual${co}${i} 300
|
1994-06-04 02:44:00 +02:00
|
|
|
done
|
|
|
|
}
|
|
|
|
|
|
|
|
modem() {
|
|
|
|
# Modem that supports CTS and perhaps RTS handshaking.
|
1996-02-24 20:51:25 +01:00
|
|
|
|
|
|
|
ci=$1; shift
|
|
|
|
co=$1; shift
|
|
|
|
|
1994-06-04 02:44:00 +02:00
|
|
|
for i in $*
|
|
|
|
do
|
1995-04-09 11:54:51 +02:00
|
|
|
# may depend on modem
|
1999-08-25 18:01:45 +02:00
|
|
|
comcontrol /dev/tty${ci}${i} dtrwait 100 drainwait 180
|
1994-06-04 02:44:00 +02:00
|
|
|
# Lock crtscts on.
|
|
|
|
# Speed reasonable for V42bis.
|
1999-08-25 18:01:45 +02:00
|
|
|
stty < /dev/ttyi${ci}${i} crtscts 57600
|
|
|
|
stty < /dev/ttyl${ci}${i} crtscts
|
|
|
|
stty < /dev/cuai${co}${i} crtscts 57600
|
|
|
|
stty < /dev/cual${co}${i} crtscts
|
1994-06-04 02:44:00 +02:00
|
|
|
done
|
|
|
|
}
|
|
|
|
|
|
|
|
mouse() {
|
|
|
|
# Mouse on either callin or callout port.
|
1996-02-24 20:51:25 +01:00
|
|
|
|
|
|
|
ci=$1; shift
|
|
|
|
co=$1; shift
|
|
|
|
|
1994-06-04 02:44:00 +02:00
|
|
|
for i in $*
|
|
|
|
do
|
|
|
|
# Lock clocal on, hupcl off.
|
|
|
|
# Standard speed for Microsoft mouse.
|
1999-08-25 18:01:45 +02:00
|
|
|
stty < /dev/ttyi${ci}${i} clocal -hupcl 1200
|
|
|
|
stty < /dev/ttyl${ci}${i} clocal hupcl
|
|
|
|
stty < /dev/cuai${co}${i} clocal -hupcl 1200
|
|
|
|
stty < /dev/cual${co}${i} clocal hupcl
|
1994-06-04 02:44:00 +02:00
|
|
|
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.
|
1996-02-24 20:51:25 +01:00
|
|
|
|
|
|
|
ci=$1; shift
|
|
|
|
co=$1; shift
|
|
|
|
|
1999-08-25 18:01:45 +02:00
|
|
|
modem ${ci} ${co} $*
|
1994-06-04 02:44:00 +02:00
|
|
|
for i in $*
|
|
|
|
do
|
1999-08-25 18:01:45 +02:00
|
|
|
comcontrol /dev/tty${ci}${i} dtrwait 0
|
|
|
|
stty < /dev/ttyi${ci}${i} 115200
|
|
|
|
stty < /dev/cuai${co}${i} 115200
|
1994-06-04 02:44:00 +02:00
|
|
|
done
|
|
|
|
}
|
|
|
|
|
|
|
|
# Don't use anything from this file unless you have some buggy programs
|
|
|
|
# that require it.
|
1996-02-24 20:51:25 +01:00
|
|
|
|
1994-06-04 02:44:00 +02:00
|
|
|
# Edit the functions and the examples to suit your system.
|
1996-02-24 20:51:25 +01:00
|
|
|
# $1 is the call in device identifier, $2 is the call out device identifier
|
|
|
|
# and the remainder of the line lists the device numbers.
|
|
|
|
|
|
|
|
# Initialize assorted 8250-16550 (sio) ports.
|
|
|
|
# maybe d a 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 d a 2
|
|
|
|
# modem d a 1
|
|
|
|
# terminal d a 0
|
|
|
|
|
|
|
|
# Initialize all ports on a Cyclades-8yo.
|
1998-03-13 23:03:03 +01:00
|
|
|
# modem c c 00 01 02 03 04 05 06 07
|
1996-02-24 20:51:25 +01:00
|
|
|
|
|
|
|
# Initialize all ports on a Cyclades-16ye.
|
1998-03-13 23:03:03 +01:00
|
|
|
# modem c c 00 01 02 03 04 05 06 07 08 09 0a 0b 0c 0d 0e 0f
|
1996-02-24 20:51:25 +01:00
|
|
|
|
|
|
|
# Initialize all ports on a Digiboard 8.
|
1997-03-10 15:17:49 +01:00
|
|
|
# modem D D 00 01 02 03 04 05 06 07
|