Merge branch 'master' into 3M-810
[Biblio-RFID.git] / lib / RFID / Biblio / Reader / 3M810.pm
index 2031d8b..421dd9b 100644 (file)
@@ -36,7 +36,6 @@ use Time::HiRes;
 use Digest::CRC;
 
 sub serial_settings {{
-       device    => "/dev/ttyUSB1", # FIXME comment out before shipping
        baudrate  => "19200",
        databits  => "8",
        parity    => "none",
@@ -75,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);
@@ -92,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',