telephonyserverplugins/attestltsy/config/modifycommdb.pl
author Tom Pritchard <tomp@symbian.org>
Tue, 02 Mar 2010 21:40:14 +0000
branchAT_Test_LTSY
changeset 10 4d82aaca4452
parent 6 9b3b5a50db11
child 84 e8b449273975
permissions -rw-r--r--
Updating the config scripts and adding support for updating the CCE CenRep file
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
6
9b3b5a50db11 Updating the config script to setup commdb dynamically
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
     1
#!perl -w
9b3b5a50db11 Updating the config script to setup commdb dynamically
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
     2
# Copyright (c) 2010 Symbian Foundation and/or its subsidiary(-ies).
9b3b5a50db11 Updating the config script to setup commdb dynamically
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
     3
# All rights reserved.
9b3b5a50db11 Updating the config script to setup commdb dynamically
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
     4
# This component and the accompanying materials are made available
9b3b5a50db11 Updating the config script to setup commdb dynamically
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
     5
# under the terms of "Eclipse Public License v1.0"
9b3b5a50db11 Updating the config script to setup commdb dynamically
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
     6
# which accompanies this distribution, and is available
9b3b5a50db11 Updating the config script to setup commdb dynamically
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
     7
# at the URL "http://www.eclipse.org/legal/epl-v10.html".
9b3b5a50db11 Updating the config script to setup commdb dynamically
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
     8
#
9b3b5a50db11 Updating the config script to setup commdb dynamically
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
     9
# Initial Contributors:
9b3b5a50db11 Updating the config script to setup commdb dynamically
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
    10
# Symbian Foundation - initial contribution.
9b3b5a50db11 Updating the config script to setup commdb dynamically
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
    11
#
9b3b5a50db11 Updating the config script to setup commdb dynamically
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
    12
# Contributors:
9b3b5a50db11 Updating the config script to setup commdb dynamically
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
    13
#
9b3b5a50db11 Updating the config script to setup commdb dynamically
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
    14
# Description:
10
4d82aaca4452 Updating the config scripts and adding support for updating the CCE CenRep file
Tom Pritchard <tomp@symbian.org>
parents: 6
diff changeset
    15
# This modifies CommDB for the AT LTSY modem, asking the user for the comm port and baud rate to use.
6
9b3b5a50db11 Updating the config script to setup commdb dynamically
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
    16
# 
9b3b5a50db11 Updating the config script to setup commdb dynamically
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
    17
#
9b3b5a50db11 Updating the config script to setup commdb dynamically
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
    18
9b3b5a50db11 Updating the config script to setup commdb dynamically
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
    19
use strict;
9b3b5a50db11 Updating the config script to setup commdb dynamically
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
    20
9b3b5a50db11 Updating the config script to setup commdb dynamically
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
    21
9b3b5a50db11 Updating the config script to setup commdb dynamically
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
    22
# Ask for the COM port and Baud
9b3b5a50db11 Updating the config script to setup commdb dynamically
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
    23
my $com;
9b3b5a50db11 Updating the config script to setup commdb dynamically
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
    24
my $baud;
9b3b5a50db11 Updating the config script to setup commdb dynamically
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
    25
print "What COMM port is the modem on?\n(Note: Symbian COMM ports are 1 less than windows)\n\tCOMM::";
9b3b5a50db11 Updating the config script to setup commdb dynamically
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
    26
chomp ($com = <>);
9b3b5a50db11 Updating the config script to setup commdb dynamically
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
    27
9b3b5a50db11 Updating the config script to setup commdb dynamically
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
    28
print "What is the baud rate of the modem?\n(Wavecomm default is 9600, Telit default is 152000)\n\tBaud=";
9b3b5a50db11 Updating the config script to setup commdb dynamically
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
    29
chomp ($baud = <>);
9b3b5a50db11 Updating the config script to setup commdb dynamically
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
    30
10
4d82aaca4452 Updating the config scripts and adding support for updating the CCE CenRep file
Tom Pritchard <tomp@symbian.org>
parents: 6
diff changeset
    31
#print "\nComm::$com Baud=$baud\n";
6
9b3b5a50db11 Updating the config script to setup commdb dynamically
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
    32
9b3b5a50db11 Updating the config script to setup commdb dynamically
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
    33
# Open the config files
9b3b5a50db11 Updating the config script to setup commdb dynamically
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
    34
my $defaultcomdb = "<./AT-LTSY(default).cfg";
10
4d82aaca4452 Updating the config scripts and adding support for updating the CCE CenRep file
Tom Pritchard <tomp@symbian.org>
parents: 6
diff changeset
    35
my $commdb = ">/epoc32/winscw/c/AT-LTSY.cfg";
6
9b3b5a50db11 Updating the config script to setup commdb dynamically
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
    36
9b3b5a50db11 Updating the config script to setup commdb dynamically
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
    37
open(COMMDBOUT, $commdb);
9b3b5a50db11 Updating the config script to setup commdb dynamically
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
    38
open(COMMDBREAD, $defaultcomdb);
9b3b5a50db11 Updating the config script to setup commdb dynamically
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
    39
9b3b5a50db11 Updating the config script to setup commdb dynamically
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
    40
# Read in the default commdb and write it out to the new file, changing the com port and baud where necessary
9b3b5a50db11 Updating the config script to setup commdb dynamically
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
    41
my $modembearertable = 0;
9b3b5a50db11 Updating the config script to setup commdb dynamically
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
    42
my $modementry = 0;
9b3b5a50db11 Updating the config script to setup commdb dynamically
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
    43
9b3b5a50db11 Updating the config script to setup commdb dynamically
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
    44
while(<COMMDBREAD>)
9b3b5a50db11 Updating the config script to setup commdb dynamically
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
    45
{
9b3b5a50db11 Updating the config script to setup commdb dynamically
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
    46
my($line)=$_;
9b3b5a50db11 Updating the config script to setup commdb dynamically
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
    47
9b3b5a50db11 Updating the config script to setup commdb dynamically
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
    48
# first wait till we've found the $modembearertable line.
9b3b5a50db11 Updating the config script to setup commdb dynamically
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
    49
if ($line =~ m/^\[ModemBearer\]/) 
9b3b5a50db11 Updating the config script to setup commdb dynamically
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
    50
	{
10
4d82aaca4452 Updating the config scripts and adding support for updating the CCE CenRep file
Tom Pritchard <tomp@symbian.org>
parents: 6
diff changeset
    51
	#print "Found the modem bearer table\n";
6
9b3b5a50db11 Updating the config script to setup commdb dynamically
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
    52
	$modembearertable = 1;
9b3b5a50db11 Updating the config script to setup commdb dynamically
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
    53
	}
9b3b5a50db11 Updating the config script to setup commdb dynamically
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
    54
# Or if we've got the end of the table unset the boolean
9b3b5a50db11 Updating the config script to setup commdb dynamically
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
    55
elsif ($modembearertable && $line =~ m/^\[/) 
9b3b5a50db11 Updating the config script to setup commdb dynamically
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
    56
	{
10
4d82aaca4452 Updating the config scripts and adding support for updating the CCE CenRep file
Tom Pritchard <tomp@symbian.org>
parents: 6
diff changeset
    57
	#print "Found the end fo the modem bearer table\n";
6
9b3b5a50db11 Updating the config script to setup commdb dynamically
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
    58
	$modembearertable = 0;	
9b3b5a50db11 Updating the config script to setup commdb dynamically
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
    59
	}
9b3b5a50db11 Updating the config script to setup commdb dynamically
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
    60
9b3b5a50db11 Updating the config script to setup commdb dynamically
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
    61
# If we're in the modem table then check for a few things
9b3b5a50db11 Updating the config script to setup commdb dynamically
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
    62
if ($modembearertable)
9b3b5a50db11 Updating the config script to setup commdb dynamically
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
    63
	{
9b3b5a50db11 Updating the config script to setup commdb dynamically
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
    64
	# Now wait till we've got to an entry for our modem
9b3b5a50db11 Updating the config script to setup commdb dynamically
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
    65
	if ($line =~ m/^\sName=CommModem/) 
9b3b5a50db11 Updating the config script to setup commdb dynamically
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
    66
		{
10
4d82aaca4452 Updating the config scripts and adding support for updating the CCE CenRep file
Tom Pritchard <tomp@symbian.org>
parents: 6
diff changeset
    67
		#print "Found the modem entry\n";
6
9b3b5a50db11 Updating the config script to setup commdb dynamically
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
    68
		$modementry = 1;
9b3b5a50db11 Updating the config script to setup commdb dynamically
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
    69
		}
9b3b5a50db11 Updating the config script to setup commdb dynamically
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
    70
9b3b5a50db11 Updating the config script to setup commdb dynamically
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
    71
	# Or if we've reached the end of the modem entry unset the boolean
9b3b5a50db11 Updating the config script to setup commdb dynamically
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
    72
	if ($modementry && $line =~ m/^END_ADD/) 
9b3b5a50db11 Updating the config script to setup commdb dynamically
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
    73
		{
10
4d82aaca4452 Updating the config scripts and adding support for updating the CCE CenRep file
Tom Pritchard <tomp@symbian.org>
parents: 6
diff changeset
    74
		#print "Found the end of the modem entry\n";
6
9b3b5a50db11 Updating the config script to setup commdb dynamically
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
    75
		$modementry = 0;
9b3b5a50db11 Updating the config script to setup commdb dynamically
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
    76
		}
9b3b5a50db11 Updating the config script to setup commdb dynamically
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
    77
	}
9b3b5a50db11 Updating the config script to setup commdb dynamically
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
    78
9b3b5a50db11 Updating the config script to setup commdb dynamically
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
    79
# If we're in the entry for our modem then potentially modify the line
9b3b5a50db11 Updating the config script to setup commdb dynamically
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
    80
if ($modementry)
9b3b5a50db11 Updating the config script to setup commdb dynamically
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
    81
	{
9b3b5a50db11 Updating the config script to setup commdb dynamically
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
    82
	# If it's the comm port number set that up
9b3b5a50db11 Updating the config script to setup commdb dynamically
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
    83
	if ($line =~ m/^\sPortName=COMM::/) 
9b3b5a50db11 Updating the config script to setup commdb dynamically
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
    84
		{
10
4d82aaca4452 Updating the config scripts and adding support for updating the CCE CenRep file
Tom Pritchard <tomp@symbian.org>
parents: 6
diff changeset
    85
		print "\tSetting the COMM port\n";
6
9b3b5a50db11 Updating the config script to setup commdb dynamically
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
    86
		$line = "\tPortName=COMM::$com\n"
9b3b5a50db11 Updating the config script to setup commdb dynamically
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
    87
		}
9b3b5a50db11 Updating the config script to setup commdb dynamically
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
    88
	
9b3b5a50db11 Updating the config script to setup commdb dynamically
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
    89
	# If it's the rate then set that up
9b3b5a50db11 Updating the config script to setup commdb dynamically
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
    90
	if ($line =~ m/^\sRate=/) 
9b3b5a50db11 Updating the config script to setup commdb dynamically
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
    91
		{
10
4d82aaca4452 Updating the config scripts and adding support for updating the CCE CenRep file
Tom Pritchard <tomp@symbian.org>
parents: 6
diff changeset
    92
		print "\tSetting the Baud rate\n";
6
9b3b5a50db11 Updating the config script to setup commdb dynamically
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
    93
		$line = "\tRate=$baud\n"
9b3b5a50db11 Updating the config script to setup commdb dynamically
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
    94
		}
9b3b5a50db11 Updating the config script to setup commdb dynamically
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
    95
	}
9b3b5a50db11 Updating the config script to setup commdb dynamically
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
    96
9b3b5a50db11 Updating the config script to setup commdb dynamically
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
    97
# Write out the (modified) line to the new commdb
9b3b5a50db11 Updating the config script to setup commdb dynamically
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
    98
print COMMDBOUT $line;
9b3b5a50db11 Updating the config script to setup commdb dynamically
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
    99
}
9b3b5a50db11 Updating the config script to setup commdb dynamically
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   100
9b3b5a50db11 Updating the config script to setup commdb dynamically
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   101
# Close the files
9b3b5a50db11 Updating the config script to setup commdb dynamically
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   102
close(COMMDBOUT);
9b3b5a50db11 Updating the config script to setup commdb dynamically
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   103
close(COMMDBREAD);
9b3b5a50db11 Updating the config script to setup commdb dynamically
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   104
9b3b5a50db11 Updating the config script to setup commdb dynamically
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   105