--- mdap-server.pl 2007/11/18 10:27:37 69 +++ mdap-server.pl 2007/12/05 23:13:56 86 @@ -199,16 +199,16 @@ my $client_version = $h->{'MDAP-VERSION'}; $mdap_ver = $client_version if ($client_version); - print "<< $type $proto/$mdap_ver << ", length($data), " bytes: ",_dump_data($data),$/ unless $quiet; - - warn dump( $data, $h ),$/ if ($debug); - # we are getting our own messages (since our source port # is same as destination) next if ( $type =~ m#^(INFO|ANT-SEARCH|EXEC-CLI)# ); + print "<< $type $proto/$mdap_ver << ", length($data), " bytes: ",_dump_data($data),$/ unless $quiet; + + warn dump( $data, $h ),$/ if ($debug); + my $ant = $h->{'ANT-ID'} || die "no ANT-ID in ", dump( $h ); - my $seq_nr = $1 if (defined $h->{'SEQ-NR'} && $h->{'SEQ-NR'} =~ m/^-*(\d)+/); + my $seq_nr = $1 if (defined $h->{'SEQ-NR'} && $h->{'SEQ-NR'} =~ m/^(-*\d)+/); #warn "SEQ-NR: $seq_nr ok: ",$ant_ok_password->{$ant},"\n" if ($seq_nr); my ($user_id,$user_pwd) = ant_credentials( $ant ); @@ -234,6 +234,7 @@ my $board = $h->{'_BOARD_NAME'} || die "no _BOARD_NAME?"; if ( fw_exists( $board ) ) { my $build = $h->{'_BUILD'} || die "no _BUILD?"; + $build =~ s/^(\d+)\.(\d+)\.(\d+)\.(\d+).*$/$1.$2.$3.$4/; my $new_build = fw_build( $board ); if ( $build ne $new_build ) { print "+ $ant $board version $build -> $new_build\n"; @@ -263,28 +264,28 @@ } } - if ( $plugins ) { - foreach my $plugin ( MDAP->plugins ) { - warn "## calling $plugin\n" if $debug; - if ( my $command = $plugin->check( $h ) ) { - - warn ">> $plugin $ant $board ", - $h->{'ANT-NAME'}, " ", - $h->{'_BUILD'}, " ", - "\t:$command\n"; - - mdap_send("EXEC-CLI MDAP/$mdap_ver\r\nCLI-CMD:$command\r\nSEQ-NR:1\r\nTO-ANT:$ant\r\nUSER-ID:$user_id\r\nUSER-PWD:$user_pwd\r\n"); - last; - } - } - } - } else { once "!! NO FIRMWARE for $board in $tftp_path for ant $ant, skipping update"; } + if ( $plugins ) { + foreach my $plugin ( MDAP->plugins ) { + warn "## calling $plugin\n" if $debug; + if ( my $command = $plugin->check( $h ) ) { + + warn ">> $plugin $ant $board ", + $h->{'ANT-NAME'}, " ", + $h->{'_BUILD'}, " ", + "\t:$command\n"; + + mdap_send("EXEC-CLI MDAP/$mdap_ver\r\nCLI-CMD:$command\r\nSEQ-NR:1\r\nTO-ANT:$ant\r\nUSER-ID:$user_id\r\nUSER-PWD:$user_pwd\r\n"); + last; + } + } + } + } elsif ( $type eq 'REPLY-EXEC-CLI' ) { - print "##<< $type\n$data\n" if $debug; + print "##<< $type $seq_nr\n$data\n" if $debug; 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 ) if ( $ant_flashing->{$ant} );