--- mdap-server.pl 2007/04/24 15:44:20 31 +++ mdap-server.pl 2007/04/24 18:57:19 33 @@ -28,6 +28,7 @@ ); $quiet = 0 if $verbose; +$credentials = 1 if $debug; # tab-delimited list of user id/passwd to try on ants my @try_accounts = ( "Administrator\t" ); @@ -98,7 +99,7 @@ $sock->mcast_send( $data, "${GROUP}:${PORT}" ); if ($debug) { - warn ">> ", dump( $data ), $/; + warn ">> ${GROUP}:${PORT} >> ", dump( $data ), $/; } elsif( ! $quiet ) { $data =~ s/\s+/ /gi; warn ">> ", substr($data,0,70), $/; @@ -192,7 +193,7 @@ print "<< $type $proto/$mdap_ver << ", length($data), " bytes\n" unless $quiet; - warn dump($h),$/ if ($debug); + warn dump( $data, $h ),$/ if ($debug); # we are getting our own messages (since our source port # is same as destination) @@ -219,7 +220,7 @@ next; } else { $ant_ok_password->{$ant}++; - print "$ant credentials $user_id $user_pwd\n" if ($credentials && $ant_ok_password->{$ant} == 1); + print "$ant credentials $user_id $user_pwd\n" if ( $credentials && $ant_ok_password->{$ant} == 1 ) || $debug; } my $board = $h->{'_BOARD_NAME'} || die "no _BOARD_NAME?"; @@ -229,13 +230,17 @@ if ( $build ne $new_build ) { print "+ $ant version $build -> $new_build\n"; mdap_send("EXEC-CLI MDAP/$mdap_ver\r\nCLI-CMD:software upgrade\r\nSEQ-NR:1\r\nTO-ANT:$ant\r\nUSER-ID:$user_id\r\nUSER-PWD:$user_pwd\r\n"); + $ant_flashing->{$ant}++; } else { once "$ant OK version $build", $ant_unknown_password->{$ant} ? ' with unknown password' : - $ant_ok_password->{$ant} ? ' password protected' : + $ant_passwd->{$ant} ? ' password protected' : '', "\n"; + $ant_flashing->{$ant} = 0; + # green|red|orange|flash|off + 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"); my $waiting = 0; my $count = 0; map { @@ -252,13 +257,14 @@ } 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" if ($verbose); + } elsif ( $type eq 'REPLY-EXEC-CLI' ) { + print "+ $type ", dump( $data ), "\n" if ($verbose); + if ( $seq_nr == 1 ) { 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}++; + forget_ant( $ant ) if ( $ant_flashing->{$ant} ); + } } else { - print "!! reply ignored ", dump( $h ), $/; + print "!! reply $type ignored ", dump( $h ), $/; } } else {