FIXED: lf t55xx fsk now demods but only to binary.

ADD:  holimans lf io / hid fskdemod  changes.
This commit is contained in:
iceman1001
2014-10-23 18:36:44 +02:00
parent fbceacc5b8
commit 72e930ef32
10 changed files with 272 additions and 355 deletions

View File

@@ -347,7 +347,7 @@ int CmdHF15DumpMem(const char*Cmd) {
if (!(recv[0] & ISO15_RES_ERROR)) {
retry=0;
*output=0; // reset outputstring
sprintf(output, "Block %2i ",blocknum);
sprintf(output, "Block %02x ",blocknum);
for ( int i=1; i<resp.arg[0]-2; i++) { // data in hex
sprintf(output+strlen(output),"%02X ",recv[i]);
}

View File

@@ -418,7 +418,7 @@ static command_t CommandTable[] =
{"setlfdivisor", CmdSetDivisor, 0, "<19 - 255> -- Drive LF antenna at 12Mhz/(divisor+1)"},
{"setmux", CmdSetMux, 0, "<loraw|hiraw|lopkd|hipkd> -- Set the ADC mux to a specific value"},
{"tune", CmdTune, 0, "Measure antenna tuning"},
{"version", CmdVersion, 0, "Show version inforation about the connected Proxmark"},
{"version", CmdVersion, 0, "Show version information about the connected Proxmark"},
{NULL, NULL, 0, NULL}
};

View File

@@ -28,9 +28,7 @@ static int CmdHelp(const char *Cmd);
int CmdReadBlk(const char *Cmd)
{
//default to invalid block
int Block = -1;
UsbCommand c;
sscanf(Cmd, "%d", &Block);
@@ -39,10 +37,8 @@ int CmdReadBlk(const char *Cmd)
return 1;
}
//PrintAndLog(" Reading page 0 block : %d", Block);
// this command fills up BigBuff
//
UsbCommand c;
c.cmd = CMD_T55XX_READ_BLOCK;
c.d.asBytes[0] = 0x00;
c.arg[0] = 0;
@@ -57,10 +53,10 @@ int CmdReadBlk(const char *Cmd)
WaitForResponseTimeout(CMD_ACK,NULL, 1500);
for (int j = 0; j < LF_TRACE_BUFF_SIZE; j++) {
GraphBuffer[j] = ((int)data[j]) ;
GraphBuffer[j] = (int)data[j];
}
GraphTraceLen = LF_TRACE_BUFF_SIZE;
CmdIceManchester(Cmd);
CmdIceManchester(Block);
RepaintGraphWindow();
return 0;
}
@@ -97,9 +93,7 @@ int CmdReadBlkPWD(const char *Cmd)
GraphBuffer[j] = ((int)data[j]) - 128;
}
GraphTraceLen = LF_TRACE_BUFF_SIZE;
CmdIceManchester(Cmd);
CmdIceManchester(Block);
RepaintGraphWindow();
return 0;
}
@@ -349,6 +343,10 @@ int CmdIceFsk(const char *Cmd){
return 0;
}
int CmdIceManchester(const char *Cmd){
ManchesterDemod( -1);
return 0;
}
int ManchesterDemod(int block){
int blockNum = -1;
uint32_t blockData;
@@ -357,9 +355,9 @@ int CmdIceManchester(const char *Cmd){
manchester_decode(GraphBuffer, LF_TRACE_BUFF_SIZE, bitstream);
blockData = PackBits(5, 32, bitstream);
sscanf(Cmd, "%d", &blockNum);
if ( blockNum > -1){
PrintAndLog(" Block %d : 0x%08X %s", blockNum, blockData, sprint_bin(bitstream+5,32) );
PrintAndLog(" Block %d : 0x%08X %s", blockNum, blockData, sprint_bin(bitstream+5,32) );
}else{
PrintAndLog(" Decoded : 0x%08X %s", blockData, sprint_bin(bitstream+5,32) );
}
@@ -484,7 +482,7 @@ static command_t CommandTable[] =
{"info", CmdInfo, 0, "[1] Read T55xx configuration data (page0 /blk 0)"},
{"dump", CmdDump, 0, "[password] Dump T55xx card block 0-7. optional with password"},
{"fsk", CmdIceFsk, 0, "FSK demod"},
{"man", CmdIceManchester, 0, "Manchester demod"},
{"man", CmdIceManchester, 0, "Manchester demod (with SST)"},
{NULL, NULL, 0, NULL}
};

View File

@@ -20,6 +20,7 @@ int CmdReadTrace(const char *Cmd);
int CmdInfo(const char *Cmd);
int CmdIceFsk(const char *Cmd);
int CmdIceManchester(const char *Cmd);
int ManchesterDemod(int block);
char * GetBitRateStr(uint32_t id);
char * GetSaferStr(uint32_t id);
char * GetModulationStr( uint32_t id);

View File

@@ -26,6 +26,10 @@
#include "util.h"
#include "cmdscript.h"
int delta125[2];
int delta134[2];
int deltahf[2];
int deltaReset = 0;
unsigned int current_command = CMD_UNKNOWN;
//unsigned int received_command = CMD_UNKNOWN;
@@ -210,13 +214,30 @@ void UsbCommandReceived(UsbCommand *UC)
int vLf125, vLf134, vHf;
vLf125 = UC->arg[0] & 0xffff;
vLf134 = UC->arg[0] >> 16;
vHf = UC->arg[1] & 0xffff;;
peakf = UC->arg[2] & 0xffff;
peakv = UC->arg[2] >> 16;
vHf = UC->arg[1] & 0xffff;;
peakf = UC->arg[2] & 0xffff;
peakv = UC->arg[2] >> 16;
//Reset delta trigger every 3:d time
if ( deltaReset == 4){
delta125[0] = vLf125;
delta134[0] = vLf134;
deltahf[0] = vHf;
} else if ( deltaReset == 2){
delta125[1] = vLf125;
delta134[1] = vLf134;
deltahf[1] = vHf;
}
if ( deltaReset == 0){
}
PrintAndLog("");
PrintAndLog("# LF antenna: %5.2f V @ 125.00 kHz", vLf125/1000.0);
PrintAndLog("# LF antenna: %5.2f V @ 134.00 kHz", vLf134/1000.0);
PrintAndLog("# LF optimal: %5.2f V @%9.2f kHz", peakv/1000.0, 12000.0/(peakf+1));
PrintAndLog("# LF optimal: %5.2f V @ %9.2f kHz", peakv/1000.0, 12000.0/(peakf+1));
PrintAndLog("# HF antenna: %5.2f V @ 13.56 MHz", vHf/1000.0);
if (peakv<2000)
PrintAndLog("# Your LF antenna is unusable.");
@@ -226,7 +247,10 @@ void UsbCommandReceived(UsbCommand *UC)
PrintAndLog("# Your HF antenna is unusable.");
else if (vHf<5000)
PrintAndLog("# Your HF antenna is marginal.");
} break;
}
deltaReset = (deltaReset == 0) ? 4 : deltaReset>>1;
break;
case CMD_DOWNLOADED_RAW_ADC_SAMPLES_125K: {
// printf("received samples: ");

View File

@@ -48,6 +48,11 @@ void SendCommand(UsbCommand *c) {
return;
}
/**
The while-loop below causes hangups at times, when the pm3 unit is unresponsive
or disconnected. The main console thread is alive, but comm thread just spins here.
Not good.../holiman
**/
while(txcmd_pending);
txcmd = *c;
txcmd_pending = true;

View File

@@ -116,8 +116,8 @@ int manchester_decode( int * data, const size_t len, uint8_t * dataout){
clock = GetT55x7Clock( data, len, high );
startindex = DetectFirstTransition(data, len, high);
// PrintAndLog(" Clock : %d", clock);
// PrintAndLog(" startindex : %d", startindex);
PrintAndLog(" Clock : %d", clock);
PrintAndLog(" startindex : %d", startindex);
if (high != 1)
bitlength = ManchesterConvertFrom255(data, len, bitStream, high, low, clock, startindex);
@@ -579,25 +579,21 @@ void iceFsk3(int * data, const size_t len){
printf("000111 position: %d \n", startPos);
startPos += 6*fieldlen+1;
startPos += 6*fieldlen+5;
int bit =0;
printf("BINARY\n");
printf("R/40 : ");
for (i =startPos ; i < len; i += 40){
if ( data[i] > 0 )
printf("1");
else
printf("0");
bit = data[i]>0 ? 1:0;
printf("%d", bit );
}
printf("\n");
printf("R/50 : ");
for (i =startPos ; i < len; i += 50){
if ( data[i] > 0 )
printf("1");
else
printf("0");
}
bit = data[i]>0 ? 1:0;
printf("%d", bit ); }
printf("\n");
}