From f2ad37aa00a03e8a95eed38f031f22301834a2eb Mon Sep 17 00:00:00 2001 From: Chris Date: Wed, 4 Jul 2018 14:33:59 +0200 Subject: [PATCH] chg: hexlen is half size.. --- client/cmdanalyse.c | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/client/cmdanalyse.c b/client/cmdanalyse.c index fcaf144e8..4261da253 100644 --- a/client/cmdanalyse.c +++ b/client/cmdanalyse.c @@ -477,6 +477,7 @@ int CmdAnalyseA(const char *Cmd){ switch (tolower(param_getchar(Cmd, cmdp))) { case 'd': param_gethex_ex(Cmd, cmdp+1, data, &hexlen); + hexlen >>= 1; if ( hexlen != sizeof(data) ) { PrintAndLogEx(WARNING, "Read %d bytes of %u", hexlen, sizeof(data) ); } @@ -493,13 +494,21 @@ int CmdAnalyseA(const char *Cmd){ //Validations if (errors || cmdp == 0 ) return usage_analyse_checksum(); -// for testing of smart card. Sending raw bytes. + // for testing of smart card. Sending raw bytes. UsbCommand c = {CMD_SMART_SEND, {0, 0, 0}}; c.arg[0] = hexlen; memcpy(c.d.asBytes, data, hexlen ); clearCommandBuffer(); SendCommand(&c); + + // reading response from smart card + UsbCommand resp; + if (!WaitForResponseTimeout(CMD_ACK, &resp, 2500)) { + PrintAndLogEx(WARNING, "smart card response failed"); + return 1; + } + PrintAndLogEx(SUCCESS,"resp: %s", sprint_hex(resp.d.asBytes, resp.arg[0])); return 0; PrintAndLogEx(NORMAL, "-- " _BLUE_(its my message) "\n");