X-Git-Url: http://git.zerfleddert.de/cgi-bin/gitweb.cgi/proxmark3-svn/blobdiff_plain/7b40affb6f7087e116bccff352923834dcdc8d46..710208245b42f91db9dcad5a32232c9d280d80a7:/client/cmdlft55xx.c diff --git a/client/cmdlft55xx.c b/client/cmdlft55xx.c index b303aced..5ecf290a 100644 --- a/client/cmdlft55xx.c +++ b/client/cmdlft55xx.c @@ -26,17 +26,9 @@ #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 = -// 0 = FSK -// 1 = ASK -// 2 = PSK -// 4 = NZR (direct) -typedef struct { - uint8_t modulation; - bool inversed; - uint32_t block0; -} t55xx_conf_block_t; - -// Default configuration: FSK, not inversed. + + +// Default configuration: ASK, not inversed. t55xx_conf_block_t config = { .modulation = 2, .inversed = FALSE, .block0 = 0x00}; int usage_t55xx_config(){ @@ -119,8 +111,9 @@ static int CmdHelp(const char *Cmd); int CmdT55xxSetConfig(const char *Cmd){ - int len; - bool inverse; + int len = 0; + int foundModulation = 2; + bool inverse = FALSE; bool errors = FALSE; uint8_t cmdp = 0; char modulation[4] = {0x00}; @@ -137,15 +130,15 @@ int CmdT55xxSetConfig(const char *Cmd){ cmdp+= len+1; //FSK|ASK|PSK|NZ|BI if ( strcmp(modulation, "FSK" ) == 0) - len = 1; + foundModulation = 1; else if ( strcmp(modulation, "ASK" ) == 0) - len = 2; + foundModulation = 2; else if ( strcmp(modulation, "PSK" ) == 0) - len = 3; + foundModulation = 3; else if ( strcmp(modulation, "NZ" ) == 0) - len = 4; + foundModulation = 4; else if ( strcmp(modulation, "BI" ) == 0) - len = 5; + foundModulation = 5; else { PrintAndLog("Unknown modulation '%s'", modulation); errors = TRUE; @@ -163,16 +156,14 @@ int CmdT55xxSetConfig(const char *Cmd){ } // No args if (cmdp == 0) { - PrintAndLog("Modulation: %d", config.modulation); - PrintAndLog("Invert : %d", config.inversed); - PrintAndLog("Block0 : %08X", config.block0); + printConfiguration( config ); return 0; } //Validations if (errors) return usage_t55xx_config(); - config.modulation = len; + config.modulation = foundModulation; config.inversed = inverse; config.block0 = 0; return 0; @@ -237,7 +228,6 @@ void DecodeT55xxBlock(){ case 2: sprintf(cmdStr,"0 %d 1", config.inversed ); ASKmanDemod(cmdStr, FALSE, FALSE); - PrintAndLog("ice"); break; case 3: sprintf(cmdStr,"0 %d 1", config.inversed ); @@ -351,16 +341,16 @@ bool tryDetectModulation(){ // } } if ( hits == 1) { - PrintAndLog("Modulation: %d Inverse: %d", tests[0].modulation, tests[0].inversed); config.modulation = tests[0].modulation; config.inversed = tests[0].inversed; + printConfiguration( config ); return TRUE; } if ( hits > 1) { PrintAndLog("Found [%d] possible matches for modulation.",hits); for(int i=0; i