--- mdap-server.pl 2007/11/18 01:29:04 67 +++ mdap-server.pl 2007/11/18 10:36:30 71 @@ -101,6 +101,12 @@ return $hash; } +sub _dump_data { + my $data = shift; + $data =~ s/\s+/ /gs; + return substr($data,0,150); +} + sub mdap_send { my $data = shift; @@ -112,8 +118,7 @@ if ($debug) { warn ">> ${GROUP}:${PORT} >> ", dump( $data ), $/; } elsif( ! $quiet ) { - $data =~ s/\s+/ /gi; - warn ">> ", substr($data,0,70), $/; + warn ">> ",_dump_data($data),$/; } } @@ -194,7 +199,7 @@ my $client_version = $h->{'MDAP-VERSION'}; $mdap_ver = $client_version if ($client_version); - print "<< $type $proto/$mdap_ver << ", length($data), " bytes\n" unless $quiet; + print "<< $type $proto/$mdap_ver << ", length($data), " bytes: ",_dump_data($data),$/ unless $quiet; warn dump( $data, $h ),$/ if ($debug); @@ -203,7 +208,7 @@ next if ( $type =~ m#^(INFO|ANT-SEARCH|EXEC-CLI)# ); 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 ); @@ -231,12 +236,12 @@ my $build = $h->{'_BUILD'} || die "no _BUILD?"; my $new_build = fw_build( $board ); if ( $build ne $new_build ) { - print "+ $ant version $build -> $new_build\n"; + print "+ $ant $board 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}++; next; } else { - once "$ant OK version $build", + once "$ant $board OK version $build", $ant_unknown_password->{$ant} ? ' with unknown password' : $ant_passwd->{$ant} ? ' password protected' : ''; @@ -251,10 +256,10 @@ $count++; } keys %$ant_flashing; if ($waiting == 0) { - status "ALL $count ANTS FLASHED to $build\n"; + status "ALL $count ANTS FLASHED\n"; $ant_flashing = undef; } else { - status "$waiting of $count ants still flasing upto $build\n"; + status "$waiting of $count ants still flasing\n"; } } @@ -263,7 +268,7 @@ warn "## calling $plugin\n" if $debug; if ( my $command = $plugin->check( $h ) ) { - warn ">> $plugin $ant ", + warn ">> $plugin $ant $board ", $h->{'ANT-NAME'}, " ", $h->{'_BUILD'}, " ", "\t:$command\n"; @@ -279,7 +284,7 @@ } } 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} );