X-Git-Url: http://git.zerfleddert.de/cgi-bin/gitweb.cgi/proxmark3-svn/blobdiff_plain/710208245b42f91db9dcad5a32232c9d280d80a7..2c5ed706511e60aacc291bc4c47d0efe1892596c:/client/cmdlft55xx.c diff --git a/client/cmdlft55xx.c b/client/cmdlft55xx.c index 5ecf290a..aec47dc0 100644 --- a/client/cmdlft55xx.c +++ b/client/cmdlft55xx.c @@ -26,8 +26,6 @@ #define LF_TRACE_BUFF_SIZE 20000 // 32 x 32 x 10 (32 bit times numofblock (7), times clock skip..) #define LF_BITSSTREAM_LEN 1000 // more then 1000 bits shouldn't happend.. 8block * 4 bytes * 8bits = - - // Default configuration: ASK, not inversed. t55xx_conf_block_t config = { .modulation = 2, .inversed = FALSE, .block0 = 0x00}; @@ -219,6 +217,9 @@ void DecodeT55xxBlock(){ char buf[6] = {0x00}; char *cmdStr = buf; + // clearing the DemodBuffer. + DemodBufferLen = 0x00; + // use the configuration switch( config.modulation ){ case 1: @@ -285,59 +286,59 @@ bool tryDetectModulation(){ if (GetFskClock("", FALSE, FALSE)){ if ( FSKrawDemod("0 0", FALSE) && test()){ - tests[hits].modulation = 1; - tests[hits].inversed = 0; + tests[hits].modulation = DEMOD_FSK; + tests[hits].inversed = FALSE; ++hits; } if ( FSKrawDemod("0 1", FALSE) && test()) { - tests[hits].modulation = 1; - tests[hits].inversed = 1; + tests[hits].modulation = DEMOD_FSK; + tests[hits].inversed = TRUE; ++hits; } } else { if ( ASKmanDemod("0 0 1", FALSE, FALSE) && test()) { - tests[hits].modulation = 2; - tests[hits].inversed = 0; + tests[hits].modulation = DEMOD_ASK; + tests[hits].inversed = FALSE; ++hits; } if ( ASKmanDemod("0 1 1", FALSE, FALSE) && test()) { - tests[hits].modulation = 2; - tests[hits].inversed = 1; + tests[hits].modulation = DEMOD_ASK; + tests[hits].inversed = TRUE; ++hits; } if ( NRZrawDemod("0 0 1", FALSE) && test()) { - tests[hits].modulation = 3; - tests[hits].inversed = 0; + tests[hits].modulation = DEMOD_NZR; + tests[hits].inversed = FALSE; ++hits; } if ( NRZrawDemod("0 1 1", FALSE) && test()) { - tests[hits].modulation = 3; - tests[hits].inversed = 1; + tests[hits].modulation = DEMOD_NZR; + tests[hits].inversed = TRUE; ++hits; } - if ( PSKDemod("0 0 1", FALSE) && test()) { - tests[hits].modulation = 4; - tests[hits].inversed = 0; + if ( PSKDemod("0 0 1", FALSE) >= 0 && test()) { + tests[hits].modulation = DEMOD_PSK; + tests[hits].inversed = FALSE; ++hits; } - if ( PSKDemod("0 1 1", FALSE) && test()) { - tests[++hits].modulation = 4; - tests[hits].inversed = 1; + if ( PSKDemod("0 1 1", FALSE) >= 0 && test()) { + tests[hits].modulation = DEMOD_PSK; + tests[hits].inversed = TRUE; ++hits; } //PSK2? // if (!BiphaseRawDecode("0",FALSE) && test()) { - // tests[++hits].modulation = 5; - // tests[hits].inversed = 0; + // tests[++hits].modulation = DEMOD_BI; + // tests[hits].inversed = FALSE; //} // if (!BiphaseRawDecode("1",FALSE) && test()) { - // tests[++hits].modulation = 5; - // tests[hits].inversed = 1; + // tests[++hits].modulation = DEMOD_BI; + // tests[hits].inversed = TRUE; // } } if ( hits == 1) { @@ -350,6 +351,7 @@ bool tryDetectModulation(){ if ( hits > 1) { PrintAndLog("Found [%d] possible matches for modulation.",hits); for(int i=0; i