/[RFID]/3m-810.pl
This is repository of my old source code which isn't updated any more. Go to git.rot13.org for current projects!
ViewVC logotype

Diff of /3m-810.pl

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 91 by dpavlin, Tue Jul 6 15:05:44 2010 UTC revision 92 by dpavlin, Fri Jul 23 13:16:51 2010 UTC
# Line 518  sub write_tag { Line 518  sub write_tag {
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  06 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  }  }
# Line 538  sub secure_tag_with { Line 548  sub secure_tag_with {
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;
# Line 712  sub readchunk { Line 726  sub readchunk {
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;

Legend:
Removed from v.91  
changed lines
  Added in v.92

  ViewVC Help
Powered by ViewVC 1.1.26