From: Dobrica Pavlinusic Date: Mon, 20 Jan 2014 00:27:18 +0000 (-0500) Subject: use librfid-tool from $PATH X-Git-Url: http://git.rot13.org/?a=commitdiff_plain;ds=inline;h=bb5520887c1a9d474688da63e195d14e284bcf1c;p=Biblio-RFID.git use librfid-tool from $PATH --- diff --git a/lib/Biblio/RFID/Reader/librfid.pm b/lib/Biblio/RFID/Reader/librfid.pm index 126d0d5..e4136cc 100644 --- a/lib/Biblio/RFID/Reader/librfid.pm +++ b/lib/Biblio/RFID/Reader/librfid.pm @@ -35,21 +35,10 @@ C sub serial_settings {} # don't open serial -our $bin = '/usr/local/bin/librfid-tool'; - -sub init { - my $self = shift; - if ( -e $bin ) { - warn "# using $bin"; - return 1; - } else { - warn "# no $bin found\n"; - return 0; - } -} +sub init { 1 } sub _grep_tool { - my ( $param, $coderef ) = @_; + my ( $bin, $param, $coderef, $path ) = @_; warn "# _grep_tool $bin $param\n"; open(my $s, '-|', "$bin $param") || die $!; @@ -73,7 +62,7 @@ sub _grep_tool { sub inventory { my @tags; - _grep_tool '--scan' => sub { + _grep_tool 'librfid-tool', '--scan' => sub { my $sid = shift; push @tags, $sid if $sid; }; @@ -85,7 +74,7 @@ sub read_blocks { my $sid; my $blocks; - _grep_tool '--read -1' => sub { + _grep_tool 'librfid-tool', '--read -1' => sub { $sid ||= shift; $blocks->{$sid}->[$1] = hex2bytes($2) if m/block\[\s*(\d+):.+data.+:\s*(.+)/; diff --git a/t/30-librfid.t b/t/30-librfid.t index 6e207e2..c078400 100755 --- a/t/30-librfid.t +++ b/t/30-librfid.t @@ -9,7 +9,7 @@ BEGIN { use_ok( 'Biblio::RFID::Reader::librfid' ); } -ok( my $o = Biblio::RFID::Reader::librfid->new( tool => '/rest/cvs/librfid/utils/librfid-tool' ), 'new' ); +ok( my $o = Biblio::RFID::Reader::librfid->new(), 'new' ); my @tags = $o->inventory; diag 'inventory = ', dump @tags;