try to reset openpcd if mifare-read starts outputting nonsense
[svn42.git] / checkcard.pl
index fb576be..082b638 100755 (executable)
@@ -47,9 +47,14 @@ while (sleep 1)
 
   read_keys() unless ($keys_last_read == -M ($keysfile));
 
-       while (<$fh>)
+  READLOOP: while (<$fh>)
        {
-               next unless /UID/;
+               unless (/UID/)
+    {
+      close($fh);
+      system("/flash/tuer/reset_openpcd.sh");
+      last READLOOP;
+    }
                my ($id) = /UID=(\S+)\s+/;
                if ($good{$id})
                {