]> rtime.felk.cvut.cz Git - novaboot.git/commitdiff
Always use bi-direction target communication
authorMichal Sojka <sojkam1@fel.cvut.cz>
Tue, 2 Dec 2014 14:50:24 +0000 (15:50 +0100)
committerMichal Sojka <sojkam1@fel.cvut.cz>
Tue, 2 Dec 2014 14:50:24 +0000 (15:50 +0100)
I don't remember what was the reason for setting up bi-directional
interaction only when on terminal. It seems, it is useful to have also
when not on terminal - for example when running under socat.

With this change, I'm able to use novaboot with socat to load u-boot
to the target using X-modem protocol:

    socat EXEC:"novaboot -t mytarget --no-uboot --no-reset /dev/null" EXEC:"sx -kbvv -t 10 ./images/u-boot-spl.bin"

novaboot

index 90b709631638f196250f4dbb73f38c7db1146d50..9cc5e1b3640b056cd1ad1e29bf86304239e2ade2 100755 (executable)
--- a/novaboot
+++ b/novaboot
@@ -1107,28 +1107,25 @@ if ($interaction && defined $exp) {
     if ($interactive && !@exiton) {
        $interrupt = '"~~."';
     }
     if ($interactive && !@exiton) {
        $interrupt = '"~~."';
     }
-    my $note = (-t STDIN) ? '' : '- only target->host ';
-    print STDERR "novaboot: Serial line interaction $note(press $interrupt to interrupt)...\n";
+    print STDERR "novaboot: Serial line interaction (press $interrupt to interrupt)...\n";
     $exp->log_stdout(1);
     if (@exiton) {
        $exp->expect($exiton_timeout, @expect_raw, @exiton) || die("exiton timeout");
        print STDERR "\n";
     } else {
        my @inputs = ($exp);
     $exp->log_stdout(1);
     if (@exiton) {
        $exp->expect($exiton_timeout, @expect_raw, @exiton) || die("exiton timeout");
        print STDERR "\n";
     } else {
        my @inputs = ($exp);
-       if (-t STDIN) { # Set up bi-directional communication if we run on terminal
-           my $infile = new IO::File;
-           $infile->IO::File::fdopen(*STDIN,'r');
-           my $in_object = Expect->exp_init($infile);
-           $in_object->set_group($exp);
-
-           if ($interactive) {
-               $in_object->set_seq('~~\.', sub { print STDERR "novaboot: Escape sequence detected\r\n"; undef; });
-               $in_object->manual_stty(0);       # Use raw terminal mode
-           } else {
-               $in_object->manual_stty(1);       # Do not modify terminal settings
-           }
-           push(@inputs, $in_object);
+       my $infile = new IO::File;
+       $infile->IO::File::fdopen(*STDIN,'r');
+       my $in_object = Expect->exp_init($infile);
+       $in_object->set_group($exp);
+
+       if ($interactive) {
+           $in_object->set_seq('~~\.', sub { print STDERR "novaboot: Escape sequence detected\r\n"; undef; });
+           $in_object->manual_stty(0);   # Use raw terminal mode
+       } else {
+           $in_object->manual_stty(1);   # Do not modify terminal settings
        }
        }
+       push(@inputs, $in_object);
        #use Data::Dumper;
        #print Dumper(\@expect_raw);
        $exp->expect(undef, @expect_raw) if @expect_raw;
        #use Data::Dumper;
        #print Dumper(\@expect_raw);
        $exp->expect(undef, @expect_raw) if @expect_raw;