#!perl -w use Win32::SerialPort; # 0.14; use strict; my $VERSION = sprintf("%d.%02d", '$Revision: 1.4 $ ' =~ /(\d+)\.(\d+)/); my $port; if (@ARGV) { $port = shift @ARGV; if (! ($port =~ /^COM\d{1}$/i)) { die "Option port to be specified as ``COMx''.\n"; } } else { print "\nUsage: $0 \nVersion: $VERSION\n"; exit; } my $port_obj = new Win32::SerialPort ($port) || die "Can't open $port: $^E\n"; # Open port # Modify port settings $port_obj->error_msg(1); $port_obj->user_msg(1); $port_obj->databits(8); #$port_obj->baudrate(9600); $port_obj->parity("none"); $port_obj->stopbits(1); ## $port_obj->handshake("dtr"); ## my modem wanted "rts" $port_obj->handshake("rts"); # default timeouts $port_obj->read_char_time(0); $port_obj->read_const_time(5000); $port_obj->read_interval(0); $port_obj->write_char_time(0); $port_obj->write_const_time(3000); # other parameters $port_obj->stty_echo(0); ## so lookfor doesn't thrash with modem ## This is the essential step $port_obj->write_settings || die "Cannot write settings"; $port_obj->save("pager_$port.cfg") || die "Can't save pager_$port.cfg: $^E\n"; # Configuration file $port_obj->close; # Close port __END__ =head1 NAME pager_setup.pl. Perl script to create pager_COMx.cfg files. =head1 SYNOPSIS perl pager_setup.pl COM1 =head1 DESCRIPTION The script pager_setup.pl creates a configuration file for use by pager.pl. It permits different ports to use different characteristics and simplifies maintaining pager.pl. =head1 AUTHORS Ceri E. Jones Bill Birthisel (wcbirthisel@alum.mit.edu> =head1 SEE ALSO perl(1). pager.pl. =head1 HISTORY $Log: pager_setup.pl,v $ Revision 1.4 1999/03/06 19:44:44 BILLB Extracted from pager.pl as separate script. Revision 1.3 1999/02/27 09:04:15 JONESC Added a couple more command line options. Revision 1.2 1999/02/26 20:45:11 JONESC Added POD. =cut