]> rtime.felk.cvut.cz Git - novaboot.git/commitdiff
Warn when multiple target connection options are given
authorMichal Sojka <sojkam1@fel.cvut.cz>
Mon, 24 Nov 2014 09:53:51 +0000 (10:53 +0100)
committerMichal Sojka <sojkam1@fel.cvut.cz>
Mon, 24 Nov 2014 09:57:01 +0000 (10:57 +0100)
This may be problem when --remote-expect is used, but the expected string
is not produced by all connection methods. Then, --remote-expect will may
cause indefinite blocking. For example, when

   --remote-cmd 'sterm ...' --remote-exepect Connected

is overridedn with --serial ..., then the "Connected" may not be
received.

Since this override may behave correctly in certain cases, we only warn
here.

Thanks to Michal Vokáč for reporting this.

novaboot

index 23b853aecb1d0590f24dd7577b113ef391025582..c2e391ea61c8a5be0cc7c59566df8e7c563a192c 100755 (executable)
--- a/novaboot
+++ b/novaboot
@@ -256,6 +256,16 @@ if ($ider) {
     if (!defined $amt) { die "Error: --ider requires --amt"; }
 }
 
+{
+    my %input_opts = ('--iprelay'    => \$iprelay,
+                     '--serial'     => \$serial,
+                     '--remote-cmd' => \$remote_cmd,
+                     '--amt'        => \$amt);
+    my @opts = grep(defined(${$input_opts{$_}}) , keys %input_opts);
+
+    print STDERR "novaboot: Warning: More than one target connection option: ".join(', ', @opts) if scalar @opts > 1;
+}
+
 # Default options
 if (defined $serial) {
     $serial ||= "/dev/ttyUSB0";