mirror of
https://github.com/RfidResearchGroup/proxmark3.git
synced 2025-04-15 17:00:04 +08:00
ADD: printConfiguration method for a nice printout of the selected configuration.
This commit is contained in:
parent
8e726f6c37
commit
710208245b
2 changed files with 50 additions and 15 deletions
client
|
@ -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(){
|
||||
|
@ -164,9 +156,7 @@ 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
|
||||
|
@ -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<hits; ++i){
|
||||
PrintAndLog("Modulation: %d Inverse: %d", tests[i].modulation, tests[i].inversed);
|
||||
printConfiguration( tests[i] );
|
||||
}
|
||||
}
|
||||
return FALSE;
|
||||
|
@ -405,6 +395,13 @@ void printT55xxBlock(const char *demodStr){
|
|||
PrintAndLog("0x%08X %s [%s]", blockData, sprint_bin(bits+1,32), demodStr);
|
||||
}
|
||||
|
||||
void printConfiguration( t55xx_conf_block_t b){
|
||||
PrintAndLog("Modulation : %s", GetSelectedModulationStr(b.modulation) );
|
||||
PrintAndLog("Inverted : %s", (b.inversed) ? "Yes" : "No" );
|
||||
PrintAndLog("Block0 : %08X", b.block0);
|
||||
PrintAndLog("");
|
||||
}
|
||||
|
||||
/*
|
||||
FSK1 / FSK1a
|
||||
size = fskdemod(dest, size, 32, 0, 8, 10); // fsk1 RF/32
|
||||
|
@ -752,6 +749,34 @@ char * GetModulationStr( uint32_t id){
|
|||
return buf;
|
||||
}
|
||||
|
||||
char * GetSelectedModulationStr( uint8_t id){
|
||||
|
||||
static char buf[16];
|
||||
char *retStr = buf;
|
||||
|
||||
switch (id){
|
||||
case 1:
|
||||
sprintf(retStr,"FSK (%d)",id);
|
||||
break;
|
||||
case 2:
|
||||
sprintf(retStr,"ASK (%d)",id);
|
||||
break;
|
||||
case 3:
|
||||
sprintf(retStr,"DIRECT/NRZ (%d)",id);
|
||||
break;
|
||||
case 4:
|
||||
sprintf(retStr,"PSK (%d)",id);
|
||||
break;
|
||||
case 5:
|
||||
sprintf(retStr,"BIPHASE (%d)",id);
|
||||
break;
|
||||
default:
|
||||
sprintf(retStr,"(Unknown)");
|
||||
break;
|
||||
}
|
||||
return buf;
|
||||
}
|
||||
|
||||
uint32_t PackBits(uint8_t start, uint8_t len, uint8_t* bits){
|
||||
|
||||
int i = start;
|
||||
|
|
|
@ -10,6 +10,13 @@
|
|||
#ifndef CMDLFT55XX_H__
|
||||
#define CMDLFT55XX_H__
|
||||
|
||||
typedef struct {
|
||||
uint8_t modulation;
|
||||
bool inversed;
|
||||
uint32_t block0;
|
||||
} t55xx_conf_block_t;
|
||||
|
||||
|
||||
int CmdLFT55XX(const char *Cmd);
|
||||
int CmdT55xxSetConfig(const char *Cmd);
|
||||
int CmdT55xxReadBlock(const char *Cmd);
|
||||
|
@ -21,8 +28,11 @@ int CmdT55xxDetect(const char *Cmd);
|
|||
char * GetBitRateStr(uint32_t id);
|
||||
char * GetSaferStr(uint32_t id);
|
||||
char * GetModulationStr( uint32_t id);
|
||||
char * GetSelectedModulationStr( uint8_t id);
|
||||
uint32_t PackBits(uint8_t start, uint8_t len, uint8_t* bitstream);
|
||||
void printT55xxBlock(const char *demodStr);
|
||||
void printConfiguration( t55xx_conf_block_t b);
|
||||
|
||||
void DecodeT55xxBlock();
|
||||
bool tryDetectModulation();
|
||||
bool test();
|
||||
|
|
Loading…
Add table
Reference in a new issue