serial revision 1675
11675Sache# Change some defauls for serial devices.
21675Sache# Standard defaults are:
31675Sache#	dtrwait 300
41675Sache#	initial cflag from <sys/ttydefaults.h> = cread cs8 hupcl
51675Sache#	initial iflag, lflag and oflag all 0
61675Sache#	speed 9600
71675Sache#	special chars from <sys/ttydefaults.h>
81675Sache#	nothing locked
91675Sache# except for serial consoles the initial iflag, lflag and oflag are from
101675Sache# <sys/ttydefaults.h> and clocal is locked on.
111675Sache
121675Sachedefault() {
131675Sache	# Reset everything changed by the other functions to initial defaults.
141675Sache	for i in $*
151675Sache	do
161675Sache		comcontrol /dev/ttyd$i dtrwait 300
171675Sache		stty </dev/ttyid$i -clocal  crtscts  hupcl 9600 reprint ^R
181675Sache		stty </dev/ttyld$i -clocal -crtscts -hupcl 0
191675Sache		stty </dev/cuai0$i -clocal  crtscts  hupcl 9600 reprint ^R
201675Sache		stty </dev/cual0$i -clocal -crtscts -hupcl 0
211675Sache	done
221675Sache}
231675Sache
241675Sachemaybe() {
251675Sache	# Special settings.
261675Sache	for i in $*
271675Sache	do
281675Sache		# Don't use ^R; it breaks bash's ^R when typed ahead.
291675Sache		stty </dev/ttyid$i reprint undef
301675Sache		stty </dev/cuai0$i reprint undef
311675Sache		# Lock clocal off on dialin device for security.
321675Sache		stty </dev/ttyld$i clocal
331675Sache		# Lock the speeds to use old binaries that don't support them.
341675Sache		# Any legal speed works to lock the initial speed.
351675Sache		stty </dev/ttyld$i 300
361675Sache		stty </dev/cual0$i 300
371675Sache	done
381675Sache}
391675Sache
401675Sachemodem() {
411675Sache	# Modem that supports CTS and perhaps RTS handshaking.
421675Sache	for i in $*
431675Sache	do
441675Sache		comcontrol /dev/ttyd$i dtrwait 100	# may depend on modem
451675Sache		# Lock crtscts on.
461675Sache		# Speed reasonable for V42bis.
471675Sache		stty </dev/ttyid$i crtscts 57600
481675Sache		stty </dev/ttyld$i crtscts
491675Sache		stty </dev/cuai0$i crtscts 57600
501675Sache		stty </dev/cual0$i crtscts
511675Sache	done
521675Sache}
531675Sache
541675Sachemouse() {
551675Sache	# Mouse on either callin or callout port.
561675Sache	for i in $*
571675Sache	do
581675Sache		# Lock clocal on, hupcl off.
591675Sache		# Standard speed for Microsoft mouse.
601675Sache		stty </dev/ttyid$i clocal -hupcl 1200
611675Sache		stty </dev/ttyld$i clocal  hupcl
621675Sache		stty </dev/cuai0$i clocal -hupcl 1200
631675Sache		stty </dev/cual0$i clocal  hupcl
641675Sache	done
651675Sache}
661675Sache
671675Sacheterminal() {
681675Sache	# Terminal that supports CTS and perhaps RTS handshaking
691675Sache	# with the cable or terminal arranged so that DCD is on
701675Sache	# at least while the terminal is on.
711675Sache	# Also works for bidirectional communications to another pc
721675Sache	# provided at most one side runs getty.
731675Sache	# Same as modem() except we want a faster speed and no dtrwait.
741675Sache	modem $*
751675Sache	for i in $*
761675Sache	do
771675Sache		comcontrol /dev/ttyd$i dtrwait 0
781675Sache		stty </dev/ttyid$i 115200
791675Sache		stty </dev/cuai0$i 115200
801675Sache	done
811675Sache}
821675Sache
831675Sache# Don't use anything from this file unless you have some buggy programs
841675Sache# that require it.
851675Sache#
861675Sache# Edit the functions and the examples to suit your system.
871675Sache#
881675Sache# 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
891675Sache# mouse		    2
901675Sache# modem		  1
911675Sache# terminal	0
92