From 7d9746003b1e3b2bb9524e013a62d729fd89e371 Mon Sep 17 00:00:00 2001 From: Andrew Johnson Date: Mon, 20 Jul 2020 18:20:45 -0500 Subject: [PATCH] ca: Fix capr.pl to handle missing fields properly When using an EPICS 7 softIoc.dbd file with a PV from an older version of Base which didn't have all the fields, our attempts to read those fields will time out, but the internal logic was buggy. Don't try to print the values of timed out fields at all. The user will still see a warning about connection timeouts at the top. --- modules/ca/src/perl/capr.pl | 15 +++++---------- 1 file changed, 5 insertions(+), 10 deletions(-) diff --git a/modules/ca/src/perl/capr.pl b/modules/ca/src/perl/capr.pl index 21e56ecd9..1e571bec7 100644 --- a/modules/ca/src/perl/capr.pl +++ b/modules/ca/src/perl/capr.pl @@ -280,7 +280,7 @@ sub caget { my $err = (@chans > 1) ? 'some PV(s)' : '"' . $chans[0]->name . '"'; print "Channel connect timed out: $err not found.\n"; foreach my $chan (@chans) { - $timed_out{$chan->name} = $chan->is_connected; + $timed_out{$chan->name} = !$chan->is_connected; } @chans = grep { $_->is_connected } @chans; } else { @@ -346,15 +346,10 @@ sub printRecord { my $field = $fields_pr[$i]; my $fToGet = $readlist[$i]; my ($fType, $data, $base); - if ($timed_out{$fToGet}) { - $fType = $fieldType{DBF_STRING}; - $data = ''; - } - else { - $fType = $ftypes[$i]; - $base = $bases[$i]; - $data = $callback_data{$fToGet}; - } + next if $timed_out{$fToGet}; + $fType = $ftypes[$i]; + $base = $bases[$i]; + $data = $callback_data{$fToGet}; $col = printField($field, $data, $fType, $base, $col); } print("\n"); # Final newline