16 |
my $resend_search_delay = 3; |
my $resend_search_delay = 3; |
17 |
my $tftp_path = '/srv/tftp/'; |
my $tftp_path = '/srv/tftp/'; |
18 |
|
|
19 |
|
my $flashed_cmd = 'system config led=flash'; |
20 |
|
|
21 |
GetOptions( |
GetOptions( |
22 |
"port=i" => \$PORT, |
"port=i" => \$PORT, |
23 |
"group=s" => \$GROUP, |
"group=s" => \$GROUP, |
27 |
"search=i" => \$resend_search_delay, |
"search=i" => \$resend_search_delay, |
28 |
"tftp=s" => \$tftp_path, |
"tftp=s" => \$tftp_path, |
29 |
"credentials" => \$credentials, |
"credentials" => \$credentials, |
30 |
|
"exec=s" => \$flashed_cmd, |
31 |
); |
); |
32 |
|
|
33 |
$quiet = 0 if $verbose; |
$quiet = 0 if $verbose; |
50 |
warn "invalid $passwd_path entry: $_\n"; |
warn "invalid $passwd_path entry: $_\n"; |
51 |
} |
} |
52 |
} |
} |
53 |
print "found ", $#try_accounts + 1, " accounts to try on password protected ants\n"; |
print "found ", $#try_accounts + 1, " accounts to try on password protected ants", |
54 |
|
$credentials ? " and display credentials" : "", "\n"; |
55 |
} |
} |
56 |
|
|
57 |
warn "search for ants every ${resend_search_delay}s\ntftp server path: $tftp_path\n"; |
warn "search for ants every ${resend_search_delay}s\ntftp server path: $tftp_path\nflashed to current version: $flashed_cmd\n"; |
58 |
|
|
59 |
sub fw { |
sub fw { |
60 |
my ($board, $offset,$len) = @_; |
my ($board, $offset,$len) = @_; |
244 |
|
|
245 |
$ant_flashing->{$ant} = 0; |
$ant_flashing->{$ant} = 0; |
246 |
# green|red|orange|flash|off |
# green|red|orange|flash|off |
247 |
mdap_send("EXEC-CLI MDAP/$mdap_ver\r\nCLI-CMD:system config led=flash\r\nSEQ-NR:1\r\nTO-ANT:$ant\r\nUSER-ID:$user_id\r\nUSER-PWD:$user_pwd\r\n"); |
mdap_send("EXEC-CLI MDAP/$mdap_ver\r\nCLI-CMD:$flashed_cmd\r\nSEQ-NR:1\r\nTO-ANT:$ant\r\nUSER-ID:$user_id\r\nUSER-PWD:$user_pwd\r\n"); |
248 |
my $waiting = 0; |
my $waiting = 0; |
249 |
my $count = 0; |
my $count = 0; |
250 |
map { |
map { |
262 |
once "!! NO FIRMWARE for $board in $tftp_path for ant $ant, skipping update\n"; |
once "!! NO FIRMWARE for $board in $tftp_path for ant $ant, skipping update\n"; |
263 |
} |
} |
264 |
} elsif ( $type eq 'REPLY-EXEC-CLI' ) { |
} elsif ( $type eq 'REPLY-EXEC-CLI' ) { |
265 |
print "+ $type ", dump( $data ), "\n" if ($verbose); |
print "+ $type\n$data\n" if ($verbose); |
266 |
if ( $seq_nr == 1 ) { |
if ( $seq_nr == 1 ) { |
267 |
mdap_send("EXEC-CLI MDAP/$mdap_ver\r\nSEQ-NR:2\r\nTO-ANT:$ant\r\nUSER-ID:$user_id\r\nUSER-PWD:$user_pwd\r\n"); |
mdap_send("EXEC-CLI MDAP/$mdap_ver\r\nSEQ-NR:2\r\nTO-ANT:$ant\r\nUSER-ID:$user_id\r\nUSER-PWD:$user_pwd\r\n"); |
268 |
forget_ant( $ant ) if ( $ant_flashing->{$ant} ); |
forget_ant( $ant ) if ( $ant_flashing->{$ant} ); |
269 |
} |
} |
270 |
|
|
271 |
} else { |
} else { |
272 |
print "!! reply $type ignored ", dump( $h ), $/; |
print "!! reply $type ignored ", dump( $h ), $/; |
273 |
} |
} |