27 chomp ($com = <>); |
26 chomp ($com = <>); |
28 |
27 |
29 print "What is the baud rate of the modem?\n(Wavecomm default is 9600, Telit default is 152000)\n\tBaud="; |
28 print "What is the baud rate of the modem?\n(Wavecomm default is 9600, Telit default is 152000)\n\tBaud="; |
30 chomp ($baud = <>); |
29 chomp ($baud = <>); |
31 |
30 |
32 print "\nComm::$com Baud=$baud\n"; |
31 #print "\nComm::$com Baud=$baud\n"; |
33 |
32 |
34 # Open the config files |
33 # Open the config files |
35 my $defaultcomdb = "<./AT-LTSY(default).cfg"; |
34 my $defaultcomdb = "<./AT-LTSY(default).cfg"; |
36 my $commdb = ">>../../../../../../epoc32/winscw/c/AT-LTSY.cfg"; |
35 my $commdb = ">/epoc32/winscw/c/AT-LTSY.cfg"; |
37 #my $commdb = ">./AT-LTSY.cfg"; |
|
38 |
36 |
39 open(COMMDBOUT, $commdb); |
37 open(COMMDBOUT, $commdb); |
40 open(COMMDBREAD, $defaultcomdb); |
38 open(COMMDBREAD, $defaultcomdb); |
41 |
39 |
42 # Read in the default commdb and write it out to the new file, changing the com port and baud where necessary |
40 # Read in the default commdb and write it out to the new file, changing the com port and baud where necessary |
48 my($line)=$_; |
46 my($line)=$_; |
49 |
47 |
50 # first wait till we've found the $modembearertable line. |
48 # first wait till we've found the $modembearertable line. |
51 if ($line =~ m/^\[ModemBearer\]/) |
49 if ($line =~ m/^\[ModemBearer\]/) |
52 { |
50 { |
53 print "Found the modem bearer table\n"; |
51 #print "Found the modem bearer table\n"; |
54 $modembearertable = 1; |
52 $modembearertable = 1; |
55 } |
53 } |
56 # Or if we've got the end of the table unset the boolean |
54 # Or if we've got the end of the table unset the boolean |
57 elsif ($modembearertable && $line =~ m/^\[/) |
55 elsif ($modembearertable && $line =~ m/^\[/) |
58 { |
56 { |
59 print "Found the end fo the modem bearer table\n"; |
57 #print "Found the end fo the modem bearer table\n"; |
60 $modembearertable = 0; |
58 $modembearertable = 0; |
61 } |
59 } |
62 |
60 |
63 # If we're in the modem table then check for a few things |
61 # If we're in the modem table then check for a few things |
64 if ($modembearertable) |
62 if ($modembearertable) |
65 { |
63 { |
66 # Now wait till we've got to an entry for our modem |
64 # Now wait till we've got to an entry for our modem |
67 if ($line =~ m/^\sName=CommModem/) |
65 if ($line =~ m/^\sName=CommModem/) |
68 { |
66 { |
69 print "Found the modem entry\n"; |
67 #print "Found the modem entry\n"; |
70 $modementry = 1; |
68 $modementry = 1; |
71 } |
69 } |
72 |
70 |
73 # Or if we've reached the end of the modem entry unset the boolean |
71 # Or if we've reached the end of the modem entry unset the boolean |
74 if ($modementry && $line =~ m/^END_ADD/) |
72 if ($modementry && $line =~ m/^END_ADD/) |
75 { |
73 { |
76 print "Found the end of the modem entry\n"; |
74 #print "Found the end of the modem entry\n"; |
77 $modementry = 0; |
75 $modementry = 0; |
78 } |
76 } |
79 } |
77 } |
80 |
78 |
81 # If we're in the entry for our modem then potentially modify the line |
79 # If we're in the entry for our modem then potentially modify the line |
82 if ($modementry) |
80 if ($modementry) |
83 { |
81 { |
84 # If it's the comm port number set that up |
82 # If it's the comm port number set that up |
85 if ($line =~ m/^\sPortName=COMM::/) |
83 if ($line =~ m/^\sPortName=COMM::/) |
86 { |
84 { |
87 print "Changing COMM port\n"; |
85 print "\tSetting the COMM port\n"; |
88 $line = "\tPortName=COMM::$com\n" |
86 $line = "\tPortName=COMM::$com\n" |
89 } |
87 } |
90 |
88 |
91 # If it's the rate then set that up |
89 # If it's the rate then set that up |
92 if ($line =~ m/^\sRate=/) |
90 if ($line =~ m/^\sRate=/) |
93 { |
91 { |
94 print "Changing Baud rate\n"; |
92 print "\tSetting the Baud rate\n"; |
95 $line = "\tRate=$baud\n" |
93 $line = "\tRate=$baud\n" |
96 } |
94 } |
97 } |
95 } |
98 |
96 |
99 # Write out the (modified) line to the new commdb |
97 # Write out the (modified) line to the new commdb |