serial revision 13798
113798Smpp# Change some defaults for serial devices. 21675Sache# Standard defaults are: 37708Srgrimes# dtrwait 300 drainwait 0 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 165398Sache comcontrol /dev/ttyd$i dtrwait 300 drainwait 0 171675Sache stty </dev/ttyid$i -clocal crtscts hupcl 9600 reprint ^R 181675Sache stty </dev/ttyld$i -clocal -crtscts -hupcl 0 194982Sache stty </dev/cuaia$i -clocal crtscts hupcl 9600 reprint ^R 204982Sache stty </dev/cuala$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 304982Sache stty </dev/cuaia$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 364982Sache stty </dev/cuala$i 300 371675Sache done 381675Sache} 391675Sache 401675Sachemodem() { 411675Sache # Modem that supports CTS and perhaps RTS handshaking. 421675Sache for i in $* 431675Sache do 447708Srgrimes # may depend on modem 457708Srgrimes comcontrol /dev/ttyd$i dtrwait 100 drainwait 180 461675Sache # Lock crtscts on. 471675Sache # Speed reasonable for V42bis. 481675Sache stty </dev/ttyid$i crtscts 57600 491675Sache stty </dev/ttyld$i crtscts 504982Sache stty </dev/cuaia$i crtscts 57600 514982Sache stty </dev/cuala$i crtscts 521675Sache done 531675Sache} 541675Sache 551675Sachemouse() { 561675Sache # Mouse on either callin or callout port. 571675Sache for i in $* 581675Sache do 591675Sache # Lock clocal on, hupcl off. 601675Sache # Standard speed for Microsoft mouse. 611675Sache stty </dev/ttyid$i clocal -hupcl 1200 621675Sache stty </dev/ttyld$i clocal hupcl 634982Sache stty </dev/cuaia$i clocal -hupcl 1200 644982Sache stty </dev/cuala$i clocal hupcl 651675Sache done 661675Sache} 671675Sache 681675Sacheterminal() { 691675Sache # Terminal that supports CTS and perhaps RTS handshaking 701675Sache # with the cable or terminal arranged so that DCD is on 711675Sache # at least while the terminal is on. 721675Sache # Also works for bidirectional communications to another pc 731675Sache # provided at most one side runs getty. 741675Sache # Same as modem() except we want a faster speed and no dtrwait. 751675Sache modem $* 761675Sache for i in $* 771675Sache do 781675Sache comcontrol /dev/ttyd$i dtrwait 0 791675Sache stty </dev/ttyid$i 115200 804982Sache stty </dev/cuaia$i 115200 811675Sache done 821675Sache} 831675Sache 841675Sache# Don't use anything from this file unless you have some buggy programs 851675Sache# that require it. 861675Sache# 871675Sache# Edit the functions and the examples to suit your system. 881675Sache# 891675Sache# 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 901675Sache# mouse 2 911675Sache# modem 1 921675Sache# terminal 0 93