]> git.zerfleddert.de Git - proxmark3-svn/blobdiff - client/cmdhf14b.c
CHG: some textual change and some syntax suger changes.
[proxmark3-svn] / client / cmdhf14b.c
index 05572a3b7993f514a0c001a1ba500ccac7cc97b0..f6692bac747e8606a4109ec007e64ceea000ebe6 100644 (file)
@@ -14,6 +14,7 @@
 #include <stdint.h>
 #include "cmdhf14b.h"
 
+#define TIMEOUT 2000
 static int CmdHelp(const char *Cmd);
 
 int usage_hf_14b_info(void){
@@ -209,19 +210,24 @@ int CmdHF14BCmdRaw (const char *Cmd) {
 }
 
 // print full atqb info
+// bytes
+// 0,1,2,3 = application data
+// 4       = bit rate capacity
+// 5       = max frame size / -4 info
+// 6       = FWI / Coding options
 static void print_atqb_resp(uint8_t *data, uint8_t cid){
-       //PrintAndLog ("           UID: %s", sprint_hex(data+1,4));
-       PrintAndLog ("      App Data: %s", sprint_hex(data,4));
-       PrintAndLog ("      Protocol: %s", sprint_hex(data+4,3));
+       //PrintAndLog("           UID: %s", sprint_hex(data+1,4));
+       PrintAndLog("      App Data: %s", sprint_hex(data,4));
+       PrintAndLog("      Protocol: %s", sprint_hex(data+4,3));
        uint8_t BitRate = data[4];
-       if (!BitRate) PrintAndLog ("      Bit Rate: 106 kbit/s only PICC <-> PCD");
-       if (BitRate & 0x10)     PrintAndLog ("      Bit Rate: 212 kbit/s PICC -> PCD supported");
-       if (BitRate & 0x20)     PrintAndLog ("      Bit Rate: 424 kbit/s PICC -> PCD supported"); 
-       if (BitRate & 0x40)     PrintAndLog ("      Bit Rate: 847 kbit/s PICC -> PCD supported"); 
-       if (BitRate & 0x01)     PrintAndLog ("      Bit Rate: 212 kbit/s PICC <- PCD supported");
-       if (BitRate & 0x02)     PrintAndLog ("      Bit Rate: 424 kbit/s PICC <- PCD supported"); 
-       if (BitRate & 0x04)     PrintAndLog ("      Bit Rate: 847 kbit/s PICC <- PCD supported"); 
-       if (BitRate & 0x80)     PrintAndLog ("                Same bit rate <-> required");
+       if (!BitRate) PrintAndLog("      Bit Rate: 106 kbit/s only PICC <-> PCD");
+       if (BitRate & 0x10)     PrintAndLog("      Bit Rate: 212 kbit/s PICC -> PCD supported");
+       if (BitRate & 0x20)     PrintAndLog("      Bit Rate: 424 kbit/s PICC -> PCD supported"); 
+       if (BitRate & 0x40)     PrintAndLog("      Bit Rate: 847 kbit/s PICC -> PCD supported"); 
+       if (BitRate & 0x01)     PrintAndLog("      Bit Rate: 212 kbit/s PICC <- PCD supported");
+       if (BitRate & 0x02)     PrintAndLog("      Bit Rate: 424 kbit/s PICC <- PCD supported"); 
+       if (BitRate & 0x04)     PrintAndLog("      Bit Rate: 847 kbit/s PICC <- PCD supported"); 
+       if (BitRate & 0x80)     PrintAndLog("                Same bit rate <-> required");
 
        uint16_t maxFrame = data[5]>>4;
        if (maxFrame < 5)               maxFrame = 8 * maxFrame + 16;
@@ -231,17 +237,28 @@ static void print_atqb_resp(uint8_t *data, uint8_t cid){
        else if (maxFrame == 8) maxFrame = 256;
        else maxFrame = 257;
 
-       PrintAndLog ("Max Frame Size: %u%s",maxFrame, (maxFrame == 257) ? "+ RFU" : "");
+
+       
+       PrintAndLog("Max Frame Size: %u%s bytes",maxFrame, (maxFrame == 257) ? "+ RFU" : "");
 
        uint8_t protocolT = data[5] & 0xF;
-       PrintAndLog (" Protocol Type: Protocol is %scompliant with ISO/IEC 14443-4",(protocolT) ? "" : "not " );
-       PrintAndLog ("Frame Wait Int: %u", data[6]>>4);
-       PrintAndLog (" App Data Code: Application is %s",(data[6]&4) ? "Standard" : "Proprietary");
-       PrintAndLog (" Frame Options: NAD is %ssupported",(data[6]&2) ? "" : "not ");
-       PrintAndLog (" Frame Options: CID is %ssupported",(data[6]&1) ? "" : "not ");
-       PrintAndLog ("Tag :");
-       PrintAndLog ("  Max Buf Length: %u (MBLI) %s",cid>>4, (cid & 0xF0) ? "" : "not supported");
-       PrintAndLog ("  Cid : %u", cid & 0x0f);
+       PrintAndLog(" Protocol Type: Protocol is %scompliant with ISO/IEC 14443-4",(protocolT) ? "" : "not " );
+       
+       uint8_t fwt = data[6]>>4;
+       if ( fwt < 16 ){
+               uint32_t etus = (32 << fwt);
+               uint32_t fwt_time = (302 << fwt);
+               PrintAndLog("Frame Wait Integer: %u - %u ETUs | %u µS", fwt, etus, fwt_time);
+       } else {
+               PrintAndLog("Frame Wait Integer: %u - RFU", fwt);
+       }
+       
+       PrintAndLog(" App Data Code: Application is %s",(data[6]&4) ? "Standard" : "Proprietary");
+       PrintAndLog(" Frame Options: NAD is %ssupported",(data[6]&2) ? "" : "not ");
+       PrintAndLog(" Frame Options: CID is %ssupported",(data[6]&1) ? "" : "not ");
+       PrintAndLog("Tag :");
+       PrintAndLog("  Max Buf Length: %u (MBLI) %s", cid>>4, (cid & 0xF0) ? "" : "chained frames not supported");
+       PrintAndLog("  CDI : %u", cid & 0x0f);
        return;
 }
 
@@ -351,7 +368,7 @@ bool HF14B_ST_Info(bool verbose){
        SendCommand(&c);
        UsbCommand resp;
 
-       if (!WaitForResponseTimeout(CMD_ACK, &resp, 1000)) {
+       if (!WaitForResponseTimeout(CMD_ACK, &resp, TIMEOUT)) {
                if (verbose) PrintAndLog("timeout while waiting for reply.");
                return FALSE;
     }
@@ -425,7 +442,7 @@ bool HF14B_ST_Reader(bool verbose){
        SendCommand(&c);
        UsbCommand resp;
        
-       if (!WaitForResponseTimeout(CMD_ACK, &resp, 1000)) {
+       if (!WaitForResponseTimeout(CMD_ACK, &resp, TIMEOUT)) {
                if (verbose) PrintAndLog("timeout while waiting for reply.");
                return FALSE;
     }
@@ -469,7 +486,7 @@ bool HF14B_Std_Reader(bool verbose){
        SendCommand(&c);
        UsbCommand resp;
        
-       if (!WaitForResponseTimeout(CMD_ACK, &resp, 1000)) {
+       if (!WaitForResponseTimeout(CMD_ACK, &resp, TIMEOUT)) {
                if (verbose) PrintAndLog("timeout while waiting for reply.");
                return FALSE;
     }
@@ -814,7 +831,7 @@ bool waitCmd(bool verbose) {
        uint16_t len = 0;       
     UsbCommand resp;
 
-    if (WaitForResponseTimeout(CMD_ACK, &resp, 2000)) {
+    if (WaitForResponseTimeout(CMD_ACK, &resp, TIMEOUT)) {
 
                status = (resp.arg[0] & 0xFFFF);
                if ( status > 0 ) return FALSE;
Impressum, Datenschutz