projects
/
Biblio-RFID.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
| inline |
side by side
(parent:
f044017
)
ensure that all blocks are read before returing data
author
Dobrica Pavlinusic
<dpavlin@rot13.org>
Thu, 13 Feb 2014 11:14:52 +0000
(12:14 +0100)
committer
Dobrica Pavlinusic
<dpavlin@rot13.org>
Thu, 13 Feb 2014 11:14:52 +0000
(12:14 +0100)
lib/Biblio/RFID/Reader/librfid.pm
patch
|
blob
|
history
diff --git
a/lib/Biblio/RFID/Reader/librfid.pm
b/lib/Biblio/RFID/Reader/librfid.pm
index
8f6a96d
..
44afc28
100644
(file)
--- a/
lib/Biblio/RFID/Reader/librfid.pm
+++ b/
lib/Biblio/RFID/Reader/librfid.pm
@@
-158,6
+158,13
@@
sub read_blocks {
$blocks->{$sid}->[$1] = hex2bytes($2)
if m/page=(\d+).*data=\s*(.+)/;
};
+
+ my $blocks_read = 0;
+ $blocks_read += $_ foreach grep { defined $blocks->{$sid}->[$_] } ( 4 .. 6 );
+ if ( $blocks_read < (4 + 5 + 6) ) {
+ warn "# invalidate partial read of SmartX card\n";
+ $blocks = undef;
+ }
}
warn "# read_blocks ",dump($blocks);
return $blocks;