From: iceman1001 Date: Wed, 18 Jan 2017 21:54:27 +0000 (+0100) Subject: ADD: T55XX_WRITE_TIMEOUT to make sure all WaitForResponseTimeout for t55xx behaves... X-Git-Url: http://cvs.zerfleddert.de/cgi-bin/gitweb.cgi/proxmark3-svn/commitdiff_plain/42c235e7efdac01da7e7ef3e4e442557fe50198d ADD: T55XX_WRITE_TIMEOUT to make sure all WaitForResponseTimeout for t55xx behaves the same. CHG: removed some "DONE!" device prints.. CHG: unified some "clone" commands output. --- diff --git a/armsrc/lfops.c b/armsrc/lfops.c index 1b922ca0..71d9ba95 100644 --- a/armsrc/lfops.c +++ b/armsrc/lfops.c @@ -1369,7 +1369,7 @@ void CopyHIDtoT55x7(uint32_t hi2, uint32_t hi, uint32_t lo, uint8_t longFMT) { data[4] = manchesterEncode2Bytes(hi & 0xFFFF); data[5] = manchesterEncode2Bytes(lo >> 16); data[6] = manchesterEncode2Bytes(lo & 0xFFFF); - } else { + } else { // Ensure no more than 44 bits supplied if (hi > 0xFFF) { DbpString("Tags can only have 44 bits."); @@ -1389,13 +1389,8 @@ void CopyHIDtoT55x7(uint32_t hi2, uint32_t hi, uint32_t lo, uint8_t longFMT) { // data[0] = (((50-2)/2)< #include #include "proxmark3.h" -#include "lfdemod.h" - +#include "lfdemod.h" // device/client demods of LF signals #include "util.h" // for parsing cli command utils #include "ui.h" // for show graph controls #include "graph.h" // for graph data @@ -41,6 +40,9 @@ #include "cmdlfvisa2000.h" // for VISA2000 menu #include "cmdlfnoralsy.h" // for NORALSY meny #include "cmdlffdx.h" // for FDX-B meny + +#define T55XX_WRITE_TIMEOUT 1500 + int CmdLF(const char *Cmd); int CmdLFCommandRead(const char *Cmd); diff --git a/client/cmdlfawid.c b/client/cmdlfawid.c index 8b04a3d6..a323f52b 100644 --- a/client/cmdlfawid.c +++ b/client/cmdlfawid.c @@ -313,7 +313,7 @@ int CmdAWIDClone(const char *Cmd) { c.arg[1] = i; clearCommandBuffer(); SendCommand(&c); - if (!WaitForResponseTimeout(CMD_ACK, &resp, 1500)){ + if (!WaitForResponseTimeout(CMD_ACK, &resp, T55XX_WRITE_TIMEOUT)){ PrintAndLog("Error occurred, device did not respond during write operation."); return -1; } diff --git a/client/cmdlffdx.c b/client/cmdlffdx.c index 511806dd..0e6b43f4 100644 --- a/client/cmdlffdx.c +++ b/client/cmdlffdx.c @@ -250,7 +250,7 @@ int CmdFdxClone(const char *Cmd) { c.arg[1] = i; clearCommandBuffer(); SendCommand(&c); - if (!WaitForResponseTimeout(CMD_ACK, &resp, 1000)){ + if (!WaitForResponseTimeout(CMD_ACK, &resp, T55XX_WRITE_TIMEOUT)){ PrintAndLog("Error occurred, device did not respond during write operation."); return -1; } diff --git a/client/cmdlfguard.c b/client/cmdlfguard.c index 43492678..d9010a19 100644 --- a/client/cmdlfguard.c +++ b/client/cmdlfguard.c @@ -6,8 +6,7 @@ //----------------------------------------------------------------------------- // Low frequency Farpoint / Pyramid tag commands //----------------------------------------------------------------------------- -#include -#include + #include "cmdlfguard.h" static int CmdHelp(const char *Cmd); @@ -40,7 +39,6 @@ int usage_lf_guard_sim(void) { return 0; } - // Works for 26bits. int GetGuardBits(uint32_t fc, uint32_t cn, uint8_t *guardBits) { @@ -50,8 +48,6 @@ int GetGuardBits(uint32_t fc, uint32_t cn, uint8_t *guardBits) { //uint8_t xorKey = rand() % 0xFF; uint8_t xorKey = 0x66; uint8_t i; - - uint8_t pre[96]; memset(pre, 0x00, sizeof(pre)); @@ -122,7 +118,7 @@ int GetGuardBits(uint32_t fc, uint32_t cn, uint8_t *guardBits) { int CmdGuardRead(const char *Cmd) { CmdLFRead("s"); - getSamples("20000", TRUE); + getSamples("12000", TRUE); return CmdG_Prox_II_Demod(""); } @@ -161,7 +157,7 @@ int CmdGuardClone(const char *Cmd) { PrintAndLog("Blk | Data "); PrintAndLog("----+------------"); for ( i = 0; i<4; ++i ) - PrintAndLog(" %02d | %08x", i, blocks[i]); + PrintAndLog(" %02d | 0x%08x", i, blocks[i]); UsbCommand resp; UsbCommand c = {CMD_T55XX_WRITE_BLOCK, {0,0,0}}; @@ -171,7 +167,7 @@ int CmdGuardClone(const char *Cmd) { c.arg[1] = i; clearCommandBuffer(); SendCommand(&c); - if (!WaitForResponseTimeout(CMD_ACK, &resp, 1000)){ + if (!WaitForResponseTimeout(CMD_ACK, &resp, T55XX_WRITE_TIMEOUT)){ PrintAndLog("Error occurred, device did not respond during write operation."); return -1; } diff --git a/client/cmdlfguard.h b/client/cmdlfguard.h index 68ab8f2b..63b28789 100644 --- a/client/cmdlfguard.h +++ b/client/cmdlfguard.h @@ -8,6 +8,8 @@ //----------------------------------------------------------------------------- #ifndef CMDLFGUARD_H__ #define CMDLFGUARD_H__ +#include +#include #include "proxmark3.h" #include "ui.h" #include "util.h" diff --git a/client/cmdlfjablotron.c b/client/cmdlfjablotron.c index 7852508d..508886d5 100644 --- a/client/cmdlfjablotron.c +++ b/client/cmdlfjablotron.c @@ -180,7 +180,7 @@ int CmdJablotronClone(const char *Cmd) { c.arg[1] = i; clearCommandBuffer(); SendCommand(&c); - if (!WaitForResponseTimeout(CMD_ACK, &resp, 1000)){ + if (!WaitForResponseTimeout(CMD_ACK, &resp, T55XX_WRITE_TIMEOUT)){ PrintAndLog("Error occurred, device did not respond during write operation."); return -1; } diff --git a/client/cmdlfnedap.c b/client/cmdlfnedap.c index ab34d8ff..21d47fb9 100644 --- a/client/cmdlfnedap.c +++ b/client/cmdlfnedap.c @@ -254,7 +254,7 @@ int CmdLFNedapClone(const char *Cmd) { c.arg[1] = i; clearCommandBuffer(); SendCommand(&c); - if (!WaitForResponseTimeout(CMD_ACK, &resp, 1000)){ + if (!WaitForResponseTimeout(CMD_ACK, &resp, T55XX_WRITE_TIMEOUT)){ PrintAndLog("Error occurred, device did not respond during write operation."); return -1; } diff --git a/client/cmdlfnoralsy.c b/client/cmdlfnoralsy.c index f859bae9..96c43655 100644 --- a/client/cmdlfnoralsy.c +++ b/client/cmdlfnoralsy.c @@ -184,7 +184,7 @@ int CmdNoralsyClone(const char *Cmd) { c.arg[1] = i; clearCommandBuffer(); SendCommand(&c); - if (!WaitForResponseTimeout(CMD_ACK, &resp, 1000)){ + if (!WaitForResponseTimeout(CMD_ACK, &resp, T55XX_WRITE_TIMEOUT)){ PrintAndLog("Error occurred, device did not respond during write operation."); return -1; } diff --git a/client/cmdlfpresco.c b/client/cmdlfpresco.c index 36f99107..47ff7db3 100644 --- a/client/cmdlfpresco.c +++ b/client/cmdlfpresco.c @@ -116,13 +116,12 @@ int GetPrescoBits(uint32_t fullcode, uint8_t *prescoBits) { //see ASKDemod for what args are accepted int CmdPrescoDemod(const char *Cmd) { bool st = true; - if (!ASKDemod_ext("32 0 0", FALSE, FALSE, 1, &st)) { if (g_debugMode) PrintAndLog("DEBUG: Error Presco ASKDemod failed"); return 0; } size_t size = DemodBufferLen; - //call lfdemod.c demod for Viking + //call lfdemod.c demod for Presco int ans = PrescoDemod(DemodBuffer, &size); if (ans < 0) { if (g_debugMode){ @@ -163,7 +162,7 @@ int CmdPrescoRead(const char *Cmd) { // read lf silently CmdLFRead("s"); // get samples silently - getSamples("20000", TRUE); + getSamples("12000", TRUE); // demod and output Presco ID return CmdPrescoDemod(Cmd); } @@ -174,7 +173,7 @@ int CmdPrescoClone(const char *Cmd) { bool Q5 = false; uint32_t sitecode=0, usercode=0, fullcode=0; - uint32_t blocks[5] = {T55x7_MODULATION_MANCHESTER | T55x7_BITRATE_RF_32 | 4<