]> git.zerfleddert.de Git - proxmark3-svn/blobdiff - client/cmdsmartcard.c
modify USB communications
[proxmark3-svn] / client / cmdsmartcard.c
index 90a219ab6974572eacf2d5b1e10841f60b7dd4a5..caf33db6a886f76103ae1318f333423d3114486e 100644 (file)
@@ -10,6 +10,7 @@
 #include "cmdsmartcard.h"
 
 #include <ctype.h>
+#include <string.h>
 
 #include "ui.h"
 #include "cmdparser.h"
@@ -311,7 +312,7 @@ static int PrintATR(uint8_t *atr, size_t atrlen) {
        return 0;
 }
 
-static bool smart_getATR(smart_card_atr_t *card)
+bool smart_getATR(smart_card_atr_t *card)
 {
        if (UseAlternativeSmartcardReader) {
                return pcscGetATR(card);
@@ -570,7 +571,7 @@ int ExchangeAPDUSC(uint8_t *APDU, int APDUlen, bool activateCard, bool leaveSign
        }
 
        if (*responselen < 0 ) {
-               return 2;
+               return 1;
        } else {
                return 0;
        }
@@ -804,6 +805,11 @@ static int CmdSmartInfo(const char *Cmd){
                if (!silent) PrintAndLogEx(WARNING, "smart card select failed");
                return 1;
        }
+       
+       if (!card.atr_len) {
+               if (!silent) PrintAndLogEx(ERR, "can't get ATR from a smart card");
+               return 1;
+       }
 
        // print header
        PrintAndLogEx(INFO, "--- Smartcard Information ---------");
@@ -929,7 +935,11 @@ static int CmdSmartSetClock(const char *Cmd){
 
 
 static int CmdSmartList(const char *Cmd) {
-       CmdHFList("7816");
+       if (UseAlternativeSmartcardReader) {
+               CmdHFList("7816 p");
+       } else {
+               CmdHFList("7816");
+       }
        return 0;
 }
 
Impressum, Datenschutz