#!/bin/bash # # New scheme - check interrupt rate on the serial port over 1 sec interval, # if less than CHARSPERSEC threshold, return # # This is actually interrupts, and seem to get ~ 7 chars per interrupt # # Modem uses IRQ11 # CHARSPERSEC=150 NEWINTS=`cat /proc/interrupts | grep '^11:' | awk '{print $2}'` while true do INTS=$NEWINTS sleep 1 NEWINTS=`cat /proc/interrupts | grep '^11:' | awk '{print $2}'` # echo "$NEWINTS - $INTS" if expr $NEWINTS '-' $INTS '<' $CHARSPERSEC > /dev/null then # Char count dropped, make sure line still up pppdpid=`/etc/pidrunning pppd` if test "$pppdpid" = "" then # Gone - wait for line up to proceed /usr/sbin/waitpppd # Wait a while for line to be properly established sleep 30 continue; fi break; fi done