remove all wait_device since we are using timeouts
authorDobrica Pavlinusic <dpavlin@rot13.org>
Mon, 9 Aug 2010 17:08:49 +0000 (19:08 +0200)
committerDobrica Pavlinusic <dpavlin@rot13.org>
Mon, 9 Aug 2010 17:08:49 +0000 (19:08 +0200)
lib/RFID/Biblio/Reader/3M810.pm

index 9679e68..421dd9b 100644 (file)
@@ -74,10 +74,6 @@ sub checksum {
        pack('n', $crc->digest);
 }
 
-sub wait_device {
-       Time::HiRes::sleep 0.015;
-}
-
 sub cmd {
        my ( $hex, $description, $coderef ) = @_;
        my $bytes = hex2bytes($hex);
@@ -91,26 +87,15 @@ sub cmd {
        warn ">> ", as_hex( $bytes ), "\t\t[$description]\n";
        $port->write( $bytes );
 
-       wait_device;
-
        my $r_len = $port->read(3);
 
        while ( length($r_len) < 3 ) {
-               wait_device;
                $r_len = $port->read( 3 - length($r_len) );
        }
 
-       wait_device;
-
        my $len = ord( substr($r_len,2,1) );
        my $data = $port->read( $len );
 
-       while ( length($data) < $len ) {
-               warn "# short read ", length($data), " < $len\n";
-               wait_device;
-               $data .= $port->read( $len - length($data) );
-       }
-
        warn "<< ", as_hex($r_len,$data),
                ' | ',
                substr($data,-2,2) eq checksum(substr($r_len,1).substr($data,0,-2)) ? 'OK' : 'ERROR',