#!/bin/sh
#
# Configure serial ports.
#
SETSERIAL=/bin/setserial
SED=/usr/bin/sed
AUTO_IRQ=auto_irq

case "$1" in
start)
    # perhaps we want to do some wild interrupt detection.  Or perhaps
    # not.
    #${SETSERIAL} -W /dev/ttyS0

    # try to autoconfigure all the serial devices we can find in the
    # bootmsgs file
    for i in `${SED} -n -e '/tty0/s/tty0\(.\).*/\1/p' /var/log/dmesg`; do
	${SETSERIAL} /dev/ttyS$i $AUTO_IRQ autoconfig
	${SETSERIAL} /dev/ttyS$i
    done
    ;;
info)
    echo "Set up serial ports"
    ;;
stop)
    ;;
*)
    echo "usage: $0 {start|stop}"
    ;;
esac
