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:
9eb5891
)
make programming die-proof
author
Dobrica Pavlinusic
<dpavlin@rot13.org>
Mon, 16 Aug 2010 21:31:59 +0000
(23:31 +0200)
committer
Dobrica Pavlinusic
<dpavlin@rot13.org>
Mon, 16 Aug 2010 21:31:59 +0000
(23:31 +0200)
scripts/print.pl
patch
|
blob
|
history
diff --git
a/scripts/print.pl
b/scripts/print.pl
index
a09e0f7
..
f067038
100755
(executable)
--- a/
scripts/print.pl
+++ b/
scripts/print.pl
@@
-59,22
+59,30
@@
while ( $rfid->tags ) {
print_card;
print_card;
+my $programmed;
+
do {
my @visible = $rfid->tags(
enter => sub {
my $tag = shift;
do {
my @visible = $rfid->tags(
enter => sub {
my $tag = shift;
- print localtime()." enter ", tag($tag);
+ print localtime()." enter ", eval { tag($tag) };
+ return if $@;
+
+ if ( ! $programmed->{$tag} ) {
+ my $card = shift @queue;
+ my $number = $card->[0];
+ print "PROGRAM $tag $number\n";
+ $rfid->write_blocks( $tag => RFID::Biblio::RFID501->from_hash({ content => $number }) );
+ $rfid->write_afi( $tag => chr($afi) ) if $afi;
- my $card = shift @queue;
- $rfid->write_blocks( $tag => RFID::Biblio::RFID501->from_hash({ content => $card->[0] }) );
- $rfid->write_afi( $tag => chr($afi) ) if $afi;
+ $programmed->{$tag} = $number;
+ }
},
leave => sub {
my $tag = shift;
},
leave => sub {
my $tag = shift;
- print localtime()." leave ", tag($tag);
- print_card;
+ print_card
if $programmed->{$tag}
;
},
);
},
);
@@
-89,6
+97,7
@@
sub print_card {
my $p = Printer::EVOLIS::Parallel->new( '/dev/usb/lp0' );
print "insert card ", $p->command( 'Si' ),$/;
my $p = Printer::EVOLIS::Parallel->new( '/dev/usb/lp0' );
print "insert card ", $p->command( 'Si' ),$/;
+ sleep 1;
print "eject card ", $p->command( 'Ser' ),$/;
}
print "eject card ", $p->command( 'Ser' ),$/;
}