]> git.cryptolib.org Git - avr-crypto-lib.git/blobdiff - host/get_test.rb
moving from uart to cli
[avr-crypto-lib.git] / host / get_test.rb
index 2a12de1334459d73e81297980b504c7c57f2decc..0c3eb1bea1ae0e8a2c5a466fcffd27fb860e8de5 100644 (file)
 
 require 'serialport'
 
-def read_line
+def read_line(error_msg=true)
   s = $sp.gets()
   if s==nil
-    puts "ERROR: read timeout!\n";
+    puts("ERROR: read timeout!\n") if error_msg
        return nil
   end  
   s.gsub(/\006/, '');  
@@ -36,7 +36,7 @@ def readTestVector(param)
   set=0;
   vector=0;
   begin
-    lb = read_line()
+    lb = read_line(false)
        if (m=/unknown command/.match(lb) || m=/[Ee][Rr]{2}[Oo][Rr]/.match(lb))
       puts("ERROR: "+lb);
       exit(2);
@@ -111,7 +111,7 @@ param=(ARGV.size>=7)?ARGV[6]:"";
 puts("\nPort: "+ARGV[0]+ "@"+ARGV[1]+" "+ARGV[2]+"N"+ARGV[3]+"\n");
 $linewidth = 16
 $sp = SerialPort.new(ARGV[0], ARGV[1].to_i, ARGV[2].to_i, ARGV[3].to_i, SerialPort::NONE);
-$sp.read_timeout=1*60*1000; # 5 minutes
+$sp.read_timeout=1000; # 1 secound
 $extended_wait=100;
 $sp.write(command);