From 2e6309413e432b7fe070cd4dbc81ee6940202444 Mon Sep 17 00:00:00 2001 From: Michal Sojka Date: Mon, 24 Nov 2014 10:53:51 +0100 Subject: [PATCH] Warn when multiple target connection options are given MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit 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 | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/novaboot b/novaboot index 23b853a..c2e391e 100755 --- 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"; -- 2.39.2