--- mdap-server.pl 2007/04/24 09:52:05 27 +++ mdap-server.pl 2007/04/24 14:53:04 30 @@ -104,6 +104,9 @@ } my $ant_passwd; +my $ant_unknown_password; +my $ant_ok_password; +my $ant_flashing; sub ant_credentials { my $ant = shift || die "no ant?"; @@ -113,9 +116,6 @@ return ($user_id,$user_pwd); } -my $ant_unknown_password; -my $ant_ok_password; - sub ant_unknown_password { my $ant = shift || die "no ant?"; if ( $ant_unknown_password->{$ant} ) { @@ -128,6 +128,7 @@ my $ant = shift || die "no ant?"; return 0 if ant_unknown_password( $ant ); + return 0 if $ant_ok_password->{$ant}; $ant_passwd->{$ant}++; @@ -155,6 +156,16 @@ print $m if ($once->{$m} == 1); } +my $status = ''; + +sub status { + my $m = join('', @_); + if ($m ne $status) { + print $m; + $status = $m; + } +} + local $SIG{ALRM} = sub { mdap_send("ANT-SEARCH MDAP/1.1\r\n"); alarm( $resend_search_delay ); @@ -221,14 +232,28 @@ $ant_ok_password->{$ant} ? ' password protected' : '', "\n"; + $ant_flashing->{$ant} = 0; + my $waiting = 0; + my $count = 0; + map { + $waiting++ if ($ant_flashing->{$_}); + $count++; + } keys %$ant_flashing; + if ($waiting == 0) { + status "ALL $count ANTS FLASHED to $build\n"; + $ant_flashing = undef; + } else { + status "$waiting of $count ants still flasing upto $build\n"; + } } } else { once "!! NO FIRMWARE for $board in $tftp_path for ant $ant, skipping update\n"; } } elsif ( $type eq 'REPLY-EXEC-CLI' && $h->{'SEQ-NR'} == 1 ) { - print "+ $ant bootp mode re-flash started\n"; + print "+ $ant bootp mode re-flash started\n" if ($verbose); 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"); forget_ant( $ant ); + $ant_flashing->{$ant}++; } else { print "!! reply ignored ", dump( $h ), $/; }