read length and header (3 bytes) until done
authorDobrica Pavlinusic <dpavlin@rot13.org>
Tue, 27 Jul 2010 20:23:15 +0000 (22:23 +0200)
committerDobrica Pavlinusic <dpavlin@rot13.org>
Tue, 27 Jul 2010 20:24:00 +0000 (22:24 +0200)
lib/RFID/Serial/3M810.pm

index 41fd380..892c20f 100644 (file)
@@ -62,9 +62,9 @@ sub cmd {
 
        my $r_len = $port->read(3);
 
-       while ( ! $r_len ) {
+       while ( length($r_len) < 3 ) {
                wait_device;
-               $r_len = $port->read(3);
+               $r_len = $port->read( 3 - length($r_len) );
        }
 
        wait_device;