serial revision 50357
1#!/bin/sh 2# $Id: rc.serial,v 1.11 1998/03/13 22:03:03 danny Exp $ 3 4# Change some defaults for serial devices. 5# Standard defaults are: 6# dtrwait 300 drainwait 0 7# initial cflag from <sys/ttydefaults.h> = cread cs8 hupcl 8# initial iflag, lflag and oflag all 0 9# speed 9600 10# special chars from <sys/ttydefaults.h> 11# nothing locked 12# except for serial consoles the initial iflag, lflag and oflag are from 13# <sys/ttydefaults.h> and clocal is locked on. 14 15default() { 16 # Reset everything changed by the other functions to initial defaults. 17 18 ci=$1; shift # call in device identifier 19 co=$1; shift # call out device identifier 20 21 for i in $* 22 do 23 comcontrol /dev/tty${ci}${i} dtrwait 300 drainwait 0 24 stty < /dev/ttyi${ci}${i} -clocal crtscts hupcl 9600 reprint ^R 25 stty < /dev/ttyl${ci}${i} -clocal -crtscts -hupcl 0 26 stty < /dev/cuai${co}${i} -clocal crtscts hupcl 9600 reprint ^R 27 stty < /dev/cual${co}${i} -clocal -crtscts -hupcl 0 28 done 29} 30 31maybe() { 32 # Special settings. 33 34 ci=$1; shift 35 co=$1; shift 36 37 for i in $* 38 do 39 # Don't use ^R; it breaks bash's ^R when typed ahead. 40 stty < /dev/ttyi${ci}${i} reprint undef 41 stty < /dev/cuai${co}${i} reprint undef 42 # Lock clocal off on dialin device for security. 43 stty < /dev/ttyl${ci}${i} clocal 44 # Lock the speeds to use old binaries that don't support them. 45 # Any legal speed works to lock the initial speed. 46 stty < /dev/ttyl${ci}${i} 300 47 stty < /dev/cual${co}${i} 300 48 done 49} 50 51modem() { 52 # Modem that supports CTS and perhaps RTS handshaking. 53 54 ci=$1; shift 55 co=$1; shift 56 57 for i in $* 58 do 59 # may depend on modem 60 comcontrol /dev/tty${ci}${i} dtrwait 100 drainwait 180 61 # Lock crtscts on. 62 # Speed reasonable for V42bis. 63 stty < /dev/ttyi${ci}${i} crtscts 57600 64 stty < /dev/ttyl${ci}${i} crtscts 65 stty < /dev/cuai${co}${i} crtscts 57600 66 stty < /dev/cual${co}${i} crtscts 67 done 68} 69 70mouse() { 71 # Mouse on either callin or callout port. 72 73 ci=$1; shift 74 co=$1; shift 75 76 for i in $* 77 do 78 # Lock clocal on, hupcl off. 79 # Standard speed for Microsoft mouse. 80 stty < /dev/ttyi${ci}${i} clocal -hupcl 1200 81 stty < /dev/ttyl${ci}${i} clocal hupcl 82 stty < /dev/cuai${co}${i} clocal -hupcl 1200 83 stty < /dev/cual${co}${i} clocal hupcl 84 done 85} 86 87terminal() { 88 # Terminal that supports CTS and perhaps RTS handshaking 89 # with the cable or terminal arranged so that DCD is on 90 # at least while the terminal is on. 91 # Also works for bidirectional communications to another pc 92 # provided at most one side runs getty. 93 # Same as modem() except we want a faster speed and no dtrwait. 94 95 ci=$1; shift 96 co=$1; shift 97 98 modem ${ci} ${co} $* 99 for i in $* 100 do 101 comcontrol /dev/tty${ci}${i} dtrwait 0 102 stty < /dev/ttyi${ci}${i} 115200 103 stty < /dev/cuai${co}${i} 115200 104 done 105} 106 107# Don't use anything from this file unless you have some buggy programs 108# that require it. 109 110# Edit the functions and the examples to suit your system. 111# $1 is the call in device identifier, $2 is the call out device identifier 112# and the remainder of the line lists the device numbers. 113 114# Initialize assorted 8250-16550 (sio) ports. 115# 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 116# mouse d a 2 117# modem d a 1 118# terminal d a 0 119 120# Initialize all ports on a Cyclades-8yo. 121# modem c c 00 01 02 03 04 05 06 07 122 123# Initialize all ports on a Cyclades-16ye. 124# modem c c 00 01 02 03 04 05 06 07 08 09 0a 0b 0c 0d 0e 0f 125 126# Initialize all ports on a Digiboard 8. 127# modem D D 00 01 02 03 04 05 06 07 128