don't modify echo ATE0
authorDobrica Pavlinusic <dpavlin@rot13.org>
Sun, 29 Jan 2012 12:05:45 +0000 (13:05 +0100)
committerDobrica Pavlinusic <dpavlin@rot13.org>
Sun, 29 Jan 2012 12:05:45 +0000 (13:05 +0100)
at-chat.pl

index 7157a30..0fc9411 100755 (executable)
@@ -35,7 +35,9 @@ sub c {
        print STDERR ">>> $cmd >>> $message\n";
        $port->write("$cmd\r");
 #      $port->write_done(1); # flush
        print STDERR ">>> $cmd >>> $message\n";
        $port->write("$cmd\r");
 #      $port->write_done(1); # flush
-       $port->write_drain;
+#      $port->write_drain;
+       $port->read( length($cmd) + 1 ); # slurp echo
+
        my $ret = $port->read(1);
 again:
        while ( my $c = $port->input ) {
        my $ret = $port->read(1);
 again:
        while ( my $c = $port->input ) {
@@ -49,9 +51,9 @@ again:
        return $ret;
 }
 
        return $ret;
 }
 
-c 'ATE0' => 'echo off';
-#c 'ATZ' => 'reset';
-#
+#c 'ATE0' => 'echo off';
+c 'ATZ' => 'reset';
+
 c 'ATI'  => 'info';
 
 c 'AT+CGMI'  => 'manufacturer';
 c 'ATI'  => 'info';
 
 c 'AT+CGMI'  => 'manufacturer';