]> git.zerfleddert.de Git - proxmark3-svn/blobdiff - client/cmdhf14a.c
Merge branch 'graphwork2' into graphwork
[proxmark3-svn] / client / cmdhf14a.c
index cba179ec75cf55ae03a268525f0b0d1d00afb002..812db8ee0d85506630119de580162e2e4884dae4 100644 (file)
@@ -11,6 +11,7 @@
 
 #include <stdio.h>
 #include <stdlib.h>
+#include <inttypes.h>
 #include <string.h>
 #include <unistd.h>
 #include "util.h"
@@ -352,16 +353,16 @@ int CmdHF14AReader(const char *Cmd)
                                                PrintAndLog("                     x0 -> <1 kByte");
                                                break;
                                        case 0x01:
-                                               PrintAndLog("                     x0 -> 1 kByte");
+                                               PrintAndLog("                     x1 -> 1 kByte");
                                                break;
                                        case 0x02:
-                                               PrintAndLog("                     x0 -> 2 kByte");
+                                               PrintAndLog("                     x2 -> 2 kByte");
                                                break;
                                        case 0x03:
-                                               PrintAndLog("                     x0 -> 4 kByte");
+                                               PrintAndLog("                     x3 -> 4 kByte");
                                                break;
                                        case 0x04:
-                                               PrintAndLog("                     x0 -> 8 kByte");
+                                               PrintAndLog("                     x4 -> 8 kByte");
                                                break;
                                }
                                switch (card.ats[pos + 3] & 0xf0) {
@@ -430,7 +431,7 @@ int CmdHF14ACUIDs(const char *Cmd)
        n = n > 0 ? n : 1;
 
        PrintAndLog("Collecting %d UIDs", n);
-       PrintAndLog("Start: %u", time(NULL));
+       PrintAndLog("Start: %" PRIu64, msclock()/1000);
        // repeat n times
        for (int i = 0; i < n; i++) {
                // execute anticollision procedure
@@ -453,7 +454,7 @@ int CmdHF14ACUIDs(const char *Cmd)
                        PrintAndLog("%s", uid_string);
                }
        }
-       PrintAndLog("End: %u", time(NULL));
+       PrintAndLog("End: %" PRIu64, msclock()/1000);
 
        return 1;
 }
@@ -490,7 +491,7 @@ int CmdHF14ASim(const char *Cmd)
 
        // Are we handling the (optional) second part uid?
        if (long_uid > 0xffffffff) {
-               PrintAndLog("Emulating ISO/IEC 14443 type A tag with 7 byte UID (%014"llx")",long_uid);
+               PrintAndLog("Emulating ISO/IEC 14443 type A tag with 7 byte UID (%014" PRIx64 ")",long_uid);
                // Store the second part
                c.arg[2] = (long_uid & 0xffffffff);
                long_uid >>= 32;
@@ -569,14 +570,14 @@ int CmdHF14ASnoop(const char *Cmd) {
 int CmdHF14ACmdRaw(const char *cmd) {
     UsbCommand c = {CMD_READER_ISO_14443a, {0, 0, 0}};
     bool reply=1;
-    bool crc = FALSE;
-    bool power = FALSE;
-    bool active = FALSE;
-    bool active_select = FALSE;
+    bool crc = false;
+    bool power = false;
+    bool active = false;
+    bool active_select = false;
     uint16_t numbits = 0;
-       bool bTimeout = FALSE;
+       bool bTimeout = false;
        uint32_t timeout = 0;
-       bool topazmode = FALSE;
+       bool topazmode = false;
     char buf[5]="";
     int i = 0;
     uint8_t data[USB_CMD_DATA_SIZE];
@@ -605,19 +606,19 @@ int CmdHF14ACmdRaw(const char *cmd) {
         if (cmd[i]=='-') {
             switch (cmd[i+1]) {
                 case 'r': 
-                    reply = FALSE;
+                    reply = false;
                     break;
                 case 'c':
-                    crc = TRUE;
+                    crc = true;
                     break;
                 case 'p':
-                    power = TRUE;
+                    power = true;
                     break;
                 case 'a':
-                    active = TRUE;
+                    active = true;
                     break;
                 case 's':
-                    active_select = TRUE;
+                    active_select = true;
                     break;
                 case 'b': 
                     sscanf(cmd+i+2,"%d",&temp);
@@ -627,7 +628,7 @@ int CmdHF14ACmdRaw(const char *cmd) {
                     i-=2;
                     break;
                                case 't':
-                                       bTimeout = TRUE;
+                                       bTimeout = true;
                                        sscanf(cmd+i+2,"%d",&temp);
                                        timeout = temp;
                                        i+=3;
@@ -635,7 +636,7 @@ int CmdHF14ACmdRaw(const char *cmd) {
                                        i-=2;
                                        break;
                 case 'T':
-                                       topazmode = TRUE;
+                                       topazmode = true;
                                        break;
                 default:
                     PrintAndLog("Invalid option");
@@ -696,14 +697,17 @@ int CmdHF14ACmdRaw(const char *cmd) {
                c.arg[2] = 13560000 / 1000 / (8*16) * timeout; // timeout in ETUs (time to transfer 1 bit, approx. 9.4 us)
        }
 
-    if(power)
+    if(power) {
         c.arg[0] |= ISO14A_NO_DISCONNECT;
+    }
 
-       if(datalen > 0)
+       if(datalen > 0) {
         c.arg[0] |= ISO14A_RAW;
+    }
 
-       if(topazmode)
+       if(topazmode) {
                c.arg[0] |= ISO14A_TOPAZMODE;
+    }
                
        // Max buffer is USB_CMD_DATA_SIZE
     c.arg[1] = (datalen & 0xFFFF) | (numbits << 16);
Impressum, Datenschutz