]> git.zerfleddert.de Git - proxmark3-svn/blobdiff - client/cmdhf14a.c
add: start to support Topaz tags
[proxmark3-svn] / client / cmdhf14a.c
index 744b38758588d27342b229d33b3b5223accc4753..8978f43d379ae90381dc2966528a514bf7cd4668 100644 (file)
@@ -140,7 +140,7 @@ int CmdHF14AReader(const char *Cmd)
        iso14a_card_select_t card;
        memcpy(&card, (iso14a_card_select_t *)resp.d.asBytes, sizeof(iso14a_card_select_t));
 
-       uint64_t select_status = resp.arg[0];           // 0: couldn't read, 1: OK, with ATS, 2: OK, no ATS
+       uint64_t select_status = resp.arg[0];           // 0: couldn't read, 1: OK, with ATS, 2: OK, no ATS, 3: proprietary Anticollision
        
        if(select_status == 0) {
                PrintAndLog("iso14443a card select failed");
@@ -152,6 +152,18 @@ int CmdHF14AReader(const char *Cmd)
                return 0;
        }
 
+       if(select_status == 3) {
+               PrintAndLog("Card doesn't support standard iso14443-3 anticollision");
+               PrintAndLog("ATQA : %02x %02x", card.atqa[1], card.atqa[0]);
+               // disconnect
+               c.arg[0] = 0;
+               c.arg[1] = 0;
+               c.arg[2] = 0;
+               SendCommand(&c);
+               return 0;
+       }
+
+
        PrintAndLog("ATQA : %02x %02x", card.atqa[1], card.atqa[0]);
        PrintAndLog(" UID : %s", sprint_hex(card.uid, card.uidlen));
        PrintAndLog(" SAK : %02x [%d]", card.sak, resp.arg[0]);
@@ -560,7 +572,7 @@ int CmdHF14ACmdRaw(const char *cmd) {
                                        timeout = temp;
                                        i+=3;
                                        while(cmd[i]!=' ' && cmd[i]!='\0') { i++; }
-                                       i+=2;
+                                       i-=2;
                                        break;
                 default:
                     PrintAndLog("Invalid option");
@@ -605,6 +617,7 @@ int CmdHF14ACmdRaw(const char *cmd) {
         if(active)
             c.arg[0] |= ISO14A_NO_SELECT;
     }
+
        if(bTimeout){
            #define MAX_TIMEOUT 40542464        // (2^32-1) * (8*16) / 13560000Hz * 1000ms/s = 
         c.arg[0] |= ISO14A_SET_TIMEOUT;
@@ -612,7 +625,7 @@ int CmdHF14ACmdRaw(const char *cmd) {
             timeout = MAX_TIMEOUT;
             PrintAndLog("Set timeout to 40542 seconds (11.26 hours). The max we can wait for response");
         }
-        c.arg[2] = 13560000 / 1000 / (8*16) * timeout; // timeout in ETUs (time to transfer 1 bit, approx. 9.4 us)
+               c.arg[2] = 13560000 / 1000 / (8*16) * timeout; // timeout in ETUs (time to transfer 1 bit, approx. 9.4 us)
        }
     if(power)
         c.arg[0] |= ISO14A_NO_DISCONNECT;
Impressum, Datenschutz