Tired of fighting the modem (fwd)

Gert Doering (gert@greenie.muc.de)
Fri, 22 Dec 1995 20:47:29 +0100


Hi,

this message came just through, maybe one or the other can use it.

gert

PS: While I am at it, I wish you all a merry christmas and a happy,
successful new year!!
----- Forwarded message from Marius SERITAN -----

>From m386.pub.ro!chapter!mseritan Fri Dec 22 20:45:02 1995
Sender: mseritan@chapter.golana.pub.ro (Marius SERITAN)
Date: Sat, 23 Dec 1995 02:50:25 +12000
From: Marius SERITAN <mseritan@chapter.golana.pub.ro>
Sender: Marius SERITAN <mseritan@chapter.golana.pub.ro>
Reply-To: Marius SERITAN <mseritan@chapter.golana.pub.ro>
Subject: Tired of fighting the modem
To: gert@greenie.muc.de
Message-ID: <Pine.3.89.9512220911.A824-a200000@chapter.golana.pub.ro>
MIME-Version: 1.0
Content-Type: MULTIPART/MIXED; BOUNDARY="1435320622-1047687270-819679825:#454"

In the first place I wish you a Merry Xmas and a Happy New Year!

I have set up mgetty to pick up the modem after the fifth ring, but even
in this case we are always fighting over the phone line. I wrote a small
perl script based on kvg that allows me better control control of the
%%&^%$$$^& device (the modem I mean :-). Maybe somebody else is also
interested --- or has a better solution. 

I am running the script under Linux from init on a virtual console,
here is my /etc/inittab entry (I am using only 4 virtual consoles for loggin)

c5:45:respawn:/home/mseritan/scripts/modem.pl < /dev/tty5 > /dev/tty5

so it is always one key away. 

Now I am in control, not the modem ;-)

Marius SERITAN                 Net/Unix/Dos C/C++/Assembler/Postscript 
mseritan@chapter.golana.pub.ro http://edil.edil.pub.ro/~mseritan Tel: 
+(40) 1 674 7798               smail: Stirului 7, Bucuresti 3, ROMANIA


Content-Description: The Perl script

#!/usr/local/bin/perl

$tty="ttyS2";       # the modem

while( 1 ) {
  printf "\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n";
  printf "         1.   Make the fax/modem answer\n";
  printf "         2.   Hangup the fax/modem\n";
  printf "         3.   Stop uucico\n";
  printf "\n\n\n\n\n         Your choice: ";
  $ans = <STDIN>;
  if( $ans =~ 1 ) {
    if( ! -f "/etc/mg-pid.$tty" ) {
         printf "\n\n\nno mgetty/vgetty on tty /dev/$tty";
    } else {
      $pid = `cat /etc/mg-pid.$tty`;
      printf "\n\n\n\n\n\nAnswering the modem\n\n\n\n\n";
      kill USR1, $pid;
    }
  }
  if( $ans =~ 2 ) {
    if( ! -f "/etc/mg-pid.$tty" ) {
	printf "\n\n\nno mgetty/vgetty on tty /dev/$tty";
    } else {
      $pid = `cat /etc/mg-pid.$tty`;
      printf "n\n\n\n\n\n\nHanging up the modem\n\n\n\n\n\n";
      kill HUP, $pid;
    }
  }
  if( $ans =~ 3 ) {
    printf "\n\n\n\n\n\n\nHanging uucico\n\n\n\n\n\n";
    system("killall -HUP uucico");
  }
}
----- End of forwarded message from Marius SERITAN -----

-- 
Meine Eltern sind selbst schuld, dass sie sich so
eine missratene Tochter gezogen haben       ---     Simone Demmel
--
It can hardly be a coincidence that no language on Earth has ever
produced the expression `as pretty as an airport'.        -- D.Adams