518 |
|
|
519 |
print "write_tag $tag = ",dump( $data ), " [$len/$blocks] == $hex_data\n"; |
print "write_tag $tag = ",dump( $data ), " [$len/$blocks] == $hex_data\n"; |
520 |
|
|
521 |
|
my $ok = 0; |
522 |
|
|
523 |
cmd( |
cmd( |
524 |
"d6 00 ff 04 $tag 00 $blocks 00 $hex_data BEEF", "write $tag", |
"d6 00 ff 04 $tag 00 $blocks 00 $hex_data BEEF", "write $tag", |
525 |
"d6 00 0d 04 00 $tag $blocks BEEF", sub { assert() }, |
"d6 00 0d 04 00 $tag $blocks BEEF", sub { assert(); $ok++ }, |
526 |
|
"d6 00 0d 04 06 ", sub { |
527 |
|
my $data = shift; |
528 |
|
warn "no tag ",as_hex( substr($data,0,8) ), " in range for write\n"; |
529 |
|
}, |
530 |
); # foreach ( 1 .. 3 ); # XXX 3m software does this three times! |
); # foreach ( 1 .. 3 ); # XXX 3m software does this three times! |
531 |
|
|
532 |
my $to = $path; |
if ( $ok ) { |
|
$to .= '.' . time(); |
|
533 |
|
|
534 |
rename $path, $to; |
my $to = $path; |
535 |
print ">> $to\n"; |
$to .= '.' . time(); |
536 |
|
|
537 |
|
rename $path, $to; |
538 |
|
print ">> $to\n"; |
539 |
|
|
540 |
|
} |
541 |
|
|
542 |
forget_tag $tag; |
forget_tag $tag; |
543 |
} |
} |
548 |
cmd( |
cmd( |
549 |
"d6 00 0c 09 $tag $data BEEF", "secure $tag -> $data", |
"d6 00 0c 09 $tag $data BEEF", "secure $tag -> $data", |
550 |
"d6 00 0c 09 00 $tag BEEF", sub { assert() }, |
"d6 00 0c 09 00 $tag BEEF", sub { assert() }, |
551 |
|
"d6 00 0c 09 06 ", sub { |
552 |
|
my $data = shift; |
553 |
|
warn "no tag ",as_hex( substr($data,0,8) ), " in range for secure\n"; |
554 |
|
}, |
555 |
); |
); |
556 |
|
|
557 |
forget_tag $tag; |
forget_tag $tag; |
726 |
warn "## DISPATCH payload to with rest", dump( $payload, $to, $rest ) if $debug; |
warn "## DISPATCH payload to with rest", dump( $payload, $to, $rest ) if $debug; |
727 |
$dispatch->{ $to }->( $rest ); |
$dispatch->{ $to }->( $rest ); |
728 |
} else { |
} else { |
729 |
die "NO DISPATCH for ",as_hex( $full ),"\n"; |
die "NO DISPATCH for ",as_hex( $full ), " in ", dump( $dispatch ); |
730 |
} |
} |
731 |
|
|
732 |
return $data; |
return $data; |