1 package RFID::Biblio::librfid;
6 use base 'RFID::Biblio';
9 use Data::Dump qw(dump);
13 RFID::Biblio::librfid - execute librfid-tool
17 This is wrapper around C<librfid-tool> from
19 L<http://openmrtd.org/projects/librfid/>
21 Due to limitation of C<librfid-tool> only C<inventory> and
22 C<read_blocks> is supported.
24 However, this code might provide template for integration
25 with any command-line utilities for different RFID readers.
29 sub serial_settings {} # don't open serial
31 our $bin = '/rest/cvs/librfid/utils/librfid-tool';
39 warn "# no $bin found\n";
45 my ( $param, $coderef ) = @_;
47 warn "# _grep_tool $bin $param\n";
48 open(my $s, '-|', "$bin $param") || die $!;
54 if ( m/success.+:\s+(.+)/ ) {
57 $sid = uc join('', reverse split(/\s+/, $sid));
69 _grep_tool '--scan' => sub {
71 push @tags, $sid if $sid;
73 warn "# invetory ",dump(@tags);
81 _grep_tool '--read -1' => sub {
83 $blocks->{$sid}->[$1] = hex2bytes($2)
84 if m/block\[\s*(\d+):.+data.+:\s*(.+)/;
87 warn "# read_blocks ",dump($blocks);