File: dump_tag_blocks.pl

package info (click to toggle)
libhipi-perl 0.93-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 20,048 kB
  • sloc: perl: 471,917; ansic: 22; makefile: 10
file content (27 lines) | stat: -rwxr-xr-x 676 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
#!/usr/bin/perl
use strict;
use warnings;
use HiPi qw( :rpi :mfrc522);
use HiPi::Interface::MFRC522;

my $resetpin = RPI_PIN_38; # the pin connected to reset

my $rfid = HiPi::Interface::MFRC522->new( reset_pin => $resetpin, devicename => '/dev/spidev0.1' );

$rfid->scan( \&handle_scan );

sub handle_scan {
    my $continue = 1;
    my( $uid, $uidstring) = @_;
    print qq(\nReading Tag UID $uidstring Blocks\n);
    print qq(   do not remove tag from field ....\n);
    my $output = $rfid->picc_dump_tag_info( $uid );
    print $output;
    # set the card inactive
    $rfid->picc_end_session;
    print qq(\nTag $uidstring read complete\n\n);
    return $continue;
}


1;