From: Michal Sojka Date: Tue, 9 Dec 2014 09:17:53 +0000 (+0100) Subject: Flush serial line output after reset X-Git-Tag: 20141209~1 X-Git-Url: https://rtime.felk.cvut.cz/gitweb/novaboot.git/commitdiff_plain/f442e299038ddee58d295b5117ab1e0d34d18306?hp=a873f04a2e4d661387123f2bedab2551e71ad175 Flush serial line output after reset This caused some problems when novaboot was used in other scripts and those scripts looked for certain strings in novaboot output. It happened that the string was found in the output before reset and therefore, the whole thing didn't work correctly. --- diff --git a/novaboot b/novaboot index bd81271..e3e084e 100755 --- a/novaboot +++ b/novaboot @@ -1023,6 +1023,20 @@ if (defined $target_reset && $reset) { print STDERR "novaboot: Reseting the test box... "; &$target_reset(); print STDERR "done\n"; + if (defined $exp) { + # We don't want to output anything printed by the target + # before reset so we clear the buffers now. This is, however, + # not ideal because we may loose some data that were sent + # after the reset. If this is a problem, one should reset and + # connect to serial line in atomic manner. For example, if + # supported by hardware, use --remote-cmd 'sterm -d ...' and + # do not use separate --reset-cmd. + my $log = $exp->log_stdout; + $exp->log_stdout(0); + $exp->expect(0); # Read data from target + $exp->clear_accum(); # Clear the read data + $exp->log_stdout($log); + } } ### U-boot conversation