Subject: TROUBLE WITH SERIAL PORTS ON 1.0_BETA
To: None <current-users@sun-lamp.cs.berkeley.edu>
From: Brian Buhrow <buhrow@cats.ucsc.edu>
List: current-users
Date: 08/05/1994 17:47:34
	I'm attempting to get current from early February and, as some of you may
have seen, I have been having trouble getting the serial ports working.
My problem is that I have this script that automatically gets the machine's
slip internet connection going and, as conditions warrant, keep it going.
As the machine boots up under 1.0, this script gets called as it should,
but it can never pick up the phone.  Per suggestions from this list, I
tried setting clocal on the serial port and then tried calling this script.
 Still no go.
Under the system I'm running now, which is not current 1.0, but 0.9a, this
script works flawlessly.  If anyone can suggest a method of modifying this
script so that it will work under 1.0, I'd be much appreciative.  I have
been scratching my head over this one for a while, and it still baffles me.
 Because vmstat -i doesn't work, I can't even see if the serial ports are
generating interrupts as I try to use them.

I'm sure its not a bug, just something I'm missing.
-thanks
-Brian
#!/bin/sh
#This shell script will get the slip link running and configure the the routes.
#
#
#Note that this script can call twice, due to a bug at the other end of the
#line which causes the other side not to log out on hangup.
PATH=/bin:/usr/bin:/sbin:/usr/sbin; export PATH
/bin/kill `fstat /dev/com0 |tail +1 |awk '{print $3}'` > /dev/null 2>&1
sleep 10 > /dev/null 2>&1 #give the processes time to die.
sleep 180 < /dev/com0&
stty clocal 38400 < /dev/com0
chat -v "" atdt5551212 ogin: "\\d\\d\\dfoomoria slip\\d\\d\\d\\n" word: foo\\n < /dev/com0 > /dev/com0
case $? in
	0)
	stty -f /dev/com0 -clocal
	slattach -h -s 38400 /dev/com0
	netstat -rn |fgrep 'sl0' > /dev/null 2>&1
	if [ $? -eq 1 ]; then
		ifconfig sl0 inet 199.4.218.2 199.4.218.1 netmask 0xfffffff8 |logger -i -p daemon.err
		route add 199.4.218.1 199.4.218.2 |logger -i -p daemon.err
	fi
	netstat -rn |fgrep 'default' > /dev/null 2>&1
	if [ $? -eq 1 ]; then
		route add default 199.4.218.1 |logger -i -p daemon.err
		exit 0
	fi
	echo 'No routes to add' |logger -i -p daemon.err
	exit 0
	;;
	1)
	/bin/kill `fstat /dev/com0 |tail +1 |awk '{print $3}'` > /dev/null 2>&1 ;\
 sleep 10 > /dev/null 2>&1
	(sleep 180 < /dev/com0 &)
	stty clocal 38400 < /dev/com0 ;\
	chat -v "" atdt5551212 CONNECT "" < /dev/com0 > /dev/com0
	if [ $? -eq 0 ]; then
		stty -f /dev/com0 -clocal
		slattach -h -s 38400 /dev/com0
		netstat -rn |fgrep 'sl0' > /dev/null 2>&1
		if [ $? -eq 1 ]; then
			ifconfig sl0 inet 199.4.218.2 199.4.218.1 netmask 0xfffffff8 |logger -i -p daemon.err
			route add 199.4.218.1 199.4.218.2 |logger -i -p daemon.err
		fi
		netstat -rn |fgrep 'default' > /dev/null 2>&1
		if [ $? -eq 1 ]; then
			route add default 199.4.218.1 |logger -i -p daemon.err
			exit 0
		fi
		echo 'No routes to add' |logger -i -p daemon.err
		exit 0
	fi
	;;
	esac
	echo 'could not't start the network' |logger -i -p daemon.err
	exit 1

------------------------------------------------------------------------------